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 : #define SOURCE_fd_src_flamenco_types_fd_types_c
6 : #include "fd_types_custom.c"
7 138876 : void fd_hash_new( fd_hash_t * self ) { }
8 0 : void fd_hash_destroy( fd_hash_t * self ) { }
9 0 : ulong fd_hash_footprint( void ) { return sizeof(fd_hash_t); }
10 0 : ulong fd_hash_align( void ) { return alignof(fd_hash_t); }
11 33 : ulong fd_hash_size( fd_hash_t const * self ) { (void)self; return sizeof(fd_hash_t); }
12 93453 : int fd_hash_encode( fd_hash_t const * self, fd_bincode_encode_ctx_t * ctx ) {
13 93453 : return fd_bincode_bytes_encode( (uchar const *)self, sizeof(fd_hash_t), ctx );
14 93453 : }
15 46383 : void fd_hash_walk( void * w, fd_hash_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
16 46383 : fun( w, (uchar const *)self, name, FD_FLAMENCO_TYPE_HASH256, name, level );
17 46383 : }
18 0 : int fd_hash_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
19 0 : *total_sz += sizeof(fd_hash_t);
20 0 : void const * start_data = ctx->data;
21 0 : int err = fd_hash_decode_footprint_inner( ctx, total_sz );
22 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
23 0 : ctx->data = start_data;
24 0 : return err;
25 0 : }
26 92748 : int fd_hash_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
27 92748 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
28 92748 : return fd_bincode_bytes_decode_footprint( sizeof(fd_hash_t), ctx );
29 92748 : }
30 0 : void * fd_hash_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
31 0 : fd_bincode_bytes_decode_unsafe( mem, sizeof(fd_hash_t), ctx );
32 0 : return mem;
33 0 : }
34 139053 : void fd_hash_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
35 139053 : fd_bincode_bytes_decode_unsafe( struct_mem, sizeof(fd_hash_t), ctx );
36 139053 : return;
37 139053 : }
38 0 : void * fd_hash_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
39 0 : fd_bincode_bytes_decode_unsafe( mem, sizeof(fd_hash_t), ctx );
40 0 : return mem;
41 0 : }
42 27 : void fd_hash_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
43 27 : fd_bincode_bytes_decode_unsafe( struct_mem, sizeof(fd_hash_t), ctx );
44 27 : return;
45 27 : }
46 216 : int fd_hash_convert_global_to_local( void const * global_self, fd_hash_t * self, fd_bincode_decode_ctx_t * ctx ) {
47 216 : fd_memcpy( self, global_self, sizeof(fd_hash_t) );
48 216 : return FD_BINCODE_SUCCESS;
49 216 : }
50 :
51 27 : void fd_signature_new( fd_signature_t * self ) { }
52 0 : void fd_signature_destroy( fd_signature_t * self ) { }
53 0 : ulong fd_signature_footprint( void ) { return sizeof(fd_signature_t); }
54 0 : ulong fd_signature_align( void ) { return alignof(fd_signature_t); }
55 0 : ulong fd_signature_size( fd_signature_t const * self ) { (void)self; return sizeof(fd_signature_t); }
56 0 : int fd_signature_encode( fd_signature_t const * self, fd_bincode_encode_ctx_t * ctx ) {
57 0 : return fd_bincode_bytes_encode( (uchar const *)self, sizeof(fd_signature_t), ctx );
58 0 : }
59 30 : void fd_signature_walk( void * w, fd_signature_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
60 30 : fun( w, (uchar const *)self, name, FD_FLAMENCO_TYPE_SIG512, name, level );
61 30 : }
62 0 : int fd_signature_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
63 0 : *total_sz += sizeof(fd_signature_t);
64 0 : void const * start_data = ctx->data;
65 0 : int err = fd_signature_decode_footprint_inner( ctx, total_sz );
66 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
67 0 : ctx->data = start_data;
68 0 : return err;
69 0 : }
70 30 : int fd_signature_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
71 30 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
72 30 : return fd_bincode_bytes_decode_footprint( sizeof(fd_signature_t), ctx );
73 30 : }
74 0 : void * fd_signature_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
75 0 : fd_bincode_bytes_decode_unsafe( mem, sizeof(fd_signature_t), ctx );
76 0 : return mem;
77 0 : }
78 30 : void fd_signature_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
79 30 : fd_bincode_bytes_decode_unsafe( struct_mem, sizeof(fd_signature_t), ctx );
80 30 : return;
81 30 : }
82 0 : void * fd_signature_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
83 0 : fd_bincode_bytes_decode_unsafe( mem, sizeof(fd_signature_t), ctx );
84 0 : return mem;
85 0 : }
86 0 : void fd_signature_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
87 0 : fd_bincode_bytes_decode_unsafe( struct_mem, sizeof(fd_signature_t), ctx );
88 0 : return;
89 0 : }
90 0 : int fd_signature_convert_global_to_local( void const * global_self, fd_signature_t * self, fd_bincode_decode_ctx_t * ctx ) {
91 0 : fd_memcpy( self, global_self, sizeof(fd_signature_t) );
92 0 : return FD_BINCODE_SUCCESS;
93 0 : }
94 :
95 0 : void fd_gossip_ip4_addr_new( fd_gossip_ip4_addr_t * self ) { }
96 0 : void fd_gossip_ip4_addr_destroy( fd_gossip_ip4_addr_t * self ) { }
97 0 : ulong fd_gossip_ip4_addr_footprint( void ) { return sizeof(fd_gossip_ip4_addr_t); }
98 0 : ulong fd_gossip_ip4_addr_align( void ) { return alignof(fd_gossip_ip4_addr_t); }
99 0 : ulong fd_gossip_ip4_addr_size( fd_gossip_ip4_addr_t const * self ) { (void)self; return sizeof(fd_gossip_ip4_addr_t); }
100 0 : int fd_gossip_ip4_addr_encode( fd_gossip_ip4_addr_t const * self, fd_bincode_encode_ctx_t * ctx ) {
101 0 : return fd_bincode_bytes_encode( (uchar const *)self, sizeof(fd_gossip_ip4_addr_t), ctx );
102 0 : }
103 0 : int fd_gossip_ip4_addr_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
104 0 : *total_sz += sizeof(fd_gossip_ip4_addr_t);
105 0 : void const * start_data = ctx->data;
106 0 : int err = fd_gossip_ip4_addr_decode_footprint_inner( ctx, total_sz );
107 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
108 0 : ctx->data = start_data;
109 0 : return err;
110 0 : }
111 93 : int fd_gossip_ip4_addr_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
112 93 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
113 93 : return fd_bincode_bytes_decode_footprint( sizeof(fd_gossip_ip4_addr_t), ctx );
114 93 : }
115 0 : void * fd_gossip_ip4_addr_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
116 0 : fd_bincode_bytes_decode_unsafe( mem, sizeof(fd_gossip_ip4_addr_t), ctx );
117 0 : return mem;
118 0 : }
119 93 : void fd_gossip_ip4_addr_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
120 93 : fd_bincode_bytes_decode_unsafe( struct_mem, sizeof(fd_gossip_ip4_addr_t), ctx );
121 93 : return;
122 93 : }
123 0 : void * fd_gossip_ip4_addr_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
124 0 : fd_bincode_bytes_decode_unsafe( mem, sizeof(fd_gossip_ip4_addr_t), ctx );
125 0 : return mem;
126 0 : }
127 0 : void fd_gossip_ip4_addr_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
128 0 : fd_bincode_bytes_decode_unsafe( struct_mem, sizeof(fd_gossip_ip4_addr_t), ctx );
129 0 : return;
130 0 : }
131 0 : int fd_gossip_ip4_addr_convert_global_to_local( void const * global_self, fd_gossip_ip4_addr_t * self, fd_bincode_decode_ctx_t * ctx ) {
132 0 : fd_memcpy( self, global_self, sizeof(fd_gossip_ip4_addr_t) );
133 0 : return FD_BINCODE_SUCCESS;
134 0 : }
135 :
136 0 : void fd_gossip_ip6_addr_new( fd_gossip_ip6_addr_t * self ) { }
137 0 : void fd_gossip_ip6_addr_destroy( fd_gossip_ip6_addr_t * self ) { }
138 0 : ulong fd_gossip_ip6_addr_footprint( void ) { return sizeof(fd_gossip_ip6_addr_t); }
139 0 : ulong fd_gossip_ip6_addr_align( void ) { return alignof(fd_gossip_ip6_addr_t); }
140 0 : ulong fd_gossip_ip6_addr_size( fd_gossip_ip6_addr_t const * self ) { (void)self; return sizeof(fd_gossip_ip6_addr_t); }
141 0 : int fd_gossip_ip6_addr_encode( fd_gossip_ip6_addr_t const * self, fd_bincode_encode_ctx_t * ctx ) {
142 0 : return fd_bincode_bytes_encode( (uchar const *)self, sizeof(fd_gossip_ip6_addr_t), ctx );
143 0 : }
144 0 : int fd_gossip_ip6_addr_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
145 0 : *total_sz += sizeof(fd_gossip_ip6_addr_t);
146 0 : void const * start_data = ctx->data;
147 0 : int err = fd_gossip_ip6_addr_decode_footprint_inner( ctx, total_sz );
148 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
149 0 : ctx->data = start_data;
150 0 : return err;
151 0 : }
152 0 : int fd_gossip_ip6_addr_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
153 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
154 0 : return fd_bincode_bytes_decode_footprint( sizeof(fd_gossip_ip6_addr_t), ctx );
155 0 : }
156 0 : void * fd_gossip_ip6_addr_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
157 0 : fd_bincode_bytes_decode_unsafe( mem, sizeof(fd_gossip_ip6_addr_t), ctx );
158 0 : return mem;
159 0 : }
160 0 : void fd_gossip_ip6_addr_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
161 0 : fd_bincode_bytes_decode_unsafe( struct_mem, sizeof(fd_gossip_ip6_addr_t), ctx );
162 0 : return;
163 0 : }
164 0 : void * fd_gossip_ip6_addr_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
165 0 : fd_bincode_bytes_decode_unsafe( mem, sizeof(fd_gossip_ip6_addr_t), ctx );
166 0 : return mem;
167 0 : }
168 0 : void fd_gossip_ip6_addr_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
169 0 : fd_bincode_bytes_decode_unsafe( struct_mem, sizeof(fd_gossip_ip6_addr_t), ctx );
170 0 : return;
171 0 : }
172 0 : int fd_gossip_ip6_addr_convert_global_to_local( void const * global_self, fd_gossip_ip6_addr_t * self, fd_bincode_decode_ctx_t * ctx ) {
173 0 : fd_memcpy( self, global_self, sizeof(fd_gossip_ip6_addr_t) );
174 0 : return FD_BINCODE_SUCCESS;
175 0 : }
176 :
177 0 : int fd_feature_encode( fd_feature_t const * self, fd_bincode_encode_ctx_t * ctx ) {
178 0 : int err;
179 0 : err = fd_bincode_bool_encode( self->has_activated_at, ctx );
180 0 : if( FD_UNLIKELY( err ) ) return err;
181 0 : if( self->has_activated_at ) {
182 0 : err = fd_bincode_uint64_encode( self->activated_at, ctx );
183 0 : if( FD_UNLIKELY( err ) ) return err;
184 0 : }
185 0 : return FD_BINCODE_SUCCESS;
186 0 : }
187 0 : int fd_feature_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
188 0 : *total_sz += sizeof(fd_feature_t);
189 0 : void const * start_data = ctx->data;
190 0 : int err = fd_feature_decode_footprint_inner( ctx, total_sz );
191 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
192 0 : ctx->data = start_data;
193 0 : return err;
194 0 : }
195 0 : int fd_feature_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
196 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
197 0 : int err = 0;
198 0 : {
199 0 : uchar o;
200 0 : err = fd_bincode_bool_decode( &o, ctx );
201 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
202 0 : if( o ) {
203 0 : err = fd_bincode_uint64_decode_footprint( ctx );
204 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
205 0 : }
206 0 : }
207 0 : return 0;
208 0 : }
209 0 : void * fd_feature_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
210 0 : fd_feature_t * self = (fd_feature_t *)mem;
211 0 : fd_feature_new( self );
212 0 : void * alloc_region = (uchar *)mem + sizeof(fd_feature_t);
213 0 : void * * alloc_mem = &alloc_region;
214 0 : fd_feature_decode_inner( mem, alloc_mem, ctx );
215 0 : return self;
216 0 : }
217 0 : void fd_feature_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
218 0 : fd_feature_t * self = (fd_feature_t *)struct_mem;
219 0 : {
220 0 : uchar o;
221 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
222 0 : self->has_activated_at = !!o;
223 0 : if( o ) {
224 0 : fd_bincode_uint64_decode_unsafe( &self->activated_at, ctx );
225 0 : }
226 0 : }
227 0 : }
228 0 : void * fd_feature_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
229 0 : fd_feature_global_t * self = (fd_feature_global_t *)mem;
230 0 : fd_feature_new( (fd_feature_t *)self );
231 0 : void * alloc_region = (uchar *)mem + sizeof(fd_feature_global_t);
232 0 : void * * alloc_mem = &alloc_region;
233 0 : fd_feature_decode_inner_global( mem, alloc_mem, ctx );
234 0 : return self;
235 0 : }
236 0 : void fd_feature_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
237 0 : fd_feature_global_t * self = (fd_feature_global_t *)struct_mem;
238 0 : {
239 0 : uchar o;
240 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
241 0 : self->has_activated_at = !!o;
242 0 : if( o ) {
243 0 : fd_bincode_uint64_decode_unsafe( &self->activated_at, ctx );
244 0 : }
245 0 : }
246 0 : }
247 0 : int fd_feature_convert_global_to_local( void const * global_self, fd_feature_t * self, fd_bincode_decode_ctx_t * ctx ) {
248 0 : int err = 0;
249 0 : fd_feature_global_t const * mem = (fd_feature_global_t const *)global_self;
250 0 : self->activated_at = mem->activated_at;
251 0 : self->has_activated_at = mem->has_activated_at;
252 0 : return FD_BINCODE_SUCCESS;
253 0 : }
254 0 : void fd_feature_new(fd_feature_t * self) {
255 0 : fd_memset( self, 0, sizeof(fd_feature_t) );
256 0 : }
257 0 : void fd_feature_destroy( fd_feature_t * self ) {
258 0 : if( self->has_activated_at ) {
259 0 : self->has_activated_at = 0;
260 0 : }
261 0 : }
262 :
263 0 : ulong fd_feature_footprint( void ){ return FD_FEATURE_FOOTPRINT; }
264 0 : ulong fd_feature_align( void ){ return FD_FEATURE_ALIGN; }
265 :
266 0 : void fd_feature_walk( void * w, fd_feature_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
267 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_feature", level++ );
268 0 : if( !self->has_activated_at ) {
269 0 : fun( w, NULL, "activated_at", FD_FLAMENCO_TYPE_NULL, "ulong", level );
270 0 : } else {
271 0 : fun( w, &self->activated_at, "activated_at", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
272 0 : }
273 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_feature", level-- );
274 0 : }
275 0 : ulong fd_feature_size( fd_feature_t const * self ) {
276 0 : ulong size = 0;
277 0 : size += sizeof(char);
278 0 : if( self->has_activated_at ) {
279 0 : size += sizeof(ulong);
280 0 : }
281 0 : return size;
282 0 : }
283 :
284 1812 : int fd_fee_calculator_encode( fd_fee_calculator_t const * self, fd_bincode_encode_ctx_t * ctx ) {
285 1812 : int err;
286 1812 : err = fd_bincode_uint64_encode( self->lamports_per_signature, ctx );
287 1812 : if( FD_UNLIKELY( err ) ) return err;
288 1812 : return FD_BINCODE_SUCCESS;
289 1812 : }
290 0 : int fd_fee_calculator_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
291 0 : *total_sz += sizeof(fd_fee_calculator_t);
292 0 : void const * start_data = ctx->data;
293 0 : int err = fd_fee_calculator_decode_footprint_inner( ctx, total_sz );
294 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
295 0 : ctx->data = start_data;
296 0 : return err;
297 0 : }
298 1812 : int fd_fee_calculator_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
299 1812 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
300 1812 : int err = 0;
301 1812 : err = fd_bincode_uint64_decode_footprint( ctx );
302 1812 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
303 1812 : return 0;
304 1812 : }
305 0 : void * fd_fee_calculator_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
306 0 : fd_fee_calculator_t * self = (fd_fee_calculator_t *)mem;
307 0 : fd_fee_calculator_new( self );
308 0 : void * alloc_region = (uchar *)mem + sizeof(fd_fee_calculator_t);
309 0 : void * * alloc_mem = &alloc_region;
310 0 : fd_fee_calculator_decode_inner( mem, alloc_mem, ctx );
311 0 : return self;
312 0 : }
313 2715 : void fd_fee_calculator_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
314 2715 : fd_fee_calculator_t * self = (fd_fee_calculator_t *)struct_mem;
315 2715 : fd_bincode_uint64_decode_unsafe( &self->lamports_per_signature, ctx );
316 2715 : }
317 0 : void * fd_fee_calculator_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
318 0 : fd_fee_calculator_global_t * self = (fd_fee_calculator_global_t *)mem;
319 0 : fd_fee_calculator_new( (fd_fee_calculator_t *)self );
320 0 : void * alloc_region = (uchar *)mem + sizeof(fd_fee_calculator_global_t);
321 0 : void * * alloc_mem = &alloc_region;
322 0 : fd_fee_calculator_decode_inner_global( mem, alloc_mem, ctx );
323 0 : return self;
324 0 : }
325 0 : void fd_fee_calculator_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
326 0 : fd_fee_calculator_global_t * self = (fd_fee_calculator_global_t *)struct_mem;
327 0 : fd_bincode_uint64_decode_unsafe( &self->lamports_per_signature, ctx );
328 0 : }
329 0 : int fd_fee_calculator_convert_global_to_local( void const * global_self, fd_fee_calculator_t * self, fd_bincode_decode_ctx_t * ctx ) {
330 0 : int err = 0;
331 0 : fd_fee_calculator_global_t const * mem = (fd_fee_calculator_global_t const *)global_self;
332 0 : self->lamports_per_signature = mem->lamports_per_signature;
333 0 : return FD_BINCODE_SUCCESS;
334 0 : }
335 2715 : void fd_fee_calculator_new(fd_fee_calculator_t * self) {
336 2715 : fd_memset( self, 0, sizeof(fd_fee_calculator_t) );
337 2715 : }
338 0 : void fd_fee_calculator_destroy( fd_fee_calculator_t * self ) {
339 0 : }
340 :
341 0 : ulong fd_fee_calculator_footprint( void ){ return FD_FEE_CALCULATOR_FOOTPRINT; }
342 0 : ulong fd_fee_calculator_align( void ){ return FD_FEE_CALCULATOR_ALIGN; }
343 :
344 903 : void fd_fee_calculator_walk( void * w, fd_fee_calculator_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
345 903 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_fee_calculator", level++ );
346 903 : fun( w, &self->lamports_per_signature, "lamports_per_signature", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
347 903 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_fee_calculator", level-- );
348 903 : }
349 6 : ulong fd_fee_calculator_size( fd_fee_calculator_t const * self ) {
350 6 : ulong size = 0;
351 6 : size += sizeof(ulong);
352 6 : return size;
353 6 : }
354 :
355 1806 : int fd_hash_age_encode( fd_hash_age_t const * self, fd_bincode_encode_ctx_t * ctx ) {
356 1806 : int err;
357 1806 : err = fd_fee_calculator_encode( &self->fee_calculator, ctx );
358 1806 : if( FD_UNLIKELY( err ) ) return err;
359 1806 : err = fd_bincode_uint64_encode( self->hash_index, ctx );
360 1806 : if( FD_UNLIKELY( err ) ) return err;
361 1806 : err = fd_bincode_uint64_encode( self->timestamp, ctx );
362 1806 : if( FD_UNLIKELY( err ) ) return err;
363 1806 : return FD_BINCODE_SUCCESS;
364 1806 : }
365 0 : int fd_hash_age_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
366 0 : *total_sz += sizeof(fd_hash_age_t);
367 0 : void const * start_data = ctx->data;
368 0 : int err = fd_hash_age_decode_footprint_inner( ctx, total_sz );
369 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
370 0 : ctx->data = start_data;
371 0 : return err;
372 0 : }
373 1806 : int fd_hash_age_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
374 1806 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
375 1806 : int err = 0;
376 1806 : err = fd_fee_calculator_decode_footprint_inner( ctx, total_sz );
377 1806 : if( FD_UNLIKELY( err ) ) return err;
378 1806 : err = fd_bincode_uint64_decode_footprint( ctx );
379 1806 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
380 1806 : err = fd_bincode_uint64_decode_footprint( ctx );
381 1806 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
382 1806 : return 0;
383 1806 : }
384 0 : void * fd_hash_age_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
385 0 : fd_hash_age_t * self = (fd_hash_age_t *)mem;
386 0 : fd_hash_age_new( self );
387 0 : void * alloc_region = (uchar *)mem + sizeof(fd_hash_age_t);
388 0 : void * * alloc_mem = &alloc_region;
389 0 : fd_hash_age_decode_inner( mem, alloc_mem, ctx );
390 0 : return self;
391 0 : }
392 2709 : void fd_hash_age_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
393 2709 : fd_hash_age_t * self = (fd_hash_age_t *)struct_mem;
394 2709 : fd_fee_calculator_decode_inner( &self->fee_calculator, alloc_mem, ctx );
395 2709 : fd_bincode_uint64_decode_unsafe( &self->hash_index, ctx );
396 2709 : fd_bincode_uint64_decode_unsafe( &self->timestamp, ctx );
397 2709 : }
398 0 : void * fd_hash_age_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
399 0 : fd_hash_age_global_t * self = (fd_hash_age_global_t *)mem;
400 0 : fd_hash_age_new( (fd_hash_age_t *)self );
401 0 : void * alloc_region = (uchar *)mem + sizeof(fd_hash_age_global_t);
402 0 : void * * alloc_mem = &alloc_region;
403 0 : fd_hash_age_decode_inner_global( mem, alloc_mem, ctx );
404 0 : return self;
405 0 : }
406 0 : void fd_hash_age_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
407 0 : fd_hash_age_global_t * self = (fd_hash_age_global_t *)struct_mem;
408 0 : fd_fee_calculator_decode_inner_global( &self->fee_calculator, alloc_mem, ctx );
409 0 : fd_bincode_uint64_decode_unsafe( &self->hash_index, ctx );
410 0 : fd_bincode_uint64_decode_unsafe( &self->timestamp, ctx );
411 0 : }
412 0 : int fd_hash_age_convert_global_to_local( void const * global_self, fd_hash_age_t * self, fd_bincode_decode_ctx_t * ctx ) {
413 0 : int err = 0;
414 0 : fd_hash_age_global_t const * mem = (fd_hash_age_global_t const *)global_self;
415 0 : err = fd_fee_calculator_convert_global_to_local( &mem->fee_calculator, &self->fee_calculator, ctx );
416 0 : if( FD_UNLIKELY( err ) ) return err;
417 0 : self->hash_index = mem->hash_index;
418 0 : self->timestamp = mem->timestamp;
419 0 : return FD_BINCODE_SUCCESS;
420 0 : }
421 2709 : void fd_hash_age_new(fd_hash_age_t * self) {
422 2709 : fd_memset( self, 0, sizeof(fd_hash_age_t) );
423 2709 : fd_fee_calculator_new( &self->fee_calculator );
424 2709 : }
425 0 : void fd_hash_age_destroy( fd_hash_age_t * self ) {
426 0 : fd_fee_calculator_destroy( &self->fee_calculator );
427 0 : }
428 :
429 0 : ulong fd_hash_age_footprint( void ){ return FD_HASH_AGE_FOOTPRINT; }
430 0 : ulong fd_hash_age_align( void ){ return FD_HASH_AGE_ALIGN; }
431 :
432 903 : void fd_hash_age_walk( void * w, fd_hash_age_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
433 903 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_hash_age", level++ );
434 903 : fd_fee_calculator_walk( w, &self->fee_calculator, fun, "fee_calculator", level );
435 903 : fun( w, &self->hash_index, "hash_index", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
436 903 : fun( w, &self->timestamp, "timestamp", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
437 903 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_hash_age", level-- );
438 903 : }
439 0 : ulong fd_hash_age_size( fd_hash_age_t const * self ) {
440 0 : ulong size = 0;
441 0 : size += fd_fee_calculator_size( &self->fee_calculator );
442 0 : size += sizeof(ulong);
443 0 : size += sizeof(ulong);
444 0 : return size;
445 0 : }
446 :
447 1806 : int fd_hash_hash_age_pair_encode( fd_hash_hash_age_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
448 1806 : int err;
449 1806 : err = fd_hash_encode( &self->key, ctx );
450 1806 : if( FD_UNLIKELY( err ) ) return err;
451 1806 : err = fd_hash_age_encode( &self->val, ctx );
452 1806 : if( FD_UNLIKELY( err ) ) return err;
453 1806 : return FD_BINCODE_SUCCESS;
454 1806 : }
455 0 : int fd_hash_hash_age_pair_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
456 0 : *total_sz += sizeof(fd_hash_hash_age_pair_t);
457 0 : void const * start_data = ctx->data;
458 0 : int err = fd_hash_hash_age_pair_decode_footprint_inner( ctx, total_sz );
459 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
460 0 : ctx->data = start_data;
461 0 : return err;
462 0 : }
463 1806 : int fd_hash_hash_age_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
464 1806 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
465 1806 : int err = 0;
466 1806 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
467 1806 : if( FD_UNLIKELY( err ) ) return err;
468 1806 : err = fd_hash_age_decode_footprint_inner( ctx, total_sz );
469 1806 : if( FD_UNLIKELY( err ) ) return err;
470 1806 : return 0;
471 1806 : }
472 0 : void * fd_hash_hash_age_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
473 0 : fd_hash_hash_age_pair_t * self = (fd_hash_hash_age_pair_t *)mem;
474 0 : fd_hash_hash_age_pair_new( self );
475 0 : void * alloc_region = (uchar *)mem + sizeof(fd_hash_hash_age_pair_t);
476 0 : void * * alloc_mem = &alloc_region;
477 0 : fd_hash_hash_age_pair_decode_inner( mem, alloc_mem, ctx );
478 0 : return self;
479 0 : }
480 2709 : void fd_hash_hash_age_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
481 2709 : fd_hash_hash_age_pair_t * self = (fd_hash_hash_age_pair_t *)struct_mem;
482 2709 : fd_hash_decode_inner( &self->key, alloc_mem, ctx );
483 2709 : fd_hash_age_decode_inner( &self->val, alloc_mem, ctx );
484 2709 : }
485 0 : void * fd_hash_hash_age_pair_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
486 0 : fd_hash_hash_age_pair_global_t * self = (fd_hash_hash_age_pair_global_t *)mem;
487 0 : fd_hash_hash_age_pair_new( (fd_hash_hash_age_pair_t *)self );
488 0 : void * alloc_region = (uchar *)mem + sizeof(fd_hash_hash_age_pair_global_t);
489 0 : void * * alloc_mem = &alloc_region;
490 0 : fd_hash_hash_age_pair_decode_inner_global( mem, alloc_mem, ctx );
491 0 : return self;
492 0 : }
493 0 : void fd_hash_hash_age_pair_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
494 0 : fd_hash_hash_age_pair_global_t * self = (fd_hash_hash_age_pair_global_t *)struct_mem;
495 0 : fd_hash_decode_inner_global( &self->key, alloc_mem, ctx );
496 0 : fd_hash_age_decode_inner_global( &self->val, alloc_mem, ctx );
497 0 : }
498 0 : int fd_hash_hash_age_pair_convert_global_to_local( void const * global_self, fd_hash_hash_age_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
499 0 : int err = 0;
500 0 : fd_hash_hash_age_pair_global_t const * mem = (fd_hash_hash_age_pair_global_t const *)global_self;
501 0 : err = fd_hash_convert_global_to_local( &mem->key, &self->key, ctx );
502 0 : if( FD_UNLIKELY( err ) ) return err;
503 0 : err = fd_hash_age_convert_global_to_local( &mem->val, &self->val, ctx );
504 0 : if( FD_UNLIKELY( err ) ) return err;
505 0 : return FD_BINCODE_SUCCESS;
506 0 : }
507 2709 : void fd_hash_hash_age_pair_new(fd_hash_hash_age_pair_t * self) {
508 2709 : fd_memset( self, 0, sizeof(fd_hash_hash_age_pair_t) );
509 2709 : fd_hash_new( &self->key );
510 2709 : fd_hash_age_new( &self->val );
511 2709 : }
512 0 : void fd_hash_hash_age_pair_destroy( fd_hash_hash_age_pair_t * self ) {
513 0 : fd_hash_destroy( &self->key );
514 0 : fd_hash_age_destroy( &self->val );
515 0 : }
516 :
517 0 : ulong fd_hash_hash_age_pair_footprint( void ){ return FD_HASH_HASH_AGE_PAIR_FOOTPRINT; }
518 0 : ulong fd_hash_hash_age_pair_align( void ){ return FD_HASH_HASH_AGE_PAIR_ALIGN; }
519 :
520 903 : void fd_hash_hash_age_pair_walk( void * w, fd_hash_hash_age_pair_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
521 903 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_hash_hash_age_pair", level++ );
522 903 : fd_hash_walk( w, &self->key, fun, "key", level );
523 903 : fd_hash_age_walk( w, &self->val, fun, "val", level );
524 903 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_hash_hash_age_pair", level-- );
525 903 : }
526 0 : ulong fd_hash_hash_age_pair_size( fd_hash_hash_age_pair_t const * self ) {
527 0 : ulong size = 0;
528 0 : size += fd_hash_size( &self->key );
529 0 : size += fd_hash_age_size( &self->val );
530 0 : return size;
531 0 : }
532 :
533 6 : int fd_block_hash_vec_encode( fd_block_hash_vec_t const * self, fd_bincode_encode_ctx_t * ctx ) {
534 6 : int err;
535 6 : err = fd_bincode_uint64_encode( self->last_hash_index, ctx );
536 6 : if( FD_UNLIKELY( err ) ) return err;
537 6 : if( self->last_hash != NULL ) {
538 0 : err = fd_bincode_bool_encode( 1, ctx );
539 0 : if( FD_UNLIKELY( err ) ) return err;
540 0 : err = fd_hash_encode( self->last_hash, ctx );
541 0 : if( FD_UNLIKELY( err ) ) return err;
542 6 : } else {
543 6 : err = fd_bincode_bool_encode( 0, ctx );
544 6 : if( FD_UNLIKELY( err ) ) return err;
545 6 : }
546 6 : err = fd_bincode_uint64_encode( self->ages_len, ctx );
547 6 : if( FD_UNLIKELY(err) ) return err;
548 6 : if( self->ages_len ) {
549 0 : for( ulong i=0; i < self->ages_len; i++ ) {
550 0 : err = fd_hash_hash_age_pair_encode( self->ages + i, ctx );
551 0 : if( FD_UNLIKELY( err ) ) return err;
552 0 : }
553 0 : }
554 6 : err = fd_bincode_uint64_encode( self->max_age, ctx );
555 6 : if( FD_UNLIKELY( err ) ) return err;
556 6 : return FD_BINCODE_SUCCESS;
557 6 : }
558 0 : int fd_block_hash_vec_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
559 0 : *total_sz += sizeof(fd_block_hash_vec_t);
560 0 : void const * start_data = ctx->data;
561 0 : int err = fd_block_hash_vec_decode_footprint_inner( ctx, total_sz );
562 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
563 0 : ctx->data = start_data;
564 0 : return err;
565 0 : }
566 9 : int fd_block_hash_vec_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
567 9 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
568 9 : int err = 0;
569 9 : err = fd_bincode_uint64_decode_footprint( ctx );
570 9 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
571 9 : {
572 9 : uchar o;
573 9 : err = fd_bincode_bool_decode( &o, ctx );
574 9 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
575 6 : if( o ) {
576 0 : *total_sz += FD_HASH_ALIGN + FD_HASH_FOOTPRINT;
577 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
578 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
579 0 : }
580 6 : }
581 6 : ulong ages_len;
582 6 : err = fd_bincode_uint64_decode( &ages_len, ctx );
583 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
584 6 : if( ages_len ) {
585 0 : *total_sz += FD_HASH_HASH_AGE_PAIR_ALIGN + FD_HASH_HASH_AGE_PAIR_FOOTPRINT*ages_len;
586 0 : for( ulong i=0; i < ages_len; i++ ) {
587 0 : err = fd_hash_hash_age_pair_decode_footprint_inner( ctx, total_sz );
588 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
589 0 : }
590 0 : }
591 6 : err = fd_bincode_uint64_decode_footprint( ctx );
592 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
593 6 : return 0;
594 6 : }
595 0 : void * fd_block_hash_vec_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
596 0 : fd_block_hash_vec_t * self = (fd_block_hash_vec_t *)mem;
597 0 : fd_block_hash_vec_new( self );
598 0 : void * alloc_region = (uchar *)mem + sizeof(fd_block_hash_vec_t);
599 0 : void * * alloc_mem = &alloc_region;
600 0 : fd_block_hash_vec_decode_inner( mem, alloc_mem, ctx );
601 0 : return self;
602 0 : }
603 6 : void fd_block_hash_vec_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
604 6 : fd_block_hash_vec_t * self = (fd_block_hash_vec_t *)struct_mem;
605 6 : fd_bincode_uint64_decode_unsafe( &self->last_hash_index, ctx );
606 6 : {
607 6 : uchar o;
608 6 : fd_bincode_bool_decode_unsafe( &o, ctx );
609 6 : if( o ) {
610 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, FD_HASH_ALIGN );
611 0 : self->last_hash = *alloc_mem;
612 0 : *alloc_mem = (uchar *)*alloc_mem + FD_HASH_FOOTPRINT;
613 0 : fd_hash_new( self->last_hash );
614 0 : fd_hash_decode_inner( self->last_hash, alloc_mem, ctx );
615 6 : } else {
616 6 : self->last_hash = NULL;
617 6 : }
618 6 : }
619 6 : fd_bincode_uint64_decode_unsafe( &self->ages_len, ctx );
620 6 : if( self->ages_len ) {
621 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_HASH_HASH_AGE_PAIR_ALIGN );
622 0 : self->ages = *alloc_mem;
623 0 : *alloc_mem = (uchar *)(*alloc_mem) + FD_HASH_HASH_AGE_PAIR_FOOTPRINT*self->ages_len;
624 0 : for( ulong i=0; i < self->ages_len; i++ ) {
625 0 : fd_hash_hash_age_pair_new( self->ages + i );
626 0 : fd_hash_hash_age_pair_decode_inner( self->ages + i, alloc_mem, ctx );
627 0 : }
628 0 : } else
629 6 : self->ages = NULL;
630 6 : fd_bincode_uint64_decode_unsafe( &self->max_age, ctx );
631 6 : }
632 0 : void * fd_block_hash_vec_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
633 0 : fd_block_hash_vec_global_t * self = (fd_block_hash_vec_global_t *)mem;
634 0 : fd_block_hash_vec_new( (fd_block_hash_vec_t *)self );
635 0 : void * alloc_region = (uchar *)mem + sizeof(fd_block_hash_vec_global_t);
636 0 : void * * alloc_mem = &alloc_region;
637 0 : fd_block_hash_vec_decode_inner_global( mem, alloc_mem, ctx );
638 0 : return self;
639 0 : }
640 0 : void fd_block_hash_vec_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
641 0 : fd_block_hash_vec_global_t * self = (fd_block_hash_vec_global_t *)struct_mem;
642 0 : fd_bincode_uint64_decode_unsafe( &self->last_hash_index, ctx );
643 0 : {
644 0 : uchar o;
645 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
646 0 : if( o ) {
647 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, FD_HASH_ALIGN );
648 0 : self->last_hash_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
649 0 : fd_hash_new( *alloc_mem );
650 0 : *alloc_mem = (uchar *)*alloc_mem + FD_HASH_FOOTPRINT;
651 0 : fd_hash_decode_inner_global( fd_wksp_laddr_fast( ctx->wksp, self->last_hash_gaddr ), alloc_mem, ctx );
652 0 : } else {
653 0 : self->last_hash_gaddr = 0UL;
654 0 : }
655 0 : }
656 0 : fd_bincode_uint64_decode_unsafe( &self->ages_len, ctx );
657 0 : if( self->ages_len ) {
658 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_HASH_HASH_AGE_PAIR_ALIGN );
659 0 : self->ages_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
660 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
661 0 : *alloc_mem = (uchar *)(*alloc_mem) + FD_HASH_HASH_AGE_PAIR_FOOTPRINT*self->ages_len;
662 0 : for( ulong i=0; i < self->ages_len; i++ ) {
663 0 : fd_hash_hash_age_pair_new( (fd_hash_hash_age_pair_t *)(cur_mem + FD_HASH_HASH_AGE_PAIR_FOOTPRINT * i) );
664 0 : fd_hash_hash_age_pair_decode_inner_global( cur_mem + FD_HASH_HASH_AGE_PAIR_FOOTPRINT * i, alloc_mem, ctx );
665 0 : }
666 0 : } else
667 0 : self->ages_gaddr = 0UL;
668 0 : fd_bincode_uint64_decode_unsafe( &self->max_age, ctx );
669 0 : }
670 0 : int fd_block_hash_vec_convert_global_to_local( void const * global_self, fd_block_hash_vec_t * self, fd_bincode_decode_ctx_t * ctx ) {
671 0 : int err = 0;
672 0 : fd_block_hash_vec_global_t const * mem = (fd_block_hash_vec_global_t const *)global_self;
673 0 : self->last_hash_index = mem->last_hash_index;
674 0 : self->last_hash = fd_wksp_laddr_fast( ctx->wksp, mem->last_hash_gaddr );
675 0 : self->ages_len = mem->ages_len;
676 0 : self->ages = fd_wksp_laddr_fast( ctx->wksp, mem->ages_gaddr );
677 0 : self->max_age = mem->max_age;
678 0 : return FD_BINCODE_SUCCESS;
679 0 : }
680 6 : void fd_block_hash_vec_new(fd_block_hash_vec_t * self) {
681 6 : fd_memset( self, 0, sizeof(fd_block_hash_vec_t) );
682 6 : }
683 0 : void fd_block_hash_vec_destroy( fd_block_hash_vec_t * self ) {
684 0 : if( self->last_hash ) {
685 0 : fd_hash_destroy( self->last_hash );
686 0 : self->last_hash = NULL;
687 0 : }
688 0 : if( self->ages ) {
689 0 : for( ulong i=0; i < self->ages_len; i++ )
690 0 : fd_hash_hash_age_pair_destroy( self->ages + i );
691 0 : self->ages = NULL;
692 0 : }
693 0 : }
694 :
695 0 : ulong fd_block_hash_vec_footprint( void ){ return FD_BLOCK_HASH_VEC_FOOTPRINT; }
696 0 : ulong fd_block_hash_vec_align( void ){ return FD_BLOCK_HASH_VEC_ALIGN; }
697 :
698 0 : void fd_block_hash_vec_walk( void * w, fd_block_hash_vec_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
699 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_block_hash_vec", level++ );
700 0 : fun( w, &self->last_hash_index, "last_hash_index", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
701 0 : if( !self->last_hash ) {
702 0 : fun( w, NULL, "last_hash", FD_FLAMENCO_TYPE_NULL, "hash", level );
703 0 : } else {
704 0 : fd_hash_walk( w, self->last_hash, fun, "last_hash", level );
705 0 : }
706 0 : if( self->ages_len ) {
707 0 : fun( w, NULL, "ages", FD_FLAMENCO_TYPE_ARR, "array", level++ );
708 0 : for( ulong i=0; i < self->ages_len; i++ )
709 0 : fd_hash_hash_age_pair_walk(w, self->ages + i, fun, "hash_hash_age_pair", level );
710 0 : fun( w, NULL, "ages", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
711 0 : }
712 0 : fun( w, &self->max_age, "max_age", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
713 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_block_hash_vec", level-- );
714 0 : }
715 6 : ulong fd_block_hash_vec_size( fd_block_hash_vec_t const * self ) {
716 6 : ulong size = 0;
717 6 : size += sizeof(ulong);
718 6 : size += sizeof(char);
719 6 : if( NULL != self->last_hash ) {
720 0 : size += fd_hash_size( self->last_hash );
721 0 : }
722 6 : do {
723 6 : size += sizeof(ulong);
724 6 : for( ulong i=0; i < self->ages_len; i++ )
725 0 : size += fd_hash_hash_age_pair_size( self->ages + i );
726 6 : } while(0);
727 6 : size += sizeof(ulong);
728 6 : return size;
729 6 : }
730 :
731 6 : int fd_block_hash_queue_encode( fd_block_hash_queue_t const * self, fd_bincode_encode_ctx_t * ctx ) {
732 6 : int err;
733 6 : err = fd_bincode_uint64_encode( self->last_hash_index, ctx );
734 6 : if( FD_UNLIKELY( err ) ) return err;
735 6 : if( self->last_hash != NULL ) {
736 6 : err = fd_bincode_bool_encode( 1, ctx );
737 6 : if( FD_UNLIKELY( err ) ) return err;
738 6 : err = fd_hash_encode( self->last_hash, ctx );
739 6 : if( FD_UNLIKELY( err ) ) return err;
740 6 : } else {
741 0 : err = fd_bincode_bool_encode( 0, ctx );
742 0 : if( FD_UNLIKELY( err ) ) return err;
743 0 : }
744 6 : if( self->ages_root ) {
745 6 : ulong ages_len = fd_hash_hash_age_pair_t_map_size( self->ages_pool, self->ages_root );
746 6 : err = fd_bincode_uint64_encode( ages_len, ctx );
747 6 : if( FD_UNLIKELY( err ) ) return err;
748 1812 : for( fd_hash_hash_age_pair_t_mapnode_t * n = fd_hash_hash_age_pair_t_map_minimum( self->ages_pool, self->ages_root ); n; n = fd_hash_hash_age_pair_t_map_successor( self->ages_pool, n ) ) {
749 1806 : err = fd_hash_hash_age_pair_encode( &n->elem, ctx );
750 1806 : if( FD_UNLIKELY( err ) ) return err;
751 1806 : }
752 6 : } else {
753 0 : ulong ages_len = 0;
754 0 : err = fd_bincode_uint64_encode( ages_len, ctx );
755 0 : if( FD_UNLIKELY( err ) ) return err;
756 0 : }
757 6 : err = fd_bincode_uint64_encode( self->max_age, ctx );
758 6 : if( FD_UNLIKELY( err ) ) return err;
759 6 : return FD_BINCODE_SUCCESS;
760 6 : }
761 0 : int fd_block_hash_queue_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
762 0 : *total_sz += sizeof(fd_block_hash_queue_t);
763 0 : void const * start_data = ctx->data;
764 0 : int err = fd_block_hash_queue_decode_footprint_inner( ctx, total_sz );
765 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
766 0 : ctx->data = start_data;
767 0 : return err;
768 0 : }
769 6 : int fd_block_hash_queue_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
770 6 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
771 6 : int err = 0;
772 6 : err = fd_bincode_uint64_decode_footprint( ctx );
773 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
774 6 : {
775 6 : uchar o;
776 6 : err = fd_bincode_bool_decode( &o, ctx );
777 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
778 6 : if( o ) {
779 6 : *total_sz += FD_HASH_ALIGN + FD_HASH_FOOTPRINT;
780 6 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
781 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
782 6 : }
783 6 : }
784 6 : ulong ages_len = 0UL;
785 6 : err = fd_bincode_uint64_decode( &ages_len, ctx );
786 6 : ulong ages_cnt = fd_ulong_max( ages_len, 400 );
787 6 : *total_sz += fd_hash_hash_age_pair_t_map_align() + fd_hash_hash_age_pair_t_map_footprint( ages_cnt );
788 6 : if( FD_UNLIKELY( err ) ) return err;
789 1812 : for( ulong i=0; i < ages_len; i++ ) {
790 1806 : err = fd_hash_hash_age_pair_decode_footprint_inner( ctx, total_sz );
791 1806 : if( FD_UNLIKELY( err ) ) return err;
792 1806 : }
793 6 : err = fd_bincode_uint64_decode_footprint( ctx );
794 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
795 6 : return 0;
796 6 : }
797 0 : void * fd_block_hash_queue_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
798 0 : fd_block_hash_queue_t * self = (fd_block_hash_queue_t *)mem;
799 0 : fd_block_hash_queue_new( self );
800 0 : void * alloc_region = (uchar *)mem + sizeof(fd_block_hash_queue_t);
801 0 : void * * alloc_mem = &alloc_region;
802 0 : fd_block_hash_queue_decode_inner( mem, alloc_mem, ctx );
803 0 : return self;
804 0 : }
805 6 : void fd_block_hash_queue_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
806 6 : fd_block_hash_queue_t * self = (fd_block_hash_queue_t *)struct_mem;
807 6 : fd_bincode_uint64_decode_unsafe( &self->last_hash_index, ctx );
808 6 : {
809 6 : uchar o;
810 6 : fd_bincode_bool_decode_unsafe( &o, ctx );
811 6 : if( o ) {
812 6 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, FD_HASH_ALIGN );
813 6 : self->last_hash = *alloc_mem;
814 6 : *alloc_mem = (uchar *)*alloc_mem + FD_HASH_FOOTPRINT;
815 6 : fd_hash_new( self->last_hash );
816 6 : fd_hash_decode_inner( self->last_hash, alloc_mem, ctx );
817 6 : } else {
818 0 : self->last_hash = NULL;
819 0 : }
820 6 : }
821 6 : ulong ages_len;
822 6 : fd_bincode_uint64_decode_unsafe( &ages_len, ctx );
823 6 : self->ages_pool = fd_hash_hash_age_pair_t_map_join_new( alloc_mem, fd_ulong_max( ages_len, 400 ) );
824 6 : self->ages_root = NULL;
825 1812 : for( ulong i=0; i < ages_len; i++ ) {
826 1806 : fd_hash_hash_age_pair_t_mapnode_t * node = fd_hash_hash_age_pair_t_map_acquire( self->ages_pool );
827 1806 : fd_hash_hash_age_pair_new( &node->elem );
828 1806 : fd_hash_hash_age_pair_decode_inner( &node->elem, alloc_mem, ctx );
829 1806 : fd_hash_hash_age_pair_t_map_insert( self->ages_pool, &self->ages_root, node );
830 1806 : }
831 6 : fd_bincode_uint64_decode_unsafe( &self->max_age, ctx );
832 6 : }
833 0 : void * fd_block_hash_queue_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
834 0 : fd_block_hash_queue_global_t * self = (fd_block_hash_queue_global_t *)mem;
835 0 : fd_block_hash_queue_new( (fd_block_hash_queue_t *)self );
836 0 : void * alloc_region = (uchar *)mem + sizeof(fd_block_hash_queue_global_t);
837 0 : void * * alloc_mem = &alloc_region;
838 0 : fd_block_hash_queue_decode_inner_global( mem, alloc_mem, ctx );
839 0 : return self;
840 0 : }
841 3 : void fd_block_hash_queue_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
842 3 : fd_block_hash_queue_global_t * self = (fd_block_hash_queue_global_t *)struct_mem;
843 3 : fd_bincode_uint64_decode_unsafe( &self->last_hash_index, ctx );
844 3 : {
845 3 : uchar o;
846 3 : fd_bincode_bool_decode_unsafe( &o, ctx );
847 3 : if( o ) {
848 3 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, FD_HASH_ALIGN );
849 3 : self->last_hash_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
850 3 : fd_hash_new( *alloc_mem );
851 3 : *alloc_mem = (uchar *)*alloc_mem + FD_HASH_FOOTPRINT;
852 3 : fd_hash_decode_inner_global( fd_wksp_laddr_fast( ctx->wksp, self->last_hash_gaddr ), alloc_mem, ctx );
853 3 : } else {
854 0 : self->last_hash_gaddr = 0UL;
855 0 : }
856 3 : }
857 3 : ulong ages_len;
858 3 : fd_bincode_uint64_decode_unsafe( &ages_len, ctx );
859 3 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, fd_hash_hash_age_pair_t_map_align() );
860 3 : fd_hash_hash_age_pair_t_mapnode_t * ages_pool = fd_hash_hash_age_pair_t_map_join_new( alloc_mem, fd_ulong_max( ages_len, 400 ) );
861 3 : fd_hash_hash_age_pair_t_mapnode_t * ages_root = NULL;
862 3 : self->ages_root_gaddr = 0UL;
863 906 : for( ulong i=0; i < ages_len; i++ ) {
864 903 : fd_hash_hash_age_pair_t_mapnode_t * node = fd_hash_hash_age_pair_t_map_acquire( ages_pool );
865 903 : fd_hash_hash_age_pair_new( &node->elem );
866 903 : fd_hash_hash_age_pair_decode_inner( &node->elem, alloc_mem, ctx );
867 903 : fd_hash_hash_age_pair_t_map_insert( ages_pool, &ages_root, node );
868 903 : }
869 3 : self->ages_pool_gaddr = fd_wksp_gaddr_fast( ctx->wksp, ages_pool );
870 3 : self->ages_root_gaddr = fd_wksp_gaddr_fast( ctx->wksp, ages_root );
871 3 : fd_bincode_uint64_decode_unsafe( &self->max_age, ctx );
872 3 : }
873 3 : int fd_block_hash_queue_convert_global_to_local( void const * global_self, fd_block_hash_queue_t * self, fd_bincode_decode_ctx_t * ctx ) {
874 3 : int err = 0;
875 3 : fd_block_hash_queue_global_t const * mem = (fd_block_hash_queue_global_t const *)global_self;
876 3 : self->last_hash_index = mem->last_hash_index;
877 3 : self->last_hash = fd_wksp_laddr_fast( ctx->wksp, mem->last_hash_gaddr );
878 3 : self->ages_pool = fd_wksp_laddr_fast( ctx->wksp, mem->ages_pool_gaddr );
879 3 : self->ages_root = fd_wksp_laddr_fast( ctx->wksp, mem->ages_root_gaddr );
880 3 : self->max_age = mem->max_age;
881 3 : return FD_BINCODE_SUCCESS;
882 3 : }
883 9 : void fd_block_hash_queue_new(fd_block_hash_queue_t * self) {
884 9 : fd_memset( self, 0, sizeof(fd_block_hash_queue_t) );
885 9 : }
886 0 : void fd_block_hash_queue_destroy( fd_block_hash_queue_t * self ) {
887 0 : if( self->last_hash ) {
888 0 : fd_hash_destroy( self->last_hash );
889 0 : self->last_hash = NULL;
890 0 : }
891 0 : for( fd_hash_hash_age_pair_t_mapnode_t * n = fd_hash_hash_age_pair_t_map_minimum(self->ages_pool, self->ages_root ); n; n = fd_hash_hash_age_pair_t_map_successor(self->ages_pool, n) ) {
892 0 : fd_hash_hash_age_pair_destroy( &n->elem );
893 0 : }
894 0 : self->ages_pool = NULL;
895 0 : self->ages_root = NULL;
896 0 : }
897 :
898 0 : ulong fd_block_hash_queue_footprint( void ){ return FD_BLOCK_HASH_QUEUE_FOOTPRINT; }
899 0 : ulong fd_block_hash_queue_align( void ){ return FD_BLOCK_HASH_QUEUE_ALIGN; }
900 :
901 3 : void fd_block_hash_queue_walk( void * w, fd_block_hash_queue_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
902 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_block_hash_queue", level++ );
903 3 : fun( w, &self->last_hash_index, "last_hash_index", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
904 3 : if( !self->last_hash ) {
905 0 : fun( w, NULL, "last_hash", FD_FLAMENCO_TYPE_NULL, "hash", level );
906 3 : } else {
907 3 : fd_hash_walk( w, self->last_hash, fun, "last_hash", level );
908 3 : }
909 3 : if( self->ages_root ) {
910 906 : for( fd_hash_hash_age_pair_t_mapnode_t * n = fd_hash_hash_age_pair_t_map_minimum(self->ages_pool, self->ages_root ); n; n = fd_hash_hash_age_pair_t_map_successor( self->ages_pool, n ) ) {
911 903 : fd_hash_hash_age_pair_walk(w, &n->elem, fun, "ages", level );
912 903 : }
913 3 : }
914 3 : fun( w, &self->max_age, "max_age", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
915 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_block_hash_queue", level-- );
916 3 : }
917 0 : ulong fd_block_hash_queue_size( fd_block_hash_queue_t const * self ) {
918 0 : ulong size = 0;
919 0 : size += sizeof(ulong);
920 0 : size += sizeof(char);
921 0 : if( NULL != self->last_hash ) {
922 0 : size += fd_hash_size( self->last_hash );
923 0 : }
924 0 : if( self->ages_root ) {
925 0 : size += sizeof(ulong);
926 0 : for( fd_hash_hash_age_pair_t_mapnode_t * n = fd_hash_hash_age_pair_t_map_minimum( self->ages_pool, self->ages_root ); n; n = fd_hash_hash_age_pair_t_map_successor( self->ages_pool, n ) ) {
927 0 : size += fd_hash_hash_age_pair_size( &n->elem );
928 0 : }
929 0 : } else {
930 0 : size += sizeof(ulong);
931 0 : }
932 0 : size += sizeof(ulong);
933 0 : return size;
934 0 : }
935 :
936 21 : int fd_fee_rate_governor_encode( fd_fee_rate_governor_t const * self, fd_bincode_encode_ctx_t * ctx ) {
937 21 : int err;
938 21 : err = fd_bincode_uint64_encode( self->target_lamports_per_signature, ctx );
939 21 : if( FD_UNLIKELY( err ) ) return err;
940 21 : err = fd_bincode_uint64_encode( self->target_signatures_per_slot, ctx );
941 21 : if( FD_UNLIKELY( err ) ) return err;
942 21 : err = fd_bincode_uint64_encode( self->min_lamports_per_signature, ctx );
943 21 : if( FD_UNLIKELY( err ) ) return err;
944 21 : err = fd_bincode_uint64_encode( self->max_lamports_per_signature, ctx );
945 21 : if( FD_UNLIKELY( err ) ) return err;
946 21 : err = fd_bincode_uint8_encode( (uchar)(self->burn_percent), ctx );
947 21 : if( FD_UNLIKELY( err ) ) return err;
948 21 : return FD_BINCODE_SUCCESS;
949 21 : }
950 0 : int fd_fee_rate_governor_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
951 0 : *total_sz += sizeof(fd_fee_rate_governor_t);
952 0 : void const * start_data = ctx->data;
953 0 : int err = fd_fee_rate_governor_decode_footprint_inner( ctx, total_sz );
954 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
955 0 : ctx->data = start_data;
956 0 : return err;
957 0 : }
958 12 : int fd_fee_rate_governor_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
959 12 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
960 12 : int err = 0;
961 12 : err = fd_bincode_uint64_decode_footprint( ctx );
962 12 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
963 12 : err = fd_bincode_uint64_decode_footprint( ctx );
964 12 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
965 12 : err = fd_bincode_uint64_decode_footprint( ctx );
966 12 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
967 12 : err = fd_bincode_uint64_decode_footprint( ctx );
968 12 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
969 12 : err = fd_bincode_uint8_decode_footprint( ctx );
970 12 : if( FD_UNLIKELY( err ) ) return err;
971 12 : return 0;
972 12 : }
973 0 : void * fd_fee_rate_governor_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
974 0 : fd_fee_rate_governor_t * self = (fd_fee_rate_governor_t *)mem;
975 0 : fd_fee_rate_governor_new( self );
976 0 : void * alloc_region = (uchar *)mem + sizeof(fd_fee_rate_governor_t);
977 0 : void * * alloc_mem = &alloc_region;
978 0 : fd_fee_rate_governor_decode_inner( mem, alloc_mem, ctx );
979 0 : return self;
980 0 : }
981 12 : void fd_fee_rate_governor_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
982 12 : fd_fee_rate_governor_t * self = (fd_fee_rate_governor_t *)struct_mem;
983 12 : fd_bincode_uint64_decode_unsafe( &self->target_lamports_per_signature, ctx );
984 12 : fd_bincode_uint64_decode_unsafe( &self->target_signatures_per_slot, ctx );
985 12 : fd_bincode_uint64_decode_unsafe( &self->min_lamports_per_signature, ctx );
986 12 : fd_bincode_uint64_decode_unsafe( &self->max_lamports_per_signature, ctx );
987 12 : fd_bincode_uint8_decode_unsafe( &self->burn_percent, ctx );
988 12 : }
989 0 : void * fd_fee_rate_governor_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
990 0 : fd_fee_rate_governor_global_t * self = (fd_fee_rate_governor_global_t *)mem;
991 0 : fd_fee_rate_governor_new( (fd_fee_rate_governor_t *)self );
992 0 : void * alloc_region = (uchar *)mem + sizeof(fd_fee_rate_governor_global_t);
993 0 : void * * alloc_mem = &alloc_region;
994 0 : fd_fee_rate_governor_decode_inner_global( mem, alloc_mem, ctx );
995 0 : return self;
996 0 : }
997 3 : void fd_fee_rate_governor_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
998 3 : fd_fee_rate_governor_global_t * self = (fd_fee_rate_governor_global_t *)struct_mem;
999 3 : fd_bincode_uint64_decode_unsafe( &self->target_lamports_per_signature, ctx );
1000 3 : fd_bincode_uint64_decode_unsafe( &self->target_signatures_per_slot, ctx );
1001 3 : fd_bincode_uint64_decode_unsafe( &self->min_lamports_per_signature, ctx );
1002 3 : fd_bincode_uint64_decode_unsafe( &self->max_lamports_per_signature, ctx );
1003 3 : fd_bincode_uint8_decode_unsafe( &self->burn_percent, ctx );
1004 3 : }
1005 3 : int fd_fee_rate_governor_convert_global_to_local( void const * global_self, fd_fee_rate_governor_t * self, fd_bincode_decode_ctx_t * ctx ) {
1006 3 : int err = 0;
1007 3 : fd_fee_rate_governor_global_t const * mem = (fd_fee_rate_governor_global_t const *)global_self;
1008 3 : self->target_lamports_per_signature = mem->target_lamports_per_signature;
1009 3 : self->target_signatures_per_slot = mem->target_signatures_per_slot;
1010 3 : self->min_lamports_per_signature = mem->min_lamports_per_signature;
1011 3 : self->max_lamports_per_signature = mem->max_lamports_per_signature;
1012 3 : self->burn_percent = mem->burn_percent;
1013 3 : return FD_BINCODE_SUCCESS;
1014 3 : }
1015 27 : void fd_fee_rate_governor_new(fd_fee_rate_governor_t * self) {
1016 27 : fd_memset( self, 0, sizeof(fd_fee_rate_governor_t) );
1017 27 : }
1018 0 : void fd_fee_rate_governor_destroy( fd_fee_rate_governor_t * self ) {
1019 0 : }
1020 :
1021 0 : ulong fd_fee_rate_governor_footprint( void ){ return FD_FEE_RATE_GOVERNOR_FOOTPRINT; }
1022 0 : ulong fd_fee_rate_governor_align( void ){ return FD_FEE_RATE_GOVERNOR_ALIGN; }
1023 :
1024 3 : void fd_fee_rate_governor_walk( void * w, fd_fee_rate_governor_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
1025 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_fee_rate_governor", level++ );
1026 3 : fun( w, &self->target_lamports_per_signature, "target_lamports_per_signature", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
1027 3 : fun( w, &self->target_signatures_per_slot, "target_signatures_per_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
1028 3 : fun( w, &self->min_lamports_per_signature, "min_lamports_per_signature", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
1029 3 : fun( w, &self->max_lamports_per_signature, "max_lamports_per_signature", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
1030 3 : fun( w, &self->burn_percent, "burn_percent", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
1031 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_fee_rate_governor", level-- );
1032 3 : }
1033 6 : ulong fd_fee_rate_governor_size( fd_fee_rate_governor_t const * self ) {
1034 6 : ulong size = 0;
1035 6 : size += sizeof(ulong);
1036 6 : size += sizeof(ulong);
1037 6 : size += sizeof(ulong);
1038 6 : size += sizeof(ulong);
1039 6 : size += sizeof(char);
1040 6 : return size;
1041 6 : }
1042 :
1043 54 : int fd_slot_pair_encode( fd_slot_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1044 54 : int err;
1045 54 : err = fd_bincode_uint64_encode( self->slot, ctx );
1046 54 : if( FD_UNLIKELY( err ) ) return err;
1047 54 : err = fd_bincode_uint64_encode( self->val, ctx );
1048 54 : if( FD_UNLIKELY( err ) ) return err;
1049 54 : return FD_BINCODE_SUCCESS;
1050 54 : }
1051 0 : int fd_slot_pair_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1052 0 : *total_sz += sizeof(fd_slot_pair_t);
1053 0 : void const * start_data = ctx->data;
1054 0 : int err = fd_slot_pair_decode_footprint_inner( ctx, total_sz );
1055 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1056 0 : ctx->data = start_data;
1057 0 : return err;
1058 0 : }
1059 54 : int fd_slot_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1060 54 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1061 54 : int err = 0;
1062 54 : err = fd_bincode_uint64_decode_footprint( ctx );
1063 54 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1064 54 : err = fd_bincode_uint64_decode_footprint( ctx );
1065 54 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1066 54 : return 0;
1067 54 : }
1068 0 : void * fd_slot_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1069 0 : fd_slot_pair_t * self = (fd_slot_pair_t *)mem;
1070 0 : fd_slot_pair_new( self );
1071 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_pair_t);
1072 0 : void * * alloc_mem = &alloc_region;
1073 0 : fd_slot_pair_decode_inner( mem, alloc_mem, ctx );
1074 0 : return self;
1075 0 : }
1076 54 : void fd_slot_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1077 54 : fd_slot_pair_t * self = (fd_slot_pair_t *)struct_mem;
1078 54 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
1079 54 : fd_bincode_uint64_decode_unsafe( &self->val, ctx );
1080 54 : }
1081 0 : void * fd_slot_pair_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1082 0 : fd_slot_pair_global_t * self = (fd_slot_pair_global_t *)mem;
1083 0 : fd_slot_pair_new( (fd_slot_pair_t *)self );
1084 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_pair_global_t);
1085 0 : void * * alloc_mem = &alloc_region;
1086 0 : fd_slot_pair_decode_inner_global( mem, alloc_mem, ctx );
1087 0 : return self;
1088 0 : }
1089 27 : void fd_slot_pair_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1090 27 : fd_slot_pair_global_t * self = (fd_slot_pair_global_t *)struct_mem;
1091 27 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
1092 27 : fd_bincode_uint64_decode_unsafe( &self->val, ctx );
1093 27 : }
1094 0 : int fd_slot_pair_convert_global_to_local( void const * global_self, fd_slot_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
1095 0 : int err = 0;
1096 0 : fd_slot_pair_global_t const * mem = (fd_slot_pair_global_t const *)global_self;
1097 0 : self->slot = mem->slot;
1098 0 : self->val = mem->val;
1099 0 : return FD_BINCODE_SUCCESS;
1100 0 : }
1101 81 : void fd_slot_pair_new(fd_slot_pair_t * self) {
1102 81 : fd_memset( self, 0, sizeof(fd_slot_pair_t) );
1103 81 : }
1104 0 : void fd_slot_pair_destroy( fd_slot_pair_t * self ) {
1105 0 : }
1106 :
1107 0 : ulong fd_slot_pair_footprint( void ){ return FD_SLOT_PAIR_FOOTPRINT; }
1108 0 : ulong fd_slot_pair_align( void ){ return FD_SLOT_PAIR_ALIGN; }
1109 :
1110 27 : void fd_slot_pair_walk( void * w, fd_slot_pair_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
1111 27 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_slot_pair", level++ );
1112 27 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
1113 27 : fun( w, &self->val, "val", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
1114 27 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_slot_pair", level-- );
1115 27 : }
1116 0 : ulong fd_slot_pair_size( fd_slot_pair_t const * self ) {
1117 0 : ulong size = 0;
1118 0 : size += sizeof(ulong);
1119 0 : size += sizeof(ulong);
1120 0 : return size;
1121 0 : }
1122 :
1123 12 : int fd_hard_forks_encode( fd_hard_forks_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1124 12 : int err;
1125 12 : err = fd_bincode_uint64_encode( self->hard_forks_len, ctx );
1126 12 : if( FD_UNLIKELY(err) ) return err;
1127 12 : if( self->hard_forks_len ) {
1128 60 : for( ulong i=0; i < self->hard_forks_len; i++ ) {
1129 54 : err = fd_slot_pair_encode( self->hard_forks + i, ctx );
1130 54 : if( FD_UNLIKELY( err ) ) return err;
1131 54 : }
1132 6 : }
1133 12 : return FD_BINCODE_SUCCESS;
1134 12 : }
1135 0 : int fd_hard_forks_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1136 0 : *total_sz += sizeof(fd_hard_forks_t);
1137 0 : void const * start_data = ctx->data;
1138 0 : int err = fd_hard_forks_decode_footprint_inner( ctx, total_sz );
1139 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1140 0 : ctx->data = start_data;
1141 0 : return err;
1142 0 : }
1143 12 : int fd_hard_forks_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1144 12 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1145 12 : int err = 0;
1146 12 : ulong hard_forks_len;
1147 12 : err = fd_bincode_uint64_decode( &hard_forks_len, ctx );
1148 12 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1149 12 : if( hard_forks_len ) {
1150 6 : *total_sz += FD_SLOT_PAIR_ALIGN + FD_SLOT_PAIR_FOOTPRINT*hard_forks_len;
1151 60 : for( ulong i=0; i < hard_forks_len; i++ ) {
1152 54 : err = fd_slot_pair_decode_footprint_inner( ctx, total_sz );
1153 54 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1154 54 : }
1155 6 : }
1156 12 : return 0;
1157 12 : }
1158 0 : void * fd_hard_forks_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1159 0 : fd_hard_forks_t * self = (fd_hard_forks_t *)mem;
1160 0 : fd_hard_forks_new( self );
1161 0 : void * alloc_region = (uchar *)mem + sizeof(fd_hard_forks_t);
1162 0 : void * * alloc_mem = &alloc_region;
1163 0 : fd_hard_forks_decode_inner( mem, alloc_mem, ctx );
1164 0 : return self;
1165 0 : }
1166 12 : void fd_hard_forks_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1167 12 : fd_hard_forks_t * self = (fd_hard_forks_t *)struct_mem;
1168 12 : fd_bincode_uint64_decode_unsafe( &self->hard_forks_len, ctx );
1169 12 : if( self->hard_forks_len ) {
1170 6 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_SLOT_PAIR_ALIGN );
1171 6 : self->hard_forks = *alloc_mem;
1172 6 : *alloc_mem = (uchar *)(*alloc_mem) + FD_SLOT_PAIR_FOOTPRINT*self->hard_forks_len;
1173 60 : for( ulong i=0; i < self->hard_forks_len; i++ ) {
1174 54 : fd_slot_pair_new( self->hard_forks + i );
1175 54 : fd_slot_pair_decode_inner( self->hard_forks + i, alloc_mem, ctx );
1176 54 : }
1177 6 : } else
1178 6 : self->hard_forks = NULL;
1179 12 : }
1180 0 : void * fd_hard_forks_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1181 0 : fd_hard_forks_global_t * self = (fd_hard_forks_global_t *)mem;
1182 0 : fd_hard_forks_new( (fd_hard_forks_t *)self );
1183 0 : void * alloc_region = (uchar *)mem + sizeof(fd_hard_forks_global_t);
1184 0 : void * * alloc_mem = &alloc_region;
1185 0 : fd_hard_forks_decode_inner_global( mem, alloc_mem, ctx );
1186 0 : return self;
1187 0 : }
1188 3 : void fd_hard_forks_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1189 3 : fd_hard_forks_global_t * self = (fd_hard_forks_global_t *)struct_mem;
1190 3 : fd_bincode_uint64_decode_unsafe( &self->hard_forks_len, ctx );
1191 3 : if( self->hard_forks_len ) {
1192 3 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_SLOT_PAIR_ALIGN );
1193 3 : self->hard_forks_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
1194 3 : uchar * cur_mem = (uchar *)(*alloc_mem);
1195 3 : *alloc_mem = (uchar *)(*alloc_mem) + FD_SLOT_PAIR_FOOTPRINT*self->hard_forks_len;
1196 30 : for( ulong i=0; i < self->hard_forks_len; i++ ) {
1197 27 : fd_slot_pair_new( (fd_slot_pair_t *)(cur_mem + FD_SLOT_PAIR_FOOTPRINT * i) );
1198 27 : fd_slot_pair_decode_inner_global( cur_mem + FD_SLOT_PAIR_FOOTPRINT * i, alloc_mem, ctx );
1199 27 : }
1200 3 : } else
1201 0 : self->hard_forks_gaddr = 0UL;
1202 3 : }
1203 3 : int fd_hard_forks_convert_global_to_local( void const * global_self, fd_hard_forks_t * self, fd_bincode_decode_ctx_t * ctx ) {
1204 3 : int err = 0;
1205 3 : fd_hard_forks_global_t const * mem = (fd_hard_forks_global_t const *)global_self;
1206 3 : self->hard_forks_len = mem->hard_forks_len;
1207 3 : self->hard_forks = fd_wksp_laddr_fast( ctx->wksp, mem->hard_forks_gaddr );
1208 3 : return FD_BINCODE_SUCCESS;
1209 3 : }
1210 15 : void fd_hard_forks_new(fd_hard_forks_t * self) {
1211 15 : fd_memset( self, 0, sizeof(fd_hard_forks_t) );
1212 15 : }
1213 0 : void fd_hard_forks_destroy( fd_hard_forks_t * self ) {
1214 0 : if( self->hard_forks ) {
1215 0 : for( ulong i=0; i < self->hard_forks_len; i++ )
1216 0 : fd_slot_pair_destroy( self->hard_forks + i );
1217 0 : self->hard_forks = NULL;
1218 0 : }
1219 0 : }
1220 :
1221 0 : ulong fd_hard_forks_footprint( void ){ return FD_HARD_FORKS_FOOTPRINT; }
1222 0 : ulong fd_hard_forks_align( void ){ return FD_HARD_FORKS_ALIGN; }
1223 :
1224 3 : void fd_hard_forks_walk( void * w, fd_hard_forks_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
1225 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_hard_forks", level++ );
1226 3 : if( self->hard_forks_len ) {
1227 3 : fun( w, NULL, "hard_forks", FD_FLAMENCO_TYPE_ARR, "array", level++ );
1228 30 : for( ulong i=0; i < self->hard_forks_len; i++ )
1229 27 : fd_slot_pair_walk(w, self->hard_forks + i, fun, "slot_pair", level );
1230 3 : fun( w, NULL, "hard_forks", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
1231 3 : }
1232 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_hard_forks", level-- );
1233 3 : }
1234 6 : ulong fd_hard_forks_size( fd_hard_forks_t const * self ) {
1235 6 : ulong size = 0;
1236 6 : do {
1237 6 : size += sizeof(ulong);
1238 6 : for( ulong i=0; i < self->hard_forks_len; i++ )
1239 0 : size += fd_slot_pair_size( self->hard_forks + i );
1240 6 : } while(0);
1241 6 : return size;
1242 6 : }
1243 :
1244 15 : int fd_inflation_encode( fd_inflation_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1245 15 : int err;
1246 15 : err = fd_bincode_double_encode( self->initial, ctx );
1247 15 : if( FD_UNLIKELY( err ) ) return err;
1248 15 : err = fd_bincode_double_encode( self->terminal, ctx );
1249 15 : if( FD_UNLIKELY( err ) ) return err;
1250 15 : err = fd_bincode_double_encode( self->taper, ctx );
1251 15 : if( FD_UNLIKELY( err ) ) return err;
1252 15 : err = fd_bincode_double_encode( self->foundation, ctx );
1253 15 : if( FD_UNLIKELY( err ) ) return err;
1254 15 : err = fd_bincode_double_encode( self->foundation_term, ctx );
1255 15 : if( FD_UNLIKELY( err ) ) return err;
1256 15 : err = fd_bincode_double_encode( self->unused, ctx );
1257 15 : if( FD_UNLIKELY( err ) ) return err;
1258 15 : return FD_BINCODE_SUCCESS;
1259 15 : }
1260 0 : int fd_inflation_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1261 0 : *total_sz += sizeof(fd_inflation_t);
1262 0 : void const * start_data = ctx->data;
1263 0 : int err = fd_inflation_decode_footprint_inner( ctx, total_sz );
1264 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1265 0 : ctx->data = start_data;
1266 0 : return err;
1267 0 : }
1268 6 : int fd_inflation_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1269 6 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1270 6 : int err = 0;
1271 6 : err = fd_bincode_double_decode_footprint( ctx );
1272 6 : if( FD_UNLIKELY( err ) ) return err;
1273 6 : err = fd_bincode_double_decode_footprint( ctx );
1274 6 : if( FD_UNLIKELY( err ) ) return err;
1275 6 : err = fd_bincode_double_decode_footprint( ctx );
1276 6 : if( FD_UNLIKELY( err ) ) return err;
1277 6 : err = fd_bincode_double_decode_footprint( ctx );
1278 6 : if( FD_UNLIKELY( err ) ) return err;
1279 6 : err = fd_bincode_double_decode_footprint( ctx );
1280 6 : if( FD_UNLIKELY( err ) ) return err;
1281 6 : err = fd_bincode_double_decode_footprint( ctx );
1282 6 : if( FD_UNLIKELY( err ) ) return err;
1283 6 : return 0;
1284 6 : }
1285 0 : void * fd_inflation_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1286 0 : fd_inflation_t * self = (fd_inflation_t *)mem;
1287 0 : fd_inflation_new( self );
1288 0 : void * alloc_region = (uchar *)mem + sizeof(fd_inflation_t);
1289 0 : void * * alloc_mem = &alloc_region;
1290 0 : fd_inflation_decode_inner( mem, alloc_mem, ctx );
1291 0 : return self;
1292 0 : }
1293 6 : void fd_inflation_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1294 6 : fd_inflation_t * self = (fd_inflation_t *)struct_mem;
1295 6 : fd_bincode_double_decode_unsafe( &self->initial, ctx );
1296 6 : fd_bincode_double_decode_unsafe( &self->terminal, ctx );
1297 6 : fd_bincode_double_decode_unsafe( &self->taper, ctx );
1298 6 : fd_bincode_double_decode_unsafe( &self->foundation, ctx );
1299 6 : fd_bincode_double_decode_unsafe( &self->foundation_term, ctx );
1300 6 : fd_bincode_double_decode_unsafe( &self->unused, ctx );
1301 6 : }
1302 0 : void * fd_inflation_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1303 0 : fd_inflation_global_t * self = (fd_inflation_global_t *)mem;
1304 0 : fd_inflation_new( (fd_inflation_t *)self );
1305 0 : void * alloc_region = (uchar *)mem + sizeof(fd_inflation_global_t);
1306 0 : void * * alloc_mem = &alloc_region;
1307 0 : fd_inflation_decode_inner_global( mem, alloc_mem, ctx );
1308 0 : return self;
1309 0 : }
1310 0 : void fd_inflation_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1311 0 : fd_inflation_global_t * self = (fd_inflation_global_t *)struct_mem;
1312 0 : fd_bincode_double_decode_unsafe( &self->initial, ctx );
1313 0 : fd_bincode_double_decode_unsafe( &self->terminal, ctx );
1314 0 : fd_bincode_double_decode_unsafe( &self->taper, ctx );
1315 0 : fd_bincode_double_decode_unsafe( &self->foundation, ctx );
1316 0 : fd_bincode_double_decode_unsafe( &self->foundation_term, ctx );
1317 0 : fd_bincode_double_decode_unsafe( &self->unused, ctx );
1318 0 : }
1319 0 : int fd_inflation_convert_global_to_local( void const * global_self, fd_inflation_t * self, fd_bincode_decode_ctx_t * ctx ) {
1320 0 : int err = 0;
1321 0 : fd_inflation_global_t const * mem = (fd_inflation_global_t const *)global_self;
1322 0 : self->initial = mem->initial;
1323 0 : self->terminal = mem->terminal;
1324 0 : self->taper = mem->taper;
1325 0 : self->foundation = mem->foundation;
1326 0 : self->foundation_term = mem->foundation_term;
1327 0 : self->unused = mem->unused;
1328 0 : return FD_BINCODE_SUCCESS;
1329 0 : }
1330 18 : void fd_inflation_new(fd_inflation_t * self) {
1331 18 : fd_memset( self, 0, sizeof(fd_inflation_t) );
1332 18 : }
1333 0 : void fd_inflation_destroy( fd_inflation_t * self ) {
1334 0 : }
1335 :
1336 0 : ulong fd_inflation_footprint( void ){ return FD_INFLATION_FOOTPRINT; }
1337 0 : ulong fd_inflation_align( void ){ return FD_INFLATION_ALIGN; }
1338 :
1339 0 : void fd_inflation_walk( void * w, fd_inflation_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
1340 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_inflation", level++ );
1341 0 : fun( w, &self->initial, "initial", FD_FLAMENCO_TYPE_DOUBLE, "double", level );
1342 0 : fun( w, &self->terminal, "terminal", FD_FLAMENCO_TYPE_DOUBLE, "double", level );
1343 0 : fun( w, &self->taper, "taper", FD_FLAMENCO_TYPE_DOUBLE, "double", level );
1344 0 : fun( w, &self->foundation, "foundation", FD_FLAMENCO_TYPE_DOUBLE, "double", level );
1345 0 : fun( w, &self->foundation_term, "foundation_term", FD_FLAMENCO_TYPE_DOUBLE, "double", level );
1346 0 : fun( w, &self->unused, "unused", FD_FLAMENCO_TYPE_DOUBLE, "double", level );
1347 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_inflation", level-- );
1348 0 : }
1349 6 : ulong fd_inflation_size( fd_inflation_t const * self ) {
1350 6 : ulong size = 0;
1351 6 : size += sizeof(double);
1352 6 : size += sizeof(double);
1353 6 : size += sizeof(double);
1354 6 : size += sizeof(double);
1355 6 : size += sizeof(double);
1356 6 : size += sizeof(double);
1357 6 : return size;
1358 6 : }
1359 :
1360 15 : int fd_rent_encode( fd_rent_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1361 15 : int err;
1362 15 : err = fd_bincode_uint64_encode( self->lamports_per_uint8_year, ctx );
1363 15 : if( FD_UNLIKELY( err ) ) return err;
1364 15 : err = fd_bincode_double_encode( self->exemption_threshold, ctx );
1365 15 : if( FD_UNLIKELY( err ) ) return err;
1366 15 : err = fd_bincode_uint8_encode( (uchar)(self->burn_percent), ctx );
1367 15 : if( FD_UNLIKELY( err ) ) return err;
1368 15 : return FD_BINCODE_SUCCESS;
1369 15 : }
1370 0 : int fd_rent_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1371 0 : *total_sz += sizeof(fd_rent_t);
1372 0 : void const * start_data = ctx->data;
1373 0 : int err = fd_rent_decode_footprint_inner( ctx, total_sz );
1374 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1375 0 : ctx->data = start_data;
1376 0 : return err;
1377 0 : }
1378 6 : int fd_rent_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1379 6 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1380 6 : int err = 0;
1381 6 : err = fd_bincode_uint64_decode_footprint( ctx );
1382 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1383 6 : err = fd_bincode_double_decode_footprint( ctx );
1384 6 : if( FD_UNLIKELY( err ) ) return err;
1385 6 : err = fd_bincode_uint8_decode_footprint( ctx );
1386 6 : if( FD_UNLIKELY( err ) ) return err;
1387 6 : return 0;
1388 6 : }
1389 0 : void * fd_rent_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1390 0 : fd_rent_t * self = (fd_rent_t *)mem;
1391 0 : fd_rent_new( self );
1392 0 : void * alloc_region = (uchar *)mem + sizeof(fd_rent_t);
1393 0 : void * * alloc_mem = &alloc_region;
1394 0 : fd_rent_decode_inner( mem, alloc_mem, ctx );
1395 0 : return self;
1396 0 : }
1397 6 : void fd_rent_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1398 6 : fd_rent_t * self = (fd_rent_t *)struct_mem;
1399 6 : fd_bincode_uint64_decode_unsafe( &self->lamports_per_uint8_year, ctx );
1400 6 : fd_bincode_double_decode_unsafe( &self->exemption_threshold, ctx );
1401 6 : fd_bincode_uint8_decode_unsafe( &self->burn_percent, ctx );
1402 6 : }
1403 0 : void * fd_rent_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1404 0 : fd_rent_global_t * self = (fd_rent_global_t *)mem;
1405 0 : fd_rent_new( (fd_rent_t *)self );
1406 0 : void * alloc_region = (uchar *)mem + sizeof(fd_rent_global_t);
1407 0 : void * * alloc_mem = &alloc_region;
1408 0 : fd_rent_decode_inner_global( mem, alloc_mem, ctx );
1409 0 : return self;
1410 0 : }
1411 0 : void fd_rent_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1412 0 : fd_rent_global_t * self = (fd_rent_global_t *)struct_mem;
1413 0 : fd_bincode_uint64_decode_unsafe( &self->lamports_per_uint8_year, ctx );
1414 0 : fd_bincode_double_decode_unsafe( &self->exemption_threshold, ctx );
1415 0 : fd_bincode_uint8_decode_unsafe( &self->burn_percent, ctx );
1416 0 : }
1417 0 : int fd_rent_convert_global_to_local( void const * global_self, fd_rent_t * self, fd_bincode_decode_ctx_t * ctx ) {
1418 0 : int err = 0;
1419 0 : fd_rent_global_t const * mem = (fd_rent_global_t const *)global_self;
1420 0 : self->lamports_per_uint8_year = mem->lamports_per_uint8_year;
1421 0 : self->exemption_threshold = mem->exemption_threshold;
1422 0 : self->burn_percent = mem->burn_percent;
1423 0 : return FD_BINCODE_SUCCESS;
1424 0 : }
1425 18 : void fd_rent_new(fd_rent_t * self) {
1426 18 : fd_memset( self, 0, sizeof(fd_rent_t) );
1427 18 : }
1428 0 : void fd_rent_destroy( fd_rent_t * self ) {
1429 0 : }
1430 :
1431 0 : ulong fd_rent_footprint( void ){ return FD_RENT_FOOTPRINT; }
1432 0 : ulong fd_rent_align( void ){ return FD_RENT_ALIGN; }
1433 :
1434 0 : void fd_rent_walk( void * w, fd_rent_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
1435 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_rent", level++ );
1436 0 : fun( w, &self->lamports_per_uint8_year, "lamports_per_uint8_year", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
1437 0 : fun( w, &self->exemption_threshold, "exemption_threshold", FD_FLAMENCO_TYPE_DOUBLE, "double", level );
1438 0 : fun( w, &self->burn_percent, "burn_percent", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
1439 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_rent", level-- );
1440 0 : }
1441 6 : ulong fd_rent_size( fd_rent_t const * self ) {
1442 6 : ulong size = 0;
1443 6 : size += sizeof(ulong);
1444 6 : size += sizeof(double);
1445 6 : size += sizeof(char);
1446 6 : return size;
1447 6 : }
1448 :
1449 21 : int fd_epoch_schedule_encode( fd_epoch_schedule_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1450 21 : int err;
1451 21 : err = fd_bincode_uint64_encode( self->slots_per_epoch, ctx );
1452 21 : if( FD_UNLIKELY( err ) ) return err;
1453 21 : err = fd_bincode_uint64_encode( self->leader_schedule_slot_offset, ctx );
1454 21 : if( FD_UNLIKELY( err ) ) return err;
1455 21 : err = fd_bincode_bool_encode( (uchar)(self->warmup), ctx );
1456 21 : if( FD_UNLIKELY( err ) ) return err;
1457 21 : err = fd_bincode_uint64_encode( self->first_normal_epoch, ctx );
1458 21 : if( FD_UNLIKELY( err ) ) return err;
1459 21 : err = fd_bincode_uint64_encode( self->first_normal_slot, ctx );
1460 21 : if( FD_UNLIKELY( err ) ) return err;
1461 21 : return FD_BINCODE_SUCCESS;
1462 21 : }
1463 0 : int fd_epoch_schedule_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1464 0 : *total_sz += sizeof(fd_epoch_schedule_t);
1465 0 : void const * start_data = ctx->data;
1466 0 : int err = fd_epoch_schedule_decode_footprint_inner( ctx, total_sz );
1467 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1468 0 : ctx->data = start_data;
1469 0 : return err;
1470 0 : }
1471 12 : int fd_epoch_schedule_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1472 12 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1473 12 : int err = 0;
1474 12 : err = fd_bincode_uint64_decode_footprint( ctx );
1475 12 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1476 12 : err = fd_bincode_uint64_decode_footprint( ctx );
1477 12 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1478 12 : err = fd_bincode_bool_decode_footprint( ctx );
1479 12 : if( FD_UNLIKELY( err ) ) return err;
1480 12 : err = fd_bincode_uint64_decode_footprint( ctx );
1481 12 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1482 12 : err = fd_bincode_uint64_decode_footprint( ctx );
1483 12 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1484 12 : return 0;
1485 12 : }
1486 0 : void * fd_epoch_schedule_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1487 0 : fd_epoch_schedule_t * self = (fd_epoch_schedule_t *)mem;
1488 0 : fd_epoch_schedule_new( self );
1489 0 : void * alloc_region = (uchar *)mem + sizeof(fd_epoch_schedule_t);
1490 0 : void * * alloc_mem = &alloc_region;
1491 0 : fd_epoch_schedule_decode_inner( mem, alloc_mem, ctx );
1492 0 : return self;
1493 0 : }
1494 12 : void fd_epoch_schedule_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1495 12 : fd_epoch_schedule_t * self = (fd_epoch_schedule_t *)struct_mem;
1496 12 : fd_bincode_uint64_decode_unsafe( &self->slots_per_epoch, ctx );
1497 12 : fd_bincode_uint64_decode_unsafe( &self->leader_schedule_slot_offset, ctx );
1498 12 : fd_bincode_bool_decode_unsafe( &self->warmup, ctx );
1499 12 : fd_bincode_uint64_decode_unsafe( &self->first_normal_epoch, ctx );
1500 12 : fd_bincode_uint64_decode_unsafe( &self->first_normal_slot, ctx );
1501 12 : }
1502 0 : void * fd_epoch_schedule_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1503 0 : fd_epoch_schedule_global_t * self = (fd_epoch_schedule_global_t *)mem;
1504 0 : fd_epoch_schedule_new( (fd_epoch_schedule_t *)self );
1505 0 : void * alloc_region = (uchar *)mem + sizeof(fd_epoch_schedule_global_t);
1506 0 : void * * alloc_mem = &alloc_region;
1507 0 : fd_epoch_schedule_decode_inner_global( mem, alloc_mem, ctx );
1508 0 : return self;
1509 0 : }
1510 0 : void fd_epoch_schedule_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1511 0 : fd_epoch_schedule_global_t * self = (fd_epoch_schedule_global_t *)struct_mem;
1512 0 : fd_bincode_uint64_decode_unsafe( &self->slots_per_epoch, ctx );
1513 0 : fd_bincode_uint64_decode_unsafe( &self->leader_schedule_slot_offset, ctx );
1514 0 : fd_bincode_bool_decode_unsafe( &self->warmup, ctx );
1515 0 : fd_bincode_uint64_decode_unsafe( &self->first_normal_epoch, ctx );
1516 0 : fd_bincode_uint64_decode_unsafe( &self->first_normal_slot, ctx );
1517 0 : }
1518 0 : int fd_epoch_schedule_convert_global_to_local( void const * global_self, fd_epoch_schedule_t * self, fd_bincode_decode_ctx_t * ctx ) {
1519 0 : int err = 0;
1520 0 : fd_epoch_schedule_global_t const * mem = (fd_epoch_schedule_global_t const *)global_self;
1521 0 : self->slots_per_epoch = mem->slots_per_epoch;
1522 0 : self->leader_schedule_slot_offset = mem->leader_schedule_slot_offset;
1523 0 : self->warmup = mem->warmup;
1524 0 : self->first_normal_epoch = mem->first_normal_epoch;
1525 0 : self->first_normal_slot = mem->first_normal_slot;
1526 0 : return FD_BINCODE_SUCCESS;
1527 0 : }
1528 24 : void fd_epoch_schedule_new(fd_epoch_schedule_t * self) {
1529 24 : fd_memset( self, 0, sizeof(fd_epoch_schedule_t) );
1530 24 : }
1531 0 : void fd_epoch_schedule_destroy( fd_epoch_schedule_t * self ) {
1532 0 : }
1533 :
1534 0 : ulong fd_epoch_schedule_footprint( void ){ return FD_EPOCH_SCHEDULE_FOOTPRINT; }
1535 0 : ulong fd_epoch_schedule_align( void ){ return FD_EPOCH_SCHEDULE_ALIGN; }
1536 :
1537 0 : void fd_epoch_schedule_walk( void * w, fd_epoch_schedule_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
1538 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_epoch_schedule", level++ );
1539 0 : fun( w, &self->slots_per_epoch, "slots_per_epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
1540 0 : fun( w, &self->leader_schedule_slot_offset, "leader_schedule_slot_offset", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
1541 0 : fun( w, &self->warmup, "warmup", FD_FLAMENCO_TYPE_BOOL, "bool", level );
1542 0 : fun( w, &self->first_normal_epoch, "first_normal_epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
1543 0 : fun( w, &self->first_normal_slot, "first_normal_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
1544 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_epoch_schedule", level-- );
1545 0 : }
1546 12 : ulong fd_epoch_schedule_size( fd_epoch_schedule_t const * self ) {
1547 12 : ulong size = 0;
1548 12 : size += sizeof(ulong);
1549 12 : size += sizeof(ulong);
1550 12 : size += sizeof(char);
1551 12 : size += sizeof(ulong);
1552 12 : size += sizeof(ulong);
1553 12 : return size;
1554 12 : }
1555 :
1556 6 : int fd_rent_collector_encode( fd_rent_collector_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1557 6 : int err;
1558 6 : err = fd_bincode_uint64_encode( self->epoch, ctx );
1559 6 : if( FD_UNLIKELY( err ) ) return err;
1560 6 : err = fd_epoch_schedule_encode( &self->epoch_schedule, ctx );
1561 6 : if( FD_UNLIKELY( err ) ) return err;
1562 6 : err = fd_bincode_double_encode( self->slots_per_year, ctx );
1563 6 : if( FD_UNLIKELY( err ) ) return err;
1564 6 : err = fd_rent_encode( &self->rent, ctx );
1565 6 : if( FD_UNLIKELY( err ) ) return err;
1566 6 : return FD_BINCODE_SUCCESS;
1567 6 : }
1568 0 : int fd_rent_collector_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1569 0 : *total_sz += sizeof(fd_rent_collector_t);
1570 0 : void const * start_data = ctx->data;
1571 0 : int err = fd_rent_collector_decode_footprint_inner( ctx, total_sz );
1572 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1573 0 : ctx->data = start_data;
1574 0 : return err;
1575 0 : }
1576 6 : int fd_rent_collector_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1577 6 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1578 6 : int err = 0;
1579 6 : err = fd_bincode_uint64_decode_footprint( ctx );
1580 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1581 6 : err = fd_epoch_schedule_decode_footprint_inner( ctx, total_sz );
1582 6 : if( FD_UNLIKELY( err ) ) return err;
1583 6 : err = fd_bincode_double_decode_footprint( ctx );
1584 6 : if( FD_UNLIKELY( err ) ) return err;
1585 6 : err = fd_rent_decode_footprint_inner( ctx, total_sz );
1586 6 : if( FD_UNLIKELY( err ) ) return err;
1587 6 : return 0;
1588 6 : }
1589 0 : void * fd_rent_collector_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1590 0 : fd_rent_collector_t * self = (fd_rent_collector_t *)mem;
1591 0 : fd_rent_collector_new( self );
1592 0 : void * alloc_region = (uchar *)mem + sizeof(fd_rent_collector_t);
1593 0 : void * * alloc_mem = &alloc_region;
1594 0 : fd_rent_collector_decode_inner( mem, alloc_mem, ctx );
1595 0 : return self;
1596 0 : }
1597 6 : void fd_rent_collector_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1598 6 : fd_rent_collector_t * self = (fd_rent_collector_t *)struct_mem;
1599 6 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
1600 6 : fd_epoch_schedule_decode_inner( &self->epoch_schedule, alloc_mem, ctx );
1601 6 : fd_bincode_double_decode_unsafe( &self->slots_per_year, ctx );
1602 6 : fd_rent_decode_inner( &self->rent, alloc_mem, ctx );
1603 6 : }
1604 0 : void * fd_rent_collector_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1605 0 : fd_rent_collector_global_t * self = (fd_rent_collector_global_t *)mem;
1606 0 : fd_rent_collector_new( (fd_rent_collector_t *)self );
1607 0 : void * alloc_region = (uchar *)mem + sizeof(fd_rent_collector_global_t);
1608 0 : void * * alloc_mem = &alloc_region;
1609 0 : fd_rent_collector_decode_inner_global( mem, alloc_mem, ctx );
1610 0 : return self;
1611 0 : }
1612 0 : void fd_rent_collector_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1613 0 : fd_rent_collector_global_t * self = (fd_rent_collector_global_t *)struct_mem;
1614 0 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
1615 0 : fd_epoch_schedule_decode_inner_global( &self->epoch_schedule, alloc_mem, ctx );
1616 0 : fd_bincode_double_decode_unsafe( &self->slots_per_year, ctx );
1617 0 : fd_rent_decode_inner_global( &self->rent, alloc_mem, ctx );
1618 0 : }
1619 0 : int fd_rent_collector_convert_global_to_local( void const * global_self, fd_rent_collector_t * self, fd_bincode_decode_ctx_t * ctx ) {
1620 0 : int err = 0;
1621 0 : fd_rent_collector_global_t const * mem = (fd_rent_collector_global_t const *)global_self;
1622 0 : self->epoch = mem->epoch;
1623 0 : err = fd_epoch_schedule_convert_global_to_local( &mem->epoch_schedule, &self->epoch_schedule, ctx );
1624 0 : if( FD_UNLIKELY( err ) ) return err;
1625 0 : self->slots_per_year = mem->slots_per_year;
1626 0 : err = fd_rent_convert_global_to_local( &mem->rent, &self->rent, ctx );
1627 0 : if( FD_UNLIKELY( err ) ) return err;
1628 0 : return FD_BINCODE_SUCCESS;
1629 0 : }
1630 6 : void fd_rent_collector_new(fd_rent_collector_t * self) {
1631 6 : fd_memset( self, 0, sizeof(fd_rent_collector_t) );
1632 6 : fd_epoch_schedule_new( &self->epoch_schedule );
1633 6 : fd_rent_new( &self->rent );
1634 6 : }
1635 0 : void fd_rent_collector_destroy( fd_rent_collector_t * self ) {
1636 0 : fd_epoch_schedule_destroy( &self->epoch_schedule );
1637 0 : fd_rent_destroy( &self->rent );
1638 0 : }
1639 :
1640 0 : ulong fd_rent_collector_footprint( void ){ return FD_RENT_COLLECTOR_FOOTPRINT; }
1641 0 : ulong fd_rent_collector_align( void ){ return FD_RENT_COLLECTOR_ALIGN; }
1642 :
1643 0 : void fd_rent_collector_walk( void * w, fd_rent_collector_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
1644 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_rent_collector", level++ );
1645 0 : fun( w, &self->epoch, "epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
1646 0 : fd_epoch_schedule_walk( w, &self->epoch_schedule, fun, "epoch_schedule", level );
1647 0 : fun( w, &self->slots_per_year, "slots_per_year", FD_FLAMENCO_TYPE_DOUBLE, "double", level );
1648 0 : fd_rent_walk( w, &self->rent, fun, "rent", level );
1649 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_rent_collector", level-- );
1650 0 : }
1651 6 : ulong fd_rent_collector_size( fd_rent_collector_t const * self ) {
1652 6 : ulong size = 0;
1653 6 : size += sizeof(ulong);
1654 6 : size += fd_epoch_schedule_size( &self->epoch_schedule );
1655 6 : size += sizeof(double);
1656 6 : size += fd_rent_size( &self->rent );
1657 6 : return size;
1658 6 : }
1659 :
1660 0 : int fd_stake_history_entry_encode( fd_stake_history_entry_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1661 0 : int err;
1662 0 : err = fd_bincode_uint64_encode( self->epoch, ctx );
1663 0 : if( FD_UNLIKELY( err ) ) return err;
1664 0 : err = fd_bincode_uint64_encode( self->effective, ctx );
1665 0 : if( FD_UNLIKELY( err ) ) return err;
1666 0 : err = fd_bincode_uint64_encode( self->activating, ctx );
1667 0 : if( FD_UNLIKELY( err ) ) return err;
1668 0 : err = fd_bincode_uint64_encode( self->deactivating, ctx );
1669 0 : if( FD_UNLIKELY( err ) ) return err;
1670 0 : return FD_BINCODE_SUCCESS;
1671 0 : }
1672 0 : int fd_stake_history_entry_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1673 0 : *total_sz += sizeof(fd_stake_history_entry_t);
1674 0 : void const * start_data = ctx->data;
1675 0 : int err = fd_stake_history_entry_decode_footprint_inner( ctx, total_sz );
1676 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1677 0 : ctx->data = start_data;
1678 0 : return err;
1679 0 : }
1680 0 : int fd_stake_history_entry_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1681 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1682 0 : int err = 0;
1683 0 : err = fd_bincode_uint64_decode_footprint( ctx );
1684 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1685 0 : err = fd_bincode_uint64_decode_footprint( ctx );
1686 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1687 0 : err = fd_bincode_uint64_decode_footprint( ctx );
1688 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1689 0 : err = fd_bincode_uint64_decode_footprint( ctx );
1690 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1691 0 : return 0;
1692 0 : }
1693 0 : void * fd_stake_history_entry_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1694 0 : fd_stake_history_entry_t * self = (fd_stake_history_entry_t *)mem;
1695 0 : fd_stake_history_entry_new( self );
1696 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_history_entry_t);
1697 0 : void * * alloc_mem = &alloc_region;
1698 0 : fd_stake_history_entry_decode_inner( mem, alloc_mem, ctx );
1699 0 : return self;
1700 0 : }
1701 0 : void fd_stake_history_entry_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1702 0 : fd_stake_history_entry_t * self = (fd_stake_history_entry_t *)struct_mem;
1703 0 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
1704 0 : fd_bincode_uint64_decode_unsafe( &self->effective, ctx );
1705 0 : fd_bincode_uint64_decode_unsafe( &self->activating, ctx );
1706 0 : fd_bincode_uint64_decode_unsafe( &self->deactivating, ctx );
1707 0 : }
1708 0 : void * fd_stake_history_entry_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1709 0 : fd_stake_history_entry_global_t * self = (fd_stake_history_entry_global_t *)mem;
1710 0 : fd_stake_history_entry_new( (fd_stake_history_entry_t *)self );
1711 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_history_entry_global_t);
1712 0 : void * * alloc_mem = &alloc_region;
1713 0 : fd_stake_history_entry_decode_inner_global( mem, alloc_mem, ctx );
1714 0 : return self;
1715 0 : }
1716 0 : void fd_stake_history_entry_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1717 0 : fd_stake_history_entry_global_t * self = (fd_stake_history_entry_global_t *)struct_mem;
1718 0 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
1719 0 : fd_bincode_uint64_decode_unsafe( &self->effective, ctx );
1720 0 : fd_bincode_uint64_decode_unsafe( &self->activating, ctx );
1721 0 : fd_bincode_uint64_decode_unsafe( &self->deactivating, ctx );
1722 0 : }
1723 0 : int fd_stake_history_entry_convert_global_to_local( void const * global_self, fd_stake_history_entry_t * self, fd_bincode_decode_ctx_t * ctx ) {
1724 0 : int err = 0;
1725 0 : fd_stake_history_entry_global_t const * mem = (fd_stake_history_entry_global_t const *)global_self;
1726 0 : self->epoch = mem->epoch;
1727 0 : self->effective = mem->effective;
1728 0 : self->activating = mem->activating;
1729 0 : self->deactivating = mem->deactivating;
1730 0 : return FD_BINCODE_SUCCESS;
1731 0 : }
1732 3072 : void fd_stake_history_entry_new(fd_stake_history_entry_t * self) {
1733 3072 : fd_memset( self, 0, sizeof(fd_stake_history_entry_t) );
1734 3072 : }
1735 0 : void fd_stake_history_entry_destroy( fd_stake_history_entry_t * self ) {
1736 0 : }
1737 :
1738 0 : ulong fd_stake_history_entry_footprint( void ){ return FD_STAKE_HISTORY_ENTRY_FOOTPRINT; }
1739 0 : ulong fd_stake_history_entry_align( void ){ return FD_STAKE_HISTORY_ENTRY_ALIGN; }
1740 :
1741 0 : void fd_stake_history_entry_walk( void * w, fd_stake_history_entry_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
1742 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_history_entry", level++ );
1743 0 : fun( w, &self->epoch, "epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
1744 0 : fun( w, &self->effective, "effective", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
1745 0 : fun( w, &self->activating, "activating", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
1746 0 : fun( w, &self->deactivating, "deactivating", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
1747 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_history_entry", level-- );
1748 0 : }
1749 0 : ulong fd_stake_history_entry_size( fd_stake_history_entry_t const * self ) {
1750 0 : ulong size = 0;
1751 0 : size += sizeof(ulong);
1752 0 : size += sizeof(ulong);
1753 0 : size += sizeof(ulong);
1754 0 : size += sizeof(ulong);
1755 0 : return size;
1756 0 : }
1757 :
1758 6 : int fd_stake_history_encode( fd_stake_history_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1759 6 : int err;
1760 6 : err = fd_bincode_uint64_encode( self->fd_stake_history_len, ctx );
1761 6 : if( FD_UNLIKELY(err) ) return err;
1762 6 : if( FD_UNLIKELY( 0 == self->fd_stake_history_len ) ) return FD_BINCODE_SUCCESS;
1763 0 : for( ulong i=0; i<self->fd_stake_history_len; i++ ) {
1764 0 : ulong idx = ( i + self->fd_stake_history_offset ) & (512 - 1);
1765 0 : err = fd_stake_history_entry_encode( self->fd_stake_history + idx, ctx );
1766 0 : if( FD_UNLIKELY( err ) ) return err;
1767 0 : }
1768 0 : return FD_BINCODE_SUCCESS;
1769 0 : }
1770 0 : int fd_stake_history_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1771 0 : *total_sz += sizeof(fd_stake_history_t);
1772 0 : void const * start_data = ctx->data;
1773 0 : int err = fd_stake_history_decode_footprint_inner( ctx, total_sz );
1774 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1775 0 : ctx->data = start_data;
1776 0 : return err;
1777 0 : }
1778 6 : int fd_stake_history_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1779 6 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1780 6 : int err = 0;
1781 6 : ulong fd_stake_history_len;
1782 6 : err = fd_bincode_uint64_decode( &fd_stake_history_len, ctx );
1783 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1784 6 : if( fd_stake_history_len ) {
1785 0 : for( ulong i=0; i < fd_stake_history_len; i++ ) {
1786 0 : err = fd_stake_history_entry_decode_footprint_inner( ctx, total_sz );
1787 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1788 0 : }
1789 0 : }
1790 6 : return 0;
1791 6 : }
1792 0 : void * fd_stake_history_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1793 0 : fd_stake_history_t * self = (fd_stake_history_t *)mem;
1794 0 : fd_stake_history_new( self );
1795 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_history_t);
1796 0 : void * * alloc_mem = &alloc_region;
1797 0 : fd_stake_history_decode_inner( mem, alloc_mem, ctx );
1798 0 : return self;
1799 0 : }
1800 6 : void fd_stake_history_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1801 6 : fd_stake_history_t * self = (fd_stake_history_t *)struct_mem;
1802 6 : fd_bincode_uint64_decode_unsafe( &self->fd_stake_history_len, ctx );
1803 6 : self->fd_stake_history_size = 512;
1804 6 : self->fd_stake_history_offset = 0;
1805 6 : for( ulong i=0; i<self->fd_stake_history_len; i++ ) {
1806 0 : fd_stake_history_entry_decode_inner( self->fd_stake_history + i, alloc_mem, ctx );
1807 0 : }
1808 6 : }
1809 0 : void * fd_stake_history_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1810 0 : fd_stake_history_global_t * self = (fd_stake_history_global_t *)mem;
1811 0 : fd_stake_history_new( (fd_stake_history_t *)self );
1812 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_history_global_t);
1813 0 : void * * alloc_mem = &alloc_region;
1814 0 : fd_stake_history_decode_inner_global( mem, alloc_mem, ctx );
1815 0 : return self;
1816 0 : }
1817 0 : void fd_stake_history_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1818 0 : fd_stake_history_global_t * self = (fd_stake_history_global_t *)struct_mem;
1819 0 : fd_bincode_uint64_decode_unsafe( &self->fd_stake_history_len, ctx );
1820 0 : self->fd_stake_history_size = 512;
1821 0 : self->fd_stake_history_offset = 0;
1822 0 : for( ulong i=0; i<self->fd_stake_history_len; i++ ) {
1823 0 : fd_stake_history_entry_decode_inner_global( self->fd_stake_history + i, alloc_mem, ctx );
1824 0 : }
1825 0 : }
1826 0 : int fd_stake_history_convert_global_to_local( void const * global_self, fd_stake_history_t * self, fd_bincode_decode_ctx_t * ctx ) {
1827 0 : int err = 0;
1828 0 : fd_stake_history_global_t const * mem = (fd_stake_history_global_t const *)global_self;
1829 0 : self->fd_stake_history_len = mem->fd_stake_history_len;
1830 0 : self->fd_stake_history_size = mem->fd_stake_history_size;
1831 0 : self->fd_stake_history_offset = mem->fd_stake_history_offset;
1832 0 : for( ulong i=0; i<self->fd_stake_history_len; i++ ) {
1833 0 : err = fd_stake_history_entry_convert_global_to_local( &mem->fd_stake_history[i], &self->fd_stake_history[i], ctx );
1834 0 : if( FD_UNLIKELY( err ) ) return err;
1835 0 : }
1836 0 : return FD_BINCODE_SUCCESS;
1837 0 : }
1838 6 : void fd_stake_history_new(fd_stake_history_t * self) {
1839 6 : fd_memset( self, 0, sizeof(fd_stake_history_t) );
1840 6 : self->fd_stake_history_size = 512;
1841 3078 : for( ulong i=0; i<512; i++ )
1842 3072 : fd_stake_history_entry_new( self->fd_stake_history + i );
1843 6 : }
1844 0 : void fd_stake_history_destroy( fd_stake_history_t * self ) {
1845 0 : for( ulong i=0; i<512; i++ )
1846 0 : fd_stake_history_entry_destroy( self->fd_stake_history + i );
1847 0 : }
1848 :
1849 0 : ulong fd_stake_history_footprint( void ){ return FD_STAKE_HISTORY_FOOTPRINT; }
1850 0 : ulong fd_stake_history_align( void ){ return FD_STAKE_HISTORY_ALIGN; }
1851 :
1852 0 : void fd_stake_history_walk( void * w, fd_stake_history_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
1853 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_history", level++ );
1854 0 : fun( w, NULL, "fd_stake_history", FD_FLAMENCO_TYPE_ARR, "stake_history_entry[]", level++ );
1855 0 : for( ulong i=0; i<self->fd_stake_history_len; i++ ) {
1856 0 : ulong idx = ( i + self->fd_stake_history_offset ) & (512 - 1);
1857 0 : fd_stake_history_entry_walk( w, self->fd_stake_history + idx, fun, "stake_history_entry", level );
1858 0 : }
1859 0 : fun( w, NULL, "fd_stake_history", FD_FLAMENCO_TYPE_ARR_END, "stake_history_entry[]", level-- );
1860 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_history", level-- );
1861 0 : }
1862 6 : ulong fd_stake_history_size( fd_stake_history_t const * self ) {
1863 6 : ulong size = 0;
1864 6 : size += sizeof(ulong);
1865 6 : for( ulong i=0; i<self->fd_stake_history_len; i++ )
1866 0 : size += fd_stake_history_entry_size( self->fd_stake_history + i );
1867 6 : return size;
1868 6 : }
1869 :
1870 32118 : int fd_solana_account_encode( fd_solana_account_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1871 32118 : int err;
1872 32118 : err = fd_bincode_uint64_encode( self->lamports, ctx );
1873 32118 : if( FD_UNLIKELY( err ) ) return err;
1874 32118 : err = fd_bincode_uint64_encode( self->data_len, ctx );
1875 32118 : if( FD_UNLIKELY(err) ) return err;
1876 32118 : if( self->data_len ) {
1877 32004 : err = fd_bincode_bytes_encode( self->data, self->data_len, ctx );
1878 32004 : if( FD_UNLIKELY( err ) ) return err;
1879 32004 : }
1880 32118 : err = fd_pubkey_encode( &self->owner, ctx );
1881 32118 : if( FD_UNLIKELY( err ) ) return err;
1882 32118 : err = fd_bincode_bool_encode( (uchar)(self->executable), ctx );
1883 32118 : if( FD_UNLIKELY( err ) ) return err;
1884 32118 : err = fd_bincode_uint64_encode( self->rent_epoch, ctx );
1885 32118 : if( FD_UNLIKELY( err ) ) return err;
1886 32118 : return FD_BINCODE_SUCCESS;
1887 32118 : }
1888 0 : int fd_solana_account_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1889 0 : *total_sz += sizeof(fd_solana_account_t);
1890 0 : void const * start_data = ctx->data;
1891 0 : int err = fd_solana_account_decode_footprint_inner( ctx, total_sz );
1892 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1893 0 : ctx->data = start_data;
1894 0 : return err;
1895 0 : }
1896 31974 : int fd_solana_account_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1897 31974 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1898 31974 : int err = 0;
1899 31974 : err = fd_bincode_uint64_decode_footprint( ctx );
1900 31974 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1901 31974 : ulong data_len;
1902 31974 : err = fd_bincode_uint64_decode( &data_len, ctx );
1903 31974 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1904 31974 : if( data_len ) {
1905 31974 : *total_sz += 8UL + data_len;
1906 31974 : err = fd_bincode_bytes_decode_footprint( data_len, ctx );
1907 31974 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1908 31974 : }
1909 31974 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
1910 31974 : if( FD_UNLIKELY( err ) ) return err;
1911 31974 : err = fd_bincode_bool_decode_footprint( ctx );
1912 31974 : if( FD_UNLIKELY( err ) ) return err;
1913 31974 : err = fd_bincode_uint64_decode_footprint( ctx );
1914 31974 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1915 31974 : return 0;
1916 31974 : }
1917 0 : void * fd_solana_account_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1918 0 : fd_solana_account_t * self = (fd_solana_account_t *)mem;
1919 0 : fd_solana_account_new( self );
1920 0 : void * alloc_region = (uchar *)mem + sizeof(fd_solana_account_t);
1921 0 : void * * alloc_mem = &alloc_region;
1922 0 : fd_solana_account_decode_inner( mem, alloc_mem, ctx );
1923 0 : return self;
1924 0 : }
1925 47961 : void fd_solana_account_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1926 47961 : fd_solana_account_t * self = (fd_solana_account_t *)struct_mem;
1927 47961 : fd_bincode_uint64_decode_unsafe( &self->lamports, ctx );
1928 47961 : fd_bincode_uint64_decode_unsafe( &self->data_len, ctx );
1929 47961 : if( self->data_len ) {
1930 47961 : self->data = *alloc_mem;
1931 47961 : fd_bincode_bytes_decode_unsafe( self->data, self->data_len, ctx );
1932 47961 : *alloc_mem = (uchar *)(*alloc_mem) + self->data_len;
1933 47961 : } else
1934 0 : self->data = NULL;
1935 47961 : fd_pubkey_decode_inner( &self->owner, alloc_mem, ctx );
1936 47961 : fd_bincode_bool_decode_unsafe( &self->executable, ctx );
1937 47961 : fd_bincode_uint64_decode_unsafe( &self->rent_epoch, ctx );
1938 47961 : }
1939 0 : void * fd_solana_account_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1940 0 : fd_solana_account_global_t * self = (fd_solana_account_global_t *)mem;
1941 0 : fd_solana_account_new( (fd_solana_account_t *)self );
1942 0 : void * alloc_region = (uchar *)mem + sizeof(fd_solana_account_global_t);
1943 0 : void * * alloc_mem = &alloc_region;
1944 0 : fd_solana_account_decode_inner_global( mem, alloc_mem, ctx );
1945 0 : return self;
1946 0 : }
1947 0 : void fd_solana_account_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1948 0 : fd_solana_account_global_t * self = (fd_solana_account_global_t *)struct_mem;
1949 0 : fd_bincode_uint64_decode_unsafe( &self->lamports, ctx );
1950 0 : fd_bincode_uint64_decode_unsafe( &self->data_len, ctx );
1951 0 : if( self->data_len ) {
1952 0 : self->data_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
1953 0 : fd_bincode_bytes_decode_unsafe( *alloc_mem, self->data_len, ctx );
1954 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->data_len;
1955 0 : } else
1956 0 : self->data_gaddr = 0UL;
1957 0 : fd_pubkey_decode_inner_global( &self->owner, alloc_mem, ctx );
1958 0 : fd_bincode_bool_decode_unsafe( &self->executable, ctx );
1959 0 : fd_bincode_uint64_decode_unsafe( &self->rent_epoch, ctx );
1960 0 : }
1961 0 : int fd_solana_account_convert_global_to_local( void const * global_self, fd_solana_account_t * self, fd_bincode_decode_ctx_t * ctx ) {
1962 0 : int err = 0;
1963 0 : fd_solana_account_global_t const * mem = (fd_solana_account_global_t const *)global_self;
1964 0 : self->lamports = mem->lamports;
1965 0 : self->data_len = mem->data_len;
1966 0 : self->data = fd_wksp_laddr_fast( ctx->wksp, mem->data_gaddr );
1967 0 : err = fd_pubkey_convert_global_to_local( &mem->owner, &self->owner, ctx );
1968 0 : if( FD_UNLIKELY( err ) ) return err;
1969 0 : self->executable = mem->executable;
1970 0 : self->rent_epoch = mem->rent_epoch;
1971 0 : return FD_BINCODE_SUCCESS;
1972 0 : }
1973 47961 : void fd_solana_account_new(fd_solana_account_t * self) {
1974 47961 : fd_memset( self, 0, sizeof(fd_solana_account_t) );
1975 47961 : fd_pubkey_new( &self->owner );
1976 47961 : }
1977 0 : void fd_solana_account_destroy( fd_solana_account_t * self ) {
1978 0 : if( self->data ) {
1979 0 : self->data = NULL;
1980 0 : }
1981 0 : fd_pubkey_destroy( &self->owner );
1982 0 : }
1983 :
1984 0 : ulong fd_solana_account_footprint( void ){ return FD_SOLANA_ACCOUNT_FOOTPRINT; }
1985 0 : ulong fd_solana_account_align( void ){ return FD_SOLANA_ACCOUNT_ALIGN; }
1986 :
1987 15987 : void fd_solana_account_walk( void * w, fd_solana_account_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
1988 15987 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_solana_account", level++ );
1989 15987 : fun( w, &self->lamports, "lamports", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
1990 15987 : fun(w, self->data, "data", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
1991 15987 : fd_pubkey_walk( w, &self->owner, fun, "owner", level );
1992 15987 : fun( w, &self->executable, "executable", FD_FLAMENCO_TYPE_BOOL, "bool", level );
1993 15987 : fun( w, &self->rent_epoch, "rent_epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
1994 15987 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_solana_account", level-- );
1995 15987 : }
1996 0 : ulong fd_solana_account_size( fd_solana_account_t const * self ) {
1997 0 : ulong size = 0;
1998 0 : size += sizeof(ulong);
1999 0 : do {
2000 0 : size += sizeof(ulong);
2001 0 : size += self->data_len;
2002 0 : } while(0);
2003 0 : size += fd_pubkey_size( &self->owner );
2004 0 : size += sizeof(char);
2005 0 : size += sizeof(ulong);
2006 0 : return size;
2007 0 : }
2008 :
2009 31974 : int fd_vote_accounts_pair_encode( fd_vote_accounts_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2010 31974 : int err;
2011 31974 : err = fd_pubkey_encode( &self->key, ctx );
2012 31974 : if( FD_UNLIKELY( err ) ) return err;
2013 31974 : err = fd_bincode_uint64_encode( self->stake, ctx );
2014 31974 : if( FD_UNLIKELY( err ) ) return err;
2015 31974 : err = fd_solana_account_encode( &self->value, ctx );
2016 31974 : if( FD_UNLIKELY( err ) ) return err;
2017 31974 : return FD_BINCODE_SUCCESS;
2018 31974 : }
2019 0 : int fd_vote_accounts_pair_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2020 0 : *total_sz += sizeof(fd_vote_accounts_pair_t);
2021 0 : void const * start_data = ctx->data;
2022 0 : int err = fd_vote_accounts_pair_decode_footprint_inner( ctx, total_sz );
2023 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2024 0 : ctx->data = start_data;
2025 0 : return err;
2026 0 : }
2027 31974 : int fd_vote_accounts_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2028 31974 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2029 31974 : int err = 0;
2030 31974 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
2031 31974 : if( FD_UNLIKELY( err ) ) return err;
2032 31974 : err = fd_bincode_uint64_decode_footprint( ctx );
2033 31974 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2034 31974 : err = fd_solana_account_decode_footprint_inner( ctx, total_sz );
2035 31974 : if( FD_UNLIKELY( err ) ) return err;
2036 31974 : return 0;
2037 31974 : }
2038 0 : void * fd_vote_accounts_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2039 0 : fd_vote_accounts_pair_t * self = (fd_vote_accounts_pair_t *)mem;
2040 0 : fd_vote_accounts_pair_new( self );
2041 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_accounts_pair_t);
2042 0 : void * * alloc_mem = &alloc_region;
2043 0 : fd_vote_accounts_pair_decode_inner( mem, alloc_mem, ctx );
2044 0 : return self;
2045 0 : }
2046 47961 : void fd_vote_accounts_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2047 47961 : fd_vote_accounts_pair_t * self = (fd_vote_accounts_pair_t *)struct_mem;
2048 47961 : fd_pubkey_decode_inner( &self->key, alloc_mem, ctx );
2049 47961 : fd_bincode_uint64_decode_unsafe( &self->stake, ctx );
2050 47961 : fd_solana_account_decode_inner( &self->value, alloc_mem, ctx );
2051 47961 : }
2052 0 : void * fd_vote_accounts_pair_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2053 0 : fd_vote_accounts_pair_global_t * self = (fd_vote_accounts_pair_global_t *)mem;
2054 0 : fd_vote_accounts_pair_new( (fd_vote_accounts_pair_t *)self );
2055 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_accounts_pair_global_t);
2056 0 : void * * alloc_mem = &alloc_region;
2057 0 : fd_vote_accounts_pair_decode_inner_global( mem, alloc_mem, ctx );
2058 0 : return self;
2059 0 : }
2060 0 : void fd_vote_accounts_pair_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2061 0 : fd_vote_accounts_pair_global_t * self = (fd_vote_accounts_pair_global_t *)struct_mem;
2062 0 : fd_pubkey_decode_inner_global( &self->key, alloc_mem, ctx );
2063 0 : fd_bincode_uint64_decode_unsafe( &self->stake, ctx );
2064 0 : fd_solana_account_decode_inner_global( &self->value, alloc_mem, ctx );
2065 0 : }
2066 0 : int fd_vote_accounts_pair_convert_global_to_local( void const * global_self, fd_vote_accounts_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
2067 0 : int err = 0;
2068 0 : fd_vote_accounts_pair_global_t const * mem = (fd_vote_accounts_pair_global_t const *)global_self;
2069 0 : err = fd_pubkey_convert_global_to_local( &mem->key, &self->key, ctx );
2070 0 : if( FD_UNLIKELY( err ) ) return err;
2071 0 : self->stake = mem->stake;
2072 0 : err = fd_solana_account_convert_global_to_local( &mem->value, &self->value, ctx );
2073 0 : if( FD_UNLIKELY( err ) ) return err;
2074 0 : return FD_BINCODE_SUCCESS;
2075 0 : }
2076 47961 : void fd_vote_accounts_pair_new(fd_vote_accounts_pair_t * self) {
2077 47961 : fd_memset( self, 0, sizeof(fd_vote_accounts_pair_t) );
2078 47961 : fd_pubkey_new( &self->key );
2079 47961 : fd_solana_account_new( &self->value );
2080 47961 : }
2081 0 : void fd_vote_accounts_pair_destroy( fd_vote_accounts_pair_t * self ) {
2082 0 : fd_pubkey_destroy( &self->key );
2083 0 : fd_solana_account_destroy( &self->value );
2084 0 : }
2085 :
2086 0 : ulong fd_vote_accounts_pair_footprint( void ){ return FD_VOTE_ACCOUNTS_PAIR_FOOTPRINT; }
2087 0 : ulong fd_vote_accounts_pair_align( void ){ return FD_VOTE_ACCOUNTS_PAIR_ALIGN; }
2088 :
2089 15987 : void fd_vote_accounts_pair_walk( void * w, fd_vote_accounts_pair_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
2090 15987 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_accounts_pair", level++ );
2091 15987 : fd_pubkey_walk( w, &self->key, fun, "key", level );
2092 15987 : fun( w, &self->stake, "stake", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
2093 15987 : fd_solana_account_walk( w, &self->value, fun, "value", level );
2094 15987 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_accounts_pair", level-- );
2095 15987 : }
2096 0 : ulong fd_vote_accounts_pair_size( fd_vote_accounts_pair_t const * self ) {
2097 0 : ulong size = 0;
2098 0 : size += fd_pubkey_size( &self->key );
2099 0 : size += sizeof(ulong);
2100 0 : size += fd_solana_account_size( &self->value );
2101 0 : return size;
2102 0 : }
2103 :
2104 12 : int fd_vote_accounts_encode( fd_vote_accounts_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2105 12 : int err;
2106 12 : if( self->vote_accounts_root ) {
2107 6 : ulong vote_accounts_len = fd_vote_accounts_pair_t_map_size( self->vote_accounts_pool, self->vote_accounts_root );
2108 6 : err = fd_bincode_uint64_encode( vote_accounts_len, ctx );
2109 6 : if( FD_UNLIKELY( err ) ) return err;
2110 31980 : for( fd_vote_accounts_pair_t_mapnode_t * n = fd_vote_accounts_pair_t_map_minimum( self->vote_accounts_pool, self->vote_accounts_root ); n; n = fd_vote_accounts_pair_t_map_successor( self->vote_accounts_pool, n ) ) {
2111 31974 : err = fd_vote_accounts_pair_encode( &n->elem, ctx );
2112 31974 : if( FD_UNLIKELY( err ) ) return err;
2113 31974 : }
2114 6 : } else {
2115 6 : ulong vote_accounts_len = 0;
2116 6 : err = fd_bincode_uint64_encode( vote_accounts_len, ctx );
2117 6 : if( FD_UNLIKELY( err ) ) return err;
2118 6 : }
2119 12 : return FD_BINCODE_SUCCESS;
2120 12 : }
2121 0 : int fd_vote_accounts_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2122 0 : *total_sz += sizeof(fd_vote_accounts_t);
2123 0 : void const * start_data = ctx->data;
2124 0 : int err = fd_vote_accounts_decode_footprint_inner( ctx, total_sz );
2125 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2126 0 : ctx->data = start_data;
2127 0 : return err;
2128 0 : }
2129 12 : int fd_vote_accounts_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2130 12 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2131 12 : int err = 0;
2132 12 : ulong vote_accounts_len = 0UL;
2133 12 : err = fd_bincode_uint64_decode( &vote_accounts_len, ctx );
2134 12 : ulong vote_accounts_cnt = fd_ulong_max( vote_accounts_len, 15000 );
2135 12 : *total_sz += fd_vote_accounts_pair_t_map_align() + fd_vote_accounts_pair_t_map_footprint( vote_accounts_cnt );
2136 12 : if( FD_UNLIKELY( err ) ) return err;
2137 31986 : for( ulong i=0; i < vote_accounts_len; i++ ) {
2138 31974 : err = fd_vote_accounts_pair_decode_footprint_inner( ctx, total_sz );
2139 31974 : if( FD_UNLIKELY( err ) ) return err;
2140 31974 : }
2141 12 : return 0;
2142 12 : }
2143 0 : void * fd_vote_accounts_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2144 0 : fd_vote_accounts_t * self = (fd_vote_accounts_t *)mem;
2145 0 : fd_vote_accounts_new( self );
2146 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_accounts_t);
2147 0 : void * * alloc_mem = &alloc_region;
2148 0 : fd_vote_accounts_decode_inner( mem, alloc_mem, ctx );
2149 0 : return self;
2150 0 : }
2151 12 : void fd_vote_accounts_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2152 12 : fd_vote_accounts_t * self = (fd_vote_accounts_t *)struct_mem;
2153 12 : ulong vote_accounts_len;
2154 12 : fd_bincode_uint64_decode_unsafe( &vote_accounts_len, ctx );
2155 12 : self->vote_accounts_pool = fd_vote_accounts_pair_t_map_join_new( alloc_mem, fd_ulong_max( vote_accounts_len, 15000 ) );
2156 12 : self->vote_accounts_root = NULL;
2157 31986 : for( ulong i=0; i < vote_accounts_len; i++ ) {
2158 31974 : fd_vote_accounts_pair_t_mapnode_t * node = fd_vote_accounts_pair_t_map_acquire( self->vote_accounts_pool );
2159 31974 : fd_vote_accounts_pair_new( &node->elem );
2160 31974 : fd_vote_accounts_pair_decode_inner( &node->elem, alloc_mem, ctx );
2161 31974 : fd_vote_accounts_pair_t_map_insert( self->vote_accounts_pool, &self->vote_accounts_root, node );
2162 31974 : }
2163 12 : }
2164 0 : void * fd_vote_accounts_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2165 0 : fd_vote_accounts_global_t * self = (fd_vote_accounts_global_t *)mem;
2166 0 : fd_vote_accounts_new( (fd_vote_accounts_t *)self );
2167 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_accounts_global_t);
2168 0 : void * * alloc_mem = &alloc_region;
2169 0 : fd_vote_accounts_decode_inner_global( mem, alloc_mem, ctx );
2170 0 : return self;
2171 0 : }
2172 3 : void fd_vote_accounts_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2173 3 : fd_vote_accounts_global_t * self = (fd_vote_accounts_global_t *)struct_mem;
2174 3 : ulong vote_accounts_len;
2175 3 : fd_bincode_uint64_decode_unsafe( &vote_accounts_len, ctx );
2176 3 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, fd_vote_accounts_pair_t_map_align() );
2177 3 : fd_vote_accounts_pair_t_mapnode_t * vote_accounts_pool = fd_vote_accounts_pair_t_map_join_new( alloc_mem, fd_ulong_max( vote_accounts_len, 15000 ) );
2178 3 : fd_vote_accounts_pair_t_mapnode_t * vote_accounts_root = NULL;
2179 3 : self->vote_accounts_root_gaddr = 0UL;
2180 15990 : for( ulong i=0; i < vote_accounts_len; i++ ) {
2181 15987 : fd_vote_accounts_pair_t_mapnode_t * node = fd_vote_accounts_pair_t_map_acquire( vote_accounts_pool );
2182 15987 : fd_vote_accounts_pair_new( &node->elem );
2183 15987 : fd_vote_accounts_pair_decode_inner( &node->elem, alloc_mem, ctx );
2184 15987 : fd_vote_accounts_pair_t_map_insert( vote_accounts_pool, &vote_accounts_root, node );
2185 15987 : }
2186 3 : self->vote_accounts_pool_gaddr = fd_wksp_gaddr_fast( ctx->wksp, vote_accounts_pool );
2187 3 : self->vote_accounts_root_gaddr = fd_wksp_gaddr_fast( ctx->wksp, vote_accounts_root );
2188 3 : }
2189 3 : int fd_vote_accounts_convert_global_to_local( void const * global_self, fd_vote_accounts_t * self, fd_bincode_decode_ctx_t * ctx ) {
2190 3 : int err = 0;
2191 3 : fd_vote_accounts_global_t const * mem = (fd_vote_accounts_global_t const *)global_self;
2192 3 : self->vote_accounts_pool = fd_wksp_laddr_fast( ctx->wksp, mem->vote_accounts_pool_gaddr );
2193 3 : self->vote_accounts_root = fd_wksp_laddr_fast( ctx->wksp, mem->vote_accounts_root_gaddr );
2194 3 : return FD_BINCODE_SUCCESS;
2195 3 : }
2196 15 : void fd_vote_accounts_new(fd_vote_accounts_t * self) {
2197 15 : fd_memset( self, 0, sizeof(fd_vote_accounts_t) );
2198 15 : }
2199 0 : void fd_vote_accounts_destroy( fd_vote_accounts_t * self ) {
2200 0 : for( fd_vote_accounts_pair_t_mapnode_t * n = fd_vote_accounts_pair_t_map_minimum(self->vote_accounts_pool, self->vote_accounts_root ); n; n = fd_vote_accounts_pair_t_map_successor(self->vote_accounts_pool, n) ) {
2201 0 : fd_vote_accounts_pair_destroy( &n->elem );
2202 0 : }
2203 0 : self->vote_accounts_pool = NULL;
2204 0 : self->vote_accounts_root = NULL;
2205 0 : }
2206 :
2207 0 : ulong fd_vote_accounts_footprint( void ){ return FD_VOTE_ACCOUNTS_FOOTPRINT; }
2208 0 : ulong fd_vote_accounts_align( void ){ return FD_VOTE_ACCOUNTS_ALIGN; }
2209 :
2210 3 : void fd_vote_accounts_walk( void * w, fd_vote_accounts_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
2211 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_accounts", level++ );
2212 3 : if( self->vote_accounts_root ) {
2213 15990 : for( fd_vote_accounts_pair_t_mapnode_t * n = fd_vote_accounts_pair_t_map_minimum(self->vote_accounts_pool, self->vote_accounts_root ); n; n = fd_vote_accounts_pair_t_map_successor( self->vote_accounts_pool, n ) ) {
2214 15987 : fd_vote_accounts_pair_walk(w, &n->elem, fun, "vote_accounts", level );
2215 15987 : }
2216 3 : }
2217 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_accounts", level-- );
2218 3 : }
2219 6 : ulong fd_vote_accounts_size( fd_vote_accounts_t const * self ) {
2220 6 : ulong size = 0;
2221 6 : if( self->vote_accounts_root ) {
2222 0 : size += sizeof(ulong);
2223 0 : for( fd_vote_accounts_pair_t_mapnode_t * n = fd_vote_accounts_pair_t_map_minimum( self->vote_accounts_pool, self->vote_accounts_root ); n; n = fd_vote_accounts_pair_t_map_successor( self->vote_accounts_pool, n ) ) {
2224 0 : size += fd_vote_accounts_pair_size( &n->elem );
2225 0 : }
2226 6 : } else {
2227 6 : size += sizeof(ulong);
2228 6 : }
2229 6 : return size;
2230 6 : }
2231 :
2232 0 : int fd_account_keys_pair_encode( fd_account_keys_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2233 0 : int err;
2234 0 : err = fd_pubkey_encode( &self->key, ctx );
2235 0 : if( FD_UNLIKELY( err ) ) return err;
2236 0 : err = fd_bincode_uint8_encode( (uchar)(self->exists), ctx );
2237 0 : if( FD_UNLIKELY( err ) ) return err;
2238 0 : return FD_BINCODE_SUCCESS;
2239 0 : }
2240 0 : int fd_account_keys_pair_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2241 0 : *total_sz += sizeof(fd_account_keys_pair_t);
2242 0 : void const * start_data = ctx->data;
2243 0 : int err = fd_account_keys_pair_decode_footprint_inner( ctx, total_sz );
2244 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2245 0 : ctx->data = start_data;
2246 0 : return err;
2247 0 : }
2248 0 : int fd_account_keys_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2249 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2250 0 : int err = 0;
2251 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
2252 0 : if( FD_UNLIKELY( err ) ) return err;
2253 0 : err = fd_bincode_uint8_decode_footprint( ctx );
2254 0 : if( FD_UNLIKELY( err ) ) return err;
2255 0 : return 0;
2256 0 : }
2257 0 : void * fd_account_keys_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2258 0 : fd_account_keys_pair_t * self = (fd_account_keys_pair_t *)mem;
2259 0 : fd_account_keys_pair_new( self );
2260 0 : void * alloc_region = (uchar *)mem + sizeof(fd_account_keys_pair_t);
2261 0 : void * * alloc_mem = &alloc_region;
2262 0 : fd_account_keys_pair_decode_inner( mem, alloc_mem, ctx );
2263 0 : return self;
2264 0 : }
2265 0 : void fd_account_keys_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2266 0 : fd_account_keys_pair_t * self = (fd_account_keys_pair_t *)struct_mem;
2267 0 : fd_pubkey_decode_inner( &self->key, alloc_mem, ctx );
2268 0 : fd_bincode_uint8_decode_unsafe( &self->exists, ctx );
2269 0 : }
2270 0 : void * fd_account_keys_pair_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2271 0 : fd_account_keys_pair_global_t * self = (fd_account_keys_pair_global_t *)mem;
2272 0 : fd_account_keys_pair_new( (fd_account_keys_pair_t *)self );
2273 0 : void * alloc_region = (uchar *)mem + sizeof(fd_account_keys_pair_global_t);
2274 0 : void * * alloc_mem = &alloc_region;
2275 0 : fd_account_keys_pair_decode_inner_global( mem, alloc_mem, ctx );
2276 0 : return self;
2277 0 : }
2278 0 : void fd_account_keys_pair_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2279 0 : fd_account_keys_pair_global_t * self = (fd_account_keys_pair_global_t *)struct_mem;
2280 0 : fd_pubkey_decode_inner_global( &self->key, alloc_mem, ctx );
2281 0 : fd_bincode_uint8_decode_unsafe( &self->exists, ctx );
2282 0 : }
2283 0 : int fd_account_keys_pair_convert_global_to_local( void const * global_self, fd_account_keys_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
2284 0 : int err = 0;
2285 0 : fd_account_keys_pair_global_t const * mem = (fd_account_keys_pair_global_t const *)global_self;
2286 0 : err = fd_pubkey_convert_global_to_local( &mem->key, &self->key, ctx );
2287 0 : if( FD_UNLIKELY( err ) ) return err;
2288 0 : self->exists = mem->exists;
2289 0 : return FD_BINCODE_SUCCESS;
2290 0 : }
2291 0 : void fd_account_keys_pair_new(fd_account_keys_pair_t * self) {
2292 0 : fd_memset( self, 0, sizeof(fd_account_keys_pair_t) );
2293 0 : fd_pubkey_new( &self->key );
2294 0 : }
2295 0 : void fd_account_keys_pair_destroy( fd_account_keys_pair_t * self ) {
2296 0 : fd_pubkey_destroy( &self->key );
2297 0 : }
2298 :
2299 0 : ulong fd_account_keys_pair_footprint( void ){ return FD_ACCOUNT_KEYS_PAIR_FOOTPRINT; }
2300 0 : ulong fd_account_keys_pair_align( void ){ return FD_ACCOUNT_KEYS_PAIR_ALIGN; }
2301 :
2302 0 : void fd_account_keys_pair_walk( void * w, fd_account_keys_pair_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
2303 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_account_keys_pair", level++ );
2304 0 : fd_pubkey_walk( w, &self->key, fun, "key", level );
2305 0 : fun( w, &self->exists, "exists", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
2306 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_account_keys_pair", level-- );
2307 0 : }
2308 0 : ulong fd_account_keys_pair_size( fd_account_keys_pair_t const * self ) {
2309 0 : ulong size = 0;
2310 0 : size += fd_pubkey_size( &self->key );
2311 0 : size += sizeof(char);
2312 0 : return size;
2313 0 : }
2314 :
2315 12 : int fd_account_keys_encode( fd_account_keys_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2316 12 : int err;
2317 12 : if( self->account_keys_root ) {
2318 0 : ulong account_keys_len = fd_account_keys_pair_t_map_size( self->account_keys_pool, self->account_keys_root );
2319 0 : err = fd_bincode_uint64_encode( account_keys_len, ctx );
2320 0 : if( FD_UNLIKELY( err ) ) return err;
2321 0 : for( fd_account_keys_pair_t_mapnode_t * n = fd_account_keys_pair_t_map_minimum( self->account_keys_pool, self->account_keys_root ); n; n = fd_account_keys_pair_t_map_successor( self->account_keys_pool, n ) ) {
2322 0 : err = fd_account_keys_pair_encode( &n->elem, ctx );
2323 0 : if( FD_UNLIKELY( err ) ) return err;
2324 0 : }
2325 12 : } else {
2326 12 : ulong account_keys_len = 0;
2327 12 : err = fd_bincode_uint64_encode( account_keys_len, ctx );
2328 12 : if( FD_UNLIKELY( err ) ) return err;
2329 12 : }
2330 12 : return FD_BINCODE_SUCCESS;
2331 12 : }
2332 0 : int fd_account_keys_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2333 0 : *total_sz += sizeof(fd_account_keys_t);
2334 0 : void const * start_data = ctx->data;
2335 0 : int err = fd_account_keys_decode_footprint_inner( ctx, total_sz );
2336 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2337 0 : ctx->data = start_data;
2338 0 : return err;
2339 0 : }
2340 12 : int fd_account_keys_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2341 12 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2342 12 : int err = 0;
2343 12 : ulong account_keys_len = 0UL;
2344 12 : err = fd_bincode_uint64_decode( &account_keys_len, ctx );
2345 12 : ulong account_keys_cnt = fd_ulong_max( account_keys_len, 100000 );
2346 12 : *total_sz += fd_account_keys_pair_t_map_align() + fd_account_keys_pair_t_map_footprint( account_keys_cnt );
2347 12 : if( FD_UNLIKELY( err ) ) return err;
2348 12 : for( ulong i=0; i < account_keys_len; i++ ) {
2349 0 : err = fd_account_keys_pair_decode_footprint_inner( ctx, total_sz );
2350 0 : if( FD_UNLIKELY( err ) ) return err;
2351 0 : }
2352 12 : return 0;
2353 12 : }
2354 0 : void * fd_account_keys_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2355 0 : fd_account_keys_t * self = (fd_account_keys_t *)mem;
2356 0 : fd_account_keys_new( self );
2357 0 : void * alloc_region = (uchar *)mem + sizeof(fd_account_keys_t);
2358 0 : void * * alloc_mem = &alloc_region;
2359 0 : fd_account_keys_decode_inner( mem, alloc_mem, ctx );
2360 0 : return self;
2361 0 : }
2362 12 : void fd_account_keys_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2363 12 : fd_account_keys_t * self = (fd_account_keys_t *)struct_mem;
2364 12 : ulong account_keys_len;
2365 12 : fd_bincode_uint64_decode_unsafe( &account_keys_len, ctx );
2366 12 : self->account_keys_pool = fd_account_keys_pair_t_map_join_new( alloc_mem, fd_ulong_max( account_keys_len, 100000 ) );
2367 12 : self->account_keys_root = NULL;
2368 12 : for( ulong i=0; i < account_keys_len; i++ ) {
2369 0 : fd_account_keys_pair_t_mapnode_t * node = fd_account_keys_pair_t_map_acquire( self->account_keys_pool );
2370 0 : fd_account_keys_pair_new( &node->elem );
2371 0 : fd_account_keys_pair_decode_inner( &node->elem, alloc_mem, ctx );
2372 0 : fd_account_keys_pair_t_map_insert( self->account_keys_pool, &self->account_keys_root, node );
2373 0 : }
2374 12 : }
2375 0 : void * fd_account_keys_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2376 0 : fd_account_keys_global_t * self = (fd_account_keys_global_t *)mem;
2377 0 : fd_account_keys_new( (fd_account_keys_t *)self );
2378 0 : void * alloc_region = (uchar *)mem + sizeof(fd_account_keys_global_t);
2379 0 : void * * alloc_mem = &alloc_region;
2380 0 : fd_account_keys_decode_inner_global( mem, alloc_mem, ctx );
2381 0 : return self;
2382 0 : }
2383 6 : void fd_account_keys_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2384 6 : fd_account_keys_global_t * self = (fd_account_keys_global_t *)struct_mem;
2385 6 : ulong account_keys_len;
2386 6 : fd_bincode_uint64_decode_unsafe( &account_keys_len, ctx );
2387 6 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, fd_account_keys_pair_t_map_align() );
2388 6 : fd_account_keys_pair_t_mapnode_t * account_keys_pool = fd_account_keys_pair_t_map_join_new( alloc_mem, fd_ulong_max( account_keys_len, 100000 ) );
2389 6 : fd_account_keys_pair_t_mapnode_t * account_keys_root = NULL;
2390 6 : self->account_keys_root_gaddr = 0UL;
2391 6 : for( ulong i=0; i < account_keys_len; i++ ) {
2392 0 : fd_account_keys_pair_t_mapnode_t * node = fd_account_keys_pair_t_map_acquire( account_keys_pool );
2393 0 : fd_account_keys_pair_new( &node->elem );
2394 0 : fd_account_keys_pair_decode_inner( &node->elem, alloc_mem, ctx );
2395 0 : fd_account_keys_pair_t_map_insert( account_keys_pool, &account_keys_root, node );
2396 0 : }
2397 6 : self->account_keys_pool_gaddr = fd_wksp_gaddr_fast( ctx->wksp, account_keys_pool );
2398 6 : self->account_keys_root_gaddr = fd_wksp_gaddr_fast( ctx->wksp, account_keys_root );
2399 6 : }
2400 6 : int fd_account_keys_convert_global_to_local( void const * global_self, fd_account_keys_t * self, fd_bincode_decode_ctx_t * ctx ) {
2401 6 : int err = 0;
2402 6 : fd_account_keys_global_t const * mem = (fd_account_keys_global_t const *)global_self;
2403 6 : self->account_keys_pool = fd_wksp_laddr_fast( ctx->wksp, mem->account_keys_pool_gaddr );
2404 6 : self->account_keys_root = fd_wksp_laddr_fast( ctx->wksp, mem->account_keys_root_gaddr );
2405 6 : return FD_BINCODE_SUCCESS;
2406 6 : }
2407 18 : void fd_account_keys_new(fd_account_keys_t * self) {
2408 18 : fd_memset( self, 0, sizeof(fd_account_keys_t) );
2409 18 : }
2410 0 : void fd_account_keys_destroy( fd_account_keys_t * self ) {
2411 0 : for( fd_account_keys_pair_t_mapnode_t * n = fd_account_keys_pair_t_map_minimum(self->account_keys_pool, self->account_keys_root ); n; n = fd_account_keys_pair_t_map_successor(self->account_keys_pool, n) ) {
2412 0 : fd_account_keys_pair_destroy( &n->elem );
2413 0 : }
2414 0 : self->account_keys_pool = NULL;
2415 0 : self->account_keys_root = NULL;
2416 0 : }
2417 :
2418 0 : ulong fd_account_keys_footprint( void ){ return FD_ACCOUNT_KEYS_FOOTPRINT; }
2419 0 : ulong fd_account_keys_align( void ){ return FD_ACCOUNT_KEYS_ALIGN; }
2420 :
2421 6 : void fd_account_keys_walk( void * w, fd_account_keys_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
2422 6 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_account_keys", level++ );
2423 6 : if( self->account_keys_root ) {
2424 0 : for( fd_account_keys_pair_t_mapnode_t * n = fd_account_keys_pair_t_map_minimum(self->account_keys_pool, self->account_keys_root ); n; n = fd_account_keys_pair_t_map_successor( self->account_keys_pool, n ) ) {
2425 0 : fd_account_keys_pair_walk(w, &n->elem, fun, "account_keys", level );
2426 0 : }
2427 0 : }
2428 6 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_account_keys", level-- );
2429 6 : }
2430 0 : ulong fd_account_keys_size( fd_account_keys_t const * self ) {
2431 0 : ulong size = 0;
2432 0 : if( self->account_keys_root ) {
2433 0 : size += sizeof(ulong);
2434 0 : for( fd_account_keys_pair_t_mapnode_t * n = fd_account_keys_pair_t_map_minimum( self->account_keys_pool, self->account_keys_root ); n; n = fd_account_keys_pair_t_map_successor( self->account_keys_pool, n ) ) {
2435 0 : size += fd_account_keys_pair_size( &n->elem );
2436 0 : }
2437 0 : } else {
2438 0 : size += sizeof(ulong);
2439 0 : }
2440 0 : return size;
2441 0 : }
2442 :
2443 0 : int fd_stake_weight_encode( fd_stake_weight_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2444 0 : int err;
2445 0 : err = fd_pubkey_encode( &self->key, ctx );
2446 0 : if( FD_UNLIKELY( err ) ) return err;
2447 0 : err = fd_bincode_uint64_encode( self->stake, ctx );
2448 0 : if( FD_UNLIKELY( err ) ) return err;
2449 0 : return FD_BINCODE_SUCCESS;
2450 0 : }
2451 0 : int fd_stake_weight_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2452 0 : *total_sz += sizeof(fd_stake_weight_t);
2453 0 : void const * start_data = ctx->data;
2454 0 : int err = fd_stake_weight_decode_footprint_inner( ctx, total_sz );
2455 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2456 0 : ctx->data = start_data;
2457 0 : return err;
2458 0 : }
2459 0 : int fd_stake_weight_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2460 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2461 0 : int err = 0;
2462 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
2463 0 : if( FD_UNLIKELY( err ) ) return err;
2464 0 : err = fd_bincode_uint64_decode_footprint( ctx );
2465 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2466 0 : return 0;
2467 0 : }
2468 0 : void * fd_stake_weight_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2469 0 : fd_stake_weight_t * self = (fd_stake_weight_t *)mem;
2470 0 : fd_stake_weight_new( self );
2471 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_weight_t);
2472 0 : void * * alloc_mem = &alloc_region;
2473 0 : fd_stake_weight_decode_inner( mem, alloc_mem, ctx );
2474 0 : return self;
2475 0 : }
2476 0 : void fd_stake_weight_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2477 0 : fd_stake_weight_t * self = (fd_stake_weight_t *)struct_mem;
2478 0 : fd_pubkey_decode_inner( &self->key, alloc_mem, ctx );
2479 0 : fd_bincode_uint64_decode_unsafe( &self->stake, ctx );
2480 0 : }
2481 0 : void * fd_stake_weight_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2482 0 : fd_stake_weight_global_t * self = (fd_stake_weight_global_t *)mem;
2483 0 : fd_stake_weight_new( (fd_stake_weight_t *)self );
2484 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_weight_global_t);
2485 0 : void * * alloc_mem = &alloc_region;
2486 0 : fd_stake_weight_decode_inner_global( mem, alloc_mem, ctx );
2487 0 : return self;
2488 0 : }
2489 0 : void fd_stake_weight_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2490 0 : fd_stake_weight_global_t * self = (fd_stake_weight_global_t *)struct_mem;
2491 0 : fd_pubkey_decode_inner_global( &self->key, alloc_mem, ctx );
2492 0 : fd_bincode_uint64_decode_unsafe( &self->stake, ctx );
2493 0 : }
2494 0 : int fd_stake_weight_convert_global_to_local( void const * global_self, fd_stake_weight_t * self, fd_bincode_decode_ctx_t * ctx ) {
2495 0 : int err = 0;
2496 0 : fd_stake_weight_global_t const * mem = (fd_stake_weight_global_t const *)global_self;
2497 0 : err = fd_pubkey_convert_global_to_local( &mem->key, &self->key, ctx );
2498 0 : if( FD_UNLIKELY( err ) ) return err;
2499 0 : self->stake = mem->stake;
2500 0 : return FD_BINCODE_SUCCESS;
2501 0 : }
2502 0 : void fd_stake_weight_new(fd_stake_weight_t * self) {
2503 0 : fd_memset( self, 0, sizeof(fd_stake_weight_t) );
2504 0 : fd_pubkey_new( &self->key );
2505 0 : }
2506 0 : void fd_stake_weight_destroy( fd_stake_weight_t * self ) {
2507 0 : fd_pubkey_destroy( &self->key );
2508 0 : }
2509 :
2510 0 : ulong fd_stake_weight_footprint( void ){ return FD_STAKE_WEIGHT_FOOTPRINT; }
2511 0 : ulong fd_stake_weight_align( void ){ return FD_STAKE_WEIGHT_ALIGN; }
2512 :
2513 0 : void fd_stake_weight_walk( void * w, fd_stake_weight_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
2514 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_weight", level++ );
2515 0 : fd_pubkey_walk( w, &self->key, fun, "key", level );
2516 0 : fun( w, &self->stake, "stake", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
2517 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_weight", level-- );
2518 0 : }
2519 0 : ulong fd_stake_weight_size( fd_stake_weight_t const * self ) {
2520 0 : ulong size = 0;
2521 0 : size += fd_pubkey_size( &self->key );
2522 0 : size += sizeof(ulong);
2523 0 : return size;
2524 0 : }
2525 :
2526 0 : int fd_stake_weights_encode( fd_stake_weights_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2527 0 : int err;
2528 0 : if( self->stake_weights_root ) {
2529 0 : ulong stake_weights_len = fd_stake_weight_t_map_size( self->stake_weights_pool, self->stake_weights_root );
2530 0 : err = fd_bincode_uint64_encode( stake_weights_len, ctx );
2531 0 : if( FD_UNLIKELY( err ) ) return err;
2532 0 : for( fd_stake_weight_t_mapnode_t * n = fd_stake_weight_t_map_minimum( self->stake_weights_pool, self->stake_weights_root ); n; n = fd_stake_weight_t_map_successor( self->stake_weights_pool, n ) ) {
2533 0 : err = fd_stake_weight_encode( &n->elem, ctx );
2534 0 : if( FD_UNLIKELY( err ) ) return err;
2535 0 : }
2536 0 : } else {
2537 0 : ulong stake_weights_len = 0;
2538 0 : err = fd_bincode_uint64_encode( stake_weights_len, ctx );
2539 0 : if( FD_UNLIKELY( err ) ) return err;
2540 0 : }
2541 0 : return FD_BINCODE_SUCCESS;
2542 0 : }
2543 0 : int fd_stake_weights_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2544 0 : *total_sz += sizeof(fd_stake_weights_t);
2545 0 : void const * start_data = ctx->data;
2546 0 : int err = fd_stake_weights_decode_footprint_inner( ctx, total_sz );
2547 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2548 0 : ctx->data = start_data;
2549 0 : return err;
2550 0 : }
2551 0 : int fd_stake_weights_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2552 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2553 0 : int err = 0;
2554 0 : ulong stake_weights_len = 0UL;
2555 0 : err = fd_bincode_uint64_decode( &stake_weights_len, ctx );
2556 0 : ulong stake_weights_cnt = stake_weights_len;
2557 0 : *total_sz += fd_stake_weight_t_map_align() + fd_stake_weight_t_map_footprint( stake_weights_cnt );
2558 0 : if( FD_UNLIKELY( err ) ) return err;
2559 0 : for( ulong i=0; i < stake_weights_len; i++ ) {
2560 0 : err = fd_stake_weight_decode_footprint_inner( ctx, total_sz );
2561 0 : if( FD_UNLIKELY( err ) ) return err;
2562 0 : }
2563 0 : return 0;
2564 0 : }
2565 0 : void * fd_stake_weights_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2566 0 : fd_stake_weights_t * self = (fd_stake_weights_t *)mem;
2567 0 : fd_stake_weights_new( self );
2568 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_weights_t);
2569 0 : void * * alloc_mem = &alloc_region;
2570 0 : fd_stake_weights_decode_inner( mem, alloc_mem, ctx );
2571 0 : return self;
2572 0 : }
2573 0 : void fd_stake_weights_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2574 0 : fd_stake_weights_t * self = (fd_stake_weights_t *)struct_mem;
2575 0 : ulong stake_weights_len;
2576 0 : fd_bincode_uint64_decode_unsafe( &stake_weights_len, ctx );
2577 0 : self->stake_weights_pool = fd_stake_weight_t_map_join_new( alloc_mem, stake_weights_len );
2578 0 : self->stake_weights_root = NULL;
2579 0 : for( ulong i=0; i < stake_weights_len; i++ ) {
2580 0 : fd_stake_weight_t_mapnode_t * node = fd_stake_weight_t_map_acquire( self->stake_weights_pool );
2581 0 : fd_stake_weight_new( &node->elem );
2582 0 : fd_stake_weight_decode_inner( &node->elem, alloc_mem, ctx );
2583 0 : fd_stake_weight_t_map_insert( self->stake_weights_pool, &self->stake_weights_root, node );
2584 0 : }
2585 0 : }
2586 0 : void * fd_stake_weights_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2587 0 : fd_stake_weights_global_t * self = (fd_stake_weights_global_t *)mem;
2588 0 : fd_stake_weights_new( (fd_stake_weights_t *)self );
2589 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_weights_global_t);
2590 0 : void * * alloc_mem = &alloc_region;
2591 0 : fd_stake_weights_decode_inner_global( mem, alloc_mem, ctx );
2592 0 : return self;
2593 0 : }
2594 0 : void fd_stake_weights_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2595 0 : fd_stake_weights_global_t * self = (fd_stake_weights_global_t *)struct_mem;
2596 0 : ulong stake_weights_len;
2597 0 : fd_bincode_uint64_decode_unsafe( &stake_weights_len, ctx );
2598 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, fd_stake_weight_t_map_align() );
2599 0 : fd_stake_weight_t_mapnode_t * stake_weights_pool = fd_stake_weight_t_map_join_new( alloc_mem, stake_weights_len );
2600 0 : fd_stake_weight_t_mapnode_t * stake_weights_root = NULL;
2601 0 : self->stake_weights_root_gaddr = 0UL;
2602 0 : for( ulong i=0; i < stake_weights_len; i++ ) {
2603 0 : fd_stake_weight_t_mapnode_t * node = fd_stake_weight_t_map_acquire( stake_weights_pool );
2604 0 : fd_stake_weight_new( &node->elem );
2605 0 : fd_stake_weight_decode_inner( &node->elem, alloc_mem, ctx );
2606 0 : fd_stake_weight_t_map_insert( stake_weights_pool, &stake_weights_root, node );
2607 0 : }
2608 0 : self->stake_weights_pool_gaddr = fd_wksp_gaddr_fast( ctx->wksp, stake_weights_pool );
2609 0 : self->stake_weights_root_gaddr = fd_wksp_gaddr_fast( ctx->wksp, stake_weights_root );
2610 0 : }
2611 0 : int fd_stake_weights_convert_global_to_local( void const * global_self, fd_stake_weights_t * self, fd_bincode_decode_ctx_t * ctx ) {
2612 0 : int err = 0;
2613 0 : fd_stake_weights_global_t const * mem = (fd_stake_weights_global_t const *)global_self;
2614 0 : self->stake_weights_pool = fd_wksp_laddr_fast( ctx->wksp, mem->stake_weights_pool_gaddr );
2615 0 : self->stake_weights_root = fd_wksp_laddr_fast( ctx->wksp, mem->stake_weights_root_gaddr );
2616 0 : return FD_BINCODE_SUCCESS;
2617 0 : }
2618 0 : void fd_stake_weights_new(fd_stake_weights_t * self) {
2619 0 : fd_memset( self, 0, sizeof(fd_stake_weights_t) );
2620 0 : }
2621 0 : void fd_stake_weights_destroy( fd_stake_weights_t * self ) {
2622 0 : for( fd_stake_weight_t_mapnode_t * n = fd_stake_weight_t_map_minimum(self->stake_weights_pool, self->stake_weights_root ); n; n = fd_stake_weight_t_map_successor(self->stake_weights_pool, n) ) {
2623 0 : fd_stake_weight_destroy( &n->elem );
2624 0 : }
2625 0 : self->stake_weights_pool = NULL;
2626 0 : self->stake_weights_root = NULL;
2627 0 : }
2628 :
2629 0 : ulong fd_stake_weights_footprint( void ){ return FD_STAKE_WEIGHTS_FOOTPRINT; }
2630 0 : ulong fd_stake_weights_align( void ){ return FD_STAKE_WEIGHTS_ALIGN; }
2631 :
2632 0 : void fd_stake_weights_walk( void * w, fd_stake_weights_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
2633 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_weights", level++ );
2634 0 : if( self->stake_weights_root ) {
2635 0 : for( fd_stake_weight_t_mapnode_t * n = fd_stake_weight_t_map_minimum(self->stake_weights_pool, self->stake_weights_root ); n; n = fd_stake_weight_t_map_successor( self->stake_weights_pool, n ) ) {
2636 0 : fd_stake_weight_walk(w, &n->elem, fun, "stake_weights", level );
2637 0 : }
2638 0 : }
2639 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_weights", level-- );
2640 0 : }
2641 0 : ulong fd_stake_weights_size( fd_stake_weights_t const * self ) {
2642 0 : ulong size = 0;
2643 0 : if( self->stake_weights_root ) {
2644 0 : size += sizeof(ulong);
2645 0 : for( fd_stake_weight_t_mapnode_t * n = fd_stake_weight_t_map_minimum( self->stake_weights_pool, self->stake_weights_root ); n; n = fd_stake_weight_t_map_successor( self->stake_weights_pool, n ) ) {
2646 0 : size += fd_stake_weight_size( &n->elem );
2647 0 : }
2648 0 : } else {
2649 0 : size += sizeof(ulong);
2650 0 : }
2651 0 : return size;
2652 0 : }
2653 :
2654 12 : int fd_delegation_encode( fd_delegation_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2655 12 : int err;
2656 12 : err = fd_pubkey_encode( &self->voter_pubkey, ctx );
2657 12 : if( FD_UNLIKELY( err ) ) return err;
2658 12 : err = fd_bincode_uint64_encode( self->stake, ctx );
2659 12 : if( FD_UNLIKELY( err ) ) return err;
2660 12 : err = fd_bincode_uint64_encode( self->activation_epoch, ctx );
2661 12 : if( FD_UNLIKELY( err ) ) return err;
2662 12 : err = fd_bincode_uint64_encode( self->deactivation_epoch, ctx );
2663 12 : if( FD_UNLIKELY( err ) ) return err;
2664 12 : err = fd_bincode_double_encode( self->warmup_cooldown_rate, ctx );
2665 12 : if( FD_UNLIKELY( err ) ) return err;
2666 12 : return FD_BINCODE_SUCCESS;
2667 12 : }
2668 0 : int fd_delegation_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2669 0 : *total_sz += sizeof(fd_delegation_t);
2670 0 : void const * start_data = ctx->data;
2671 0 : int err = fd_delegation_decode_footprint_inner( ctx, total_sz );
2672 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2673 0 : ctx->data = start_data;
2674 0 : return err;
2675 0 : }
2676 0 : int fd_delegation_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2677 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2678 0 : int err = 0;
2679 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
2680 0 : if( FD_UNLIKELY( err ) ) return err;
2681 0 : err = fd_bincode_uint64_decode_footprint( ctx );
2682 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2683 0 : err = fd_bincode_uint64_decode_footprint( ctx );
2684 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2685 0 : err = fd_bincode_uint64_decode_footprint( ctx );
2686 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2687 0 : err = fd_bincode_double_decode_footprint( ctx );
2688 0 : if( FD_UNLIKELY( err ) ) return err;
2689 0 : return 0;
2690 0 : }
2691 0 : void * fd_delegation_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2692 0 : fd_delegation_t * self = (fd_delegation_t *)mem;
2693 0 : fd_delegation_new( self );
2694 0 : void * alloc_region = (uchar *)mem + sizeof(fd_delegation_t);
2695 0 : void * * alloc_mem = &alloc_region;
2696 0 : fd_delegation_decode_inner( mem, alloc_mem, ctx );
2697 0 : return self;
2698 0 : }
2699 0 : void fd_delegation_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2700 0 : fd_delegation_t * self = (fd_delegation_t *)struct_mem;
2701 0 : fd_pubkey_decode_inner( &self->voter_pubkey, alloc_mem, ctx );
2702 0 : fd_bincode_uint64_decode_unsafe( &self->stake, ctx );
2703 0 : fd_bincode_uint64_decode_unsafe( &self->activation_epoch, ctx );
2704 0 : fd_bincode_uint64_decode_unsafe( &self->deactivation_epoch, ctx );
2705 0 : fd_bincode_double_decode_unsafe( &self->warmup_cooldown_rate, ctx );
2706 0 : }
2707 0 : void * fd_delegation_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2708 0 : fd_delegation_global_t * self = (fd_delegation_global_t *)mem;
2709 0 : fd_delegation_new( (fd_delegation_t *)self );
2710 0 : void * alloc_region = (uchar *)mem + sizeof(fd_delegation_global_t);
2711 0 : void * * alloc_mem = &alloc_region;
2712 0 : fd_delegation_decode_inner_global( mem, alloc_mem, ctx );
2713 0 : return self;
2714 0 : }
2715 0 : void fd_delegation_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2716 0 : fd_delegation_global_t * self = (fd_delegation_global_t *)struct_mem;
2717 0 : fd_pubkey_decode_inner_global( &self->voter_pubkey, alloc_mem, ctx );
2718 0 : fd_bincode_uint64_decode_unsafe( &self->stake, ctx );
2719 0 : fd_bincode_uint64_decode_unsafe( &self->activation_epoch, ctx );
2720 0 : fd_bincode_uint64_decode_unsafe( &self->deactivation_epoch, ctx );
2721 0 : fd_bincode_double_decode_unsafe( &self->warmup_cooldown_rate, ctx );
2722 0 : }
2723 0 : int fd_delegation_convert_global_to_local( void const * global_self, fd_delegation_t * self, fd_bincode_decode_ctx_t * ctx ) {
2724 0 : int err = 0;
2725 0 : fd_delegation_global_t const * mem = (fd_delegation_global_t const *)global_self;
2726 0 : err = fd_pubkey_convert_global_to_local( &mem->voter_pubkey, &self->voter_pubkey, ctx );
2727 0 : if( FD_UNLIKELY( err ) ) return err;
2728 0 : self->stake = mem->stake;
2729 0 : self->activation_epoch = mem->activation_epoch;
2730 0 : self->deactivation_epoch = mem->deactivation_epoch;
2731 0 : self->warmup_cooldown_rate = mem->warmup_cooldown_rate;
2732 0 : return FD_BINCODE_SUCCESS;
2733 0 : }
2734 12 : void fd_delegation_new(fd_delegation_t * self) {
2735 12 : fd_memset( self, 0, sizeof(fd_delegation_t) );
2736 12 : fd_pubkey_new( &self->voter_pubkey );
2737 12 : }
2738 0 : void fd_delegation_destroy( fd_delegation_t * self ) {
2739 0 : fd_pubkey_destroy( &self->voter_pubkey );
2740 0 : }
2741 :
2742 0 : ulong fd_delegation_footprint( void ){ return FD_DELEGATION_FOOTPRINT; }
2743 0 : ulong fd_delegation_align( void ){ return FD_DELEGATION_ALIGN; }
2744 :
2745 0 : void fd_delegation_walk( void * w, fd_delegation_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
2746 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_delegation", level++ );
2747 0 : fd_pubkey_walk( w, &self->voter_pubkey, fun, "voter_pubkey", level );
2748 0 : fun( w, &self->stake, "stake", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
2749 0 : fun( w, &self->activation_epoch, "activation_epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
2750 0 : fun( w, &self->deactivation_epoch, "deactivation_epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
2751 0 : fun( w, &self->warmup_cooldown_rate, "warmup_cooldown_rate", FD_FLAMENCO_TYPE_DOUBLE, "double", level );
2752 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_delegation", level-- );
2753 0 : }
2754 0 : ulong fd_delegation_size( fd_delegation_t const * self ) {
2755 0 : ulong size = 0;
2756 0 : size += fd_pubkey_size( &self->voter_pubkey );
2757 0 : size += sizeof(ulong);
2758 0 : size += sizeof(ulong);
2759 0 : size += sizeof(ulong);
2760 0 : size += sizeof(double);
2761 0 : return size;
2762 0 : }
2763 :
2764 0 : int fd_delegation_pair_encode( fd_delegation_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2765 0 : int err;
2766 0 : err = fd_pubkey_encode( &self->account, ctx );
2767 0 : if( FD_UNLIKELY( err ) ) return err;
2768 0 : err = fd_delegation_encode( &self->delegation, ctx );
2769 0 : if( FD_UNLIKELY( err ) ) return err;
2770 0 : return FD_BINCODE_SUCCESS;
2771 0 : }
2772 0 : int fd_delegation_pair_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2773 0 : *total_sz += sizeof(fd_delegation_pair_t);
2774 0 : void const * start_data = ctx->data;
2775 0 : int err = fd_delegation_pair_decode_footprint_inner( ctx, total_sz );
2776 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2777 0 : ctx->data = start_data;
2778 0 : return err;
2779 0 : }
2780 0 : int fd_delegation_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2781 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2782 0 : int err = 0;
2783 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
2784 0 : if( FD_UNLIKELY( err ) ) return err;
2785 0 : err = fd_delegation_decode_footprint_inner( ctx, total_sz );
2786 0 : if( FD_UNLIKELY( err ) ) return err;
2787 0 : return 0;
2788 0 : }
2789 0 : void * fd_delegation_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2790 0 : fd_delegation_pair_t * self = (fd_delegation_pair_t *)mem;
2791 0 : fd_delegation_pair_new( self );
2792 0 : void * alloc_region = (uchar *)mem + sizeof(fd_delegation_pair_t);
2793 0 : void * * alloc_mem = &alloc_region;
2794 0 : fd_delegation_pair_decode_inner( mem, alloc_mem, ctx );
2795 0 : return self;
2796 0 : }
2797 0 : void fd_delegation_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2798 0 : fd_delegation_pair_t * self = (fd_delegation_pair_t *)struct_mem;
2799 0 : fd_pubkey_decode_inner( &self->account, alloc_mem, ctx );
2800 0 : fd_delegation_decode_inner( &self->delegation, alloc_mem, ctx );
2801 0 : }
2802 0 : void * fd_delegation_pair_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2803 0 : fd_delegation_pair_global_t * self = (fd_delegation_pair_global_t *)mem;
2804 0 : fd_delegation_pair_new( (fd_delegation_pair_t *)self );
2805 0 : void * alloc_region = (uchar *)mem + sizeof(fd_delegation_pair_global_t);
2806 0 : void * * alloc_mem = &alloc_region;
2807 0 : fd_delegation_pair_decode_inner_global( mem, alloc_mem, ctx );
2808 0 : return self;
2809 0 : }
2810 0 : void fd_delegation_pair_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2811 0 : fd_delegation_pair_global_t * self = (fd_delegation_pair_global_t *)struct_mem;
2812 0 : fd_pubkey_decode_inner_global( &self->account, alloc_mem, ctx );
2813 0 : fd_delegation_decode_inner_global( &self->delegation, alloc_mem, ctx );
2814 0 : }
2815 0 : int fd_delegation_pair_convert_global_to_local( void const * global_self, fd_delegation_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
2816 0 : int err = 0;
2817 0 : fd_delegation_pair_global_t const * mem = (fd_delegation_pair_global_t const *)global_self;
2818 0 : err = fd_pubkey_convert_global_to_local( &mem->account, &self->account, ctx );
2819 0 : if( FD_UNLIKELY( err ) ) return err;
2820 0 : err = fd_delegation_convert_global_to_local( &mem->delegation, &self->delegation, ctx );
2821 0 : if( FD_UNLIKELY( err ) ) return err;
2822 0 : return FD_BINCODE_SUCCESS;
2823 0 : }
2824 0 : void fd_delegation_pair_new(fd_delegation_pair_t * self) {
2825 0 : fd_memset( self, 0, sizeof(fd_delegation_pair_t) );
2826 0 : fd_pubkey_new( &self->account );
2827 0 : fd_delegation_new( &self->delegation );
2828 0 : }
2829 0 : void fd_delegation_pair_destroy( fd_delegation_pair_t * self ) {
2830 0 : fd_pubkey_destroy( &self->account );
2831 0 : fd_delegation_destroy( &self->delegation );
2832 0 : }
2833 :
2834 0 : ulong fd_delegation_pair_footprint( void ){ return FD_DELEGATION_PAIR_FOOTPRINT; }
2835 0 : ulong fd_delegation_pair_align( void ){ return FD_DELEGATION_PAIR_ALIGN; }
2836 :
2837 0 : void fd_delegation_pair_walk( void * w, fd_delegation_pair_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
2838 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_delegation_pair", level++ );
2839 0 : fd_pubkey_walk( w, &self->account, fun, "account", level );
2840 0 : fd_delegation_walk( w, &self->delegation, fun, "delegation", level );
2841 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_delegation_pair", level-- );
2842 0 : }
2843 0 : ulong fd_delegation_pair_size( fd_delegation_pair_t const * self ) {
2844 0 : ulong size = 0;
2845 0 : size += fd_pubkey_size( &self->account );
2846 0 : size += fd_delegation_size( &self->delegation );
2847 0 : return size;
2848 0 : }
2849 :
2850 12 : int fd_stake_encode( fd_stake_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2851 12 : int err;
2852 12 : err = fd_delegation_encode( &self->delegation, ctx );
2853 12 : if( FD_UNLIKELY( err ) ) return err;
2854 12 : err = fd_bincode_uint64_encode( self->credits_observed, ctx );
2855 12 : if( FD_UNLIKELY( err ) ) return err;
2856 12 : return FD_BINCODE_SUCCESS;
2857 12 : }
2858 0 : int fd_stake_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2859 0 : *total_sz += sizeof(fd_stake_t);
2860 0 : void const * start_data = ctx->data;
2861 0 : int err = fd_stake_decode_footprint_inner( ctx, total_sz );
2862 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2863 0 : ctx->data = start_data;
2864 0 : return err;
2865 0 : }
2866 0 : int fd_stake_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2867 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2868 0 : int err = 0;
2869 0 : err = fd_delegation_decode_footprint_inner( ctx, total_sz );
2870 0 : if( FD_UNLIKELY( err ) ) return err;
2871 0 : err = fd_bincode_uint64_decode_footprint( ctx );
2872 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2873 0 : return 0;
2874 0 : }
2875 0 : void * fd_stake_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2876 0 : fd_stake_t * self = (fd_stake_t *)mem;
2877 0 : fd_stake_new( self );
2878 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_t);
2879 0 : void * * alloc_mem = &alloc_region;
2880 0 : fd_stake_decode_inner( mem, alloc_mem, ctx );
2881 0 : return self;
2882 0 : }
2883 0 : void fd_stake_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2884 0 : fd_stake_t * self = (fd_stake_t *)struct_mem;
2885 0 : fd_delegation_decode_inner( &self->delegation, alloc_mem, ctx );
2886 0 : fd_bincode_uint64_decode_unsafe( &self->credits_observed, ctx );
2887 0 : }
2888 0 : void * fd_stake_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2889 0 : fd_stake_global_t * self = (fd_stake_global_t *)mem;
2890 0 : fd_stake_new( (fd_stake_t *)self );
2891 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_global_t);
2892 0 : void * * alloc_mem = &alloc_region;
2893 0 : fd_stake_decode_inner_global( mem, alloc_mem, ctx );
2894 0 : return self;
2895 0 : }
2896 0 : void fd_stake_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2897 0 : fd_stake_global_t * self = (fd_stake_global_t *)struct_mem;
2898 0 : fd_delegation_decode_inner_global( &self->delegation, alloc_mem, ctx );
2899 0 : fd_bincode_uint64_decode_unsafe( &self->credits_observed, ctx );
2900 0 : }
2901 0 : int fd_stake_convert_global_to_local( void const * global_self, fd_stake_t * self, fd_bincode_decode_ctx_t * ctx ) {
2902 0 : int err = 0;
2903 0 : fd_stake_global_t const * mem = (fd_stake_global_t const *)global_self;
2904 0 : err = fd_delegation_convert_global_to_local( &mem->delegation, &self->delegation, ctx );
2905 0 : if( FD_UNLIKELY( err ) ) return err;
2906 0 : self->credits_observed = mem->credits_observed;
2907 0 : return FD_BINCODE_SUCCESS;
2908 0 : }
2909 12 : void fd_stake_new(fd_stake_t * self) {
2910 12 : fd_memset( self, 0, sizeof(fd_stake_t) );
2911 12 : fd_delegation_new( &self->delegation );
2912 12 : }
2913 0 : void fd_stake_destroy( fd_stake_t * self ) {
2914 0 : fd_delegation_destroy( &self->delegation );
2915 0 : }
2916 :
2917 0 : ulong fd_stake_footprint( void ){ return FD_STAKE_FOOTPRINT; }
2918 0 : ulong fd_stake_align( void ){ return FD_STAKE_ALIGN; }
2919 :
2920 0 : void fd_stake_walk( void * w, fd_stake_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
2921 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake", level++ );
2922 0 : fd_delegation_walk( w, &self->delegation, fun, "delegation", level );
2923 0 : fun( w, &self->credits_observed, "credits_observed", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
2924 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake", level-- );
2925 0 : }
2926 0 : ulong fd_stake_size( fd_stake_t const * self ) {
2927 0 : ulong size = 0;
2928 0 : size += fd_delegation_size( &self->delegation );
2929 0 : size += sizeof(ulong);
2930 0 : return size;
2931 0 : }
2932 :
2933 0 : int fd_stake_pair_encode( fd_stake_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2934 0 : int err;
2935 0 : err = fd_pubkey_encode( &self->account, ctx );
2936 0 : if( FD_UNLIKELY( err ) ) return err;
2937 0 : err = fd_stake_encode( &self->stake, ctx );
2938 0 : if( FD_UNLIKELY( err ) ) return err;
2939 0 : return FD_BINCODE_SUCCESS;
2940 0 : }
2941 0 : int fd_stake_pair_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2942 0 : *total_sz += sizeof(fd_stake_pair_t);
2943 0 : void const * start_data = ctx->data;
2944 0 : int err = fd_stake_pair_decode_footprint_inner( ctx, total_sz );
2945 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2946 0 : ctx->data = start_data;
2947 0 : return err;
2948 0 : }
2949 0 : int fd_stake_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2950 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2951 0 : int err = 0;
2952 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
2953 0 : if( FD_UNLIKELY( err ) ) return err;
2954 0 : err = fd_stake_decode_footprint_inner( ctx, total_sz );
2955 0 : if( FD_UNLIKELY( err ) ) return err;
2956 0 : return 0;
2957 0 : }
2958 0 : void * fd_stake_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2959 0 : fd_stake_pair_t * self = (fd_stake_pair_t *)mem;
2960 0 : fd_stake_pair_new( self );
2961 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_pair_t);
2962 0 : void * * alloc_mem = &alloc_region;
2963 0 : fd_stake_pair_decode_inner( mem, alloc_mem, ctx );
2964 0 : return self;
2965 0 : }
2966 0 : void fd_stake_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2967 0 : fd_stake_pair_t * self = (fd_stake_pair_t *)struct_mem;
2968 0 : fd_pubkey_decode_inner( &self->account, alloc_mem, ctx );
2969 0 : fd_stake_decode_inner( &self->stake, alloc_mem, ctx );
2970 0 : }
2971 0 : void * fd_stake_pair_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2972 0 : fd_stake_pair_global_t * self = (fd_stake_pair_global_t *)mem;
2973 0 : fd_stake_pair_new( (fd_stake_pair_t *)self );
2974 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_pair_global_t);
2975 0 : void * * alloc_mem = &alloc_region;
2976 0 : fd_stake_pair_decode_inner_global( mem, alloc_mem, ctx );
2977 0 : return self;
2978 0 : }
2979 0 : void fd_stake_pair_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2980 0 : fd_stake_pair_global_t * self = (fd_stake_pair_global_t *)struct_mem;
2981 0 : fd_pubkey_decode_inner_global( &self->account, alloc_mem, ctx );
2982 0 : fd_stake_decode_inner_global( &self->stake, alloc_mem, ctx );
2983 0 : }
2984 0 : int fd_stake_pair_convert_global_to_local( void const * global_self, fd_stake_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
2985 0 : int err = 0;
2986 0 : fd_stake_pair_global_t const * mem = (fd_stake_pair_global_t const *)global_self;
2987 0 : err = fd_pubkey_convert_global_to_local( &mem->account, &self->account, ctx );
2988 0 : if( FD_UNLIKELY( err ) ) return err;
2989 0 : err = fd_stake_convert_global_to_local( &mem->stake, &self->stake, ctx );
2990 0 : if( FD_UNLIKELY( err ) ) return err;
2991 0 : return FD_BINCODE_SUCCESS;
2992 0 : }
2993 0 : void fd_stake_pair_new(fd_stake_pair_t * self) {
2994 0 : fd_memset( self, 0, sizeof(fd_stake_pair_t) );
2995 0 : fd_pubkey_new( &self->account );
2996 0 : fd_stake_new( &self->stake );
2997 0 : }
2998 0 : void fd_stake_pair_destroy( fd_stake_pair_t * self ) {
2999 0 : fd_pubkey_destroy( &self->account );
3000 0 : fd_stake_destroy( &self->stake );
3001 0 : }
3002 :
3003 0 : ulong fd_stake_pair_footprint( void ){ return FD_STAKE_PAIR_FOOTPRINT; }
3004 0 : ulong fd_stake_pair_align( void ){ return FD_STAKE_PAIR_ALIGN; }
3005 :
3006 0 : void fd_stake_pair_walk( void * w, fd_stake_pair_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
3007 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_pair", level++ );
3008 0 : fd_pubkey_walk( w, &self->account, fun, "account", level );
3009 0 : fd_stake_walk( w, &self->stake, fun, "stake", level );
3010 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_pair", level-- );
3011 0 : }
3012 0 : ulong fd_stake_pair_size( fd_stake_pair_t const * self ) {
3013 0 : ulong size = 0;
3014 0 : size += fd_pubkey_size( &self->account );
3015 0 : size += fd_stake_size( &self->stake );
3016 0 : return size;
3017 0 : }
3018 :
3019 6 : int fd_stakes_encode( fd_stakes_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3020 6 : int err;
3021 6 : err = fd_vote_accounts_encode( &self->vote_accounts, ctx );
3022 6 : if( FD_UNLIKELY( err ) ) return err;
3023 6 : if( self->stake_delegations_root ) {
3024 0 : ulong stake_delegations_len = fd_delegation_pair_t_map_size( self->stake_delegations_pool, self->stake_delegations_root );
3025 0 : err = fd_bincode_uint64_encode( stake_delegations_len, ctx );
3026 0 : if( FD_UNLIKELY( err ) ) return err;
3027 0 : for( fd_delegation_pair_t_mapnode_t * n = fd_delegation_pair_t_map_minimum( self->stake_delegations_pool, self->stake_delegations_root ); n; n = fd_delegation_pair_t_map_successor( self->stake_delegations_pool, n ) ) {
3028 0 : err = fd_delegation_pair_encode( &n->elem, ctx );
3029 0 : if( FD_UNLIKELY( err ) ) return err;
3030 0 : }
3031 6 : } else {
3032 6 : ulong stake_delegations_len = 0;
3033 6 : err = fd_bincode_uint64_encode( stake_delegations_len, ctx );
3034 6 : if( FD_UNLIKELY( err ) ) return err;
3035 6 : }
3036 6 : err = fd_bincode_uint64_encode( self->unused, ctx );
3037 6 : if( FD_UNLIKELY( err ) ) return err;
3038 6 : err = fd_bincode_uint64_encode( self->epoch, ctx );
3039 6 : if( FD_UNLIKELY( err ) ) return err;
3040 6 : err = fd_stake_history_encode( &self->stake_history, ctx );
3041 6 : if( FD_UNLIKELY( err ) ) return err;
3042 6 : return FD_BINCODE_SUCCESS;
3043 6 : }
3044 0 : int fd_stakes_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3045 0 : *total_sz += sizeof(fd_stakes_t);
3046 0 : void const * start_data = ctx->data;
3047 0 : int err = fd_stakes_decode_footprint_inner( ctx, total_sz );
3048 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3049 0 : ctx->data = start_data;
3050 0 : return err;
3051 0 : }
3052 6 : int fd_stakes_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3053 6 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3054 6 : int err = 0;
3055 6 : err = fd_vote_accounts_decode_footprint_inner( ctx, total_sz );
3056 6 : if( FD_UNLIKELY( err ) ) return err;
3057 6 : ulong stake_delegations_len = 0UL;
3058 6 : err = fd_bincode_uint64_decode( &stake_delegations_len, ctx );
3059 6 : ulong stake_delegations_cnt = stake_delegations_len;
3060 6 : *total_sz += fd_delegation_pair_t_map_align() + fd_delegation_pair_t_map_footprint( stake_delegations_cnt );
3061 6 : if( FD_UNLIKELY( err ) ) return err;
3062 6 : for( ulong i=0; i < stake_delegations_len; i++ ) {
3063 0 : err = fd_delegation_pair_decode_footprint_inner( ctx, total_sz );
3064 0 : if( FD_UNLIKELY( err ) ) return err;
3065 0 : }
3066 6 : err = fd_bincode_uint64_decode_footprint( ctx );
3067 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3068 6 : err = fd_bincode_uint64_decode_footprint( ctx );
3069 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3070 6 : err = fd_stake_history_decode_footprint_inner( ctx, total_sz );
3071 6 : if( FD_UNLIKELY( err ) ) return err;
3072 6 : return 0;
3073 6 : }
3074 0 : void * fd_stakes_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3075 0 : fd_stakes_t * self = (fd_stakes_t *)mem;
3076 0 : fd_stakes_new( self );
3077 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stakes_t);
3078 0 : void * * alloc_mem = &alloc_region;
3079 0 : fd_stakes_decode_inner( mem, alloc_mem, ctx );
3080 0 : return self;
3081 0 : }
3082 6 : void fd_stakes_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3083 6 : fd_stakes_t * self = (fd_stakes_t *)struct_mem;
3084 6 : fd_vote_accounts_decode_inner( &self->vote_accounts, alloc_mem, ctx );
3085 6 : ulong stake_delegations_len;
3086 6 : fd_bincode_uint64_decode_unsafe( &stake_delegations_len, ctx );
3087 6 : self->stake_delegations_pool = fd_delegation_pair_t_map_join_new( alloc_mem, stake_delegations_len );
3088 6 : self->stake_delegations_root = NULL;
3089 6 : for( ulong i=0; i < stake_delegations_len; i++ ) {
3090 0 : fd_delegation_pair_t_mapnode_t * node = fd_delegation_pair_t_map_acquire( self->stake_delegations_pool );
3091 0 : fd_delegation_pair_new( &node->elem );
3092 0 : fd_delegation_pair_decode_inner( &node->elem, alloc_mem, ctx );
3093 0 : fd_delegation_pair_t_map_insert( self->stake_delegations_pool, &self->stake_delegations_root, node );
3094 0 : }
3095 6 : fd_bincode_uint64_decode_unsafe( &self->unused, ctx );
3096 6 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
3097 6 : fd_stake_history_decode_inner( &self->stake_history, alloc_mem, ctx );
3098 6 : }
3099 0 : void * fd_stakes_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3100 0 : fd_stakes_global_t * self = (fd_stakes_global_t *)mem;
3101 0 : fd_stakes_new( (fd_stakes_t *)self );
3102 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stakes_global_t);
3103 0 : void * * alloc_mem = &alloc_region;
3104 0 : fd_stakes_decode_inner_global( mem, alloc_mem, ctx );
3105 0 : return self;
3106 0 : }
3107 0 : void fd_stakes_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3108 0 : fd_stakes_global_t * self = (fd_stakes_global_t *)struct_mem;
3109 0 : fd_vote_accounts_decode_inner_global( &self->vote_accounts, alloc_mem, ctx );
3110 0 : ulong stake_delegations_len;
3111 0 : fd_bincode_uint64_decode_unsafe( &stake_delegations_len, ctx );
3112 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, fd_delegation_pair_t_map_align() );
3113 0 : fd_delegation_pair_t_mapnode_t * stake_delegations_pool = fd_delegation_pair_t_map_join_new( alloc_mem, stake_delegations_len );
3114 0 : fd_delegation_pair_t_mapnode_t * stake_delegations_root = NULL;
3115 0 : self->stake_delegations_root_gaddr = 0UL;
3116 0 : for( ulong i=0; i < stake_delegations_len; i++ ) {
3117 0 : fd_delegation_pair_t_mapnode_t * node = fd_delegation_pair_t_map_acquire( stake_delegations_pool );
3118 0 : fd_delegation_pair_new( &node->elem );
3119 0 : fd_delegation_pair_decode_inner( &node->elem, alloc_mem, ctx );
3120 0 : fd_delegation_pair_t_map_insert( stake_delegations_pool, &stake_delegations_root, node );
3121 0 : }
3122 0 : self->stake_delegations_pool_gaddr = fd_wksp_gaddr_fast( ctx->wksp, stake_delegations_pool );
3123 0 : self->stake_delegations_root_gaddr = fd_wksp_gaddr_fast( ctx->wksp, stake_delegations_root );
3124 0 : fd_bincode_uint64_decode_unsafe( &self->unused, ctx );
3125 0 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
3126 0 : fd_stake_history_decode_inner_global( &self->stake_history, alloc_mem, ctx );
3127 0 : }
3128 0 : int fd_stakes_convert_global_to_local( void const * global_self, fd_stakes_t * self, fd_bincode_decode_ctx_t * ctx ) {
3129 0 : int err = 0;
3130 0 : fd_stakes_global_t const * mem = (fd_stakes_global_t const *)global_self;
3131 0 : err = fd_vote_accounts_convert_global_to_local( &mem->vote_accounts, &self->vote_accounts, ctx );
3132 0 : if( FD_UNLIKELY( err ) ) return err;
3133 0 : self->stake_delegations_pool = fd_wksp_laddr_fast( ctx->wksp, mem->stake_delegations_pool_gaddr );
3134 0 : self->stake_delegations_root = fd_wksp_laddr_fast( ctx->wksp, mem->stake_delegations_root_gaddr );
3135 0 : self->unused = mem->unused;
3136 0 : self->epoch = mem->epoch;
3137 0 : err = fd_stake_history_convert_global_to_local( &mem->stake_history, &self->stake_history, ctx );
3138 0 : if( FD_UNLIKELY( err ) ) return err;
3139 0 : return FD_BINCODE_SUCCESS;
3140 0 : }
3141 6 : void fd_stakes_new(fd_stakes_t * self) {
3142 6 : fd_memset( self, 0, sizeof(fd_stakes_t) );
3143 6 : fd_vote_accounts_new( &self->vote_accounts );
3144 6 : fd_stake_history_new( &self->stake_history );
3145 6 : }
3146 0 : void fd_stakes_destroy( fd_stakes_t * self ) {
3147 0 : fd_vote_accounts_destroy( &self->vote_accounts );
3148 0 : for( fd_delegation_pair_t_mapnode_t * n = fd_delegation_pair_t_map_minimum(self->stake_delegations_pool, self->stake_delegations_root ); n; n = fd_delegation_pair_t_map_successor(self->stake_delegations_pool, n) ) {
3149 0 : fd_delegation_pair_destroy( &n->elem );
3150 0 : }
3151 0 : self->stake_delegations_pool = NULL;
3152 0 : self->stake_delegations_root = NULL;
3153 0 : fd_stake_history_destroy( &self->stake_history );
3154 0 : }
3155 :
3156 0 : ulong fd_stakes_footprint( void ){ return FD_STAKES_FOOTPRINT; }
3157 0 : ulong fd_stakes_align( void ){ return FD_STAKES_ALIGN; }
3158 :
3159 0 : void fd_stakes_walk( void * w, fd_stakes_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
3160 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stakes", level++ );
3161 0 : fd_vote_accounts_walk( w, &self->vote_accounts, fun, "vote_accounts", level );
3162 0 : if( self->stake_delegations_root ) {
3163 0 : for( fd_delegation_pair_t_mapnode_t * n = fd_delegation_pair_t_map_minimum(self->stake_delegations_pool, self->stake_delegations_root ); n; n = fd_delegation_pair_t_map_successor( self->stake_delegations_pool, n ) ) {
3164 0 : fd_delegation_pair_walk(w, &n->elem, fun, "stake_delegations", level );
3165 0 : }
3166 0 : }
3167 0 : fun( w, &self->unused, "unused", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
3168 0 : fun( w, &self->epoch, "epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
3169 0 : fd_stake_history_walk( w, &self->stake_history, fun, "stake_history", level );
3170 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stakes", level-- );
3171 0 : }
3172 6 : ulong fd_stakes_size( fd_stakes_t const * self ) {
3173 6 : ulong size = 0;
3174 6 : size += fd_vote_accounts_size( &self->vote_accounts );
3175 6 : if( self->stake_delegations_root ) {
3176 0 : size += sizeof(ulong);
3177 0 : for( fd_delegation_pair_t_mapnode_t * n = fd_delegation_pair_t_map_minimum( self->stake_delegations_pool, self->stake_delegations_root ); n; n = fd_delegation_pair_t_map_successor( self->stake_delegations_pool, n ) ) {
3178 0 : size += fd_delegation_pair_size( &n->elem );
3179 0 : }
3180 6 : } else {
3181 6 : size += sizeof(ulong);
3182 6 : }
3183 6 : size += sizeof(ulong);
3184 6 : size += sizeof(ulong);
3185 6 : size += fd_stake_history_size( &self->stake_history );
3186 6 : return size;
3187 6 : }
3188 :
3189 0 : int fd_stakes_stake_encode( fd_stakes_stake_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3190 0 : int err;
3191 0 : err = fd_vote_accounts_encode( &self->vote_accounts, ctx );
3192 0 : if( FD_UNLIKELY( err ) ) return err;
3193 0 : if( self->stake_delegations_root ) {
3194 0 : ulong stake_delegations_len = fd_stake_pair_t_map_size( self->stake_delegations_pool, self->stake_delegations_root );
3195 0 : err = fd_bincode_uint64_encode( stake_delegations_len, ctx );
3196 0 : if( FD_UNLIKELY( err ) ) return err;
3197 0 : for( fd_stake_pair_t_mapnode_t * n = fd_stake_pair_t_map_minimum( self->stake_delegations_pool, self->stake_delegations_root ); n; n = fd_stake_pair_t_map_successor( self->stake_delegations_pool, n ) ) {
3198 0 : err = fd_stake_pair_encode( &n->elem, ctx );
3199 0 : if( FD_UNLIKELY( err ) ) return err;
3200 0 : }
3201 0 : } else {
3202 0 : ulong stake_delegations_len = 0;
3203 0 : err = fd_bincode_uint64_encode( stake_delegations_len, ctx );
3204 0 : if( FD_UNLIKELY( err ) ) return err;
3205 0 : }
3206 0 : err = fd_bincode_uint64_encode( self->unused, ctx );
3207 0 : if( FD_UNLIKELY( err ) ) return err;
3208 0 : err = fd_bincode_uint64_encode( self->epoch, ctx );
3209 0 : if( FD_UNLIKELY( err ) ) return err;
3210 0 : err = fd_stake_history_encode( &self->stake_history, ctx );
3211 0 : if( FD_UNLIKELY( err ) ) return err;
3212 0 : return FD_BINCODE_SUCCESS;
3213 0 : }
3214 0 : int fd_stakes_stake_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3215 0 : *total_sz += sizeof(fd_stakes_stake_t);
3216 0 : void const * start_data = ctx->data;
3217 0 : int err = fd_stakes_stake_decode_footprint_inner( ctx, total_sz );
3218 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3219 0 : ctx->data = start_data;
3220 0 : return err;
3221 0 : }
3222 0 : int fd_stakes_stake_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3223 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3224 0 : int err = 0;
3225 0 : err = fd_vote_accounts_decode_footprint_inner( ctx, total_sz );
3226 0 : if( FD_UNLIKELY( err ) ) return err;
3227 0 : ulong stake_delegations_len = 0UL;
3228 0 : err = fd_bincode_uint64_decode( &stake_delegations_len, ctx );
3229 0 : ulong stake_delegations_cnt = stake_delegations_len;
3230 0 : *total_sz += fd_stake_pair_t_map_align() + fd_stake_pair_t_map_footprint( stake_delegations_cnt );
3231 0 : if( FD_UNLIKELY( err ) ) return err;
3232 0 : for( ulong i=0; i < stake_delegations_len; i++ ) {
3233 0 : err = fd_stake_pair_decode_footprint_inner( ctx, total_sz );
3234 0 : if( FD_UNLIKELY( err ) ) return err;
3235 0 : }
3236 0 : err = fd_bincode_uint64_decode_footprint( ctx );
3237 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3238 0 : err = fd_bincode_uint64_decode_footprint( ctx );
3239 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3240 0 : err = fd_stake_history_decode_footprint_inner( ctx, total_sz );
3241 0 : if( FD_UNLIKELY( err ) ) return err;
3242 0 : return 0;
3243 0 : }
3244 0 : void * fd_stakes_stake_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3245 0 : fd_stakes_stake_t * self = (fd_stakes_stake_t *)mem;
3246 0 : fd_stakes_stake_new( self );
3247 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stakes_stake_t);
3248 0 : void * * alloc_mem = &alloc_region;
3249 0 : fd_stakes_stake_decode_inner( mem, alloc_mem, ctx );
3250 0 : return self;
3251 0 : }
3252 0 : void fd_stakes_stake_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3253 0 : fd_stakes_stake_t * self = (fd_stakes_stake_t *)struct_mem;
3254 0 : fd_vote_accounts_decode_inner( &self->vote_accounts, alloc_mem, ctx );
3255 0 : ulong stake_delegations_len;
3256 0 : fd_bincode_uint64_decode_unsafe( &stake_delegations_len, ctx );
3257 0 : self->stake_delegations_pool = fd_stake_pair_t_map_join_new( alloc_mem, stake_delegations_len );
3258 0 : self->stake_delegations_root = NULL;
3259 0 : for( ulong i=0; i < stake_delegations_len; i++ ) {
3260 0 : fd_stake_pair_t_mapnode_t * node = fd_stake_pair_t_map_acquire( self->stake_delegations_pool );
3261 0 : fd_stake_pair_new( &node->elem );
3262 0 : fd_stake_pair_decode_inner( &node->elem, alloc_mem, ctx );
3263 0 : fd_stake_pair_t_map_insert( self->stake_delegations_pool, &self->stake_delegations_root, node );
3264 0 : }
3265 0 : fd_bincode_uint64_decode_unsafe( &self->unused, ctx );
3266 0 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
3267 0 : fd_stake_history_decode_inner( &self->stake_history, alloc_mem, ctx );
3268 0 : }
3269 0 : void * fd_stakes_stake_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3270 0 : fd_stakes_stake_global_t * self = (fd_stakes_stake_global_t *)mem;
3271 0 : fd_stakes_stake_new( (fd_stakes_stake_t *)self );
3272 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stakes_stake_global_t);
3273 0 : void * * alloc_mem = &alloc_region;
3274 0 : fd_stakes_stake_decode_inner_global( mem, alloc_mem, ctx );
3275 0 : return self;
3276 0 : }
3277 0 : void fd_stakes_stake_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3278 0 : fd_stakes_stake_global_t * self = (fd_stakes_stake_global_t *)struct_mem;
3279 0 : fd_vote_accounts_decode_inner_global( &self->vote_accounts, alloc_mem, ctx );
3280 0 : ulong stake_delegations_len;
3281 0 : fd_bincode_uint64_decode_unsafe( &stake_delegations_len, ctx );
3282 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, fd_stake_pair_t_map_align() );
3283 0 : fd_stake_pair_t_mapnode_t * stake_delegations_pool = fd_stake_pair_t_map_join_new( alloc_mem, stake_delegations_len );
3284 0 : fd_stake_pair_t_mapnode_t * stake_delegations_root = NULL;
3285 0 : self->stake_delegations_root_gaddr = 0UL;
3286 0 : for( ulong i=0; i < stake_delegations_len; i++ ) {
3287 0 : fd_stake_pair_t_mapnode_t * node = fd_stake_pair_t_map_acquire( stake_delegations_pool );
3288 0 : fd_stake_pair_new( &node->elem );
3289 0 : fd_stake_pair_decode_inner( &node->elem, alloc_mem, ctx );
3290 0 : fd_stake_pair_t_map_insert( stake_delegations_pool, &stake_delegations_root, node );
3291 0 : }
3292 0 : self->stake_delegations_pool_gaddr = fd_wksp_gaddr_fast( ctx->wksp, stake_delegations_pool );
3293 0 : self->stake_delegations_root_gaddr = fd_wksp_gaddr_fast( ctx->wksp, stake_delegations_root );
3294 0 : fd_bincode_uint64_decode_unsafe( &self->unused, ctx );
3295 0 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
3296 0 : fd_stake_history_decode_inner_global( &self->stake_history, alloc_mem, ctx );
3297 0 : }
3298 0 : int fd_stakes_stake_convert_global_to_local( void const * global_self, fd_stakes_stake_t * self, fd_bincode_decode_ctx_t * ctx ) {
3299 0 : int err = 0;
3300 0 : fd_stakes_stake_global_t const * mem = (fd_stakes_stake_global_t const *)global_self;
3301 0 : err = fd_vote_accounts_convert_global_to_local( &mem->vote_accounts, &self->vote_accounts, ctx );
3302 0 : if( FD_UNLIKELY( err ) ) return err;
3303 0 : self->stake_delegations_pool = fd_wksp_laddr_fast( ctx->wksp, mem->stake_delegations_pool_gaddr );
3304 0 : self->stake_delegations_root = fd_wksp_laddr_fast( ctx->wksp, mem->stake_delegations_root_gaddr );
3305 0 : self->unused = mem->unused;
3306 0 : self->epoch = mem->epoch;
3307 0 : err = fd_stake_history_convert_global_to_local( &mem->stake_history, &self->stake_history, ctx );
3308 0 : if( FD_UNLIKELY( err ) ) return err;
3309 0 : return FD_BINCODE_SUCCESS;
3310 0 : }
3311 0 : void fd_stakes_stake_new(fd_stakes_stake_t * self) {
3312 0 : fd_memset( self, 0, sizeof(fd_stakes_stake_t) );
3313 0 : fd_vote_accounts_new( &self->vote_accounts );
3314 0 : fd_stake_history_new( &self->stake_history );
3315 0 : }
3316 0 : void fd_stakes_stake_destroy( fd_stakes_stake_t * self ) {
3317 0 : fd_vote_accounts_destroy( &self->vote_accounts );
3318 0 : for( fd_stake_pair_t_mapnode_t * n = fd_stake_pair_t_map_minimum(self->stake_delegations_pool, self->stake_delegations_root ); n; n = fd_stake_pair_t_map_successor(self->stake_delegations_pool, n) ) {
3319 0 : fd_stake_pair_destroy( &n->elem );
3320 0 : }
3321 0 : self->stake_delegations_pool = NULL;
3322 0 : self->stake_delegations_root = NULL;
3323 0 : fd_stake_history_destroy( &self->stake_history );
3324 0 : }
3325 :
3326 0 : ulong fd_stakes_stake_footprint( void ){ return FD_STAKES_STAKE_FOOTPRINT; }
3327 0 : ulong fd_stakes_stake_align( void ){ return FD_STAKES_STAKE_ALIGN; }
3328 :
3329 0 : void fd_stakes_stake_walk( void * w, fd_stakes_stake_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
3330 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stakes_stake", level++ );
3331 0 : fd_vote_accounts_walk( w, &self->vote_accounts, fun, "vote_accounts", level );
3332 0 : if( self->stake_delegations_root ) {
3333 0 : for( fd_stake_pair_t_mapnode_t * n = fd_stake_pair_t_map_minimum(self->stake_delegations_pool, self->stake_delegations_root ); n; n = fd_stake_pair_t_map_successor( self->stake_delegations_pool, n ) ) {
3334 0 : fd_stake_pair_walk(w, &n->elem, fun, "stake_delegations", level );
3335 0 : }
3336 0 : }
3337 0 : fun( w, &self->unused, "unused", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
3338 0 : fun( w, &self->epoch, "epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
3339 0 : fd_stake_history_walk( w, &self->stake_history, fun, "stake_history", level );
3340 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stakes_stake", level-- );
3341 0 : }
3342 0 : ulong fd_stakes_stake_size( fd_stakes_stake_t const * self ) {
3343 0 : ulong size = 0;
3344 0 : size += fd_vote_accounts_size( &self->vote_accounts );
3345 0 : if( self->stake_delegations_root ) {
3346 0 : size += sizeof(ulong);
3347 0 : for( fd_stake_pair_t_mapnode_t * n = fd_stake_pair_t_map_minimum( self->stake_delegations_pool, self->stake_delegations_root ); n; n = fd_stake_pair_t_map_successor( self->stake_delegations_pool, n ) ) {
3348 0 : size += fd_stake_pair_size( &n->elem );
3349 0 : }
3350 0 : } else {
3351 0 : size += sizeof(ulong);
3352 0 : }
3353 0 : size += sizeof(ulong);
3354 0 : size += sizeof(ulong);
3355 0 : size += fd_stake_history_size( &self->stake_history );
3356 0 : return size;
3357 0 : }
3358 :
3359 0 : int fd_bank_incremental_snapshot_persistence_encode( fd_bank_incremental_snapshot_persistence_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3360 0 : int err;
3361 0 : err = fd_bincode_uint64_encode( self->full_slot, ctx );
3362 0 : if( FD_UNLIKELY( err ) ) return err;
3363 0 : err = fd_hash_encode( &self->full_hash, ctx );
3364 0 : if( FD_UNLIKELY( err ) ) return err;
3365 0 : err = fd_bincode_uint64_encode( self->full_capitalization, ctx );
3366 0 : if( FD_UNLIKELY( err ) ) return err;
3367 0 : err = fd_hash_encode( &self->incremental_hash, ctx );
3368 0 : if( FD_UNLIKELY( err ) ) return err;
3369 0 : err = fd_bincode_uint64_encode( self->incremental_capitalization, ctx );
3370 0 : if( FD_UNLIKELY( err ) ) return err;
3371 0 : return FD_BINCODE_SUCCESS;
3372 0 : }
3373 0 : int fd_bank_incremental_snapshot_persistence_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3374 0 : *total_sz += sizeof(fd_bank_incremental_snapshot_persistence_t);
3375 0 : void const * start_data = ctx->data;
3376 0 : int err = fd_bank_incremental_snapshot_persistence_decode_footprint_inner( ctx, total_sz );
3377 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3378 0 : ctx->data = start_data;
3379 0 : return err;
3380 0 : }
3381 0 : int fd_bank_incremental_snapshot_persistence_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3382 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3383 0 : int err = 0;
3384 0 : err = fd_bincode_uint64_decode_footprint( ctx );
3385 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3386 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
3387 0 : if( FD_UNLIKELY( err ) ) return err;
3388 0 : err = fd_bincode_uint64_decode_footprint( ctx );
3389 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3390 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
3391 0 : if( FD_UNLIKELY( err ) ) return err;
3392 0 : err = fd_bincode_uint64_decode_footprint( ctx );
3393 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3394 0 : return 0;
3395 0 : }
3396 0 : void * fd_bank_incremental_snapshot_persistence_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3397 0 : fd_bank_incremental_snapshot_persistence_t * self = (fd_bank_incremental_snapshot_persistence_t *)mem;
3398 0 : fd_bank_incremental_snapshot_persistence_new( self );
3399 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bank_incremental_snapshot_persistence_t);
3400 0 : void * * alloc_mem = &alloc_region;
3401 0 : fd_bank_incremental_snapshot_persistence_decode_inner( mem, alloc_mem, ctx );
3402 0 : return self;
3403 0 : }
3404 0 : void fd_bank_incremental_snapshot_persistence_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3405 0 : fd_bank_incremental_snapshot_persistence_t * self = (fd_bank_incremental_snapshot_persistence_t *)struct_mem;
3406 0 : fd_bincode_uint64_decode_unsafe( &self->full_slot, ctx );
3407 0 : fd_hash_decode_inner( &self->full_hash, alloc_mem, ctx );
3408 0 : fd_bincode_uint64_decode_unsafe( &self->full_capitalization, ctx );
3409 0 : fd_hash_decode_inner( &self->incremental_hash, alloc_mem, ctx );
3410 0 : fd_bincode_uint64_decode_unsafe( &self->incremental_capitalization, ctx );
3411 0 : }
3412 0 : void * fd_bank_incremental_snapshot_persistence_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3413 0 : fd_bank_incremental_snapshot_persistence_global_t * self = (fd_bank_incremental_snapshot_persistence_global_t *)mem;
3414 0 : fd_bank_incremental_snapshot_persistence_new( (fd_bank_incremental_snapshot_persistence_t *)self );
3415 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bank_incremental_snapshot_persistence_global_t);
3416 0 : void * * alloc_mem = &alloc_region;
3417 0 : fd_bank_incremental_snapshot_persistence_decode_inner_global( mem, alloc_mem, ctx );
3418 0 : return self;
3419 0 : }
3420 0 : void fd_bank_incremental_snapshot_persistence_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3421 0 : fd_bank_incremental_snapshot_persistence_global_t * self = (fd_bank_incremental_snapshot_persistence_global_t *)struct_mem;
3422 0 : fd_bincode_uint64_decode_unsafe( &self->full_slot, ctx );
3423 0 : fd_hash_decode_inner_global( &self->full_hash, alloc_mem, ctx );
3424 0 : fd_bincode_uint64_decode_unsafe( &self->full_capitalization, ctx );
3425 0 : fd_hash_decode_inner_global( &self->incremental_hash, alloc_mem, ctx );
3426 0 : fd_bincode_uint64_decode_unsafe( &self->incremental_capitalization, ctx );
3427 0 : }
3428 0 : int fd_bank_incremental_snapshot_persistence_convert_global_to_local( void const * global_self, fd_bank_incremental_snapshot_persistence_t * self, fd_bincode_decode_ctx_t * ctx ) {
3429 0 : int err = 0;
3430 0 : fd_bank_incremental_snapshot_persistence_global_t const * mem = (fd_bank_incremental_snapshot_persistence_global_t const *)global_self;
3431 0 : self->full_slot = mem->full_slot;
3432 0 : err = fd_hash_convert_global_to_local( &mem->full_hash, &self->full_hash, ctx );
3433 0 : if( FD_UNLIKELY( err ) ) return err;
3434 0 : self->full_capitalization = mem->full_capitalization;
3435 0 : err = fd_hash_convert_global_to_local( &mem->incremental_hash, &self->incremental_hash, ctx );
3436 0 : if( FD_UNLIKELY( err ) ) return err;
3437 0 : self->incremental_capitalization = mem->incremental_capitalization;
3438 0 : return FD_BINCODE_SUCCESS;
3439 0 : }
3440 0 : void fd_bank_incremental_snapshot_persistence_new(fd_bank_incremental_snapshot_persistence_t * self) {
3441 0 : fd_memset( self, 0, sizeof(fd_bank_incremental_snapshot_persistence_t) );
3442 0 : fd_hash_new( &self->full_hash );
3443 0 : fd_hash_new( &self->incremental_hash );
3444 0 : }
3445 0 : void fd_bank_incremental_snapshot_persistence_destroy( fd_bank_incremental_snapshot_persistence_t * self ) {
3446 0 : fd_hash_destroy( &self->full_hash );
3447 0 : fd_hash_destroy( &self->incremental_hash );
3448 0 : }
3449 :
3450 0 : ulong fd_bank_incremental_snapshot_persistence_footprint( void ){ return FD_BANK_INCREMENTAL_SNAPSHOT_PERSISTENCE_FOOTPRINT; }
3451 0 : ulong fd_bank_incremental_snapshot_persistence_align( void ){ return FD_BANK_INCREMENTAL_SNAPSHOT_PERSISTENCE_ALIGN; }
3452 :
3453 0 : void fd_bank_incremental_snapshot_persistence_walk( void * w, fd_bank_incremental_snapshot_persistence_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
3454 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_bank_incremental_snapshot_persistence", level++ );
3455 0 : fun( w, &self->full_slot, "full_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
3456 0 : fd_hash_walk( w, &self->full_hash, fun, "full_hash", level );
3457 0 : fun( w, &self->full_capitalization, "full_capitalization", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
3458 0 : fd_hash_walk( w, &self->incremental_hash, fun, "incremental_hash", level );
3459 0 : fun( w, &self->incremental_capitalization, "incremental_capitalization", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
3460 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_bank_incremental_snapshot_persistence", level-- );
3461 0 : }
3462 0 : ulong fd_bank_incremental_snapshot_persistence_size( fd_bank_incremental_snapshot_persistence_t const * self ) {
3463 0 : ulong size = 0;
3464 0 : size += sizeof(ulong);
3465 0 : size += fd_hash_size( &self->full_hash );
3466 0 : size += sizeof(ulong);
3467 0 : size += fd_hash_size( &self->incremental_hash );
3468 0 : size += sizeof(ulong);
3469 0 : return size;
3470 0 : }
3471 :
3472 0 : int fd_node_vote_accounts_encode( fd_node_vote_accounts_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3473 0 : int err;
3474 0 : err = fd_bincode_uint64_encode( self->vote_accounts_len, ctx );
3475 0 : if( FD_UNLIKELY(err) ) return err;
3476 0 : if( self->vote_accounts_len ) {
3477 0 : for( ulong i=0; i < self->vote_accounts_len; i++ ) {
3478 0 : err = fd_pubkey_encode( self->vote_accounts + i, ctx );
3479 0 : if( FD_UNLIKELY( err ) ) return err;
3480 0 : }
3481 0 : }
3482 0 : err = fd_bincode_uint64_encode( self->total_stake, ctx );
3483 0 : if( FD_UNLIKELY( err ) ) return err;
3484 0 : return FD_BINCODE_SUCCESS;
3485 0 : }
3486 0 : int fd_node_vote_accounts_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3487 0 : *total_sz += sizeof(fd_node_vote_accounts_t);
3488 0 : void const * start_data = ctx->data;
3489 0 : int err = fd_node_vote_accounts_decode_footprint_inner( ctx, total_sz );
3490 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3491 0 : ctx->data = start_data;
3492 0 : return err;
3493 0 : }
3494 0 : int fd_node_vote_accounts_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3495 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3496 0 : int err = 0;
3497 0 : ulong vote_accounts_len;
3498 0 : err = fd_bincode_uint64_decode( &vote_accounts_len, ctx );
3499 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3500 0 : if( vote_accounts_len ) {
3501 0 : *total_sz += FD_PUBKEY_ALIGN + FD_PUBKEY_FOOTPRINT*vote_accounts_len;
3502 0 : for( ulong i=0; i < vote_accounts_len; i++ ) {
3503 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
3504 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3505 0 : }
3506 0 : }
3507 0 : err = fd_bincode_uint64_decode_footprint( ctx );
3508 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3509 0 : return 0;
3510 0 : }
3511 0 : void * fd_node_vote_accounts_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3512 0 : fd_node_vote_accounts_t * self = (fd_node_vote_accounts_t *)mem;
3513 0 : fd_node_vote_accounts_new( self );
3514 0 : void * alloc_region = (uchar *)mem + sizeof(fd_node_vote_accounts_t);
3515 0 : void * * alloc_mem = &alloc_region;
3516 0 : fd_node_vote_accounts_decode_inner( mem, alloc_mem, ctx );
3517 0 : return self;
3518 0 : }
3519 0 : void fd_node_vote_accounts_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3520 0 : fd_node_vote_accounts_t * self = (fd_node_vote_accounts_t *)struct_mem;
3521 0 : fd_bincode_uint64_decode_unsafe( &self->vote_accounts_len, ctx );
3522 0 : if( self->vote_accounts_len ) {
3523 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_ALIGN );
3524 0 : self->vote_accounts = *alloc_mem;
3525 0 : *alloc_mem = (uchar *)(*alloc_mem) + FD_PUBKEY_FOOTPRINT*self->vote_accounts_len;
3526 0 : for( ulong i=0; i < self->vote_accounts_len; i++ ) {
3527 0 : fd_pubkey_new( self->vote_accounts + i );
3528 0 : fd_pubkey_decode_inner( self->vote_accounts + i, alloc_mem, ctx );
3529 0 : }
3530 0 : } else
3531 0 : self->vote_accounts = NULL;
3532 0 : fd_bincode_uint64_decode_unsafe( &self->total_stake, ctx );
3533 0 : }
3534 0 : void * fd_node_vote_accounts_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3535 0 : fd_node_vote_accounts_global_t * self = (fd_node_vote_accounts_global_t *)mem;
3536 0 : fd_node_vote_accounts_new( (fd_node_vote_accounts_t *)self );
3537 0 : void * alloc_region = (uchar *)mem + sizeof(fd_node_vote_accounts_global_t);
3538 0 : void * * alloc_mem = &alloc_region;
3539 0 : fd_node_vote_accounts_decode_inner_global( mem, alloc_mem, ctx );
3540 0 : return self;
3541 0 : }
3542 0 : void fd_node_vote_accounts_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3543 0 : fd_node_vote_accounts_global_t * self = (fd_node_vote_accounts_global_t *)struct_mem;
3544 0 : fd_bincode_uint64_decode_unsafe( &self->vote_accounts_len, ctx );
3545 0 : if( self->vote_accounts_len ) {
3546 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_ALIGN );
3547 0 : self->vote_accounts_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
3548 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
3549 0 : *alloc_mem = (uchar *)(*alloc_mem) + FD_PUBKEY_FOOTPRINT*self->vote_accounts_len;
3550 0 : for( ulong i=0; i < self->vote_accounts_len; i++ ) {
3551 0 : fd_pubkey_new( (fd_pubkey_t *)(cur_mem + FD_PUBKEY_FOOTPRINT * i) );
3552 0 : fd_pubkey_decode_inner_global( cur_mem + FD_PUBKEY_FOOTPRINT * i, alloc_mem, ctx );
3553 0 : }
3554 0 : } else
3555 0 : self->vote_accounts_gaddr = 0UL;
3556 0 : fd_bincode_uint64_decode_unsafe( &self->total_stake, ctx );
3557 0 : }
3558 0 : int fd_node_vote_accounts_convert_global_to_local( void const * global_self, fd_node_vote_accounts_t * self, fd_bincode_decode_ctx_t * ctx ) {
3559 0 : int err = 0;
3560 0 : fd_node_vote_accounts_global_t const * mem = (fd_node_vote_accounts_global_t const *)global_self;
3561 0 : self->vote_accounts_len = mem->vote_accounts_len;
3562 0 : self->vote_accounts = fd_wksp_laddr_fast( ctx->wksp, mem->vote_accounts_gaddr );
3563 0 : self->total_stake = mem->total_stake;
3564 0 : return FD_BINCODE_SUCCESS;
3565 0 : }
3566 0 : void fd_node_vote_accounts_new(fd_node_vote_accounts_t * self) {
3567 0 : fd_memset( self, 0, sizeof(fd_node_vote_accounts_t) );
3568 0 : }
3569 0 : void fd_node_vote_accounts_destroy( fd_node_vote_accounts_t * self ) {
3570 0 : if( self->vote_accounts ) {
3571 0 : for( ulong i=0; i < self->vote_accounts_len; i++ )
3572 0 : fd_pubkey_destroy( self->vote_accounts + i );
3573 0 : self->vote_accounts = NULL;
3574 0 : }
3575 0 : }
3576 :
3577 0 : ulong fd_node_vote_accounts_footprint( void ){ return FD_NODE_VOTE_ACCOUNTS_FOOTPRINT; }
3578 0 : ulong fd_node_vote_accounts_align( void ){ return FD_NODE_VOTE_ACCOUNTS_ALIGN; }
3579 :
3580 0 : void fd_node_vote_accounts_walk( void * w, fd_node_vote_accounts_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
3581 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_node_vote_accounts", level++ );
3582 0 : if( self->vote_accounts_len ) {
3583 0 : fun( w, NULL, "vote_accounts", FD_FLAMENCO_TYPE_ARR, "array", level++ );
3584 0 : for( ulong i=0; i < self->vote_accounts_len; i++ )
3585 0 : fd_pubkey_walk(w, self->vote_accounts + i, fun, "pubkey", level );
3586 0 : fun( w, NULL, "vote_accounts", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
3587 0 : }
3588 0 : fun( w, &self->total_stake, "total_stake", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
3589 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_node_vote_accounts", level-- );
3590 0 : }
3591 0 : ulong fd_node_vote_accounts_size( fd_node_vote_accounts_t const * self ) {
3592 0 : ulong size = 0;
3593 0 : do {
3594 0 : size += sizeof(ulong);
3595 0 : for( ulong i=0; i < self->vote_accounts_len; i++ )
3596 0 : size += fd_pubkey_size( self->vote_accounts + i );
3597 0 : } while(0);
3598 0 : size += sizeof(ulong);
3599 0 : return size;
3600 0 : }
3601 :
3602 0 : int fd_pubkey_node_vote_accounts_pair_encode( fd_pubkey_node_vote_accounts_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3603 0 : int err;
3604 0 : err = fd_pubkey_encode( &self->key, ctx );
3605 0 : if( FD_UNLIKELY( err ) ) return err;
3606 0 : err = fd_node_vote_accounts_encode( &self->value, ctx );
3607 0 : if( FD_UNLIKELY( err ) ) return err;
3608 0 : return FD_BINCODE_SUCCESS;
3609 0 : }
3610 0 : int fd_pubkey_node_vote_accounts_pair_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3611 0 : *total_sz += sizeof(fd_pubkey_node_vote_accounts_pair_t);
3612 0 : void const * start_data = ctx->data;
3613 0 : int err = fd_pubkey_node_vote_accounts_pair_decode_footprint_inner( ctx, total_sz );
3614 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3615 0 : ctx->data = start_data;
3616 0 : return err;
3617 0 : }
3618 0 : int fd_pubkey_node_vote_accounts_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3619 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3620 0 : int err = 0;
3621 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
3622 0 : if( FD_UNLIKELY( err ) ) return err;
3623 0 : err = fd_node_vote_accounts_decode_footprint_inner( ctx, total_sz );
3624 0 : if( FD_UNLIKELY( err ) ) return err;
3625 0 : return 0;
3626 0 : }
3627 0 : void * fd_pubkey_node_vote_accounts_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3628 0 : fd_pubkey_node_vote_accounts_pair_t * self = (fd_pubkey_node_vote_accounts_pair_t *)mem;
3629 0 : fd_pubkey_node_vote_accounts_pair_new( self );
3630 0 : void * alloc_region = (uchar *)mem + sizeof(fd_pubkey_node_vote_accounts_pair_t);
3631 0 : void * * alloc_mem = &alloc_region;
3632 0 : fd_pubkey_node_vote_accounts_pair_decode_inner( mem, alloc_mem, ctx );
3633 0 : return self;
3634 0 : }
3635 0 : void fd_pubkey_node_vote_accounts_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3636 0 : fd_pubkey_node_vote_accounts_pair_t * self = (fd_pubkey_node_vote_accounts_pair_t *)struct_mem;
3637 0 : fd_pubkey_decode_inner( &self->key, alloc_mem, ctx );
3638 0 : fd_node_vote_accounts_decode_inner( &self->value, alloc_mem, ctx );
3639 0 : }
3640 0 : void * fd_pubkey_node_vote_accounts_pair_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3641 0 : fd_pubkey_node_vote_accounts_pair_global_t * self = (fd_pubkey_node_vote_accounts_pair_global_t *)mem;
3642 0 : fd_pubkey_node_vote_accounts_pair_new( (fd_pubkey_node_vote_accounts_pair_t *)self );
3643 0 : void * alloc_region = (uchar *)mem + sizeof(fd_pubkey_node_vote_accounts_pair_global_t);
3644 0 : void * * alloc_mem = &alloc_region;
3645 0 : fd_pubkey_node_vote_accounts_pair_decode_inner_global( mem, alloc_mem, ctx );
3646 0 : return self;
3647 0 : }
3648 0 : void fd_pubkey_node_vote_accounts_pair_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3649 0 : fd_pubkey_node_vote_accounts_pair_global_t * self = (fd_pubkey_node_vote_accounts_pair_global_t *)struct_mem;
3650 0 : fd_pubkey_decode_inner_global( &self->key, alloc_mem, ctx );
3651 0 : fd_node_vote_accounts_decode_inner_global( &self->value, alloc_mem, ctx );
3652 0 : }
3653 0 : int fd_pubkey_node_vote_accounts_pair_convert_global_to_local( void const * global_self, fd_pubkey_node_vote_accounts_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
3654 0 : int err = 0;
3655 0 : fd_pubkey_node_vote_accounts_pair_global_t const * mem = (fd_pubkey_node_vote_accounts_pair_global_t const *)global_self;
3656 0 : err = fd_pubkey_convert_global_to_local( &mem->key, &self->key, ctx );
3657 0 : if( FD_UNLIKELY( err ) ) return err;
3658 0 : err = fd_node_vote_accounts_convert_global_to_local( &mem->value, &self->value, ctx );
3659 0 : if( FD_UNLIKELY( err ) ) return err;
3660 0 : return FD_BINCODE_SUCCESS;
3661 0 : }
3662 0 : void fd_pubkey_node_vote_accounts_pair_new(fd_pubkey_node_vote_accounts_pair_t * self) {
3663 0 : fd_memset( self, 0, sizeof(fd_pubkey_node_vote_accounts_pair_t) );
3664 0 : fd_pubkey_new( &self->key );
3665 0 : fd_node_vote_accounts_new( &self->value );
3666 0 : }
3667 0 : void fd_pubkey_node_vote_accounts_pair_destroy( fd_pubkey_node_vote_accounts_pair_t * self ) {
3668 0 : fd_pubkey_destroy( &self->key );
3669 0 : fd_node_vote_accounts_destroy( &self->value );
3670 0 : }
3671 :
3672 0 : ulong fd_pubkey_node_vote_accounts_pair_footprint( void ){ return FD_PUBKEY_NODE_VOTE_ACCOUNTS_PAIR_FOOTPRINT; }
3673 0 : ulong fd_pubkey_node_vote_accounts_pair_align( void ){ return FD_PUBKEY_NODE_VOTE_ACCOUNTS_PAIR_ALIGN; }
3674 :
3675 0 : void fd_pubkey_node_vote_accounts_pair_walk( void * w, fd_pubkey_node_vote_accounts_pair_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
3676 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_pubkey_node_vote_accounts_pair", level++ );
3677 0 : fd_pubkey_walk( w, &self->key, fun, "key", level );
3678 0 : fd_node_vote_accounts_walk( w, &self->value, fun, "value", level );
3679 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_pubkey_node_vote_accounts_pair", level-- );
3680 0 : }
3681 0 : ulong fd_pubkey_node_vote_accounts_pair_size( fd_pubkey_node_vote_accounts_pair_t const * self ) {
3682 0 : ulong size = 0;
3683 0 : size += fd_pubkey_size( &self->key );
3684 0 : size += fd_node_vote_accounts_size( &self->value );
3685 0 : return size;
3686 0 : }
3687 :
3688 0 : int fd_pubkey_pubkey_pair_encode( fd_pubkey_pubkey_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3689 0 : int err;
3690 0 : err = fd_pubkey_encode( &self->key, ctx );
3691 0 : if( FD_UNLIKELY( err ) ) return err;
3692 0 : err = fd_pubkey_encode( &self->value, ctx );
3693 0 : if( FD_UNLIKELY( err ) ) return err;
3694 0 : return FD_BINCODE_SUCCESS;
3695 0 : }
3696 0 : int fd_pubkey_pubkey_pair_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3697 0 : *total_sz += sizeof(fd_pubkey_pubkey_pair_t);
3698 0 : void const * start_data = ctx->data;
3699 0 : int err = fd_pubkey_pubkey_pair_decode_footprint_inner( ctx, total_sz );
3700 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3701 0 : ctx->data = start_data;
3702 0 : return err;
3703 0 : }
3704 0 : int fd_pubkey_pubkey_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3705 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3706 0 : int err = 0;
3707 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
3708 0 : if( FD_UNLIKELY( err ) ) return err;
3709 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
3710 0 : if( FD_UNLIKELY( err ) ) return err;
3711 0 : return 0;
3712 0 : }
3713 0 : void * fd_pubkey_pubkey_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3714 0 : fd_pubkey_pubkey_pair_t * self = (fd_pubkey_pubkey_pair_t *)mem;
3715 0 : fd_pubkey_pubkey_pair_new( self );
3716 0 : void * alloc_region = (uchar *)mem + sizeof(fd_pubkey_pubkey_pair_t);
3717 0 : void * * alloc_mem = &alloc_region;
3718 0 : fd_pubkey_pubkey_pair_decode_inner( mem, alloc_mem, ctx );
3719 0 : return self;
3720 0 : }
3721 0 : void fd_pubkey_pubkey_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3722 0 : fd_pubkey_pubkey_pair_t * self = (fd_pubkey_pubkey_pair_t *)struct_mem;
3723 0 : fd_pubkey_decode_inner( &self->key, alloc_mem, ctx );
3724 0 : fd_pubkey_decode_inner( &self->value, alloc_mem, ctx );
3725 0 : }
3726 0 : void * fd_pubkey_pubkey_pair_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3727 0 : fd_pubkey_pubkey_pair_global_t * self = (fd_pubkey_pubkey_pair_global_t *)mem;
3728 0 : fd_pubkey_pubkey_pair_new( (fd_pubkey_pubkey_pair_t *)self );
3729 0 : void * alloc_region = (uchar *)mem + sizeof(fd_pubkey_pubkey_pair_global_t);
3730 0 : void * * alloc_mem = &alloc_region;
3731 0 : fd_pubkey_pubkey_pair_decode_inner_global( mem, alloc_mem, ctx );
3732 0 : return self;
3733 0 : }
3734 0 : void fd_pubkey_pubkey_pair_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3735 0 : fd_pubkey_pubkey_pair_global_t * self = (fd_pubkey_pubkey_pair_global_t *)struct_mem;
3736 0 : fd_pubkey_decode_inner_global( &self->key, alloc_mem, ctx );
3737 0 : fd_pubkey_decode_inner_global( &self->value, alloc_mem, ctx );
3738 0 : }
3739 0 : int fd_pubkey_pubkey_pair_convert_global_to_local( void const * global_self, fd_pubkey_pubkey_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
3740 0 : int err = 0;
3741 0 : fd_pubkey_pubkey_pair_global_t const * mem = (fd_pubkey_pubkey_pair_global_t const *)global_self;
3742 0 : err = fd_pubkey_convert_global_to_local( &mem->key, &self->key, ctx );
3743 0 : if( FD_UNLIKELY( err ) ) return err;
3744 0 : err = fd_pubkey_convert_global_to_local( &mem->value, &self->value, ctx );
3745 0 : if( FD_UNLIKELY( err ) ) return err;
3746 0 : return FD_BINCODE_SUCCESS;
3747 0 : }
3748 0 : void fd_pubkey_pubkey_pair_new(fd_pubkey_pubkey_pair_t * self) {
3749 0 : fd_memset( self, 0, sizeof(fd_pubkey_pubkey_pair_t) );
3750 0 : fd_pubkey_new( &self->key );
3751 0 : fd_pubkey_new( &self->value );
3752 0 : }
3753 0 : void fd_pubkey_pubkey_pair_destroy( fd_pubkey_pubkey_pair_t * self ) {
3754 0 : fd_pubkey_destroy( &self->key );
3755 0 : fd_pubkey_destroy( &self->value );
3756 0 : }
3757 :
3758 0 : ulong fd_pubkey_pubkey_pair_footprint( void ){ return FD_PUBKEY_PUBKEY_PAIR_FOOTPRINT; }
3759 0 : ulong fd_pubkey_pubkey_pair_align( void ){ return FD_PUBKEY_PUBKEY_PAIR_ALIGN; }
3760 :
3761 0 : void fd_pubkey_pubkey_pair_walk( void * w, fd_pubkey_pubkey_pair_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
3762 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_pubkey_pubkey_pair", level++ );
3763 0 : fd_pubkey_walk( w, &self->key, fun, "key", level );
3764 0 : fd_pubkey_walk( w, &self->value, fun, "value", level );
3765 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_pubkey_pubkey_pair", level-- );
3766 0 : }
3767 0 : ulong fd_pubkey_pubkey_pair_size( fd_pubkey_pubkey_pair_t const * self ) {
3768 0 : ulong size = 0;
3769 0 : size += fd_pubkey_size( &self->key );
3770 0 : size += fd_pubkey_size( &self->value );
3771 0 : return size;
3772 0 : }
3773 :
3774 0 : int fd_epoch_stakes_encode( fd_epoch_stakes_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3775 0 : int err;
3776 0 : err = fd_stakes_encode( &self->stakes, ctx );
3777 0 : if( FD_UNLIKELY( err ) ) return err;
3778 0 : err = fd_bincode_uint64_encode( self->total_stake, ctx );
3779 0 : if( FD_UNLIKELY( err ) ) return err;
3780 0 : err = fd_bincode_uint64_encode( self->node_id_to_vote_accounts_len, ctx );
3781 0 : if( FD_UNLIKELY(err) ) return err;
3782 0 : if( self->node_id_to_vote_accounts_len ) {
3783 0 : for( ulong i=0; i < self->node_id_to_vote_accounts_len; i++ ) {
3784 0 : err = fd_pubkey_node_vote_accounts_pair_encode( self->node_id_to_vote_accounts + i, ctx );
3785 0 : if( FD_UNLIKELY( err ) ) return err;
3786 0 : }
3787 0 : }
3788 0 : err = fd_bincode_uint64_encode( self->epoch_authorized_voters_len, ctx );
3789 0 : if( FD_UNLIKELY(err) ) return err;
3790 0 : if( self->epoch_authorized_voters_len ) {
3791 0 : for( ulong i=0; i < self->epoch_authorized_voters_len; i++ ) {
3792 0 : err = fd_pubkey_pubkey_pair_encode( self->epoch_authorized_voters + i, ctx );
3793 0 : if( FD_UNLIKELY( err ) ) return err;
3794 0 : }
3795 0 : }
3796 0 : return FD_BINCODE_SUCCESS;
3797 0 : }
3798 0 : int fd_epoch_stakes_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3799 0 : *total_sz += sizeof(fd_epoch_stakes_t);
3800 0 : void const * start_data = ctx->data;
3801 0 : int err = fd_epoch_stakes_decode_footprint_inner( ctx, total_sz );
3802 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3803 0 : ctx->data = start_data;
3804 0 : return err;
3805 0 : }
3806 0 : int fd_epoch_stakes_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3807 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3808 0 : int err = 0;
3809 0 : err = fd_stakes_decode_footprint_inner( ctx, total_sz );
3810 0 : if( FD_UNLIKELY( err ) ) return err;
3811 0 : err = fd_bincode_uint64_decode_footprint( ctx );
3812 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3813 0 : ulong node_id_to_vote_accounts_len;
3814 0 : err = fd_bincode_uint64_decode( &node_id_to_vote_accounts_len, ctx );
3815 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3816 0 : if( node_id_to_vote_accounts_len ) {
3817 0 : *total_sz += FD_PUBKEY_NODE_VOTE_ACCOUNTS_PAIR_ALIGN + FD_PUBKEY_NODE_VOTE_ACCOUNTS_PAIR_FOOTPRINT*node_id_to_vote_accounts_len;
3818 0 : for( ulong i=0; i < node_id_to_vote_accounts_len; i++ ) {
3819 0 : err = fd_pubkey_node_vote_accounts_pair_decode_footprint_inner( ctx, total_sz );
3820 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3821 0 : }
3822 0 : }
3823 0 : ulong epoch_authorized_voters_len;
3824 0 : err = fd_bincode_uint64_decode( &epoch_authorized_voters_len, ctx );
3825 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3826 0 : if( epoch_authorized_voters_len ) {
3827 0 : *total_sz += FD_PUBKEY_PUBKEY_PAIR_ALIGN + FD_PUBKEY_PUBKEY_PAIR_FOOTPRINT*epoch_authorized_voters_len;
3828 0 : for( ulong i=0; i < epoch_authorized_voters_len; i++ ) {
3829 0 : err = fd_pubkey_pubkey_pair_decode_footprint_inner( ctx, total_sz );
3830 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3831 0 : }
3832 0 : }
3833 0 : return 0;
3834 0 : }
3835 0 : void * fd_epoch_stakes_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3836 0 : fd_epoch_stakes_t * self = (fd_epoch_stakes_t *)mem;
3837 0 : fd_epoch_stakes_new( self );
3838 0 : void * alloc_region = (uchar *)mem + sizeof(fd_epoch_stakes_t);
3839 0 : void * * alloc_mem = &alloc_region;
3840 0 : fd_epoch_stakes_decode_inner( mem, alloc_mem, ctx );
3841 0 : return self;
3842 0 : }
3843 0 : void fd_epoch_stakes_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3844 0 : fd_epoch_stakes_t * self = (fd_epoch_stakes_t *)struct_mem;
3845 0 : fd_stakes_decode_inner( &self->stakes, alloc_mem, ctx );
3846 0 : fd_bincode_uint64_decode_unsafe( &self->total_stake, ctx );
3847 0 : fd_bincode_uint64_decode_unsafe( &self->node_id_to_vote_accounts_len, ctx );
3848 0 : if( self->node_id_to_vote_accounts_len ) {
3849 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_NODE_VOTE_ACCOUNTS_PAIR_ALIGN );
3850 0 : self->node_id_to_vote_accounts = *alloc_mem;
3851 0 : *alloc_mem = (uchar *)(*alloc_mem) + FD_PUBKEY_NODE_VOTE_ACCOUNTS_PAIR_FOOTPRINT*self->node_id_to_vote_accounts_len;
3852 0 : for( ulong i=0; i < self->node_id_to_vote_accounts_len; i++ ) {
3853 0 : fd_pubkey_node_vote_accounts_pair_new( self->node_id_to_vote_accounts + i );
3854 0 : fd_pubkey_node_vote_accounts_pair_decode_inner( self->node_id_to_vote_accounts + i, alloc_mem, ctx );
3855 0 : }
3856 0 : } else
3857 0 : self->node_id_to_vote_accounts = NULL;
3858 0 : fd_bincode_uint64_decode_unsafe( &self->epoch_authorized_voters_len, ctx );
3859 0 : if( self->epoch_authorized_voters_len ) {
3860 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_PUBKEY_PAIR_ALIGN );
3861 0 : self->epoch_authorized_voters = *alloc_mem;
3862 0 : *alloc_mem = (uchar *)(*alloc_mem) + FD_PUBKEY_PUBKEY_PAIR_FOOTPRINT*self->epoch_authorized_voters_len;
3863 0 : for( ulong i=0; i < self->epoch_authorized_voters_len; i++ ) {
3864 0 : fd_pubkey_pubkey_pair_new( self->epoch_authorized_voters + i );
3865 0 : fd_pubkey_pubkey_pair_decode_inner( self->epoch_authorized_voters + i, alloc_mem, ctx );
3866 0 : }
3867 0 : } else
3868 0 : self->epoch_authorized_voters = NULL;
3869 0 : }
3870 0 : void * fd_epoch_stakes_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3871 0 : fd_epoch_stakes_global_t * self = (fd_epoch_stakes_global_t *)mem;
3872 0 : fd_epoch_stakes_new( (fd_epoch_stakes_t *)self );
3873 0 : void * alloc_region = (uchar *)mem + sizeof(fd_epoch_stakes_global_t);
3874 0 : void * * alloc_mem = &alloc_region;
3875 0 : fd_epoch_stakes_decode_inner_global( mem, alloc_mem, ctx );
3876 0 : return self;
3877 0 : }
3878 0 : void fd_epoch_stakes_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3879 0 : fd_epoch_stakes_global_t * self = (fd_epoch_stakes_global_t *)struct_mem;
3880 0 : fd_stakes_decode_inner_global( &self->stakes, alloc_mem, ctx );
3881 0 : fd_bincode_uint64_decode_unsafe( &self->total_stake, ctx );
3882 0 : fd_bincode_uint64_decode_unsafe( &self->node_id_to_vote_accounts_len, ctx );
3883 0 : if( self->node_id_to_vote_accounts_len ) {
3884 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_NODE_VOTE_ACCOUNTS_PAIR_ALIGN );
3885 0 : self->node_id_to_vote_accounts_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
3886 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
3887 0 : *alloc_mem = (uchar *)(*alloc_mem) + FD_PUBKEY_NODE_VOTE_ACCOUNTS_PAIR_FOOTPRINT*self->node_id_to_vote_accounts_len;
3888 0 : for( ulong i=0; i < self->node_id_to_vote_accounts_len; i++ ) {
3889 0 : fd_pubkey_node_vote_accounts_pair_new( (fd_pubkey_node_vote_accounts_pair_t *)(cur_mem + FD_PUBKEY_NODE_VOTE_ACCOUNTS_PAIR_FOOTPRINT * i) );
3890 0 : fd_pubkey_node_vote_accounts_pair_decode_inner_global( cur_mem + FD_PUBKEY_NODE_VOTE_ACCOUNTS_PAIR_FOOTPRINT * i, alloc_mem, ctx );
3891 0 : }
3892 0 : } else
3893 0 : self->node_id_to_vote_accounts_gaddr = 0UL;
3894 0 : fd_bincode_uint64_decode_unsafe( &self->epoch_authorized_voters_len, ctx );
3895 0 : if( self->epoch_authorized_voters_len ) {
3896 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_PUBKEY_PAIR_ALIGN );
3897 0 : self->epoch_authorized_voters_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
3898 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
3899 0 : *alloc_mem = (uchar *)(*alloc_mem) + FD_PUBKEY_PUBKEY_PAIR_FOOTPRINT*self->epoch_authorized_voters_len;
3900 0 : for( ulong i=0; i < self->epoch_authorized_voters_len; i++ ) {
3901 0 : fd_pubkey_pubkey_pair_new( (fd_pubkey_pubkey_pair_t *)(cur_mem + FD_PUBKEY_PUBKEY_PAIR_FOOTPRINT * i) );
3902 0 : fd_pubkey_pubkey_pair_decode_inner_global( cur_mem + FD_PUBKEY_PUBKEY_PAIR_FOOTPRINT * i, alloc_mem, ctx );
3903 0 : }
3904 0 : } else
3905 0 : self->epoch_authorized_voters_gaddr = 0UL;
3906 0 : }
3907 0 : int fd_epoch_stakes_convert_global_to_local( void const * global_self, fd_epoch_stakes_t * self, fd_bincode_decode_ctx_t * ctx ) {
3908 0 : int err = 0;
3909 0 : fd_epoch_stakes_global_t const * mem = (fd_epoch_stakes_global_t const *)global_self;
3910 0 : err = fd_stakes_convert_global_to_local( &mem->stakes, &self->stakes, ctx );
3911 0 : if( FD_UNLIKELY( err ) ) return err;
3912 0 : self->total_stake = mem->total_stake;
3913 0 : self->node_id_to_vote_accounts_len = mem->node_id_to_vote_accounts_len;
3914 0 : self->node_id_to_vote_accounts = fd_wksp_laddr_fast( ctx->wksp, mem->node_id_to_vote_accounts_gaddr );
3915 0 : self->epoch_authorized_voters_len = mem->epoch_authorized_voters_len;
3916 0 : self->epoch_authorized_voters = fd_wksp_laddr_fast( ctx->wksp, mem->epoch_authorized_voters_gaddr );
3917 0 : return FD_BINCODE_SUCCESS;
3918 0 : }
3919 0 : void fd_epoch_stakes_new(fd_epoch_stakes_t * self) {
3920 0 : fd_memset( self, 0, sizeof(fd_epoch_stakes_t) );
3921 0 : fd_stakes_new( &self->stakes );
3922 0 : }
3923 0 : void fd_epoch_stakes_destroy( fd_epoch_stakes_t * self ) {
3924 0 : fd_stakes_destroy( &self->stakes );
3925 0 : if( self->node_id_to_vote_accounts ) {
3926 0 : for( ulong i=0; i < self->node_id_to_vote_accounts_len; i++ )
3927 0 : fd_pubkey_node_vote_accounts_pair_destroy( self->node_id_to_vote_accounts + i );
3928 0 : self->node_id_to_vote_accounts = NULL;
3929 0 : }
3930 0 : if( self->epoch_authorized_voters ) {
3931 0 : for( ulong i=0; i < self->epoch_authorized_voters_len; i++ )
3932 0 : fd_pubkey_pubkey_pair_destroy( self->epoch_authorized_voters + i );
3933 0 : self->epoch_authorized_voters = NULL;
3934 0 : }
3935 0 : }
3936 :
3937 0 : ulong fd_epoch_stakes_footprint( void ){ return FD_EPOCH_STAKES_FOOTPRINT; }
3938 0 : ulong fd_epoch_stakes_align( void ){ return FD_EPOCH_STAKES_ALIGN; }
3939 :
3940 0 : void fd_epoch_stakes_walk( void * w, fd_epoch_stakes_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
3941 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_epoch_stakes", level++ );
3942 0 : fd_stakes_walk( w, &self->stakes, fun, "stakes", level );
3943 0 : fun( w, &self->total_stake, "total_stake", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
3944 0 : if( self->node_id_to_vote_accounts_len ) {
3945 0 : fun( w, NULL, "node_id_to_vote_accounts", FD_FLAMENCO_TYPE_ARR, "array", level++ );
3946 0 : for( ulong i=0; i < self->node_id_to_vote_accounts_len; i++ )
3947 0 : fd_pubkey_node_vote_accounts_pair_walk(w, self->node_id_to_vote_accounts + i, fun, "pubkey_node_vote_accounts_pair", level );
3948 0 : fun( w, NULL, "node_id_to_vote_accounts", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
3949 0 : }
3950 0 : if( self->epoch_authorized_voters_len ) {
3951 0 : fun( w, NULL, "epoch_authorized_voters", FD_FLAMENCO_TYPE_ARR, "array", level++ );
3952 0 : for( ulong i=0; i < self->epoch_authorized_voters_len; i++ )
3953 0 : fd_pubkey_pubkey_pair_walk(w, self->epoch_authorized_voters + i, fun, "pubkey_pubkey_pair", level );
3954 0 : fun( w, NULL, "epoch_authorized_voters", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
3955 0 : }
3956 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_epoch_stakes", level-- );
3957 0 : }
3958 0 : ulong fd_epoch_stakes_size( fd_epoch_stakes_t const * self ) {
3959 0 : ulong size = 0;
3960 0 : size += fd_stakes_size( &self->stakes );
3961 0 : size += sizeof(ulong);
3962 0 : do {
3963 0 : size += sizeof(ulong);
3964 0 : for( ulong i=0; i < self->node_id_to_vote_accounts_len; i++ )
3965 0 : size += fd_pubkey_node_vote_accounts_pair_size( self->node_id_to_vote_accounts + i );
3966 0 : } while(0);
3967 0 : do {
3968 0 : size += sizeof(ulong);
3969 0 : for( ulong i=0; i < self->epoch_authorized_voters_len; i++ )
3970 0 : size += fd_pubkey_pubkey_pair_size( self->epoch_authorized_voters + i );
3971 0 : } while(0);
3972 0 : return size;
3973 0 : }
3974 :
3975 0 : int fd_epoch_epoch_stakes_pair_encode( fd_epoch_epoch_stakes_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3976 0 : int err;
3977 0 : err = fd_bincode_uint64_encode( self->key, ctx );
3978 0 : if( FD_UNLIKELY( err ) ) return err;
3979 0 : err = fd_epoch_stakes_encode( &self->value, ctx );
3980 0 : if( FD_UNLIKELY( err ) ) return err;
3981 0 : return FD_BINCODE_SUCCESS;
3982 0 : }
3983 0 : int fd_epoch_epoch_stakes_pair_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3984 0 : *total_sz += sizeof(fd_epoch_epoch_stakes_pair_t);
3985 0 : void const * start_data = ctx->data;
3986 0 : int err = fd_epoch_epoch_stakes_pair_decode_footprint_inner( ctx, total_sz );
3987 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3988 0 : ctx->data = start_data;
3989 0 : return err;
3990 0 : }
3991 0 : int fd_epoch_epoch_stakes_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3992 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3993 0 : int err = 0;
3994 0 : err = fd_bincode_uint64_decode_footprint( ctx );
3995 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3996 0 : err = fd_epoch_stakes_decode_footprint_inner( ctx, total_sz );
3997 0 : if( FD_UNLIKELY( err ) ) return err;
3998 0 : return 0;
3999 0 : }
4000 0 : void * fd_epoch_epoch_stakes_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4001 0 : fd_epoch_epoch_stakes_pair_t * self = (fd_epoch_epoch_stakes_pair_t *)mem;
4002 0 : fd_epoch_epoch_stakes_pair_new( self );
4003 0 : void * alloc_region = (uchar *)mem + sizeof(fd_epoch_epoch_stakes_pair_t);
4004 0 : void * * alloc_mem = &alloc_region;
4005 0 : fd_epoch_epoch_stakes_pair_decode_inner( mem, alloc_mem, ctx );
4006 0 : return self;
4007 0 : }
4008 0 : void fd_epoch_epoch_stakes_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4009 0 : fd_epoch_epoch_stakes_pair_t * self = (fd_epoch_epoch_stakes_pair_t *)struct_mem;
4010 0 : fd_bincode_uint64_decode_unsafe( &self->key, ctx );
4011 0 : fd_epoch_stakes_decode_inner( &self->value, alloc_mem, ctx );
4012 0 : }
4013 0 : void * fd_epoch_epoch_stakes_pair_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4014 0 : fd_epoch_epoch_stakes_pair_global_t * self = (fd_epoch_epoch_stakes_pair_global_t *)mem;
4015 0 : fd_epoch_epoch_stakes_pair_new( (fd_epoch_epoch_stakes_pair_t *)self );
4016 0 : void * alloc_region = (uchar *)mem + sizeof(fd_epoch_epoch_stakes_pair_global_t);
4017 0 : void * * alloc_mem = &alloc_region;
4018 0 : fd_epoch_epoch_stakes_pair_decode_inner_global( mem, alloc_mem, ctx );
4019 0 : return self;
4020 0 : }
4021 0 : void fd_epoch_epoch_stakes_pair_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4022 0 : fd_epoch_epoch_stakes_pair_global_t * self = (fd_epoch_epoch_stakes_pair_global_t *)struct_mem;
4023 0 : fd_bincode_uint64_decode_unsafe( &self->key, ctx );
4024 0 : fd_epoch_stakes_decode_inner_global( &self->value, alloc_mem, ctx );
4025 0 : }
4026 0 : int fd_epoch_epoch_stakes_pair_convert_global_to_local( void const * global_self, fd_epoch_epoch_stakes_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
4027 0 : int err = 0;
4028 0 : fd_epoch_epoch_stakes_pair_global_t const * mem = (fd_epoch_epoch_stakes_pair_global_t const *)global_self;
4029 0 : self->key = mem->key;
4030 0 : err = fd_epoch_stakes_convert_global_to_local( &mem->value, &self->value, ctx );
4031 0 : if( FD_UNLIKELY( err ) ) return err;
4032 0 : return FD_BINCODE_SUCCESS;
4033 0 : }
4034 0 : void fd_epoch_epoch_stakes_pair_new(fd_epoch_epoch_stakes_pair_t * self) {
4035 0 : fd_memset( self, 0, sizeof(fd_epoch_epoch_stakes_pair_t) );
4036 0 : fd_epoch_stakes_new( &self->value );
4037 0 : }
4038 0 : void fd_epoch_epoch_stakes_pair_destroy( fd_epoch_epoch_stakes_pair_t * self ) {
4039 0 : fd_epoch_stakes_destroy( &self->value );
4040 0 : }
4041 :
4042 0 : ulong fd_epoch_epoch_stakes_pair_footprint( void ){ return FD_EPOCH_EPOCH_STAKES_PAIR_FOOTPRINT; }
4043 0 : ulong fd_epoch_epoch_stakes_pair_align( void ){ return FD_EPOCH_EPOCH_STAKES_PAIR_ALIGN; }
4044 :
4045 0 : void fd_epoch_epoch_stakes_pair_walk( void * w, fd_epoch_epoch_stakes_pair_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
4046 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_epoch_epoch_stakes_pair", level++ );
4047 0 : fun( w, &self->key, "key", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
4048 0 : fd_epoch_stakes_walk( w, &self->value, fun, "value", level );
4049 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_epoch_epoch_stakes_pair", level-- );
4050 0 : }
4051 0 : ulong fd_epoch_epoch_stakes_pair_size( fd_epoch_epoch_stakes_pair_t const * self ) {
4052 0 : ulong size = 0;
4053 0 : size += sizeof(ulong);
4054 0 : size += fd_epoch_stakes_size( &self->value );
4055 0 : return size;
4056 0 : }
4057 :
4058 0 : int fd_pubkey_u64_pair_encode( fd_pubkey_u64_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4059 0 : int err;
4060 0 : err = fd_pubkey_encode( &self->_0, ctx );
4061 0 : if( FD_UNLIKELY( err ) ) return err;
4062 0 : err = fd_bincode_uint64_encode( self->_1, ctx );
4063 0 : if( FD_UNLIKELY( err ) ) return err;
4064 0 : return FD_BINCODE_SUCCESS;
4065 0 : }
4066 0 : int fd_pubkey_u64_pair_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4067 0 : *total_sz += sizeof(fd_pubkey_u64_pair_t);
4068 0 : void const * start_data = ctx->data;
4069 0 : int err = fd_pubkey_u64_pair_decode_footprint_inner( ctx, total_sz );
4070 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4071 0 : ctx->data = start_data;
4072 0 : return err;
4073 0 : }
4074 0 : int fd_pubkey_u64_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4075 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4076 0 : int err = 0;
4077 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
4078 0 : if( FD_UNLIKELY( err ) ) return err;
4079 0 : err = fd_bincode_uint64_decode_footprint( ctx );
4080 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4081 0 : return 0;
4082 0 : }
4083 0 : void * fd_pubkey_u64_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4084 0 : fd_pubkey_u64_pair_t * self = (fd_pubkey_u64_pair_t *)mem;
4085 0 : fd_pubkey_u64_pair_new( self );
4086 0 : void * alloc_region = (uchar *)mem + sizeof(fd_pubkey_u64_pair_t);
4087 0 : void * * alloc_mem = &alloc_region;
4088 0 : fd_pubkey_u64_pair_decode_inner( mem, alloc_mem, ctx );
4089 0 : return self;
4090 0 : }
4091 0 : void fd_pubkey_u64_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4092 0 : fd_pubkey_u64_pair_t * self = (fd_pubkey_u64_pair_t *)struct_mem;
4093 0 : fd_pubkey_decode_inner( &self->_0, alloc_mem, ctx );
4094 0 : fd_bincode_uint64_decode_unsafe( &self->_1, ctx );
4095 0 : }
4096 0 : void * fd_pubkey_u64_pair_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4097 0 : fd_pubkey_u64_pair_global_t * self = (fd_pubkey_u64_pair_global_t *)mem;
4098 0 : fd_pubkey_u64_pair_new( (fd_pubkey_u64_pair_t *)self );
4099 0 : void * alloc_region = (uchar *)mem + sizeof(fd_pubkey_u64_pair_global_t);
4100 0 : void * * alloc_mem = &alloc_region;
4101 0 : fd_pubkey_u64_pair_decode_inner_global( mem, alloc_mem, ctx );
4102 0 : return self;
4103 0 : }
4104 0 : void fd_pubkey_u64_pair_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4105 0 : fd_pubkey_u64_pair_global_t * self = (fd_pubkey_u64_pair_global_t *)struct_mem;
4106 0 : fd_pubkey_decode_inner_global( &self->_0, alloc_mem, ctx );
4107 0 : fd_bincode_uint64_decode_unsafe( &self->_1, ctx );
4108 0 : }
4109 0 : int fd_pubkey_u64_pair_convert_global_to_local( void const * global_self, fd_pubkey_u64_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
4110 0 : int err = 0;
4111 0 : fd_pubkey_u64_pair_global_t const * mem = (fd_pubkey_u64_pair_global_t const *)global_self;
4112 0 : err = fd_pubkey_convert_global_to_local( &mem->_0, &self->_0, ctx );
4113 0 : if( FD_UNLIKELY( err ) ) return err;
4114 0 : self->_1 = mem->_1;
4115 0 : return FD_BINCODE_SUCCESS;
4116 0 : }
4117 0 : void fd_pubkey_u64_pair_new(fd_pubkey_u64_pair_t * self) {
4118 0 : fd_memset( self, 0, sizeof(fd_pubkey_u64_pair_t) );
4119 0 : fd_pubkey_new( &self->_0 );
4120 0 : }
4121 0 : void fd_pubkey_u64_pair_destroy( fd_pubkey_u64_pair_t * self ) {
4122 0 : fd_pubkey_destroy( &self->_0 );
4123 0 : }
4124 :
4125 0 : ulong fd_pubkey_u64_pair_footprint( void ){ return FD_PUBKEY_U64_PAIR_FOOTPRINT; }
4126 0 : ulong fd_pubkey_u64_pair_align( void ){ return FD_PUBKEY_U64_PAIR_ALIGN; }
4127 :
4128 0 : void fd_pubkey_u64_pair_walk( void * w, fd_pubkey_u64_pair_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
4129 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_pubkey_u64_pair", level++ );
4130 0 : fd_pubkey_walk( w, &self->_0, fun, "_0", level );
4131 0 : fun( w, &self->_1, "_1", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
4132 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_pubkey_u64_pair", level-- );
4133 0 : }
4134 0 : ulong fd_pubkey_u64_pair_size( fd_pubkey_u64_pair_t const * self ) {
4135 0 : ulong size = 0;
4136 0 : size += fd_pubkey_size( &self->_0 );
4137 0 : size += sizeof(ulong);
4138 0 : return size;
4139 0 : }
4140 :
4141 6 : int fd_unused_accounts_encode( fd_unused_accounts_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4142 6 : int err;
4143 6 : err = fd_bincode_uint64_encode( self->unused1_len, ctx );
4144 6 : if( FD_UNLIKELY(err) ) return err;
4145 6 : if( self->unused1_len ) {
4146 0 : for( ulong i=0; i < self->unused1_len; i++ ) {
4147 0 : err = fd_pubkey_encode( self->unused1 + i, ctx );
4148 0 : if( FD_UNLIKELY( err ) ) return err;
4149 0 : }
4150 0 : }
4151 6 : err = fd_bincode_uint64_encode( self->unused2_len, ctx );
4152 6 : if( FD_UNLIKELY(err) ) return err;
4153 6 : if( self->unused2_len ) {
4154 0 : for( ulong i=0; i < self->unused2_len; i++ ) {
4155 0 : err = fd_pubkey_encode( self->unused2 + i, ctx );
4156 0 : if( FD_UNLIKELY( err ) ) return err;
4157 0 : }
4158 0 : }
4159 6 : err = fd_bincode_uint64_encode( self->unused3_len, ctx );
4160 6 : if( FD_UNLIKELY(err) ) return err;
4161 6 : if( self->unused3_len ) {
4162 0 : for( ulong i=0; i < self->unused3_len; i++ ) {
4163 0 : err = fd_pubkey_u64_pair_encode( self->unused3 + i, ctx );
4164 0 : if( FD_UNLIKELY( err ) ) return err;
4165 0 : }
4166 0 : }
4167 6 : return FD_BINCODE_SUCCESS;
4168 6 : }
4169 0 : int fd_unused_accounts_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4170 0 : *total_sz += sizeof(fd_unused_accounts_t);
4171 0 : void const * start_data = ctx->data;
4172 0 : int err = fd_unused_accounts_decode_footprint_inner( ctx, total_sz );
4173 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4174 0 : ctx->data = start_data;
4175 0 : return err;
4176 0 : }
4177 6 : int fd_unused_accounts_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4178 6 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4179 6 : int err = 0;
4180 6 : ulong unused1_len;
4181 6 : err = fd_bincode_uint64_decode( &unused1_len, ctx );
4182 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4183 6 : if( unused1_len ) {
4184 0 : *total_sz += FD_PUBKEY_ALIGN + FD_PUBKEY_FOOTPRINT*unused1_len;
4185 0 : for( ulong i=0; i < unused1_len; i++ ) {
4186 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
4187 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4188 0 : }
4189 0 : }
4190 6 : ulong unused2_len;
4191 6 : err = fd_bincode_uint64_decode( &unused2_len, ctx );
4192 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4193 6 : if( unused2_len ) {
4194 0 : *total_sz += FD_PUBKEY_ALIGN + FD_PUBKEY_FOOTPRINT*unused2_len;
4195 0 : for( ulong i=0; i < unused2_len; i++ ) {
4196 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
4197 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4198 0 : }
4199 0 : }
4200 6 : ulong unused3_len;
4201 6 : err = fd_bincode_uint64_decode( &unused3_len, ctx );
4202 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4203 6 : if( unused3_len ) {
4204 0 : *total_sz += FD_PUBKEY_U64_PAIR_ALIGN + FD_PUBKEY_U64_PAIR_FOOTPRINT*unused3_len;
4205 0 : for( ulong i=0; i < unused3_len; i++ ) {
4206 0 : err = fd_pubkey_u64_pair_decode_footprint_inner( ctx, total_sz );
4207 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4208 0 : }
4209 0 : }
4210 6 : return 0;
4211 6 : }
4212 0 : void * fd_unused_accounts_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4213 0 : fd_unused_accounts_t * self = (fd_unused_accounts_t *)mem;
4214 0 : fd_unused_accounts_new( self );
4215 0 : void * alloc_region = (uchar *)mem + sizeof(fd_unused_accounts_t);
4216 0 : void * * alloc_mem = &alloc_region;
4217 0 : fd_unused_accounts_decode_inner( mem, alloc_mem, ctx );
4218 0 : return self;
4219 0 : }
4220 6 : void fd_unused_accounts_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4221 6 : fd_unused_accounts_t * self = (fd_unused_accounts_t *)struct_mem;
4222 6 : fd_bincode_uint64_decode_unsafe( &self->unused1_len, ctx );
4223 6 : if( self->unused1_len ) {
4224 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_ALIGN );
4225 0 : self->unused1 = *alloc_mem;
4226 0 : *alloc_mem = (uchar *)(*alloc_mem) + FD_PUBKEY_FOOTPRINT*self->unused1_len;
4227 0 : for( ulong i=0; i < self->unused1_len; i++ ) {
4228 0 : fd_pubkey_new( self->unused1 + i );
4229 0 : fd_pubkey_decode_inner( self->unused1 + i, alloc_mem, ctx );
4230 0 : }
4231 0 : } else
4232 6 : self->unused1 = NULL;
4233 6 : fd_bincode_uint64_decode_unsafe( &self->unused2_len, ctx );
4234 6 : if( self->unused2_len ) {
4235 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_ALIGN );
4236 0 : self->unused2 = *alloc_mem;
4237 0 : *alloc_mem = (uchar *)(*alloc_mem) + FD_PUBKEY_FOOTPRINT*self->unused2_len;
4238 0 : for( ulong i=0; i < self->unused2_len; i++ ) {
4239 0 : fd_pubkey_new( self->unused2 + i );
4240 0 : fd_pubkey_decode_inner( self->unused2 + i, alloc_mem, ctx );
4241 0 : }
4242 0 : } else
4243 6 : self->unused2 = NULL;
4244 6 : fd_bincode_uint64_decode_unsafe( &self->unused3_len, ctx );
4245 6 : if( self->unused3_len ) {
4246 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_U64_PAIR_ALIGN );
4247 0 : self->unused3 = *alloc_mem;
4248 0 : *alloc_mem = (uchar *)(*alloc_mem) + FD_PUBKEY_U64_PAIR_FOOTPRINT*self->unused3_len;
4249 0 : for( ulong i=0; i < self->unused3_len; i++ ) {
4250 0 : fd_pubkey_u64_pair_new( self->unused3 + i );
4251 0 : fd_pubkey_u64_pair_decode_inner( self->unused3 + i, alloc_mem, ctx );
4252 0 : }
4253 0 : } else
4254 6 : self->unused3 = NULL;
4255 6 : }
4256 0 : void * fd_unused_accounts_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4257 0 : fd_unused_accounts_global_t * self = (fd_unused_accounts_global_t *)mem;
4258 0 : fd_unused_accounts_new( (fd_unused_accounts_t *)self );
4259 0 : void * alloc_region = (uchar *)mem + sizeof(fd_unused_accounts_global_t);
4260 0 : void * * alloc_mem = &alloc_region;
4261 0 : fd_unused_accounts_decode_inner_global( mem, alloc_mem, ctx );
4262 0 : return self;
4263 0 : }
4264 0 : void fd_unused_accounts_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4265 0 : fd_unused_accounts_global_t * self = (fd_unused_accounts_global_t *)struct_mem;
4266 0 : fd_bincode_uint64_decode_unsafe( &self->unused1_len, ctx );
4267 0 : if( self->unused1_len ) {
4268 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_ALIGN );
4269 0 : self->unused1_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
4270 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
4271 0 : *alloc_mem = (uchar *)(*alloc_mem) + FD_PUBKEY_FOOTPRINT*self->unused1_len;
4272 0 : for( ulong i=0; i < self->unused1_len; i++ ) {
4273 0 : fd_pubkey_new( (fd_pubkey_t *)(cur_mem + FD_PUBKEY_FOOTPRINT * i) );
4274 0 : fd_pubkey_decode_inner_global( cur_mem + FD_PUBKEY_FOOTPRINT * i, alloc_mem, ctx );
4275 0 : }
4276 0 : } else
4277 0 : self->unused1_gaddr = 0UL;
4278 0 : fd_bincode_uint64_decode_unsafe( &self->unused2_len, ctx );
4279 0 : if( self->unused2_len ) {
4280 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_ALIGN );
4281 0 : self->unused2_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
4282 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
4283 0 : *alloc_mem = (uchar *)(*alloc_mem) + FD_PUBKEY_FOOTPRINT*self->unused2_len;
4284 0 : for( ulong i=0; i < self->unused2_len; i++ ) {
4285 0 : fd_pubkey_new( (fd_pubkey_t *)(cur_mem + FD_PUBKEY_FOOTPRINT * i) );
4286 0 : fd_pubkey_decode_inner_global( cur_mem + FD_PUBKEY_FOOTPRINT * i, alloc_mem, ctx );
4287 0 : }
4288 0 : } else
4289 0 : self->unused2_gaddr = 0UL;
4290 0 : fd_bincode_uint64_decode_unsafe( &self->unused3_len, ctx );
4291 0 : if( self->unused3_len ) {
4292 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_U64_PAIR_ALIGN );
4293 0 : self->unused3_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
4294 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
4295 0 : *alloc_mem = (uchar *)(*alloc_mem) + FD_PUBKEY_U64_PAIR_FOOTPRINT*self->unused3_len;
4296 0 : for( ulong i=0; i < self->unused3_len; i++ ) {
4297 0 : fd_pubkey_u64_pair_new( (fd_pubkey_u64_pair_t *)(cur_mem + FD_PUBKEY_U64_PAIR_FOOTPRINT * i) );
4298 0 : fd_pubkey_u64_pair_decode_inner_global( cur_mem + FD_PUBKEY_U64_PAIR_FOOTPRINT * i, alloc_mem, ctx );
4299 0 : }
4300 0 : } else
4301 0 : self->unused3_gaddr = 0UL;
4302 0 : }
4303 0 : int fd_unused_accounts_convert_global_to_local( void const * global_self, fd_unused_accounts_t * self, fd_bincode_decode_ctx_t * ctx ) {
4304 0 : int err = 0;
4305 0 : fd_unused_accounts_global_t const * mem = (fd_unused_accounts_global_t const *)global_self;
4306 0 : self->unused1_len = mem->unused1_len;
4307 0 : self->unused1 = fd_wksp_laddr_fast( ctx->wksp, mem->unused1_gaddr );
4308 0 : self->unused2_len = mem->unused2_len;
4309 0 : self->unused2 = fd_wksp_laddr_fast( ctx->wksp, mem->unused2_gaddr );
4310 0 : self->unused3_len = mem->unused3_len;
4311 0 : self->unused3 = fd_wksp_laddr_fast( ctx->wksp, mem->unused3_gaddr );
4312 0 : return FD_BINCODE_SUCCESS;
4313 0 : }
4314 6 : void fd_unused_accounts_new(fd_unused_accounts_t * self) {
4315 6 : fd_memset( self, 0, sizeof(fd_unused_accounts_t) );
4316 6 : }
4317 0 : void fd_unused_accounts_destroy( fd_unused_accounts_t * self ) {
4318 0 : if( self->unused1 ) {
4319 0 : for( ulong i=0; i < self->unused1_len; i++ )
4320 0 : fd_pubkey_destroy( self->unused1 + i );
4321 0 : self->unused1 = NULL;
4322 0 : }
4323 0 : if( self->unused2 ) {
4324 0 : for( ulong i=0; i < self->unused2_len; i++ )
4325 0 : fd_pubkey_destroy( self->unused2 + i );
4326 0 : self->unused2 = NULL;
4327 0 : }
4328 0 : if( self->unused3 ) {
4329 0 : for( ulong i=0; i < self->unused3_len; i++ )
4330 0 : fd_pubkey_u64_pair_destroy( self->unused3 + i );
4331 0 : self->unused3 = NULL;
4332 0 : }
4333 0 : }
4334 :
4335 0 : ulong fd_unused_accounts_footprint( void ){ return FD_UNUSED_ACCOUNTS_FOOTPRINT; }
4336 0 : ulong fd_unused_accounts_align( void ){ return FD_UNUSED_ACCOUNTS_ALIGN; }
4337 :
4338 0 : void fd_unused_accounts_walk( void * w, fd_unused_accounts_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
4339 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_unused_accounts", level++ );
4340 0 : if( self->unused1_len ) {
4341 0 : fun( w, NULL, "unused1", FD_FLAMENCO_TYPE_ARR, "array", level++ );
4342 0 : for( ulong i=0; i < self->unused1_len; i++ )
4343 0 : fd_pubkey_walk(w, self->unused1 + i, fun, "pubkey", level );
4344 0 : fun( w, NULL, "unused1", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
4345 0 : }
4346 0 : if( self->unused2_len ) {
4347 0 : fun( w, NULL, "unused2", FD_FLAMENCO_TYPE_ARR, "array", level++ );
4348 0 : for( ulong i=0; i < self->unused2_len; i++ )
4349 0 : fd_pubkey_walk(w, self->unused2 + i, fun, "pubkey", level );
4350 0 : fun( w, NULL, "unused2", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
4351 0 : }
4352 0 : if( self->unused3_len ) {
4353 0 : fun( w, NULL, "unused3", FD_FLAMENCO_TYPE_ARR, "array", level++ );
4354 0 : for( ulong i=0; i < self->unused3_len; i++ )
4355 0 : fd_pubkey_u64_pair_walk(w, self->unused3 + i, fun, "pubkey_u64_pair", level );
4356 0 : fun( w, NULL, "unused3", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
4357 0 : }
4358 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_unused_accounts", level-- );
4359 0 : }
4360 6 : ulong fd_unused_accounts_size( fd_unused_accounts_t const * self ) {
4361 6 : ulong size = 0;
4362 6 : do {
4363 6 : size += sizeof(ulong);
4364 6 : for( ulong i=0; i < self->unused1_len; i++ )
4365 0 : size += fd_pubkey_size( self->unused1 + i );
4366 6 : } while(0);
4367 6 : do {
4368 6 : size += sizeof(ulong);
4369 6 : for( ulong i=0; i < self->unused2_len; i++ )
4370 0 : size += fd_pubkey_size( self->unused2 + i );
4371 6 : } while(0);
4372 6 : do {
4373 6 : size += sizeof(ulong);
4374 6 : for( ulong i=0; i < self->unused3_len; i++ )
4375 0 : size += fd_pubkey_u64_pair_size( self->unused3 + i );
4376 6 : } while(0);
4377 6 : return size;
4378 6 : }
4379 :
4380 6 : int fd_versioned_bank_encode( fd_versioned_bank_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4381 6 : int err;
4382 6 : err = fd_block_hash_vec_encode( &self->blockhash_queue, ctx );
4383 6 : if( FD_UNLIKELY( err ) ) return err;
4384 6 : err = fd_bincode_uint64_encode( self->ancestors_len, ctx );
4385 6 : if( FD_UNLIKELY(err) ) return err;
4386 6 : if( self->ancestors_len ) {
4387 0 : for( ulong i=0; i < self->ancestors_len; i++ ) {
4388 0 : err = fd_slot_pair_encode( self->ancestors + i, ctx );
4389 0 : if( FD_UNLIKELY( err ) ) return err;
4390 0 : }
4391 0 : }
4392 6 : err = fd_hash_encode( &self->hash, ctx );
4393 6 : if( FD_UNLIKELY( err ) ) return err;
4394 6 : err = fd_hash_encode( &self->parent_hash, ctx );
4395 6 : if( FD_UNLIKELY( err ) ) return err;
4396 6 : err = fd_bincode_uint64_encode( self->parent_slot, ctx );
4397 6 : if( FD_UNLIKELY( err ) ) return err;
4398 6 : err = fd_hard_forks_encode( &self->hard_forks, ctx );
4399 6 : if( FD_UNLIKELY( err ) ) return err;
4400 6 : err = fd_bincode_uint64_encode( self->transaction_count, ctx );
4401 6 : if( FD_UNLIKELY( err ) ) return err;
4402 6 : err = fd_bincode_uint64_encode( self->tick_height, ctx );
4403 6 : if( FD_UNLIKELY( err ) ) return err;
4404 6 : err = fd_bincode_uint64_encode( self->signature_count, ctx );
4405 6 : if( FD_UNLIKELY( err ) ) return err;
4406 6 : err = fd_bincode_uint64_encode( self->capitalization, ctx );
4407 6 : if( FD_UNLIKELY( err ) ) return err;
4408 6 : err = fd_bincode_uint64_encode( self->max_tick_height, ctx );
4409 6 : if( FD_UNLIKELY( err ) ) return err;
4410 6 : if( self->hashes_per_tick != NULL ) {
4411 0 : err = fd_bincode_bool_encode( 1, ctx );
4412 0 : if( FD_UNLIKELY( err ) ) return err;
4413 0 : err = fd_bincode_uint64_encode( self->hashes_per_tick[0], ctx );
4414 0 : if( FD_UNLIKELY( err ) ) return err;
4415 6 : } else {
4416 6 : err = fd_bincode_bool_encode( 0, ctx );
4417 6 : if( FD_UNLIKELY( err ) ) return err;
4418 6 : }
4419 6 : err = fd_bincode_uint64_encode( self->ticks_per_slot, ctx );
4420 6 : if( FD_UNLIKELY( err ) ) return err;
4421 6 : err = fd_bincode_uint128_encode( self->ns_per_slot, ctx );
4422 6 : if( FD_UNLIKELY( err ) ) return err;
4423 6 : err = fd_bincode_uint64_encode( self->genesis_creation_time, ctx );
4424 6 : if( FD_UNLIKELY( err ) ) return err;
4425 6 : err = fd_bincode_double_encode( self->slots_per_year, ctx );
4426 6 : if( FD_UNLIKELY( err ) ) return err;
4427 6 : err = fd_bincode_uint64_encode( self->accounts_data_len, ctx );
4428 6 : if( FD_UNLIKELY( err ) ) return err;
4429 6 : err = fd_bincode_uint64_encode( self->slot, ctx );
4430 6 : if( FD_UNLIKELY( err ) ) return err;
4431 6 : err = fd_bincode_uint64_encode( self->epoch, ctx );
4432 6 : if( FD_UNLIKELY( err ) ) return err;
4433 6 : err = fd_bincode_uint64_encode( self->block_height, ctx );
4434 6 : if( FD_UNLIKELY( err ) ) return err;
4435 6 : err = fd_pubkey_encode( &self->collector_id, ctx );
4436 6 : if( FD_UNLIKELY( err ) ) return err;
4437 6 : err = fd_bincode_uint64_encode( self->collector_fees, ctx );
4438 6 : if( FD_UNLIKELY( err ) ) return err;
4439 6 : err = fd_fee_calculator_encode( &self->fee_calculator, ctx );
4440 6 : if( FD_UNLIKELY( err ) ) return err;
4441 6 : err = fd_fee_rate_governor_encode( &self->fee_rate_governor, ctx );
4442 6 : if( FD_UNLIKELY( err ) ) return err;
4443 6 : err = fd_bincode_uint64_encode( self->collected_rent, ctx );
4444 6 : if( FD_UNLIKELY( err ) ) return err;
4445 6 : err = fd_rent_collector_encode( &self->rent_collector, ctx );
4446 6 : if( FD_UNLIKELY( err ) ) return err;
4447 6 : err = fd_epoch_schedule_encode( &self->epoch_schedule, ctx );
4448 6 : if( FD_UNLIKELY( err ) ) return err;
4449 6 : err = fd_inflation_encode( &self->inflation, ctx );
4450 6 : if( FD_UNLIKELY( err ) ) return err;
4451 6 : err = fd_stakes_encode( &self->stakes, ctx );
4452 6 : if( FD_UNLIKELY( err ) ) return err;
4453 6 : err = fd_unused_accounts_encode( &self->unused_accounts, ctx );
4454 6 : if( FD_UNLIKELY( err ) ) return err;
4455 6 : err = fd_bincode_uint64_encode( self->epoch_stakes_len, ctx );
4456 6 : if( FD_UNLIKELY(err) ) return err;
4457 6 : if( self->epoch_stakes_len ) {
4458 0 : for( ulong i=0; i < self->epoch_stakes_len; i++ ) {
4459 0 : err = fd_epoch_epoch_stakes_pair_encode( self->epoch_stakes + i, ctx );
4460 0 : if( FD_UNLIKELY( err ) ) return err;
4461 0 : }
4462 0 : }
4463 6 : err = fd_bincode_bool_encode( (uchar)(self->is_delta), ctx );
4464 6 : if( FD_UNLIKELY( err ) ) return err;
4465 6 : return FD_BINCODE_SUCCESS;
4466 6 : }
4467 0 : int fd_versioned_bank_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4468 0 : *total_sz += sizeof(fd_versioned_bank_t);
4469 0 : void const * start_data = ctx->data;
4470 0 : int err = fd_versioned_bank_decode_footprint_inner( ctx, total_sz );
4471 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4472 0 : ctx->data = start_data;
4473 0 : return err;
4474 0 : }
4475 9 : int fd_versioned_bank_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4476 9 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4477 9 : int err = 0;
4478 9 : err = fd_block_hash_vec_decode_footprint_inner( ctx, total_sz );
4479 9 : if( FD_UNLIKELY( err ) ) return err;
4480 6 : ulong ancestors_len;
4481 6 : err = fd_bincode_uint64_decode( &ancestors_len, ctx );
4482 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4483 6 : if( ancestors_len ) {
4484 0 : *total_sz += FD_SLOT_PAIR_ALIGN + FD_SLOT_PAIR_FOOTPRINT*ancestors_len;
4485 0 : for( ulong i=0; i < ancestors_len; i++ ) {
4486 0 : err = fd_slot_pair_decode_footprint_inner( ctx, total_sz );
4487 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4488 0 : }
4489 0 : }
4490 6 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
4491 6 : if( FD_UNLIKELY( err ) ) return err;
4492 6 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
4493 6 : if( FD_UNLIKELY( err ) ) return err;
4494 6 : err = fd_bincode_uint64_decode_footprint( ctx );
4495 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4496 6 : err = fd_hard_forks_decode_footprint_inner( ctx, total_sz );
4497 6 : if( FD_UNLIKELY( err ) ) return err;
4498 6 : err = fd_bincode_uint64_decode_footprint( ctx );
4499 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4500 6 : err = fd_bincode_uint64_decode_footprint( ctx );
4501 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4502 6 : err = fd_bincode_uint64_decode_footprint( ctx );
4503 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4504 6 : err = fd_bincode_uint64_decode_footprint( ctx );
4505 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4506 6 : err = fd_bincode_uint64_decode_footprint( ctx );
4507 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4508 6 : {
4509 6 : uchar o;
4510 6 : err = fd_bincode_bool_decode( &o, ctx );
4511 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4512 6 : if( o ) {
4513 0 : *total_sz += 8UL + sizeof(ulong);
4514 0 : err = fd_bincode_uint64_decode_footprint( ctx );
4515 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4516 0 : }
4517 6 : }
4518 6 : err = fd_bincode_uint64_decode_footprint( ctx );
4519 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4520 6 : err = fd_bincode_uint128_decode_footprint( ctx );
4521 6 : if( FD_UNLIKELY( err ) ) return err;
4522 6 : err = fd_bincode_uint64_decode_footprint( ctx );
4523 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4524 6 : err = fd_bincode_double_decode_footprint( ctx );
4525 6 : if( FD_UNLIKELY( err ) ) return err;
4526 6 : err = fd_bincode_uint64_decode_footprint( ctx );
4527 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4528 6 : err = fd_bincode_uint64_decode_footprint( ctx );
4529 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4530 6 : err = fd_bincode_uint64_decode_footprint( ctx );
4531 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4532 6 : err = fd_bincode_uint64_decode_footprint( ctx );
4533 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4534 6 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
4535 6 : if( FD_UNLIKELY( err ) ) return err;
4536 6 : err = fd_bincode_uint64_decode_footprint( ctx );
4537 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4538 6 : err = fd_fee_calculator_decode_footprint_inner( ctx, total_sz );
4539 6 : if( FD_UNLIKELY( err ) ) return err;
4540 6 : err = fd_fee_rate_governor_decode_footprint_inner( ctx, total_sz );
4541 6 : if( FD_UNLIKELY( err ) ) return err;
4542 6 : err = fd_bincode_uint64_decode_footprint( ctx );
4543 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4544 6 : err = fd_rent_collector_decode_footprint_inner( ctx, total_sz );
4545 6 : if( FD_UNLIKELY( err ) ) return err;
4546 6 : err = fd_epoch_schedule_decode_footprint_inner( ctx, total_sz );
4547 6 : if( FD_UNLIKELY( err ) ) return err;
4548 6 : err = fd_inflation_decode_footprint_inner( ctx, total_sz );
4549 6 : if( FD_UNLIKELY( err ) ) return err;
4550 6 : err = fd_stakes_decode_footprint_inner( ctx, total_sz );
4551 6 : if( FD_UNLIKELY( err ) ) return err;
4552 6 : err = fd_unused_accounts_decode_footprint_inner( ctx, total_sz );
4553 6 : if( FD_UNLIKELY( err ) ) return err;
4554 6 : ulong epoch_stakes_len;
4555 6 : err = fd_bincode_uint64_decode( &epoch_stakes_len, ctx );
4556 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4557 6 : if( epoch_stakes_len ) {
4558 0 : *total_sz += FD_EPOCH_EPOCH_STAKES_PAIR_ALIGN + FD_EPOCH_EPOCH_STAKES_PAIR_FOOTPRINT*epoch_stakes_len;
4559 0 : for( ulong i=0; i < epoch_stakes_len; i++ ) {
4560 0 : err = fd_epoch_epoch_stakes_pair_decode_footprint_inner( ctx, total_sz );
4561 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4562 0 : }
4563 0 : }
4564 6 : err = fd_bincode_bool_decode_footprint( ctx );
4565 6 : if( FD_UNLIKELY( err ) ) return err;
4566 6 : return 0;
4567 6 : }
4568 0 : void * fd_versioned_bank_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4569 0 : fd_versioned_bank_t * self = (fd_versioned_bank_t *)mem;
4570 0 : fd_versioned_bank_new( self );
4571 0 : void * alloc_region = (uchar *)mem + sizeof(fd_versioned_bank_t);
4572 0 : void * * alloc_mem = &alloc_region;
4573 0 : fd_versioned_bank_decode_inner( mem, alloc_mem, ctx );
4574 0 : return self;
4575 0 : }
4576 6 : void fd_versioned_bank_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4577 6 : fd_versioned_bank_t * self = (fd_versioned_bank_t *)struct_mem;
4578 6 : fd_block_hash_vec_decode_inner( &self->blockhash_queue, alloc_mem, ctx );
4579 6 : fd_bincode_uint64_decode_unsafe( &self->ancestors_len, ctx );
4580 6 : if( self->ancestors_len ) {
4581 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_SLOT_PAIR_ALIGN );
4582 0 : self->ancestors = *alloc_mem;
4583 0 : *alloc_mem = (uchar *)(*alloc_mem) + FD_SLOT_PAIR_FOOTPRINT*self->ancestors_len;
4584 0 : for( ulong i=0; i < self->ancestors_len; i++ ) {
4585 0 : fd_slot_pair_new( self->ancestors + i );
4586 0 : fd_slot_pair_decode_inner( self->ancestors + i, alloc_mem, ctx );
4587 0 : }
4588 0 : } else
4589 6 : self->ancestors = NULL;
4590 6 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
4591 6 : fd_hash_decode_inner( &self->parent_hash, alloc_mem, ctx );
4592 6 : fd_bincode_uint64_decode_unsafe( &self->parent_slot, ctx );
4593 6 : fd_hard_forks_decode_inner( &self->hard_forks, alloc_mem, ctx );
4594 6 : fd_bincode_uint64_decode_unsafe( &self->transaction_count, ctx );
4595 6 : fd_bincode_uint64_decode_unsafe( &self->tick_height, ctx );
4596 6 : fd_bincode_uint64_decode_unsafe( &self->signature_count, ctx );
4597 6 : fd_bincode_uint64_decode_unsafe( &self->capitalization, ctx );
4598 6 : fd_bincode_uint64_decode_unsafe( &self->max_tick_height, ctx );
4599 6 : {
4600 6 : uchar o;
4601 6 : fd_bincode_bool_decode_unsafe( &o, ctx );
4602 6 : if( o ) {
4603 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, 8UL );
4604 0 : self->hashes_per_tick = *alloc_mem;
4605 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(ulong);
4606 0 : fd_bincode_uint64_decode_unsafe( self->hashes_per_tick, ctx );
4607 6 : } else {
4608 6 : self->hashes_per_tick = NULL;
4609 6 : }
4610 6 : }
4611 6 : fd_bincode_uint64_decode_unsafe( &self->ticks_per_slot, ctx );
4612 6 : fd_bincode_uint128_decode_unsafe( &self->ns_per_slot, ctx );
4613 6 : fd_bincode_uint64_decode_unsafe( &self->genesis_creation_time, ctx );
4614 6 : fd_bincode_double_decode_unsafe( &self->slots_per_year, ctx );
4615 6 : fd_bincode_uint64_decode_unsafe( &self->accounts_data_len, ctx );
4616 6 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
4617 6 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
4618 6 : fd_bincode_uint64_decode_unsafe( &self->block_height, ctx );
4619 6 : fd_pubkey_decode_inner( &self->collector_id, alloc_mem, ctx );
4620 6 : fd_bincode_uint64_decode_unsafe( &self->collector_fees, ctx );
4621 6 : fd_fee_calculator_decode_inner( &self->fee_calculator, alloc_mem, ctx );
4622 6 : fd_fee_rate_governor_decode_inner( &self->fee_rate_governor, alloc_mem, ctx );
4623 6 : fd_bincode_uint64_decode_unsafe( &self->collected_rent, ctx );
4624 6 : fd_rent_collector_decode_inner( &self->rent_collector, alloc_mem, ctx );
4625 6 : fd_epoch_schedule_decode_inner( &self->epoch_schedule, alloc_mem, ctx );
4626 6 : fd_inflation_decode_inner( &self->inflation, alloc_mem, ctx );
4627 6 : fd_stakes_decode_inner( &self->stakes, alloc_mem, ctx );
4628 6 : fd_unused_accounts_decode_inner( &self->unused_accounts, alloc_mem, ctx );
4629 6 : fd_bincode_uint64_decode_unsafe( &self->epoch_stakes_len, ctx );
4630 6 : if( self->epoch_stakes_len ) {
4631 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_EPOCH_EPOCH_STAKES_PAIR_ALIGN );
4632 0 : self->epoch_stakes = *alloc_mem;
4633 0 : *alloc_mem = (uchar *)(*alloc_mem) + FD_EPOCH_EPOCH_STAKES_PAIR_FOOTPRINT*self->epoch_stakes_len;
4634 0 : for( ulong i=0; i < self->epoch_stakes_len; i++ ) {
4635 0 : fd_epoch_epoch_stakes_pair_new( self->epoch_stakes + i );
4636 0 : fd_epoch_epoch_stakes_pair_decode_inner( self->epoch_stakes + i, alloc_mem, ctx );
4637 0 : }
4638 0 : } else
4639 6 : self->epoch_stakes = NULL;
4640 6 : fd_bincode_bool_decode_unsafe( &self->is_delta, ctx );
4641 6 : }
4642 0 : void * fd_versioned_bank_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4643 0 : fd_versioned_bank_global_t * self = (fd_versioned_bank_global_t *)mem;
4644 0 : fd_versioned_bank_new( (fd_versioned_bank_t *)self );
4645 0 : void * alloc_region = (uchar *)mem + sizeof(fd_versioned_bank_global_t);
4646 0 : void * * alloc_mem = &alloc_region;
4647 0 : fd_versioned_bank_decode_inner_global( mem, alloc_mem, ctx );
4648 0 : return self;
4649 0 : }
4650 0 : void fd_versioned_bank_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4651 0 : fd_versioned_bank_global_t * self = (fd_versioned_bank_global_t *)struct_mem;
4652 0 : fd_block_hash_vec_decode_inner_global( &self->blockhash_queue, alloc_mem, ctx );
4653 0 : fd_bincode_uint64_decode_unsafe( &self->ancestors_len, ctx );
4654 0 : if( self->ancestors_len ) {
4655 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_SLOT_PAIR_ALIGN );
4656 0 : self->ancestors_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
4657 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
4658 0 : *alloc_mem = (uchar *)(*alloc_mem) + FD_SLOT_PAIR_FOOTPRINT*self->ancestors_len;
4659 0 : for( ulong i=0; i < self->ancestors_len; i++ ) {
4660 0 : fd_slot_pair_new( (fd_slot_pair_t *)(cur_mem + FD_SLOT_PAIR_FOOTPRINT * i) );
4661 0 : fd_slot_pair_decode_inner_global( cur_mem + FD_SLOT_PAIR_FOOTPRINT * i, alloc_mem, ctx );
4662 0 : }
4663 0 : } else
4664 0 : self->ancestors_gaddr = 0UL;
4665 0 : fd_hash_decode_inner_global( &self->hash, alloc_mem, ctx );
4666 0 : fd_hash_decode_inner_global( &self->parent_hash, alloc_mem, ctx );
4667 0 : fd_bincode_uint64_decode_unsafe( &self->parent_slot, ctx );
4668 0 : fd_hard_forks_decode_inner_global( &self->hard_forks, alloc_mem, ctx );
4669 0 : fd_bincode_uint64_decode_unsafe( &self->transaction_count, ctx );
4670 0 : fd_bincode_uint64_decode_unsafe( &self->tick_height, ctx );
4671 0 : fd_bincode_uint64_decode_unsafe( &self->signature_count, ctx );
4672 0 : fd_bincode_uint64_decode_unsafe( &self->capitalization, ctx );
4673 0 : fd_bincode_uint64_decode_unsafe( &self->max_tick_height, ctx );
4674 0 : {
4675 0 : uchar o;
4676 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
4677 0 : if( o ) {
4678 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, 8UL );
4679 0 : self->hashes_per_tick_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
4680 0 : fd_bincode_uint64_decode_unsafe( *alloc_mem, ctx );
4681 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(ulong);
4682 0 : } else {
4683 0 : self->hashes_per_tick_gaddr = 0UL;
4684 0 : }
4685 0 : }
4686 0 : fd_bincode_uint64_decode_unsafe( &self->ticks_per_slot, ctx );
4687 0 : fd_bincode_uint128_decode_unsafe( &self->ns_per_slot, ctx );
4688 0 : fd_bincode_uint64_decode_unsafe( &self->genesis_creation_time, ctx );
4689 0 : fd_bincode_double_decode_unsafe( &self->slots_per_year, ctx );
4690 0 : fd_bincode_uint64_decode_unsafe( &self->accounts_data_len, ctx );
4691 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
4692 0 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
4693 0 : fd_bincode_uint64_decode_unsafe( &self->block_height, ctx );
4694 0 : fd_pubkey_decode_inner_global( &self->collector_id, alloc_mem, ctx );
4695 0 : fd_bincode_uint64_decode_unsafe( &self->collector_fees, ctx );
4696 0 : fd_fee_calculator_decode_inner_global( &self->fee_calculator, alloc_mem, ctx );
4697 0 : fd_fee_rate_governor_decode_inner_global( &self->fee_rate_governor, alloc_mem, ctx );
4698 0 : fd_bincode_uint64_decode_unsafe( &self->collected_rent, ctx );
4699 0 : fd_rent_collector_decode_inner_global( &self->rent_collector, alloc_mem, ctx );
4700 0 : fd_epoch_schedule_decode_inner_global( &self->epoch_schedule, alloc_mem, ctx );
4701 0 : fd_inflation_decode_inner_global( &self->inflation, alloc_mem, ctx );
4702 0 : fd_stakes_decode_inner_global( &self->stakes, alloc_mem, ctx );
4703 0 : fd_unused_accounts_decode_inner_global( &self->unused_accounts, alloc_mem, ctx );
4704 0 : fd_bincode_uint64_decode_unsafe( &self->epoch_stakes_len, ctx );
4705 0 : if( self->epoch_stakes_len ) {
4706 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_EPOCH_EPOCH_STAKES_PAIR_ALIGN );
4707 0 : self->epoch_stakes_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
4708 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
4709 0 : *alloc_mem = (uchar *)(*alloc_mem) + FD_EPOCH_EPOCH_STAKES_PAIR_FOOTPRINT*self->epoch_stakes_len;
4710 0 : for( ulong i=0; i < self->epoch_stakes_len; i++ ) {
4711 0 : fd_epoch_epoch_stakes_pair_new( (fd_epoch_epoch_stakes_pair_t *)(cur_mem + FD_EPOCH_EPOCH_STAKES_PAIR_FOOTPRINT * i) );
4712 0 : fd_epoch_epoch_stakes_pair_decode_inner_global( cur_mem + FD_EPOCH_EPOCH_STAKES_PAIR_FOOTPRINT * i, alloc_mem, ctx );
4713 0 : }
4714 0 : } else
4715 0 : self->epoch_stakes_gaddr = 0UL;
4716 0 : fd_bincode_bool_decode_unsafe( &self->is_delta, ctx );
4717 0 : }
4718 0 : int fd_versioned_bank_convert_global_to_local( void const * global_self, fd_versioned_bank_t * self, fd_bincode_decode_ctx_t * ctx ) {
4719 0 : int err = 0;
4720 0 : fd_versioned_bank_global_t const * mem = (fd_versioned_bank_global_t const *)global_self;
4721 0 : err = fd_block_hash_vec_convert_global_to_local( &mem->blockhash_queue, &self->blockhash_queue, ctx );
4722 0 : if( FD_UNLIKELY( err ) ) return err;
4723 0 : self->ancestors_len = mem->ancestors_len;
4724 0 : self->ancestors = fd_wksp_laddr_fast( ctx->wksp, mem->ancestors_gaddr );
4725 0 : err = fd_hash_convert_global_to_local( &mem->hash, &self->hash, ctx );
4726 0 : if( FD_UNLIKELY( err ) ) return err;
4727 0 : err = fd_hash_convert_global_to_local( &mem->parent_hash, &self->parent_hash, ctx );
4728 0 : if( FD_UNLIKELY( err ) ) return err;
4729 0 : self->parent_slot = mem->parent_slot;
4730 0 : err = fd_hard_forks_convert_global_to_local( &mem->hard_forks, &self->hard_forks, ctx );
4731 0 : if( FD_UNLIKELY( err ) ) return err;
4732 0 : self->transaction_count = mem->transaction_count;
4733 0 : self->tick_height = mem->tick_height;
4734 0 : self->signature_count = mem->signature_count;
4735 0 : self->capitalization = mem->capitalization;
4736 0 : self->max_tick_height = mem->max_tick_height;
4737 0 : self->hashes_per_tick = fd_wksp_laddr_fast( ctx->wksp, mem->hashes_per_tick_gaddr );
4738 0 : self->ticks_per_slot = mem->ticks_per_slot;
4739 0 : self->ns_per_slot = mem->ns_per_slot;
4740 0 : self->genesis_creation_time = mem->genesis_creation_time;
4741 0 : self->slots_per_year = mem->slots_per_year;
4742 0 : self->accounts_data_len = mem->accounts_data_len;
4743 0 : self->slot = mem->slot;
4744 0 : self->epoch = mem->epoch;
4745 0 : self->block_height = mem->block_height;
4746 0 : err = fd_pubkey_convert_global_to_local( &mem->collector_id, &self->collector_id, ctx );
4747 0 : if( FD_UNLIKELY( err ) ) return err;
4748 0 : self->collector_fees = mem->collector_fees;
4749 0 : err = fd_fee_calculator_convert_global_to_local( &mem->fee_calculator, &self->fee_calculator, ctx );
4750 0 : if( FD_UNLIKELY( err ) ) return err;
4751 0 : err = fd_fee_rate_governor_convert_global_to_local( &mem->fee_rate_governor, &self->fee_rate_governor, ctx );
4752 0 : if( FD_UNLIKELY( err ) ) return err;
4753 0 : self->collected_rent = mem->collected_rent;
4754 0 : err = fd_rent_collector_convert_global_to_local( &mem->rent_collector, &self->rent_collector, ctx );
4755 0 : if( FD_UNLIKELY( err ) ) return err;
4756 0 : err = fd_epoch_schedule_convert_global_to_local( &mem->epoch_schedule, &self->epoch_schedule, ctx );
4757 0 : if( FD_UNLIKELY( err ) ) return err;
4758 0 : err = fd_inflation_convert_global_to_local( &mem->inflation, &self->inflation, ctx );
4759 0 : if( FD_UNLIKELY( err ) ) return err;
4760 0 : err = fd_stakes_convert_global_to_local( &mem->stakes, &self->stakes, ctx );
4761 0 : if( FD_UNLIKELY( err ) ) return err;
4762 0 : err = fd_unused_accounts_convert_global_to_local( &mem->unused_accounts, &self->unused_accounts, ctx );
4763 0 : if( FD_UNLIKELY( err ) ) return err;
4764 0 : self->epoch_stakes_len = mem->epoch_stakes_len;
4765 0 : self->epoch_stakes = fd_wksp_laddr_fast( ctx->wksp, mem->epoch_stakes_gaddr );
4766 0 : self->is_delta = mem->is_delta;
4767 0 : return FD_BINCODE_SUCCESS;
4768 0 : }
4769 6 : void fd_versioned_bank_new(fd_versioned_bank_t * self) {
4770 6 : fd_memset( self, 0, sizeof(fd_versioned_bank_t) );
4771 6 : fd_block_hash_vec_new( &self->blockhash_queue );
4772 6 : fd_hash_new( &self->hash );
4773 6 : fd_hash_new( &self->parent_hash );
4774 6 : fd_hard_forks_new( &self->hard_forks );
4775 6 : fd_pubkey_new( &self->collector_id );
4776 6 : fd_fee_calculator_new( &self->fee_calculator );
4777 6 : fd_fee_rate_governor_new( &self->fee_rate_governor );
4778 6 : fd_rent_collector_new( &self->rent_collector );
4779 6 : fd_epoch_schedule_new( &self->epoch_schedule );
4780 6 : fd_inflation_new( &self->inflation );
4781 6 : fd_stakes_new( &self->stakes );
4782 6 : fd_unused_accounts_new( &self->unused_accounts );
4783 6 : }
4784 0 : void fd_versioned_bank_destroy( fd_versioned_bank_t * self ) {
4785 0 : fd_block_hash_vec_destroy( &self->blockhash_queue );
4786 0 : if( self->ancestors ) {
4787 0 : for( ulong i=0; i < self->ancestors_len; i++ )
4788 0 : fd_slot_pair_destroy( self->ancestors + i );
4789 0 : self->ancestors = NULL;
4790 0 : }
4791 0 : fd_hash_destroy( &self->hash );
4792 0 : fd_hash_destroy( &self->parent_hash );
4793 0 : fd_hard_forks_destroy( &self->hard_forks );
4794 0 : if( self->hashes_per_tick ) {
4795 0 : self->hashes_per_tick = NULL;
4796 0 : }
4797 0 : fd_pubkey_destroy( &self->collector_id );
4798 0 : fd_fee_calculator_destroy( &self->fee_calculator );
4799 0 : fd_fee_rate_governor_destroy( &self->fee_rate_governor );
4800 0 : fd_rent_collector_destroy( &self->rent_collector );
4801 0 : fd_epoch_schedule_destroy( &self->epoch_schedule );
4802 0 : fd_inflation_destroy( &self->inflation );
4803 0 : fd_stakes_destroy( &self->stakes );
4804 0 : fd_unused_accounts_destroy( &self->unused_accounts );
4805 0 : if( self->epoch_stakes ) {
4806 0 : for( ulong i=0; i < self->epoch_stakes_len; i++ )
4807 0 : fd_epoch_epoch_stakes_pair_destroy( self->epoch_stakes + i );
4808 0 : self->epoch_stakes = NULL;
4809 0 : }
4810 0 : }
4811 :
4812 0 : ulong fd_versioned_bank_footprint( void ){ return FD_VERSIONED_BANK_FOOTPRINT; }
4813 0 : ulong fd_versioned_bank_align( void ){ return FD_VERSIONED_BANK_ALIGN; }
4814 :
4815 0 : void fd_versioned_bank_walk( void * w, fd_versioned_bank_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
4816 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_versioned_bank", level++ );
4817 0 : fd_block_hash_vec_walk( w, &self->blockhash_queue, fun, "blockhash_queue", level );
4818 0 : if( self->ancestors_len ) {
4819 0 : fun( w, NULL, "ancestors", FD_FLAMENCO_TYPE_ARR, "array", level++ );
4820 0 : for( ulong i=0; i < self->ancestors_len; i++ )
4821 0 : fd_slot_pair_walk(w, self->ancestors + i, fun, "slot_pair", level );
4822 0 : fun( w, NULL, "ancestors", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
4823 0 : }
4824 0 : fd_hash_walk( w, &self->hash, fun, "hash", level );
4825 0 : fd_hash_walk( w, &self->parent_hash, fun, "parent_hash", level );
4826 0 : fun( w, &self->parent_slot, "parent_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
4827 0 : fd_hard_forks_walk( w, &self->hard_forks, fun, "hard_forks", level );
4828 0 : fun( w, &self->transaction_count, "transaction_count", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
4829 0 : fun( w, &self->tick_height, "tick_height", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
4830 0 : fun( w, &self->signature_count, "signature_count", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
4831 0 : fun( w, &self->capitalization, "capitalization", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
4832 0 : fun( w, &self->max_tick_height, "max_tick_height", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
4833 0 : if( !self->hashes_per_tick ) {
4834 0 : fun( w, NULL, "hashes_per_tick", FD_FLAMENCO_TYPE_NULL, "ulong", level );
4835 0 : } else {
4836 0 : fun( w, self->hashes_per_tick, "hashes_per_tick", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
4837 0 : }
4838 0 : fun( w, &self->ticks_per_slot, "ticks_per_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
4839 0 : fun( w, &self->ns_per_slot, "ns_per_slot", FD_FLAMENCO_TYPE_UINT128, "uint128", level );
4840 0 : fun( w, &self->genesis_creation_time, "genesis_creation_time", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
4841 0 : fun( w, &self->slots_per_year, "slots_per_year", FD_FLAMENCO_TYPE_DOUBLE, "double", level );
4842 0 : fun( w, &self->accounts_data_len, "accounts_data_len", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
4843 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
4844 0 : fun( w, &self->epoch, "epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
4845 0 : fun( w, &self->block_height, "block_height", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
4846 0 : fd_pubkey_walk( w, &self->collector_id, fun, "collector_id", level );
4847 0 : fun( w, &self->collector_fees, "collector_fees", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
4848 0 : fd_fee_calculator_walk( w, &self->fee_calculator, fun, "fee_calculator", level );
4849 0 : fd_fee_rate_governor_walk( w, &self->fee_rate_governor, fun, "fee_rate_governor", level );
4850 0 : fun( w, &self->collected_rent, "collected_rent", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
4851 0 : fd_rent_collector_walk( w, &self->rent_collector, fun, "rent_collector", level );
4852 0 : fd_epoch_schedule_walk( w, &self->epoch_schedule, fun, "epoch_schedule", level );
4853 0 : fd_inflation_walk( w, &self->inflation, fun, "inflation", level );
4854 0 : fd_stakes_walk( w, &self->stakes, fun, "stakes", level );
4855 0 : fd_unused_accounts_walk( w, &self->unused_accounts, fun, "unused_accounts", level );
4856 0 : if( self->epoch_stakes_len ) {
4857 0 : fun( w, NULL, "epoch_stakes", FD_FLAMENCO_TYPE_ARR, "array", level++ );
4858 0 : for( ulong i=0; i < self->epoch_stakes_len; i++ )
4859 0 : fd_epoch_epoch_stakes_pair_walk(w, self->epoch_stakes + i, fun, "epoch_epoch_stakes_pair", level );
4860 0 : fun( w, NULL, "epoch_stakes", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
4861 0 : }
4862 0 : fun( w, &self->is_delta, "is_delta", FD_FLAMENCO_TYPE_BOOL, "bool", level );
4863 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_versioned_bank", level-- );
4864 0 : }
4865 6 : ulong fd_versioned_bank_size( fd_versioned_bank_t const * self ) {
4866 6 : ulong size = 0;
4867 6 : size += fd_block_hash_vec_size( &self->blockhash_queue );
4868 6 : do {
4869 6 : size += sizeof(ulong);
4870 6 : for( ulong i=0; i < self->ancestors_len; i++ )
4871 0 : size += fd_slot_pair_size( self->ancestors + i );
4872 6 : } while(0);
4873 6 : size += fd_hash_size( &self->hash );
4874 6 : size += fd_hash_size( &self->parent_hash );
4875 6 : size += sizeof(ulong);
4876 6 : size += fd_hard_forks_size( &self->hard_forks );
4877 6 : size += sizeof(ulong);
4878 6 : size += sizeof(ulong);
4879 6 : size += sizeof(ulong);
4880 6 : size += sizeof(ulong);
4881 6 : size += sizeof(ulong);
4882 6 : size += sizeof(char);
4883 6 : if( NULL != self->hashes_per_tick ) {
4884 0 : size += sizeof(ulong);
4885 0 : }
4886 6 : size += sizeof(ulong);
4887 6 : size += sizeof(uint128);
4888 6 : size += sizeof(ulong);
4889 6 : size += sizeof(double);
4890 6 : size += sizeof(ulong);
4891 6 : size += sizeof(ulong);
4892 6 : size += sizeof(ulong);
4893 6 : size += sizeof(ulong);
4894 6 : size += fd_pubkey_size( &self->collector_id );
4895 6 : size += sizeof(ulong);
4896 6 : size += fd_fee_calculator_size( &self->fee_calculator );
4897 6 : size += fd_fee_rate_governor_size( &self->fee_rate_governor );
4898 6 : size += sizeof(ulong);
4899 6 : size += fd_rent_collector_size( &self->rent_collector );
4900 6 : size += fd_epoch_schedule_size( &self->epoch_schedule );
4901 6 : size += fd_inflation_size( &self->inflation );
4902 6 : size += fd_stakes_size( &self->stakes );
4903 6 : size += fd_unused_accounts_size( &self->unused_accounts );
4904 6 : do {
4905 6 : size += sizeof(ulong);
4906 6 : for( ulong i=0; i < self->epoch_stakes_len; i++ )
4907 0 : size += fd_epoch_epoch_stakes_pair_size( self->epoch_stakes + i );
4908 6 : } while(0);
4909 6 : size += sizeof(char);
4910 6 : return size;
4911 6 : }
4912 :
4913 6 : int fd_bank_hash_stats_encode( fd_bank_hash_stats_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4914 6 : int err;
4915 6 : err = fd_bincode_uint64_encode( self->num_updated_accounts, ctx );
4916 6 : if( FD_UNLIKELY( err ) ) return err;
4917 6 : err = fd_bincode_uint64_encode( self->num_removed_accounts, ctx );
4918 6 : if( FD_UNLIKELY( err ) ) return err;
4919 6 : err = fd_bincode_uint64_encode( self->num_lamports_stored, ctx );
4920 6 : if( FD_UNLIKELY( err ) ) return err;
4921 6 : err = fd_bincode_uint64_encode( self->total_data_len, ctx );
4922 6 : if( FD_UNLIKELY( err ) ) return err;
4923 6 : err = fd_bincode_uint64_encode( self->num_executable_accounts, ctx );
4924 6 : if( FD_UNLIKELY( err ) ) return err;
4925 6 : return FD_BINCODE_SUCCESS;
4926 6 : }
4927 0 : int fd_bank_hash_stats_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4928 0 : *total_sz += sizeof(fd_bank_hash_stats_t);
4929 0 : void const * start_data = ctx->data;
4930 0 : int err = fd_bank_hash_stats_decode_footprint_inner( ctx, total_sz );
4931 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4932 0 : ctx->data = start_data;
4933 0 : return err;
4934 0 : }
4935 6 : int fd_bank_hash_stats_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4936 6 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4937 6 : int err = 0;
4938 6 : err = fd_bincode_uint64_decode_footprint( ctx );
4939 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4940 6 : err = fd_bincode_uint64_decode_footprint( ctx );
4941 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4942 6 : err = fd_bincode_uint64_decode_footprint( ctx );
4943 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4944 6 : err = fd_bincode_uint64_decode_footprint( ctx );
4945 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4946 6 : err = fd_bincode_uint64_decode_footprint( ctx );
4947 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4948 6 : return 0;
4949 6 : }
4950 0 : void * fd_bank_hash_stats_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4951 0 : fd_bank_hash_stats_t * self = (fd_bank_hash_stats_t *)mem;
4952 0 : fd_bank_hash_stats_new( self );
4953 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bank_hash_stats_t);
4954 0 : void * * alloc_mem = &alloc_region;
4955 0 : fd_bank_hash_stats_decode_inner( mem, alloc_mem, ctx );
4956 0 : return self;
4957 0 : }
4958 6 : void fd_bank_hash_stats_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4959 6 : fd_bank_hash_stats_t * self = (fd_bank_hash_stats_t *)struct_mem;
4960 6 : fd_bincode_uint64_decode_unsafe( &self->num_updated_accounts, ctx );
4961 6 : fd_bincode_uint64_decode_unsafe( &self->num_removed_accounts, ctx );
4962 6 : fd_bincode_uint64_decode_unsafe( &self->num_lamports_stored, ctx );
4963 6 : fd_bincode_uint64_decode_unsafe( &self->total_data_len, ctx );
4964 6 : fd_bincode_uint64_decode_unsafe( &self->num_executable_accounts, ctx );
4965 6 : }
4966 0 : void * fd_bank_hash_stats_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4967 0 : fd_bank_hash_stats_global_t * self = (fd_bank_hash_stats_global_t *)mem;
4968 0 : fd_bank_hash_stats_new( (fd_bank_hash_stats_t *)self );
4969 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bank_hash_stats_global_t);
4970 0 : void * * alloc_mem = &alloc_region;
4971 0 : fd_bank_hash_stats_decode_inner_global( mem, alloc_mem, ctx );
4972 0 : return self;
4973 0 : }
4974 0 : void fd_bank_hash_stats_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4975 0 : fd_bank_hash_stats_global_t * self = (fd_bank_hash_stats_global_t *)struct_mem;
4976 0 : fd_bincode_uint64_decode_unsafe( &self->num_updated_accounts, ctx );
4977 0 : fd_bincode_uint64_decode_unsafe( &self->num_removed_accounts, ctx );
4978 0 : fd_bincode_uint64_decode_unsafe( &self->num_lamports_stored, ctx );
4979 0 : fd_bincode_uint64_decode_unsafe( &self->total_data_len, ctx );
4980 0 : fd_bincode_uint64_decode_unsafe( &self->num_executable_accounts, ctx );
4981 0 : }
4982 0 : int fd_bank_hash_stats_convert_global_to_local( void const * global_self, fd_bank_hash_stats_t * self, fd_bincode_decode_ctx_t * ctx ) {
4983 0 : int err = 0;
4984 0 : fd_bank_hash_stats_global_t const * mem = (fd_bank_hash_stats_global_t const *)global_self;
4985 0 : self->num_updated_accounts = mem->num_updated_accounts;
4986 0 : self->num_removed_accounts = mem->num_removed_accounts;
4987 0 : self->num_lamports_stored = mem->num_lamports_stored;
4988 0 : self->total_data_len = mem->total_data_len;
4989 0 : self->num_executable_accounts = mem->num_executable_accounts;
4990 0 : return FD_BINCODE_SUCCESS;
4991 0 : }
4992 6 : void fd_bank_hash_stats_new(fd_bank_hash_stats_t * self) {
4993 6 : fd_memset( self, 0, sizeof(fd_bank_hash_stats_t) );
4994 6 : }
4995 0 : void fd_bank_hash_stats_destroy( fd_bank_hash_stats_t * self ) {
4996 0 : }
4997 :
4998 0 : ulong fd_bank_hash_stats_footprint( void ){ return FD_BANK_HASH_STATS_FOOTPRINT; }
4999 0 : ulong fd_bank_hash_stats_align( void ){ return FD_BANK_HASH_STATS_ALIGN; }
5000 :
5001 0 : void fd_bank_hash_stats_walk( void * w, fd_bank_hash_stats_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
5002 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_bank_hash_stats", level++ );
5003 0 : fun( w, &self->num_updated_accounts, "num_updated_accounts", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
5004 0 : fun( w, &self->num_removed_accounts, "num_removed_accounts", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
5005 0 : fun( w, &self->num_lamports_stored, "num_lamports_stored", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
5006 0 : fun( w, &self->total_data_len, "total_data_len", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
5007 0 : fun( w, &self->num_executable_accounts, "num_executable_accounts", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
5008 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_bank_hash_stats", level-- );
5009 0 : }
5010 6 : ulong fd_bank_hash_stats_size( fd_bank_hash_stats_t const * self ) {
5011 6 : ulong size = 0;
5012 6 : size += sizeof(ulong);
5013 6 : size += sizeof(ulong);
5014 6 : size += sizeof(ulong);
5015 6 : size += sizeof(ulong);
5016 6 : size += sizeof(ulong);
5017 6 : return size;
5018 6 : }
5019 :
5020 6 : int fd_bank_hash_info_encode( fd_bank_hash_info_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5021 6 : int err;
5022 6 : err = fd_hash_encode( &self->accounts_delta_hash, ctx );
5023 6 : if( FD_UNLIKELY( err ) ) return err;
5024 6 : err = fd_hash_encode( &self->accounts_hash, ctx );
5025 6 : if( FD_UNLIKELY( err ) ) return err;
5026 6 : err = fd_bank_hash_stats_encode( &self->stats, ctx );
5027 6 : if( FD_UNLIKELY( err ) ) return err;
5028 6 : return FD_BINCODE_SUCCESS;
5029 6 : }
5030 0 : int fd_bank_hash_info_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5031 0 : *total_sz += sizeof(fd_bank_hash_info_t);
5032 0 : void const * start_data = ctx->data;
5033 0 : int err = fd_bank_hash_info_decode_footprint_inner( ctx, total_sz );
5034 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5035 0 : ctx->data = start_data;
5036 0 : return err;
5037 0 : }
5038 6 : int fd_bank_hash_info_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5039 6 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5040 6 : int err = 0;
5041 6 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
5042 6 : if( FD_UNLIKELY( err ) ) return err;
5043 6 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
5044 6 : if( FD_UNLIKELY( err ) ) return err;
5045 6 : err = fd_bank_hash_stats_decode_footprint_inner( ctx, total_sz );
5046 6 : if( FD_UNLIKELY( err ) ) return err;
5047 6 : return 0;
5048 6 : }
5049 0 : void * fd_bank_hash_info_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5050 0 : fd_bank_hash_info_t * self = (fd_bank_hash_info_t *)mem;
5051 0 : fd_bank_hash_info_new( self );
5052 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bank_hash_info_t);
5053 0 : void * * alloc_mem = &alloc_region;
5054 0 : fd_bank_hash_info_decode_inner( mem, alloc_mem, ctx );
5055 0 : return self;
5056 0 : }
5057 6 : void fd_bank_hash_info_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5058 6 : fd_bank_hash_info_t * self = (fd_bank_hash_info_t *)struct_mem;
5059 6 : fd_hash_decode_inner( &self->accounts_delta_hash, alloc_mem, ctx );
5060 6 : fd_hash_decode_inner( &self->accounts_hash, alloc_mem, ctx );
5061 6 : fd_bank_hash_stats_decode_inner( &self->stats, alloc_mem, ctx );
5062 6 : }
5063 0 : void * fd_bank_hash_info_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5064 0 : fd_bank_hash_info_global_t * self = (fd_bank_hash_info_global_t *)mem;
5065 0 : fd_bank_hash_info_new( (fd_bank_hash_info_t *)self );
5066 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bank_hash_info_global_t);
5067 0 : void * * alloc_mem = &alloc_region;
5068 0 : fd_bank_hash_info_decode_inner_global( mem, alloc_mem, ctx );
5069 0 : return self;
5070 0 : }
5071 0 : void fd_bank_hash_info_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5072 0 : fd_bank_hash_info_global_t * self = (fd_bank_hash_info_global_t *)struct_mem;
5073 0 : fd_hash_decode_inner_global( &self->accounts_delta_hash, alloc_mem, ctx );
5074 0 : fd_hash_decode_inner_global( &self->accounts_hash, alloc_mem, ctx );
5075 0 : fd_bank_hash_stats_decode_inner_global( &self->stats, alloc_mem, ctx );
5076 0 : }
5077 0 : int fd_bank_hash_info_convert_global_to_local( void const * global_self, fd_bank_hash_info_t * self, fd_bincode_decode_ctx_t * ctx ) {
5078 0 : int err = 0;
5079 0 : fd_bank_hash_info_global_t const * mem = (fd_bank_hash_info_global_t const *)global_self;
5080 0 : err = fd_hash_convert_global_to_local( &mem->accounts_delta_hash, &self->accounts_delta_hash, ctx );
5081 0 : if( FD_UNLIKELY( err ) ) return err;
5082 0 : err = fd_hash_convert_global_to_local( &mem->accounts_hash, &self->accounts_hash, ctx );
5083 0 : if( FD_UNLIKELY( err ) ) return err;
5084 0 : err = fd_bank_hash_stats_convert_global_to_local( &mem->stats, &self->stats, ctx );
5085 0 : if( FD_UNLIKELY( err ) ) return err;
5086 0 : return FD_BINCODE_SUCCESS;
5087 0 : }
5088 6 : void fd_bank_hash_info_new(fd_bank_hash_info_t * self) {
5089 6 : fd_memset( self, 0, sizeof(fd_bank_hash_info_t) );
5090 6 : fd_hash_new( &self->accounts_delta_hash );
5091 6 : fd_hash_new( &self->accounts_hash );
5092 6 : fd_bank_hash_stats_new( &self->stats );
5093 6 : }
5094 0 : void fd_bank_hash_info_destroy( fd_bank_hash_info_t * self ) {
5095 0 : fd_hash_destroy( &self->accounts_delta_hash );
5096 0 : fd_hash_destroy( &self->accounts_hash );
5097 0 : fd_bank_hash_stats_destroy( &self->stats );
5098 0 : }
5099 :
5100 0 : ulong fd_bank_hash_info_footprint( void ){ return FD_BANK_HASH_INFO_FOOTPRINT; }
5101 0 : ulong fd_bank_hash_info_align( void ){ return FD_BANK_HASH_INFO_ALIGN; }
5102 :
5103 0 : void fd_bank_hash_info_walk( void * w, fd_bank_hash_info_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
5104 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_bank_hash_info", level++ );
5105 0 : fd_hash_walk( w, &self->accounts_delta_hash, fun, "accounts_delta_hash", level );
5106 0 : fd_hash_walk( w, &self->accounts_hash, fun, "accounts_hash", level );
5107 0 : fd_bank_hash_stats_walk( w, &self->stats, fun, "stats", level );
5108 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_bank_hash_info", level-- );
5109 0 : }
5110 6 : ulong fd_bank_hash_info_size( fd_bank_hash_info_t const * self ) {
5111 6 : ulong size = 0;
5112 6 : size += fd_hash_size( &self->accounts_delta_hash );
5113 6 : size += fd_hash_size( &self->accounts_hash );
5114 6 : size += fd_bank_hash_stats_size( &self->stats );
5115 6 : return size;
5116 6 : }
5117 :
5118 0 : int fd_slot_map_pair_encode( fd_slot_map_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5119 0 : int err;
5120 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
5121 0 : if( FD_UNLIKELY( err ) ) return err;
5122 0 : err = fd_hash_encode( &self->hash, ctx );
5123 0 : if( FD_UNLIKELY( err ) ) return err;
5124 0 : return FD_BINCODE_SUCCESS;
5125 0 : }
5126 0 : int fd_slot_map_pair_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5127 0 : *total_sz += sizeof(fd_slot_map_pair_t);
5128 0 : void const * start_data = ctx->data;
5129 0 : int err = fd_slot_map_pair_decode_footprint_inner( ctx, total_sz );
5130 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5131 0 : ctx->data = start_data;
5132 0 : return err;
5133 0 : }
5134 0 : int fd_slot_map_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5135 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5136 0 : int err = 0;
5137 0 : err = fd_bincode_uint64_decode_footprint( ctx );
5138 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5139 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
5140 0 : if( FD_UNLIKELY( err ) ) return err;
5141 0 : return 0;
5142 0 : }
5143 0 : void * fd_slot_map_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5144 0 : fd_slot_map_pair_t * self = (fd_slot_map_pair_t *)mem;
5145 0 : fd_slot_map_pair_new( self );
5146 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_map_pair_t);
5147 0 : void * * alloc_mem = &alloc_region;
5148 0 : fd_slot_map_pair_decode_inner( mem, alloc_mem, ctx );
5149 0 : return self;
5150 0 : }
5151 0 : void fd_slot_map_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5152 0 : fd_slot_map_pair_t * self = (fd_slot_map_pair_t *)struct_mem;
5153 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
5154 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
5155 0 : }
5156 0 : void * fd_slot_map_pair_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5157 0 : fd_slot_map_pair_global_t * self = (fd_slot_map_pair_global_t *)mem;
5158 0 : fd_slot_map_pair_new( (fd_slot_map_pair_t *)self );
5159 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_map_pair_global_t);
5160 0 : void * * alloc_mem = &alloc_region;
5161 0 : fd_slot_map_pair_decode_inner_global( mem, alloc_mem, ctx );
5162 0 : return self;
5163 0 : }
5164 0 : void fd_slot_map_pair_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5165 0 : fd_slot_map_pair_global_t * self = (fd_slot_map_pair_global_t *)struct_mem;
5166 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
5167 0 : fd_hash_decode_inner_global( &self->hash, alloc_mem, ctx );
5168 0 : }
5169 0 : int fd_slot_map_pair_convert_global_to_local( void const * global_self, fd_slot_map_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
5170 0 : int err = 0;
5171 0 : fd_slot_map_pair_global_t const * mem = (fd_slot_map_pair_global_t const *)global_self;
5172 0 : self->slot = mem->slot;
5173 0 : err = fd_hash_convert_global_to_local( &mem->hash, &self->hash, ctx );
5174 0 : if( FD_UNLIKELY( err ) ) return err;
5175 0 : return FD_BINCODE_SUCCESS;
5176 0 : }
5177 0 : void fd_slot_map_pair_new(fd_slot_map_pair_t * self) {
5178 0 : fd_memset( self, 0, sizeof(fd_slot_map_pair_t) );
5179 0 : fd_hash_new( &self->hash );
5180 0 : }
5181 0 : void fd_slot_map_pair_destroy( fd_slot_map_pair_t * self ) {
5182 0 : fd_hash_destroy( &self->hash );
5183 0 : }
5184 :
5185 0 : ulong fd_slot_map_pair_footprint( void ){ return FD_SLOT_MAP_PAIR_FOOTPRINT; }
5186 0 : ulong fd_slot_map_pair_align( void ){ return FD_SLOT_MAP_PAIR_ALIGN; }
5187 :
5188 0 : void fd_slot_map_pair_walk( void * w, fd_slot_map_pair_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
5189 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_slot_map_pair", level++ );
5190 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
5191 0 : fd_hash_walk( w, &self->hash, fun, "hash", level );
5192 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_slot_map_pair", level-- );
5193 0 : }
5194 0 : ulong fd_slot_map_pair_size( fd_slot_map_pair_t const * self ) {
5195 0 : ulong size = 0;
5196 0 : size += sizeof(ulong);
5197 0 : size += fd_hash_size( &self->hash );
5198 0 : return size;
5199 0 : }
5200 :
5201 0 : int fd_snapshot_acc_vec_encode( fd_snapshot_acc_vec_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5202 0 : int err;
5203 0 : err = fd_bincode_uint64_encode( self->id, ctx );
5204 0 : if( FD_UNLIKELY( err ) ) return err;
5205 0 : err = fd_bincode_uint64_encode( self->file_sz, ctx );
5206 0 : if( FD_UNLIKELY( err ) ) return err;
5207 0 : return FD_BINCODE_SUCCESS;
5208 0 : }
5209 0 : int fd_snapshot_acc_vec_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5210 0 : *total_sz += sizeof(fd_snapshot_acc_vec_t);
5211 0 : void const * start_data = ctx->data;
5212 0 : int err = fd_snapshot_acc_vec_decode_footprint_inner( ctx, total_sz );
5213 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5214 0 : ctx->data = start_data;
5215 0 : return err;
5216 0 : }
5217 0 : int fd_snapshot_acc_vec_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5218 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5219 0 : int err = 0;
5220 0 : err = fd_bincode_uint64_decode_footprint( ctx );
5221 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5222 0 : err = fd_bincode_uint64_decode_footprint( ctx );
5223 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5224 0 : return 0;
5225 0 : }
5226 0 : void * fd_snapshot_acc_vec_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5227 0 : fd_snapshot_acc_vec_t * self = (fd_snapshot_acc_vec_t *)mem;
5228 0 : fd_snapshot_acc_vec_new( self );
5229 0 : void * alloc_region = (uchar *)mem + sizeof(fd_snapshot_acc_vec_t);
5230 0 : void * * alloc_mem = &alloc_region;
5231 0 : fd_snapshot_acc_vec_decode_inner( mem, alloc_mem, ctx );
5232 0 : return self;
5233 0 : }
5234 0 : void fd_snapshot_acc_vec_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5235 0 : fd_snapshot_acc_vec_t * self = (fd_snapshot_acc_vec_t *)struct_mem;
5236 0 : fd_bincode_uint64_decode_unsafe( &self->id, ctx );
5237 0 : fd_bincode_uint64_decode_unsafe( &self->file_sz, ctx );
5238 0 : }
5239 0 : void * fd_snapshot_acc_vec_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5240 0 : fd_snapshot_acc_vec_global_t * self = (fd_snapshot_acc_vec_global_t *)mem;
5241 0 : fd_snapshot_acc_vec_new( (fd_snapshot_acc_vec_t *)self );
5242 0 : void * alloc_region = (uchar *)mem + sizeof(fd_snapshot_acc_vec_global_t);
5243 0 : void * * alloc_mem = &alloc_region;
5244 0 : fd_snapshot_acc_vec_decode_inner_global( mem, alloc_mem, ctx );
5245 0 : return self;
5246 0 : }
5247 0 : void fd_snapshot_acc_vec_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5248 0 : fd_snapshot_acc_vec_global_t * self = (fd_snapshot_acc_vec_global_t *)struct_mem;
5249 0 : fd_bincode_uint64_decode_unsafe( &self->id, ctx );
5250 0 : fd_bincode_uint64_decode_unsafe( &self->file_sz, ctx );
5251 0 : }
5252 0 : int fd_snapshot_acc_vec_convert_global_to_local( void const * global_self, fd_snapshot_acc_vec_t * self, fd_bincode_decode_ctx_t * ctx ) {
5253 0 : int err = 0;
5254 0 : fd_snapshot_acc_vec_global_t const * mem = (fd_snapshot_acc_vec_global_t const *)global_self;
5255 0 : self->id = mem->id;
5256 0 : self->file_sz = mem->file_sz;
5257 0 : return FD_BINCODE_SUCCESS;
5258 0 : }
5259 0 : void fd_snapshot_acc_vec_new(fd_snapshot_acc_vec_t * self) {
5260 0 : fd_memset( self, 0, sizeof(fd_snapshot_acc_vec_t) );
5261 0 : }
5262 0 : void fd_snapshot_acc_vec_destroy( fd_snapshot_acc_vec_t * self ) {
5263 0 : }
5264 :
5265 0 : ulong fd_snapshot_acc_vec_footprint( void ){ return FD_SNAPSHOT_ACC_VEC_FOOTPRINT; }
5266 0 : ulong fd_snapshot_acc_vec_align( void ){ return FD_SNAPSHOT_ACC_VEC_ALIGN; }
5267 :
5268 0 : void fd_snapshot_acc_vec_walk( void * w, fd_snapshot_acc_vec_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
5269 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_snapshot_acc_vec", level++ );
5270 0 : fun( w, &self->id, "id", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
5271 0 : fun( w, &self->file_sz, "file_sz", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
5272 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_snapshot_acc_vec", level-- );
5273 0 : }
5274 0 : ulong fd_snapshot_acc_vec_size( fd_snapshot_acc_vec_t const * self ) {
5275 0 : ulong size = 0;
5276 0 : size += sizeof(ulong);
5277 0 : size += sizeof(ulong);
5278 0 : return size;
5279 0 : }
5280 :
5281 0 : int fd_snapshot_slot_acc_vecs_encode( fd_snapshot_slot_acc_vecs_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5282 0 : int err;
5283 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
5284 0 : if( FD_UNLIKELY( err ) ) return err;
5285 0 : err = fd_bincode_uint64_encode( self->account_vecs_len, ctx );
5286 0 : if( FD_UNLIKELY(err) ) return err;
5287 0 : if( self->account_vecs_len ) {
5288 0 : for( ulong i=0; i < self->account_vecs_len; i++ ) {
5289 0 : err = fd_snapshot_acc_vec_encode( self->account_vecs + i, ctx );
5290 0 : if( FD_UNLIKELY( err ) ) return err;
5291 0 : }
5292 0 : }
5293 0 : return FD_BINCODE_SUCCESS;
5294 0 : }
5295 0 : int fd_snapshot_slot_acc_vecs_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5296 0 : *total_sz += sizeof(fd_snapshot_slot_acc_vecs_t);
5297 0 : void const * start_data = ctx->data;
5298 0 : int err = fd_snapshot_slot_acc_vecs_decode_footprint_inner( ctx, total_sz );
5299 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5300 0 : ctx->data = start_data;
5301 0 : return err;
5302 0 : }
5303 0 : int fd_snapshot_slot_acc_vecs_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5304 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5305 0 : int err = 0;
5306 0 : err = fd_bincode_uint64_decode_footprint( ctx );
5307 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5308 0 : ulong account_vecs_len;
5309 0 : err = fd_bincode_uint64_decode( &account_vecs_len, ctx );
5310 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5311 0 : if( account_vecs_len ) {
5312 0 : *total_sz += FD_SNAPSHOT_ACC_VEC_ALIGN + FD_SNAPSHOT_ACC_VEC_FOOTPRINT*account_vecs_len;
5313 0 : for( ulong i=0; i < account_vecs_len; i++ ) {
5314 0 : err = fd_snapshot_acc_vec_decode_footprint_inner( ctx, total_sz );
5315 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5316 0 : }
5317 0 : }
5318 0 : return 0;
5319 0 : }
5320 0 : void * fd_snapshot_slot_acc_vecs_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5321 0 : fd_snapshot_slot_acc_vecs_t * self = (fd_snapshot_slot_acc_vecs_t *)mem;
5322 0 : fd_snapshot_slot_acc_vecs_new( self );
5323 0 : void * alloc_region = (uchar *)mem + sizeof(fd_snapshot_slot_acc_vecs_t);
5324 0 : void * * alloc_mem = &alloc_region;
5325 0 : fd_snapshot_slot_acc_vecs_decode_inner( mem, alloc_mem, ctx );
5326 0 : return self;
5327 0 : }
5328 0 : void fd_snapshot_slot_acc_vecs_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5329 0 : fd_snapshot_slot_acc_vecs_t * self = (fd_snapshot_slot_acc_vecs_t *)struct_mem;
5330 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
5331 0 : fd_bincode_uint64_decode_unsafe( &self->account_vecs_len, ctx );
5332 0 : if( self->account_vecs_len ) {
5333 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_SNAPSHOT_ACC_VEC_ALIGN );
5334 0 : self->account_vecs = *alloc_mem;
5335 0 : *alloc_mem = (uchar *)(*alloc_mem) + FD_SNAPSHOT_ACC_VEC_FOOTPRINT*self->account_vecs_len;
5336 0 : for( ulong i=0; i < self->account_vecs_len; i++ ) {
5337 0 : fd_snapshot_acc_vec_new( self->account_vecs + i );
5338 0 : fd_snapshot_acc_vec_decode_inner( self->account_vecs + i, alloc_mem, ctx );
5339 0 : }
5340 0 : } else
5341 0 : self->account_vecs = NULL;
5342 0 : }
5343 0 : void * fd_snapshot_slot_acc_vecs_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5344 0 : fd_snapshot_slot_acc_vecs_global_t * self = (fd_snapshot_slot_acc_vecs_global_t *)mem;
5345 0 : fd_snapshot_slot_acc_vecs_new( (fd_snapshot_slot_acc_vecs_t *)self );
5346 0 : void * alloc_region = (uchar *)mem + sizeof(fd_snapshot_slot_acc_vecs_global_t);
5347 0 : void * * alloc_mem = &alloc_region;
5348 0 : fd_snapshot_slot_acc_vecs_decode_inner_global( mem, alloc_mem, ctx );
5349 0 : return self;
5350 0 : }
5351 0 : void fd_snapshot_slot_acc_vecs_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5352 0 : fd_snapshot_slot_acc_vecs_global_t * self = (fd_snapshot_slot_acc_vecs_global_t *)struct_mem;
5353 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
5354 0 : fd_bincode_uint64_decode_unsafe( &self->account_vecs_len, ctx );
5355 0 : if( self->account_vecs_len ) {
5356 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_SNAPSHOT_ACC_VEC_ALIGN );
5357 0 : self->account_vecs_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
5358 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
5359 0 : *alloc_mem = (uchar *)(*alloc_mem) + FD_SNAPSHOT_ACC_VEC_FOOTPRINT*self->account_vecs_len;
5360 0 : for( ulong i=0; i < self->account_vecs_len; i++ ) {
5361 0 : fd_snapshot_acc_vec_new( (fd_snapshot_acc_vec_t *)(cur_mem + FD_SNAPSHOT_ACC_VEC_FOOTPRINT * i) );
5362 0 : fd_snapshot_acc_vec_decode_inner_global( cur_mem + FD_SNAPSHOT_ACC_VEC_FOOTPRINT * i, alloc_mem, ctx );
5363 0 : }
5364 0 : } else
5365 0 : self->account_vecs_gaddr = 0UL;
5366 0 : }
5367 0 : int fd_snapshot_slot_acc_vecs_convert_global_to_local( void const * global_self, fd_snapshot_slot_acc_vecs_t * self, fd_bincode_decode_ctx_t * ctx ) {
5368 0 : int err = 0;
5369 0 : fd_snapshot_slot_acc_vecs_global_t const * mem = (fd_snapshot_slot_acc_vecs_global_t const *)global_self;
5370 0 : self->slot = mem->slot;
5371 0 : self->account_vecs_len = mem->account_vecs_len;
5372 0 : self->account_vecs = fd_wksp_laddr_fast( ctx->wksp, mem->account_vecs_gaddr );
5373 0 : return FD_BINCODE_SUCCESS;
5374 0 : }
5375 0 : void fd_snapshot_slot_acc_vecs_new(fd_snapshot_slot_acc_vecs_t * self) {
5376 0 : fd_memset( self, 0, sizeof(fd_snapshot_slot_acc_vecs_t) );
5377 0 : }
5378 0 : void fd_snapshot_slot_acc_vecs_destroy( fd_snapshot_slot_acc_vecs_t * self ) {
5379 0 : if( self->account_vecs ) {
5380 0 : for( ulong i=0; i < self->account_vecs_len; i++ )
5381 0 : fd_snapshot_acc_vec_destroy( self->account_vecs + i );
5382 0 : self->account_vecs = NULL;
5383 0 : }
5384 0 : }
5385 :
5386 0 : ulong fd_snapshot_slot_acc_vecs_footprint( void ){ return FD_SNAPSHOT_SLOT_ACC_VECS_FOOTPRINT; }
5387 0 : ulong fd_snapshot_slot_acc_vecs_align( void ){ return FD_SNAPSHOT_SLOT_ACC_VECS_ALIGN; }
5388 :
5389 0 : void fd_snapshot_slot_acc_vecs_walk( void * w, fd_snapshot_slot_acc_vecs_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
5390 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_snapshot_slot_acc_vecs", level++ );
5391 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
5392 0 : if( self->account_vecs_len ) {
5393 0 : fun( w, NULL, "account_vecs", FD_FLAMENCO_TYPE_ARR, "array", level++ );
5394 0 : for( ulong i=0; i < self->account_vecs_len; i++ )
5395 0 : fd_snapshot_acc_vec_walk(w, self->account_vecs + i, fun, "snapshot_acc_vec", level );
5396 0 : fun( w, NULL, "account_vecs", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
5397 0 : }
5398 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_snapshot_slot_acc_vecs", level-- );
5399 0 : }
5400 0 : ulong fd_snapshot_slot_acc_vecs_size( fd_snapshot_slot_acc_vecs_t const * self ) {
5401 0 : ulong size = 0;
5402 0 : size += sizeof(ulong);
5403 0 : do {
5404 0 : size += sizeof(ulong);
5405 0 : for( ulong i=0; i < self->account_vecs_len; i++ )
5406 0 : size += fd_snapshot_acc_vec_size( self->account_vecs + i );
5407 0 : } while(0);
5408 0 : return size;
5409 0 : }
5410 :
5411 0 : FD_FN_PURE uchar fd_reward_type_is_fee(fd_reward_type_t const * self) {
5412 0 : return self->discriminant == 0;
5413 0 : }
5414 0 : FD_FN_PURE uchar fd_reward_type_is_rent(fd_reward_type_t const * self) {
5415 0 : return self->discriminant == 1;
5416 0 : }
5417 0 : FD_FN_PURE uchar fd_reward_type_is_staking(fd_reward_type_t const * self) {
5418 0 : return self->discriminant == 2;
5419 0 : }
5420 0 : FD_FN_PURE uchar fd_reward_type_is_voting(fd_reward_type_t const * self) {
5421 0 : return self->discriminant == 3;
5422 0 : }
5423 : void fd_reward_type_inner_new( fd_reward_type_inner_t * self, uint discriminant );
5424 0 : int fd_reward_type_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5425 0 : int err;
5426 0 : switch (discriminant) {
5427 0 : case 0: {
5428 0 : return FD_BINCODE_SUCCESS;
5429 0 : }
5430 0 : case 1: {
5431 0 : return FD_BINCODE_SUCCESS;
5432 0 : }
5433 0 : case 2: {
5434 0 : return FD_BINCODE_SUCCESS;
5435 0 : }
5436 0 : case 3: {
5437 0 : return FD_BINCODE_SUCCESS;
5438 0 : }
5439 0 : default: return FD_BINCODE_ERR_ENCODING;
5440 0 : }
5441 0 : }
5442 0 : int fd_reward_type_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5443 0 : *total_sz += sizeof(fd_reward_type_t);
5444 0 : void const * start_data = ctx->data;
5445 0 : int err = fd_reward_type_decode_footprint_inner( ctx, total_sz );
5446 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5447 0 : ctx->data = start_data;
5448 0 : return err;
5449 0 : }
5450 0 : int fd_reward_type_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5451 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5452 0 : uint discriminant = 0;
5453 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
5454 0 : if( FD_UNLIKELY( err ) ) return err;
5455 0 : return fd_reward_type_inner_decode_footprint( discriminant, ctx, total_sz );
5456 0 : }
5457 0 : void fd_reward_type_inner_decode_inner( fd_reward_type_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
5458 0 : switch (discriminant) {
5459 0 : case 0: {
5460 0 : break;
5461 0 : }
5462 0 : case 1: {
5463 0 : break;
5464 0 : }
5465 0 : case 2: {
5466 0 : break;
5467 0 : }
5468 0 : case 3: {
5469 0 : break;
5470 0 : }
5471 0 : }
5472 0 : }
5473 0 : void fd_reward_type_inner_decode_inner_global( fd_reward_type_inner_global_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
5474 0 : switch (discriminant) {
5475 0 : case 0: {
5476 0 : break;
5477 0 : }
5478 0 : case 1: {
5479 0 : break;
5480 0 : }
5481 0 : case 2: {
5482 0 : break;
5483 0 : }
5484 0 : case 3: {
5485 0 : break;
5486 0 : }
5487 0 : }
5488 0 : }
5489 0 : int fd_reward_type_convert_global_to_local_inner( fd_reward_type_inner_global_t const * mem, fd_reward_type_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
5490 0 : int err = 0;
5491 0 : switch( discriminant ) {
5492 0 : case 0: {
5493 0 : break;
5494 0 : }
5495 0 : case 1: {
5496 0 : break;
5497 0 : }
5498 0 : case 2: {
5499 0 : break;
5500 0 : }
5501 0 : case 3: {
5502 0 : break;
5503 0 : }
5504 0 : }
5505 0 : return FD_BINCODE_SUCCESS;
5506 0 : }
5507 0 : int fd_reward_type_convert_global_to_local( void const * global_self, fd_reward_type_t * self, fd_bincode_decode_ctx_t * ctx ) {
5508 0 : fd_reward_type_global_t const * mem = (fd_reward_type_global_t const *)global_self;
5509 0 : uint discriminant = mem->discriminant;
5510 0 : self->discriminant = mem->discriminant;
5511 0 : int err = fd_reward_type_convert_global_to_local_inner( &mem->inner, &self->inner, discriminant, ctx );
5512 0 : return FD_BINCODE_SUCCESS;
5513 0 : }
5514 0 : void fd_reward_type_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5515 0 : fd_reward_type_t * self = (fd_reward_type_t *)struct_mem;
5516 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
5517 0 : fd_reward_type_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
5518 0 : }
5519 0 : void * fd_reward_type_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5520 0 : fd_reward_type_t * self = (fd_reward_type_t *)mem;
5521 0 : fd_reward_type_new( self );
5522 0 : void * alloc_region = (uchar *)mem + sizeof(fd_reward_type_t);
5523 0 : void * * alloc_mem = &alloc_region;
5524 0 : fd_reward_type_decode_inner( mem, alloc_mem, ctx );
5525 0 : return self;
5526 0 : }
5527 0 : void * fd_reward_type_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5528 0 : fd_reward_type_t * self = (fd_reward_type_t *)mem;
5529 0 : fd_reward_type_new( self );
5530 0 : void * alloc_region = (uchar *)mem + sizeof(fd_reward_type_t);
5531 0 : void * * alloc_mem = &alloc_region;
5532 0 : fd_reward_type_decode_inner_global( mem, alloc_mem, ctx );
5533 0 : return self;
5534 0 : }
5535 0 : void fd_reward_type_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5536 0 : fd_reward_type_global_t * self = (fd_reward_type_global_t *)struct_mem;
5537 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
5538 0 : fd_reward_type_inner_decode_inner_global( &self->inner, alloc_mem, self->discriminant, ctx );
5539 0 : }
5540 0 : void fd_reward_type_inner_new( fd_reward_type_inner_t * self, uint discriminant ) {
5541 0 : switch( discriminant ) {
5542 0 : case 0: {
5543 0 : break;
5544 0 : }
5545 0 : case 1: {
5546 0 : break;
5547 0 : }
5548 0 : case 2: {
5549 0 : break;
5550 0 : }
5551 0 : case 3: {
5552 0 : break;
5553 0 : }
5554 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
5555 0 : }
5556 0 : }
5557 0 : void fd_reward_type_new_disc( fd_reward_type_t * self, uint discriminant ) {
5558 0 : self->discriminant = discriminant;
5559 0 : fd_reward_type_inner_new( &self->inner, self->discriminant );
5560 0 : }
5561 0 : void fd_reward_type_new( fd_reward_type_t * self ) {
5562 0 : fd_memset( self, 0, sizeof(fd_reward_type_t) );
5563 0 : fd_reward_type_new_disc( self, UINT_MAX );
5564 0 : }
5565 0 : void fd_reward_type_inner_destroy( fd_reward_type_inner_t * self, uint discriminant ) {
5566 0 : switch( discriminant ) {
5567 0 : default: break; // FD_LOG_ERR(( "unhandled type" ));
5568 0 : }
5569 0 : }
5570 0 : void fd_reward_type_destroy( fd_reward_type_t * self ) {
5571 0 : fd_reward_type_inner_destroy( &self->inner, self->discriminant );
5572 0 : }
5573 :
5574 0 : ulong fd_reward_type_footprint( void ){ return FD_REWARD_TYPE_FOOTPRINT; }
5575 0 : ulong fd_reward_type_align( void ){ return FD_REWARD_TYPE_ALIGN; }
5576 :
5577 0 : void fd_reward_type_walk( void * w, fd_reward_type_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
5578 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_reward_type", level++);
5579 0 : switch( self->discriminant ) {
5580 0 : case 0: {
5581 0 : fun( w, self, "fee", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
5582 0 : break;
5583 0 : }
5584 0 : case 1: {
5585 0 : fun( w, self, "rent", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
5586 0 : break;
5587 0 : }
5588 0 : case 2: {
5589 0 : fun( w, self, "staking", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
5590 0 : break;
5591 0 : }
5592 0 : case 3: {
5593 0 : fun( w, self, "voting", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
5594 0 : break;
5595 0 : }
5596 0 : }
5597 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_reward_type", level-- );
5598 0 : }
5599 0 : ulong fd_reward_type_size( fd_reward_type_t const * self ) {
5600 0 : ulong size = 0;
5601 0 : size += sizeof(uint);
5602 0 : switch (self->discriminant) {
5603 0 : }
5604 0 : return size;
5605 0 : }
5606 :
5607 0 : int fd_reward_type_inner_encode( fd_reward_type_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
5608 0 : return FD_BINCODE_SUCCESS;
5609 0 : }
5610 0 : int fd_reward_type_encode( fd_reward_type_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5611 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
5612 0 : if( FD_UNLIKELY( err ) ) return err;
5613 0 : return fd_reward_type_inner_encode( &self->inner, self->discriminant, ctx );
5614 0 : }
5615 :
5616 6 : int fd_solana_accounts_db_fields_encode( fd_solana_accounts_db_fields_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5617 6 : int err;
5618 6 : err = fd_bincode_uint64_encode( self->storages_len, ctx );
5619 6 : if( FD_UNLIKELY(err) ) return err;
5620 6 : if( self->storages_len ) {
5621 0 : for( ulong i=0; i < self->storages_len; i++ ) {
5622 0 : err = fd_snapshot_slot_acc_vecs_encode( self->storages + i, ctx );
5623 0 : if( FD_UNLIKELY( err ) ) return err;
5624 0 : }
5625 0 : }
5626 6 : err = fd_bincode_uint64_encode( self->version, ctx );
5627 6 : if( FD_UNLIKELY( err ) ) return err;
5628 6 : err = fd_bincode_uint64_encode( self->slot, ctx );
5629 6 : if( FD_UNLIKELY( err ) ) return err;
5630 6 : err = fd_bank_hash_info_encode( &self->bank_hash_info, ctx );
5631 6 : if( FD_UNLIKELY( err ) ) return err;
5632 6 : err = fd_bincode_uint64_encode( self->historical_roots_len, ctx );
5633 6 : if( FD_UNLIKELY(err) ) return err;
5634 6 : if( self->historical_roots_len ) {
5635 0 : for( ulong i=0; i < self->historical_roots_len; i++ ) {
5636 0 : err = fd_bincode_uint64_encode( self->historical_roots[i], ctx );
5637 0 : }
5638 0 : }
5639 6 : err = fd_bincode_uint64_encode( self->historical_roots_with_hash_len, ctx );
5640 6 : if( FD_UNLIKELY(err) ) return err;
5641 6 : if( self->historical_roots_with_hash_len ) {
5642 0 : for( ulong i=0; i < self->historical_roots_with_hash_len; i++ ) {
5643 0 : err = fd_slot_map_pair_encode( self->historical_roots_with_hash + i, ctx );
5644 0 : if( FD_UNLIKELY( err ) ) return err;
5645 0 : }
5646 0 : }
5647 6 : return FD_BINCODE_SUCCESS;
5648 6 : }
5649 0 : int fd_solana_accounts_db_fields_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5650 0 : *total_sz += sizeof(fd_solana_accounts_db_fields_t);
5651 0 : void const * start_data = ctx->data;
5652 0 : int err = fd_solana_accounts_db_fields_decode_footprint_inner( ctx, total_sz );
5653 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5654 0 : ctx->data = start_data;
5655 0 : return err;
5656 0 : }
5657 6 : int fd_solana_accounts_db_fields_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5658 6 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5659 6 : int err = 0;
5660 6 : ulong storages_len;
5661 6 : err = fd_bincode_uint64_decode( &storages_len, ctx );
5662 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5663 6 : if( storages_len ) {
5664 0 : *total_sz += FD_SNAPSHOT_SLOT_ACC_VECS_ALIGN + FD_SNAPSHOT_SLOT_ACC_VECS_FOOTPRINT*storages_len;
5665 0 : for( ulong i=0; i < storages_len; i++ ) {
5666 0 : err = fd_snapshot_slot_acc_vecs_decode_footprint_inner( ctx, total_sz );
5667 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5668 0 : }
5669 0 : }
5670 6 : err = fd_bincode_uint64_decode_footprint( ctx );
5671 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5672 6 : err = fd_bincode_uint64_decode_footprint( ctx );
5673 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5674 6 : err = fd_bank_hash_info_decode_footprint_inner( ctx, total_sz );
5675 6 : if( FD_UNLIKELY( err ) ) return err;
5676 6 : ulong historical_roots_len;
5677 6 : err = fd_bincode_uint64_decode( &historical_roots_len, ctx );
5678 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5679 6 : if( historical_roots_len ) {
5680 0 : *total_sz += 8UL + sizeof(ulong)*historical_roots_len;
5681 0 : for( ulong i=0; i < historical_roots_len; i++ ) {
5682 0 : err = fd_bincode_uint64_decode_footprint( ctx );
5683 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5684 0 : }
5685 0 : }
5686 6 : ulong historical_roots_with_hash_len;
5687 6 : err = fd_bincode_uint64_decode( &historical_roots_with_hash_len, ctx );
5688 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5689 6 : if( historical_roots_with_hash_len ) {
5690 0 : *total_sz += FD_SLOT_MAP_PAIR_ALIGN + FD_SLOT_MAP_PAIR_FOOTPRINT*historical_roots_with_hash_len;
5691 0 : for( ulong i=0; i < historical_roots_with_hash_len; i++ ) {
5692 0 : err = fd_slot_map_pair_decode_footprint_inner( ctx, total_sz );
5693 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5694 0 : }
5695 0 : }
5696 6 : return 0;
5697 6 : }
5698 0 : void * fd_solana_accounts_db_fields_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5699 0 : fd_solana_accounts_db_fields_t * self = (fd_solana_accounts_db_fields_t *)mem;
5700 0 : fd_solana_accounts_db_fields_new( self );
5701 0 : void * alloc_region = (uchar *)mem + sizeof(fd_solana_accounts_db_fields_t);
5702 0 : void * * alloc_mem = &alloc_region;
5703 0 : fd_solana_accounts_db_fields_decode_inner( mem, alloc_mem, ctx );
5704 0 : return self;
5705 0 : }
5706 6 : void fd_solana_accounts_db_fields_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5707 6 : fd_solana_accounts_db_fields_t * self = (fd_solana_accounts_db_fields_t *)struct_mem;
5708 6 : fd_bincode_uint64_decode_unsafe( &self->storages_len, ctx );
5709 6 : if( self->storages_len ) {
5710 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_SNAPSHOT_SLOT_ACC_VECS_ALIGN );
5711 0 : self->storages = *alloc_mem;
5712 0 : *alloc_mem = (uchar *)(*alloc_mem) + FD_SNAPSHOT_SLOT_ACC_VECS_FOOTPRINT*self->storages_len;
5713 0 : for( ulong i=0; i < self->storages_len; i++ ) {
5714 0 : fd_snapshot_slot_acc_vecs_new( self->storages + i );
5715 0 : fd_snapshot_slot_acc_vecs_decode_inner( self->storages + i, alloc_mem, ctx );
5716 0 : }
5717 0 : } else
5718 6 : self->storages = NULL;
5719 6 : fd_bincode_uint64_decode_unsafe( &self->version, ctx );
5720 6 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
5721 6 : fd_bank_hash_info_decode_inner( &self->bank_hash_info, alloc_mem, ctx );
5722 6 : fd_bincode_uint64_decode_unsafe( &self->historical_roots_len, ctx );
5723 6 : if( self->historical_roots_len ) {
5724 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), 8UL );
5725 0 : self->historical_roots = *alloc_mem;
5726 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(ulong)*self->historical_roots_len;
5727 0 : for( ulong i=0; i < self->historical_roots_len; i++ ) {
5728 0 : fd_bincode_uint64_decode_unsafe( self->historical_roots + i, ctx );
5729 0 : }
5730 0 : } else
5731 6 : self->historical_roots = NULL;
5732 6 : fd_bincode_uint64_decode_unsafe( &self->historical_roots_with_hash_len, ctx );
5733 6 : if( self->historical_roots_with_hash_len ) {
5734 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_SLOT_MAP_PAIR_ALIGN );
5735 0 : self->historical_roots_with_hash = *alloc_mem;
5736 0 : *alloc_mem = (uchar *)(*alloc_mem) + FD_SLOT_MAP_PAIR_FOOTPRINT*self->historical_roots_with_hash_len;
5737 0 : for( ulong i=0; i < self->historical_roots_with_hash_len; i++ ) {
5738 0 : fd_slot_map_pair_new( self->historical_roots_with_hash + i );
5739 0 : fd_slot_map_pair_decode_inner( self->historical_roots_with_hash + i, alloc_mem, ctx );
5740 0 : }
5741 0 : } else
5742 6 : self->historical_roots_with_hash = NULL;
5743 6 : }
5744 0 : void * fd_solana_accounts_db_fields_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5745 0 : fd_solana_accounts_db_fields_global_t * self = (fd_solana_accounts_db_fields_global_t *)mem;
5746 0 : fd_solana_accounts_db_fields_new( (fd_solana_accounts_db_fields_t *)self );
5747 0 : void * alloc_region = (uchar *)mem + sizeof(fd_solana_accounts_db_fields_global_t);
5748 0 : void * * alloc_mem = &alloc_region;
5749 0 : fd_solana_accounts_db_fields_decode_inner_global( mem, alloc_mem, ctx );
5750 0 : return self;
5751 0 : }
5752 0 : void fd_solana_accounts_db_fields_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5753 0 : fd_solana_accounts_db_fields_global_t * self = (fd_solana_accounts_db_fields_global_t *)struct_mem;
5754 0 : fd_bincode_uint64_decode_unsafe( &self->storages_len, ctx );
5755 0 : if( self->storages_len ) {
5756 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_SNAPSHOT_SLOT_ACC_VECS_ALIGN );
5757 0 : self->storages_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
5758 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
5759 0 : *alloc_mem = (uchar *)(*alloc_mem) + FD_SNAPSHOT_SLOT_ACC_VECS_FOOTPRINT*self->storages_len;
5760 0 : for( ulong i=0; i < self->storages_len; i++ ) {
5761 0 : fd_snapshot_slot_acc_vecs_new( (fd_snapshot_slot_acc_vecs_t *)(cur_mem + FD_SNAPSHOT_SLOT_ACC_VECS_FOOTPRINT * i) );
5762 0 : fd_snapshot_slot_acc_vecs_decode_inner_global( cur_mem + FD_SNAPSHOT_SLOT_ACC_VECS_FOOTPRINT * i, alloc_mem, ctx );
5763 0 : }
5764 0 : } else
5765 0 : self->storages_gaddr = 0UL;
5766 0 : fd_bincode_uint64_decode_unsafe( &self->version, ctx );
5767 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
5768 0 : fd_bank_hash_info_decode_inner_global( &self->bank_hash_info, alloc_mem, ctx );
5769 0 : fd_bincode_uint64_decode_unsafe( &self->historical_roots_len, ctx );
5770 0 : if( self->historical_roots_len ) {
5771 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), 8UL );
5772 0 : self->historical_roots_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
5773 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
5774 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(ulong)*self->historical_roots_len;
5775 0 : for( ulong i=0; i < self->historical_roots_len; i++ ) {
5776 0 : fd_bincode_uint64_decode_unsafe( (ulong*)(cur_mem + sizeof(ulong) * i), ctx );
5777 0 : }
5778 0 : } else
5779 0 : self->historical_roots_gaddr = 0UL;
5780 0 : fd_bincode_uint64_decode_unsafe( &self->historical_roots_with_hash_len, ctx );
5781 0 : if( self->historical_roots_with_hash_len ) {
5782 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_SLOT_MAP_PAIR_ALIGN );
5783 0 : self->historical_roots_with_hash_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
5784 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
5785 0 : *alloc_mem = (uchar *)(*alloc_mem) + FD_SLOT_MAP_PAIR_FOOTPRINT*self->historical_roots_with_hash_len;
5786 0 : for( ulong i=0; i < self->historical_roots_with_hash_len; i++ ) {
5787 0 : fd_slot_map_pair_new( (fd_slot_map_pair_t *)(cur_mem + FD_SLOT_MAP_PAIR_FOOTPRINT * i) );
5788 0 : fd_slot_map_pair_decode_inner_global( cur_mem + FD_SLOT_MAP_PAIR_FOOTPRINT * i, alloc_mem, ctx );
5789 0 : }
5790 0 : } else
5791 0 : self->historical_roots_with_hash_gaddr = 0UL;
5792 0 : }
5793 0 : int fd_solana_accounts_db_fields_convert_global_to_local( void const * global_self, fd_solana_accounts_db_fields_t * self, fd_bincode_decode_ctx_t * ctx ) {
5794 0 : int err = 0;
5795 0 : fd_solana_accounts_db_fields_global_t const * mem = (fd_solana_accounts_db_fields_global_t const *)global_self;
5796 0 : self->storages_len = mem->storages_len;
5797 0 : self->storages = fd_wksp_laddr_fast( ctx->wksp, mem->storages_gaddr );
5798 0 : self->version = mem->version;
5799 0 : self->slot = mem->slot;
5800 0 : err = fd_bank_hash_info_convert_global_to_local( &mem->bank_hash_info, &self->bank_hash_info, ctx );
5801 0 : if( FD_UNLIKELY( err ) ) return err;
5802 0 : self->historical_roots_len = mem->historical_roots_len;
5803 0 : self->historical_roots = fd_wksp_laddr_fast( ctx->wksp, mem->historical_roots_gaddr );
5804 0 : self->historical_roots_with_hash_len = mem->historical_roots_with_hash_len;
5805 0 : self->historical_roots_with_hash = fd_wksp_laddr_fast( ctx->wksp, mem->historical_roots_with_hash_gaddr );
5806 0 : return FD_BINCODE_SUCCESS;
5807 0 : }
5808 6 : void fd_solana_accounts_db_fields_new(fd_solana_accounts_db_fields_t * self) {
5809 6 : fd_memset( self, 0, sizeof(fd_solana_accounts_db_fields_t) );
5810 6 : fd_bank_hash_info_new( &self->bank_hash_info );
5811 6 : }
5812 0 : void fd_solana_accounts_db_fields_destroy( fd_solana_accounts_db_fields_t * self ) {
5813 0 : if( self->storages ) {
5814 0 : for( ulong i=0; i < self->storages_len; i++ )
5815 0 : fd_snapshot_slot_acc_vecs_destroy( self->storages + i );
5816 0 : self->storages = NULL;
5817 0 : }
5818 0 : fd_bank_hash_info_destroy( &self->bank_hash_info );
5819 0 : if( self->historical_roots ) {
5820 0 : self->historical_roots = NULL;
5821 0 : }
5822 0 : if( self->historical_roots_with_hash ) {
5823 0 : for( ulong i=0; i < self->historical_roots_with_hash_len; i++ )
5824 0 : fd_slot_map_pair_destroy( self->historical_roots_with_hash + i );
5825 0 : self->historical_roots_with_hash = NULL;
5826 0 : }
5827 0 : }
5828 :
5829 0 : ulong fd_solana_accounts_db_fields_footprint( void ){ return FD_SOLANA_ACCOUNTS_DB_FIELDS_FOOTPRINT; }
5830 0 : ulong fd_solana_accounts_db_fields_align( void ){ return FD_SOLANA_ACCOUNTS_DB_FIELDS_ALIGN; }
5831 :
5832 0 : void fd_solana_accounts_db_fields_walk( void * w, fd_solana_accounts_db_fields_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
5833 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_solana_accounts_db_fields", level++ );
5834 0 : if( self->storages_len ) {
5835 0 : fun( w, NULL, "storages", FD_FLAMENCO_TYPE_ARR, "array", level++ );
5836 0 : for( ulong i=0; i < self->storages_len; i++ )
5837 0 : fd_snapshot_slot_acc_vecs_walk(w, self->storages + i, fun, "snapshot_slot_acc_vecs", level );
5838 0 : fun( w, NULL, "storages", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
5839 0 : }
5840 0 : fun( w, &self->version, "version", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
5841 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
5842 0 : fd_bank_hash_info_walk( w, &self->bank_hash_info, fun, "bank_hash_info", level );
5843 0 : if( self->historical_roots_len ) {
5844 0 : fun( w, NULL, "historical_roots", FD_FLAMENCO_TYPE_ARR, "array", level++ );
5845 0 : for( ulong i=0; i < self->historical_roots_len; i++ )
5846 0 : fun( w, self->historical_roots + i, "historical_roots", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
5847 0 : fun( w, NULL, "historical_roots", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
5848 0 : }
5849 0 : if( self->historical_roots_with_hash_len ) {
5850 0 : fun( w, NULL, "historical_roots_with_hash", FD_FLAMENCO_TYPE_ARR, "array", level++ );
5851 0 : for( ulong i=0; i < self->historical_roots_with_hash_len; i++ )
5852 0 : fd_slot_map_pair_walk(w, self->historical_roots_with_hash + i, fun, "slot_map_pair", level );
5853 0 : fun( w, NULL, "historical_roots_with_hash", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
5854 0 : }
5855 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_solana_accounts_db_fields", level-- );
5856 0 : }
5857 6 : ulong fd_solana_accounts_db_fields_size( fd_solana_accounts_db_fields_t const * self ) {
5858 6 : ulong size = 0;
5859 6 : do {
5860 6 : size += sizeof(ulong);
5861 6 : for( ulong i=0; i < self->storages_len; i++ )
5862 0 : size += fd_snapshot_slot_acc_vecs_size( self->storages + i );
5863 6 : } while(0);
5864 6 : size += sizeof(ulong);
5865 6 : size += sizeof(ulong);
5866 6 : size += fd_bank_hash_info_size( &self->bank_hash_info );
5867 6 : do {
5868 6 : size += sizeof(ulong);
5869 6 : size += self->historical_roots_len * sizeof(ulong);
5870 6 : } while(0);
5871 6 : do {
5872 6 : size += sizeof(ulong);
5873 6 : for( ulong i=0; i < self->historical_roots_with_hash_len; i++ )
5874 0 : size += fd_slot_map_pair_size( self->historical_roots_with_hash + i );
5875 6 : } while(0);
5876 6 : return size;
5877 6 : }
5878 :
5879 0 : int fd_versioned_epoch_stakes_current_encode( fd_versioned_epoch_stakes_current_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5880 0 : int err;
5881 0 : err = fd_stakes_stake_encode( &self->stakes, ctx );
5882 0 : if( FD_UNLIKELY( err ) ) return err;
5883 0 : err = fd_bincode_uint64_encode( self->total_stake, ctx );
5884 0 : if( FD_UNLIKELY( err ) ) return err;
5885 0 : err = fd_bincode_uint64_encode( self->node_id_to_vote_accounts_len, ctx );
5886 0 : if( FD_UNLIKELY(err) ) return err;
5887 0 : if( self->node_id_to_vote_accounts_len ) {
5888 0 : for( ulong i=0; i < self->node_id_to_vote_accounts_len; i++ ) {
5889 0 : err = fd_pubkey_node_vote_accounts_pair_encode( self->node_id_to_vote_accounts + i, ctx );
5890 0 : if( FD_UNLIKELY( err ) ) return err;
5891 0 : }
5892 0 : }
5893 0 : err = fd_bincode_uint64_encode( self->epoch_authorized_voters_len, ctx );
5894 0 : if( FD_UNLIKELY(err) ) return err;
5895 0 : if( self->epoch_authorized_voters_len ) {
5896 0 : for( ulong i=0; i < self->epoch_authorized_voters_len; i++ ) {
5897 0 : err = fd_pubkey_pubkey_pair_encode( self->epoch_authorized_voters + i, ctx );
5898 0 : if( FD_UNLIKELY( err ) ) return err;
5899 0 : }
5900 0 : }
5901 0 : return FD_BINCODE_SUCCESS;
5902 0 : }
5903 0 : int fd_versioned_epoch_stakes_current_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5904 0 : *total_sz += sizeof(fd_versioned_epoch_stakes_current_t);
5905 0 : void const * start_data = ctx->data;
5906 0 : int err = fd_versioned_epoch_stakes_current_decode_footprint_inner( ctx, total_sz );
5907 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5908 0 : ctx->data = start_data;
5909 0 : return err;
5910 0 : }
5911 0 : int fd_versioned_epoch_stakes_current_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5912 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5913 0 : int err = 0;
5914 0 : err = fd_stakes_stake_decode_footprint_inner( ctx, total_sz );
5915 0 : if( FD_UNLIKELY( err ) ) return err;
5916 0 : err = fd_bincode_uint64_decode_footprint( ctx );
5917 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5918 0 : ulong node_id_to_vote_accounts_len;
5919 0 : err = fd_bincode_uint64_decode( &node_id_to_vote_accounts_len, ctx );
5920 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5921 0 : if( node_id_to_vote_accounts_len ) {
5922 0 : *total_sz += FD_PUBKEY_NODE_VOTE_ACCOUNTS_PAIR_ALIGN + FD_PUBKEY_NODE_VOTE_ACCOUNTS_PAIR_FOOTPRINT*node_id_to_vote_accounts_len;
5923 0 : for( ulong i=0; i < node_id_to_vote_accounts_len; i++ ) {
5924 0 : err = fd_pubkey_node_vote_accounts_pair_decode_footprint_inner( ctx, total_sz );
5925 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5926 0 : }
5927 0 : }
5928 0 : ulong epoch_authorized_voters_len;
5929 0 : err = fd_bincode_uint64_decode( &epoch_authorized_voters_len, ctx );
5930 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5931 0 : if( epoch_authorized_voters_len ) {
5932 0 : *total_sz += FD_PUBKEY_PUBKEY_PAIR_ALIGN + FD_PUBKEY_PUBKEY_PAIR_FOOTPRINT*epoch_authorized_voters_len;
5933 0 : for( ulong i=0; i < epoch_authorized_voters_len; i++ ) {
5934 0 : err = fd_pubkey_pubkey_pair_decode_footprint_inner( ctx, total_sz );
5935 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5936 0 : }
5937 0 : }
5938 0 : return 0;
5939 0 : }
5940 0 : void * fd_versioned_epoch_stakes_current_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5941 0 : fd_versioned_epoch_stakes_current_t * self = (fd_versioned_epoch_stakes_current_t *)mem;
5942 0 : fd_versioned_epoch_stakes_current_new( self );
5943 0 : void * alloc_region = (uchar *)mem + sizeof(fd_versioned_epoch_stakes_current_t);
5944 0 : void * * alloc_mem = &alloc_region;
5945 0 : fd_versioned_epoch_stakes_current_decode_inner( mem, alloc_mem, ctx );
5946 0 : return self;
5947 0 : }
5948 0 : void fd_versioned_epoch_stakes_current_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5949 0 : fd_versioned_epoch_stakes_current_t * self = (fd_versioned_epoch_stakes_current_t *)struct_mem;
5950 0 : fd_stakes_stake_decode_inner( &self->stakes, alloc_mem, ctx );
5951 0 : fd_bincode_uint64_decode_unsafe( &self->total_stake, ctx );
5952 0 : fd_bincode_uint64_decode_unsafe( &self->node_id_to_vote_accounts_len, ctx );
5953 0 : if( self->node_id_to_vote_accounts_len ) {
5954 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_NODE_VOTE_ACCOUNTS_PAIR_ALIGN );
5955 0 : self->node_id_to_vote_accounts = *alloc_mem;
5956 0 : *alloc_mem = (uchar *)(*alloc_mem) + FD_PUBKEY_NODE_VOTE_ACCOUNTS_PAIR_FOOTPRINT*self->node_id_to_vote_accounts_len;
5957 0 : for( ulong i=0; i < self->node_id_to_vote_accounts_len; i++ ) {
5958 0 : fd_pubkey_node_vote_accounts_pair_new( self->node_id_to_vote_accounts + i );
5959 0 : fd_pubkey_node_vote_accounts_pair_decode_inner( self->node_id_to_vote_accounts + i, alloc_mem, ctx );
5960 0 : }
5961 0 : } else
5962 0 : self->node_id_to_vote_accounts = NULL;
5963 0 : fd_bincode_uint64_decode_unsafe( &self->epoch_authorized_voters_len, ctx );
5964 0 : if( self->epoch_authorized_voters_len ) {
5965 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_PUBKEY_PAIR_ALIGN );
5966 0 : self->epoch_authorized_voters = *alloc_mem;
5967 0 : *alloc_mem = (uchar *)(*alloc_mem) + FD_PUBKEY_PUBKEY_PAIR_FOOTPRINT*self->epoch_authorized_voters_len;
5968 0 : for( ulong i=0; i < self->epoch_authorized_voters_len; i++ ) {
5969 0 : fd_pubkey_pubkey_pair_new( self->epoch_authorized_voters + i );
5970 0 : fd_pubkey_pubkey_pair_decode_inner( self->epoch_authorized_voters + i, alloc_mem, ctx );
5971 0 : }
5972 0 : } else
5973 0 : self->epoch_authorized_voters = NULL;
5974 0 : }
5975 0 : void * fd_versioned_epoch_stakes_current_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5976 0 : fd_versioned_epoch_stakes_current_global_t * self = (fd_versioned_epoch_stakes_current_global_t *)mem;
5977 0 : fd_versioned_epoch_stakes_current_new( (fd_versioned_epoch_stakes_current_t *)self );
5978 0 : void * alloc_region = (uchar *)mem + sizeof(fd_versioned_epoch_stakes_current_global_t);
5979 0 : void * * alloc_mem = &alloc_region;
5980 0 : fd_versioned_epoch_stakes_current_decode_inner_global( mem, alloc_mem, ctx );
5981 0 : return self;
5982 0 : }
5983 0 : void fd_versioned_epoch_stakes_current_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5984 0 : fd_versioned_epoch_stakes_current_global_t * self = (fd_versioned_epoch_stakes_current_global_t *)struct_mem;
5985 0 : fd_stakes_stake_decode_inner_global( &self->stakes, alloc_mem, ctx );
5986 0 : fd_bincode_uint64_decode_unsafe( &self->total_stake, ctx );
5987 0 : fd_bincode_uint64_decode_unsafe( &self->node_id_to_vote_accounts_len, ctx );
5988 0 : if( self->node_id_to_vote_accounts_len ) {
5989 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_NODE_VOTE_ACCOUNTS_PAIR_ALIGN );
5990 0 : self->node_id_to_vote_accounts_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
5991 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
5992 0 : *alloc_mem = (uchar *)(*alloc_mem) + FD_PUBKEY_NODE_VOTE_ACCOUNTS_PAIR_FOOTPRINT*self->node_id_to_vote_accounts_len;
5993 0 : for( ulong i=0; i < self->node_id_to_vote_accounts_len; i++ ) {
5994 0 : fd_pubkey_node_vote_accounts_pair_new( (fd_pubkey_node_vote_accounts_pair_t *)(cur_mem + FD_PUBKEY_NODE_VOTE_ACCOUNTS_PAIR_FOOTPRINT * i) );
5995 0 : fd_pubkey_node_vote_accounts_pair_decode_inner_global( cur_mem + FD_PUBKEY_NODE_VOTE_ACCOUNTS_PAIR_FOOTPRINT * i, alloc_mem, ctx );
5996 0 : }
5997 0 : } else
5998 0 : self->node_id_to_vote_accounts_gaddr = 0UL;
5999 0 : fd_bincode_uint64_decode_unsafe( &self->epoch_authorized_voters_len, ctx );
6000 0 : if( self->epoch_authorized_voters_len ) {
6001 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_PUBKEY_PAIR_ALIGN );
6002 0 : self->epoch_authorized_voters_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
6003 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
6004 0 : *alloc_mem = (uchar *)(*alloc_mem) + FD_PUBKEY_PUBKEY_PAIR_FOOTPRINT*self->epoch_authorized_voters_len;
6005 0 : for( ulong i=0; i < self->epoch_authorized_voters_len; i++ ) {
6006 0 : fd_pubkey_pubkey_pair_new( (fd_pubkey_pubkey_pair_t *)(cur_mem + FD_PUBKEY_PUBKEY_PAIR_FOOTPRINT * i) );
6007 0 : fd_pubkey_pubkey_pair_decode_inner_global( cur_mem + FD_PUBKEY_PUBKEY_PAIR_FOOTPRINT * i, alloc_mem, ctx );
6008 0 : }
6009 0 : } else
6010 0 : self->epoch_authorized_voters_gaddr = 0UL;
6011 0 : }
6012 0 : int fd_versioned_epoch_stakes_current_convert_global_to_local( void const * global_self, fd_versioned_epoch_stakes_current_t * self, fd_bincode_decode_ctx_t * ctx ) {
6013 0 : int err = 0;
6014 0 : fd_versioned_epoch_stakes_current_global_t const * mem = (fd_versioned_epoch_stakes_current_global_t const *)global_self;
6015 0 : err = fd_stakes_stake_convert_global_to_local( &mem->stakes, &self->stakes, ctx );
6016 0 : if( FD_UNLIKELY( err ) ) return err;
6017 0 : self->total_stake = mem->total_stake;
6018 0 : self->node_id_to_vote_accounts_len = mem->node_id_to_vote_accounts_len;
6019 0 : self->node_id_to_vote_accounts = fd_wksp_laddr_fast( ctx->wksp, mem->node_id_to_vote_accounts_gaddr );
6020 0 : self->epoch_authorized_voters_len = mem->epoch_authorized_voters_len;
6021 0 : self->epoch_authorized_voters = fd_wksp_laddr_fast( ctx->wksp, mem->epoch_authorized_voters_gaddr );
6022 0 : return FD_BINCODE_SUCCESS;
6023 0 : }
6024 0 : void fd_versioned_epoch_stakes_current_new(fd_versioned_epoch_stakes_current_t * self) {
6025 0 : fd_memset( self, 0, sizeof(fd_versioned_epoch_stakes_current_t) );
6026 0 : fd_stakes_stake_new( &self->stakes );
6027 0 : }
6028 0 : void fd_versioned_epoch_stakes_current_destroy( fd_versioned_epoch_stakes_current_t * self ) {
6029 0 : fd_stakes_stake_destroy( &self->stakes );
6030 0 : if( self->node_id_to_vote_accounts ) {
6031 0 : for( ulong i=0; i < self->node_id_to_vote_accounts_len; i++ )
6032 0 : fd_pubkey_node_vote_accounts_pair_destroy( self->node_id_to_vote_accounts + i );
6033 0 : self->node_id_to_vote_accounts = NULL;
6034 0 : }
6035 0 : if( self->epoch_authorized_voters ) {
6036 0 : for( ulong i=0; i < self->epoch_authorized_voters_len; i++ )
6037 0 : fd_pubkey_pubkey_pair_destroy( self->epoch_authorized_voters + i );
6038 0 : self->epoch_authorized_voters = NULL;
6039 0 : }
6040 0 : }
6041 :
6042 0 : ulong fd_versioned_epoch_stakes_current_footprint( void ){ return FD_VERSIONED_EPOCH_STAKES_CURRENT_FOOTPRINT; }
6043 0 : ulong fd_versioned_epoch_stakes_current_align( void ){ return FD_VERSIONED_EPOCH_STAKES_CURRENT_ALIGN; }
6044 :
6045 0 : void fd_versioned_epoch_stakes_current_walk( void * w, fd_versioned_epoch_stakes_current_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
6046 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_versioned_epoch_stakes_current", level++ );
6047 0 : fd_stakes_stake_walk( w, &self->stakes, fun, "stakes", level );
6048 0 : fun( w, &self->total_stake, "total_stake", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
6049 0 : if( self->node_id_to_vote_accounts_len ) {
6050 0 : fun( w, NULL, "node_id_to_vote_accounts", FD_FLAMENCO_TYPE_ARR, "array", level++ );
6051 0 : for( ulong i=0; i < self->node_id_to_vote_accounts_len; i++ )
6052 0 : fd_pubkey_node_vote_accounts_pair_walk(w, self->node_id_to_vote_accounts + i, fun, "pubkey_node_vote_accounts_pair", level );
6053 0 : fun( w, NULL, "node_id_to_vote_accounts", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
6054 0 : }
6055 0 : if( self->epoch_authorized_voters_len ) {
6056 0 : fun( w, NULL, "epoch_authorized_voters", FD_FLAMENCO_TYPE_ARR, "array", level++ );
6057 0 : for( ulong i=0; i < self->epoch_authorized_voters_len; i++ )
6058 0 : fd_pubkey_pubkey_pair_walk(w, self->epoch_authorized_voters + i, fun, "pubkey_pubkey_pair", level );
6059 0 : fun( w, NULL, "epoch_authorized_voters", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
6060 0 : }
6061 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_versioned_epoch_stakes_current", level-- );
6062 0 : }
6063 0 : ulong fd_versioned_epoch_stakes_current_size( fd_versioned_epoch_stakes_current_t const * self ) {
6064 0 : ulong size = 0;
6065 0 : size += fd_stakes_stake_size( &self->stakes );
6066 0 : size += sizeof(ulong);
6067 0 : do {
6068 0 : size += sizeof(ulong);
6069 0 : for( ulong i=0; i < self->node_id_to_vote_accounts_len; i++ )
6070 0 : size += fd_pubkey_node_vote_accounts_pair_size( self->node_id_to_vote_accounts + i );
6071 0 : } while(0);
6072 0 : do {
6073 0 : size += sizeof(ulong);
6074 0 : for( ulong i=0; i < self->epoch_authorized_voters_len; i++ )
6075 0 : size += fd_pubkey_pubkey_pair_size( self->epoch_authorized_voters + i );
6076 0 : } while(0);
6077 0 : return size;
6078 0 : }
6079 :
6080 0 : FD_FN_PURE uchar fd_versioned_epoch_stakes_is_Current(fd_versioned_epoch_stakes_t const * self) {
6081 0 : return self->discriminant == 0;
6082 0 : }
6083 : void fd_versioned_epoch_stakes_inner_new( fd_versioned_epoch_stakes_inner_t * self, uint discriminant );
6084 0 : int fd_versioned_epoch_stakes_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6085 0 : int err;
6086 0 : switch (discriminant) {
6087 0 : case 0: {
6088 0 : err = fd_versioned_epoch_stakes_current_decode_footprint_inner( ctx, total_sz );
6089 0 : if( FD_UNLIKELY( err ) ) return err;
6090 0 : return FD_BINCODE_SUCCESS;
6091 0 : }
6092 0 : default: return FD_BINCODE_ERR_ENCODING;
6093 0 : }
6094 0 : }
6095 0 : int fd_versioned_epoch_stakes_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6096 0 : *total_sz += sizeof(fd_versioned_epoch_stakes_t);
6097 0 : void const * start_data = ctx->data;
6098 0 : int err = fd_versioned_epoch_stakes_decode_footprint_inner( ctx, total_sz );
6099 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6100 0 : ctx->data = start_data;
6101 0 : return err;
6102 0 : }
6103 0 : int fd_versioned_epoch_stakes_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6104 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6105 0 : uint discriminant = 0;
6106 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
6107 0 : if( FD_UNLIKELY( err ) ) return err;
6108 0 : return fd_versioned_epoch_stakes_inner_decode_footprint( discriminant, ctx, total_sz );
6109 0 : }
6110 0 : void fd_versioned_epoch_stakes_inner_decode_inner( fd_versioned_epoch_stakes_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
6111 0 : switch (discriminant) {
6112 0 : case 0: {
6113 0 : fd_versioned_epoch_stakes_current_decode_inner( &self->Current, alloc_mem, ctx );
6114 0 : break;
6115 0 : }
6116 0 : }
6117 0 : }
6118 0 : void fd_versioned_epoch_stakes_inner_decode_inner_global( fd_versioned_epoch_stakes_inner_global_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
6119 0 : switch (discriminant) {
6120 0 : case 0: {
6121 0 : fd_versioned_epoch_stakes_current_decode_inner_global( &self->Current, alloc_mem, ctx );
6122 0 : break;
6123 0 : }
6124 0 : }
6125 0 : }
6126 0 : int fd_versioned_epoch_stakes_convert_global_to_local_inner( fd_versioned_epoch_stakes_inner_global_t const * mem, fd_versioned_epoch_stakes_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
6127 0 : int err = 0;
6128 0 : switch( discriminant ) {
6129 0 : case 0: {
6130 0 : err = fd_versioned_epoch_stakes_current_convert_global_to_local( &mem->Current, &self->Current, ctx );
6131 0 : if( FD_UNLIKELY( err ) ) return err;
6132 0 : break;
6133 0 : }
6134 0 : }
6135 0 : return FD_BINCODE_SUCCESS;
6136 0 : }
6137 0 : int fd_versioned_epoch_stakes_convert_global_to_local( void const * global_self, fd_versioned_epoch_stakes_t * self, fd_bincode_decode_ctx_t * ctx ) {
6138 0 : fd_versioned_epoch_stakes_global_t const * mem = (fd_versioned_epoch_stakes_global_t const *)global_self;
6139 0 : uint discriminant = mem->discriminant;
6140 0 : self->discriminant = mem->discriminant;
6141 0 : int err = fd_versioned_epoch_stakes_convert_global_to_local_inner( &mem->inner, &self->inner, discriminant, ctx );
6142 0 : return FD_BINCODE_SUCCESS;
6143 0 : }
6144 0 : void fd_versioned_epoch_stakes_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6145 0 : fd_versioned_epoch_stakes_t * self = (fd_versioned_epoch_stakes_t *)struct_mem;
6146 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
6147 0 : fd_versioned_epoch_stakes_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
6148 0 : }
6149 0 : void * fd_versioned_epoch_stakes_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6150 0 : fd_versioned_epoch_stakes_t * self = (fd_versioned_epoch_stakes_t *)mem;
6151 0 : fd_versioned_epoch_stakes_new( self );
6152 0 : void * alloc_region = (uchar *)mem + sizeof(fd_versioned_epoch_stakes_t);
6153 0 : void * * alloc_mem = &alloc_region;
6154 0 : fd_versioned_epoch_stakes_decode_inner( mem, alloc_mem, ctx );
6155 0 : return self;
6156 0 : }
6157 0 : void * fd_versioned_epoch_stakes_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6158 0 : fd_versioned_epoch_stakes_t * self = (fd_versioned_epoch_stakes_t *)mem;
6159 0 : fd_versioned_epoch_stakes_new( self );
6160 0 : void * alloc_region = (uchar *)mem + sizeof(fd_versioned_epoch_stakes_t);
6161 0 : void * * alloc_mem = &alloc_region;
6162 0 : fd_versioned_epoch_stakes_decode_inner_global( mem, alloc_mem, ctx );
6163 0 : return self;
6164 0 : }
6165 0 : void fd_versioned_epoch_stakes_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6166 0 : fd_versioned_epoch_stakes_global_t * self = (fd_versioned_epoch_stakes_global_t *)struct_mem;
6167 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
6168 0 : fd_versioned_epoch_stakes_inner_decode_inner_global( &self->inner, alloc_mem, self->discriminant, ctx );
6169 0 : }
6170 0 : void fd_versioned_epoch_stakes_inner_new( fd_versioned_epoch_stakes_inner_t * self, uint discriminant ) {
6171 0 : switch( discriminant ) {
6172 0 : case 0: {
6173 0 : fd_versioned_epoch_stakes_current_new( &self->Current );
6174 0 : break;
6175 0 : }
6176 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
6177 0 : }
6178 0 : }
6179 0 : void fd_versioned_epoch_stakes_new_disc( fd_versioned_epoch_stakes_t * self, uint discriminant ) {
6180 0 : self->discriminant = discriminant;
6181 0 : fd_versioned_epoch_stakes_inner_new( &self->inner, self->discriminant );
6182 0 : }
6183 0 : void fd_versioned_epoch_stakes_new( fd_versioned_epoch_stakes_t * self ) {
6184 0 : fd_memset( self, 0, sizeof(fd_versioned_epoch_stakes_t) );
6185 0 : fd_versioned_epoch_stakes_new_disc( self, UINT_MAX );
6186 0 : }
6187 0 : void fd_versioned_epoch_stakes_inner_destroy( fd_versioned_epoch_stakes_inner_t * self, uint discriminant ) {
6188 0 : switch( discriminant ) {
6189 0 : case 0: {
6190 0 : fd_versioned_epoch_stakes_current_destroy( &self->Current );
6191 0 : break;
6192 0 : }
6193 0 : default: break; // FD_LOG_ERR(( "unhandled type" ));
6194 0 : }
6195 0 : }
6196 0 : void fd_versioned_epoch_stakes_destroy( fd_versioned_epoch_stakes_t * self ) {
6197 0 : fd_versioned_epoch_stakes_inner_destroy( &self->inner, self->discriminant );
6198 0 : }
6199 :
6200 0 : ulong fd_versioned_epoch_stakes_footprint( void ){ return FD_VERSIONED_EPOCH_STAKES_FOOTPRINT; }
6201 0 : ulong fd_versioned_epoch_stakes_align( void ){ return FD_VERSIONED_EPOCH_STAKES_ALIGN; }
6202 :
6203 0 : void fd_versioned_epoch_stakes_walk( void * w, fd_versioned_epoch_stakes_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
6204 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_versioned_epoch_stakes", level++);
6205 0 : switch( self->discriminant ) {
6206 0 : case 0: {
6207 0 : fun( w, self, "Current", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
6208 0 : fd_versioned_epoch_stakes_current_walk( w, &self->inner.Current, fun, "Current", level );
6209 0 : break;
6210 0 : }
6211 0 : }
6212 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_versioned_epoch_stakes", level-- );
6213 0 : }
6214 0 : ulong fd_versioned_epoch_stakes_size( fd_versioned_epoch_stakes_t const * self ) {
6215 0 : ulong size = 0;
6216 0 : size += sizeof(uint);
6217 0 : switch (self->discriminant) {
6218 0 : case 0: {
6219 0 : size += fd_versioned_epoch_stakes_current_size( &self->inner.Current );
6220 0 : break;
6221 0 : }
6222 0 : }
6223 0 : return size;
6224 0 : }
6225 :
6226 0 : int fd_versioned_epoch_stakes_inner_encode( fd_versioned_epoch_stakes_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
6227 0 : int err;
6228 0 : switch (discriminant) {
6229 0 : case 0: {
6230 0 : err = fd_versioned_epoch_stakes_current_encode( &self->Current, ctx );
6231 0 : if( FD_UNLIKELY( err ) ) return err;
6232 0 : break;
6233 0 : }
6234 0 : }
6235 0 : return FD_BINCODE_SUCCESS;
6236 0 : }
6237 0 : int fd_versioned_epoch_stakes_encode( fd_versioned_epoch_stakes_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6238 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
6239 0 : if( FD_UNLIKELY( err ) ) return err;
6240 0 : return fd_versioned_epoch_stakes_inner_encode( &self->inner, self->discriminant, ctx );
6241 0 : }
6242 :
6243 0 : int fd_versioned_epoch_stakes_pair_encode( fd_versioned_epoch_stakes_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6244 0 : int err;
6245 0 : err = fd_bincode_uint64_encode( self->epoch, ctx );
6246 0 : if( FD_UNLIKELY( err ) ) return err;
6247 0 : err = fd_versioned_epoch_stakes_encode( &self->val, ctx );
6248 0 : if( FD_UNLIKELY( err ) ) return err;
6249 0 : return FD_BINCODE_SUCCESS;
6250 0 : }
6251 0 : int fd_versioned_epoch_stakes_pair_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6252 0 : *total_sz += sizeof(fd_versioned_epoch_stakes_pair_t);
6253 0 : void const * start_data = ctx->data;
6254 0 : int err = fd_versioned_epoch_stakes_pair_decode_footprint_inner( ctx, total_sz );
6255 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6256 0 : ctx->data = start_data;
6257 0 : return err;
6258 0 : }
6259 0 : int fd_versioned_epoch_stakes_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6260 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6261 0 : int err = 0;
6262 0 : err = fd_bincode_uint64_decode_footprint( ctx );
6263 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6264 0 : err = fd_versioned_epoch_stakes_decode_footprint_inner( ctx, total_sz );
6265 0 : if( FD_UNLIKELY( err ) ) return err;
6266 0 : return 0;
6267 0 : }
6268 0 : void * fd_versioned_epoch_stakes_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6269 0 : fd_versioned_epoch_stakes_pair_t * self = (fd_versioned_epoch_stakes_pair_t *)mem;
6270 0 : fd_versioned_epoch_stakes_pair_new( self );
6271 0 : void * alloc_region = (uchar *)mem + sizeof(fd_versioned_epoch_stakes_pair_t);
6272 0 : void * * alloc_mem = &alloc_region;
6273 0 : fd_versioned_epoch_stakes_pair_decode_inner( mem, alloc_mem, ctx );
6274 0 : return self;
6275 0 : }
6276 0 : void fd_versioned_epoch_stakes_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6277 0 : fd_versioned_epoch_stakes_pair_t * self = (fd_versioned_epoch_stakes_pair_t *)struct_mem;
6278 0 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
6279 0 : fd_versioned_epoch_stakes_decode_inner( &self->val, alloc_mem, ctx );
6280 0 : }
6281 0 : void * fd_versioned_epoch_stakes_pair_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6282 0 : fd_versioned_epoch_stakes_pair_global_t * self = (fd_versioned_epoch_stakes_pair_global_t *)mem;
6283 0 : fd_versioned_epoch_stakes_pair_new( (fd_versioned_epoch_stakes_pair_t *)self );
6284 0 : void * alloc_region = (uchar *)mem + sizeof(fd_versioned_epoch_stakes_pair_global_t);
6285 0 : void * * alloc_mem = &alloc_region;
6286 0 : fd_versioned_epoch_stakes_pair_decode_inner_global( mem, alloc_mem, ctx );
6287 0 : return self;
6288 0 : }
6289 0 : void fd_versioned_epoch_stakes_pair_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6290 0 : fd_versioned_epoch_stakes_pair_global_t * self = (fd_versioned_epoch_stakes_pair_global_t *)struct_mem;
6291 0 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
6292 0 : fd_versioned_epoch_stakes_decode_inner_global( &self->val, alloc_mem, ctx );
6293 0 : }
6294 0 : int fd_versioned_epoch_stakes_pair_convert_global_to_local( void const * global_self, fd_versioned_epoch_stakes_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
6295 0 : int err = 0;
6296 0 : fd_versioned_epoch_stakes_pair_global_t const * mem = (fd_versioned_epoch_stakes_pair_global_t const *)global_self;
6297 0 : self->epoch = mem->epoch;
6298 0 : err = fd_versioned_epoch_stakes_convert_global_to_local( &mem->val, &self->val, ctx );
6299 0 : if( FD_UNLIKELY( err ) ) return err;
6300 0 : return FD_BINCODE_SUCCESS;
6301 0 : }
6302 0 : void fd_versioned_epoch_stakes_pair_new(fd_versioned_epoch_stakes_pair_t * self) {
6303 0 : fd_memset( self, 0, sizeof(fd_versioned_epoch_stakes_pair_t) );
6304 0 : fd_versioned_epoch_stakes_new( &self->val );
6305 0 : }
6306 0 : void fd_versioned_epoch_stakes_pair_destroy( fd_versioned_epoch_stakes_pair_t * self ) {
6307 0 : fd_versioned_epoch_stakes_destroy( &self->val );
6308 0 : }
6309 :
6310 0 : ulong fd_versioned_epoch_stakes_pair_footprint( void ){ return FD_VERSIONED_EPOCH_STAKES_PAIR_FOOTPRINT; }
6311 0 : ulong fd_versioned_epoch_stakes_pair_align( void ){ return FD_VERSIONED_EPOCH_STAKES_PAIR_ALIGN; }
6312 :
6313 0 : void fd_versioned_epoch_stakes_pair_walk( void * w, fd_versioned_epoch_stakes_pair_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
6314 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_versioned_epoch_stakes_pair", level++ );
6315 0 : fun( w, &self->epoch, "epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
6316 0 : fd_versioned_epoch_stakes_walk( w, &self->val, fun, "val", level );
6317 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_versioned_epoch_stakes_pair", level-- );
6318 0 : }
6319 0 : ulong fd_versioned_epoch_stakes_pair_size( fd_versioned_epoch_stakes_pair_t const * self ) {
6320 0 : ulong size = 0;
6321 0 : size += sizeof(ulong);
6322 0 : size += fd_versioned_epoch_stakes_size( &self->val );
6323 0 : return size;
6324 0 : }
6325 :
6326 0 : int fd_reward_info_encode( fd_reward_info_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6327 0 : int err;
6328 0 : err = fd_reward_type_encode( &self->reward_type, ctx );
6329 0 : if( FD_UNLIKELY( err ) ) return err;
6330 0 : err = fd_bincode_uint64_encode( self->lamports, ctx );
6331 0 : if( FD_UNLIKELY( err ) ) return err;
6332 0 : err = fd_bincode_uint64_encode( self->post_balance, ctx );
6333 0 : if( FD_UNLIKELY( err ) ) return err;
6334 0 : err = fd_bincode_uint64_encode( self->commission, ctx );
6335 0 : if( FD_UNLIKELY( err ) ) return err;
6336 0 : return FD_BINCODE_SUCCESS;
6337 0 : }
6338 0 : int fd_reward_info_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6339 0 : *total_sz += sizeof(fd_reward_info_t);
6340 0 : void const * start_data = ctx->data;
6341 0 : int err = fd_reward_info_decode_footprint_inner( ctx, total_sz );
6342 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6343 0 : ctx->data = start_data;
6344 0 : return err;
6345 0 : }
6346 0 : int fd_reward_info_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6347 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6348 0 : int err = 0;
6349 0 : err = fd_reward_type_decode_footprint_inner( ctx, total_sz );
6350 0 : if( FD_UNLIKELY( err ) ) return err;
6351 0 : err = fd_bincode_uint64_decode_footprint( ctx );
6352 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6353 0 : err = fd_bincode_uint64_decode_footprint( ctx );
6354 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6355 0 : err = fd_bincode_uint64_decode_footprint( ctx );
6356 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6357 0 : return 0;
6358 0 : }
6359 0 : void * fd_reward_info_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6360 0 : fd_reward_info_t * self = (fd_reward_info_t *)mem;
6361 0 : fd_reward_info_new( self );
6362 0 : void * alloc_region = (uchar *)mem + sizeof(fd_reward_info_t);
6363 0 : void * * alloc_mem = &alloc_region;
6364 0 : fd_reward_info_decode_inner( mem, alloc_mem, ctx );
6365 0 : return self;
6366 0 : }
6367 0 : void fd_reward_info_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6368 0 : fd_reward_info_t * self = (fd_reward_info_t *)struct_mem;
6369 0 : fd_reward_type_decode_inner( &self->reward_type, alloc_mem, ctx );
6370 0 : fd_bincode_uint64_decode_unsafe( &self->lamports, ctx );
6371 0 : fd_bincode_uint64_decode_unsafe( &self->post_balance, ctx );
6372 0 : fd_bincode_uint64_decode_unsafe( &self->commission, ctx );
6373 0 : }
6374 0 : void * fd_reward_info_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6375 0 : fd_reward_info_global_t * self = (fd_reward_info_global_t *)mem;
6376 0 : fd_reward_info_new( (fd_reward_info_t *)self );
6377 0 : void * alloc_region = (uchar *)mem + sizeof(fd_reward_info_global_t);
6378 0 : void * * alloc_mem = &alloc_region;
6379 0 : fd_reward_info_decode_inner_global( mem, alloc_mem, ctx );
6380 0 : return self;
6381 0 : }
6382 0 : void fd_reward_info_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6383 0 : fd_reward_info_global_t * self = (fd_reward_info_global_t *)struct_mem;
6384 0 : fd_reward_type_decode_inner_global( &self->reward_type, alloc_mem, ctx );
6385 0 : fd_bincode_uint64_decode_unsafe( &self->lamports, ctx );
6386 0 : fd_bincode_uint64_decode_unsafe( &self->post_balance, ctx );
6387 0 : fd_bincode_uint64_decode_unsafe( &self->commission, ctx );
6388 0 : }
6389 0 : int fd_reward_info_convert_global_to_local( void const * global_self, fd_reward_info_t * self, fd_bincode_decode_ctx_t * ctx ) {
6390 0 : int err = 0;
6391 0 : fd_reward_info_global_t const * mem = (fd_reward_info_global_t const *)global_self;
6392 0 : err = fd_reward_type_convert_global_to_local( &mem->reward_type, &self->reward_type, ctx );
6393 0 : if( FD_UNLIKELY( err ) ) return err;
6394 0 : self->lamports = mem->lamports;
6395 0 : self->post_balance = mem->post_balance;
6396 0 : self->commission = mem->commission;
6397 0 : return FD_BINCODE_SUCCESS;
6398 0 : }
6399 0 : void fd_reward_info_new(fd_reward_info_t * self) {
6400 0 : fd_memset( self, 0, sizeof(fd_reward_info_t) );
6401 0 : fd_reward_type_new( &self->reward_type );
6402 0 : }
6403 0 : void fd_reward_info_destroy( fd_reward_info_t * self ) {
6404 0 : fd_reward_type_destroy( &self->reward_type );
6405 0 : }
6406 :
6407 0 : ulong fd_reward_info_footprint( void ){ return FD_REWARD_INFO_FOOTPRINT; }
6408 0 : ulong fd_reward_info_align( void ){ return FD_REWARD_INFO_ALIGN; }
6409 :
6410 0 : void fd_reward_info_walk( void * w, fd_reward_info_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
6411 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_reward_info", level++ );
6412 0 : fd_reward_type_walk( w, &self->reward_type, fun, "reward_type", level );
6413 0 : fun( w, &self->lamports, "lamports", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
6414 0 : fun( w, &self->post_balance, "post_balance", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
6415 0 : fun( w, &self->commission, "commission", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
6416 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_reward_info", level-- );
6417 0 : }
6418 0 : ulong fd_reward_info_size( fd_reward_info_t const * self ) {
6419 0 : ulong size = 0;
6420 0 : size += fd_reward_type_size( &self->reward_type );
6421 0 : size += sizeof(ulong);
6422 0 : size += sizeof(ulong);
6423 0 : size += sizeof(ulong);
6424 0 : return size;
6425 0 : }
6426 :
6427 6 : int fd_slot_lthash_encode( fd_slot_lthash_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6428 6 : int err;
6429 6 : err = fd_bincode_bytes_encode( self->lthash, sizeof(self->lthash), ctx );
6430 6 : if( FD_UNLIKELY( err ) ) return err;
6431 6 : return FD_BINCODE_SUCCESS;
6432 6 : }
6433 0 : int fd_slot_lthash_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6434 0 : *total_sz += sizeof(fd_slot_lthash_t);
6435 0 : void const * start_data = ctx->data;
6436 0 : int err = fd_slot_lthash_decode_footprint_inner( ctx, total_sz );
6437 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6438 0 : ctx->data = start_data;
6439 0 : return err;
6440 0 : }
6441 6 : int fd_slot_lthash_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6442 6 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6443 6 : int err = 0;
6444 6 : err = fd_bincode_bytes_decode_footprint( 2048, ctx );
6445 6 : if( FD_UNLIKELY( err ) ) return err;
6446 6 : return 0;
6447 6 : }
6448 0 : void * fd_slot_lthash_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6449 0 : fd_slot_lthash_t * self = (fd_slot_lthash_t *)mem;
6450 0 : fd_slot_lthash_new( self );
6451 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_lthash_t);
6452 0 : void * * alloc_mem = &alloc_region;
6453 0 : fd_slot_lthash_decode_inner( mem, alloc_mem, ctx );
6454 0 : return self;
6455 0 : }
6456 6 : void fd_slot_lthash_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6457 6 : fd_slot_lthash_t * self = (fd_slot_lthash_t *)struct_mem;
6458 6 : fd_bincode_bytes_decode_unsafe( &self->lthash[0], sizeof(self->lthash), ctx );
6459 6 : }
6460 0 : void * fd_slot_lthash_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6461 0 : fd_slot_lthash_global_t * self = (fd_slot_lthash_global_t *)mem;
6462 0 : fd_slot_lthash_new( (fd_slot_lthash_t *)self );
6463 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_lthash_global_t);
6464 0 : void * * alloc_mem = &alloc_region;
6465 0 : fd_slot_lthash_decode_inner_global( mem, alloc_mem, ctx );
6466 0 : return self;
6467 0 : }
6468 3 : void fd_slot_lthash_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6469 3 : fd_slot_lthash_global_t * self = (fd_slot_lthash_global_t *)struct_mem;
6470 3 : fd_bincode_bytes_decode_unsafe( &self->lthash[0], sizeof(self->lthash), ctx );
6471 3 : }
6472 3 : int fd_slot_lthash_convert_global_to_local( void const * global_self, fd_slot_lthash_t * self, fd_bincode_decode_ctx_t * ctx ) {
6473 3 : int err = 0;
6474 3 : fd_slot_lthash_global_t const * mem = (fd_slot_lthash_global_t const *)global_self;
6475 3 : fd_memcpy( &self->lthash[0], &mem->lthash[0], sizeof(self->lthash) );
6476 3 : return FD_BINCODE_SUCCESS;
6477 3 : }
6478 9 : void fd_slot_lthash_new(fd_slot_lthash_t * self) {
6479 9 : fd_memset( self, 0, sizeof(fd_slot_lthash_t) );
6480 9 : }
6481 0 : void fd_slot_lthash_destroy( fd_slot_lthash_t * self ) {
6482 0 : }
6483 :
6484 0 : ulong fd_slot_lthash_footprint( void ){ return FD_SLOT_LTHASH_FOOTPRINT; }
6485 0 : ulong fd_slot_lthash_align( void ){ return FD_SLOT_LTHASH_ALIGN; }
6486 :
6487 3 : void fd_slot_lthash_walk( void * w, fd_slot_lthash_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
6488 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_slot_lthash", level++ );
6489 3 : fun( w, self->lthash, "lthash", FD_FLAMENCO_TYPE_HASH16384, "uchar[2048]", level );
6490 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_slot_lthash", level-- );
6491 3 : }
6492 0 : ulong fd_slot_lthash_size( fd_slot_lthash_t const * self ) {
6493 0 : ulong size = 0;
6494 0 : size += sizeof(char) * 2048;
6495 0 : return size;
6496 0 : }
6497 :
6498 6 : int fd_solana_manifest_encode( fd_solana_manifest_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6499 6 : int err;
6500 6 : err = fd_versioned_bank_encode( &self->bank, ctx );
6501 6 : if( FD_UNLIKELY( err ) ) return err;
6502 6 : err = fd_solana_accounts_db_fields_encode( &self->accounts_db, ctx );
6503 6 : if( FD_UNLIKELY( err ) ) return err;
6504 6 : err = fd_bincode_uint64_encode( self->lamports_per_signature, ctx );
6505 6 : if( FD_UNLIKELY( err ) ) return err;
6506 6 : if( self->bank_incremental_snapshot_persistence != NULL ) {
6507 0 : err = fd_bincode_bool_encode( 1, ctx );
6508 0 : if( FD_UNLIKELY( err ) ) return err;
6509 0 : err = fd_bank_incremental_snapshot_persistence_encode( self->bank_incremental_snapshot_persistence, ctx );
6510 0 : if( FD_UNLIKELY( err ) ) return err;
6511 6 : } else {
6512 6 : err = fd_bincode_bool_encode( 0, ctx );
6513 6 : if( FD_UNLIKELY( err ) ) return err;
6514 6 : }
6515 6 : if( self->epoch_account_hash != NULL ) {
6516 0 : err = fd_bincode_bool_encode( 1, ctx );
6517 0 : if( FD_UNLIKELY( err ) ) return err;
6518 0 : err = fd_hash_encode( self->epoch_account_hash, ctx );
6519 0 : if( FD_UNLIKELY( err ) ) return err;
6520 6 : } else {
6521 6 : err = fd_bincode_bool_encode( 0, ctx );
6522 6 : if( FD_UNLIKELY( err ) ) return err;
6523 6 : }
6524 6 : err = fd_bincode_uint64_encode( self->versioned_epoch_stakes_len, ctx );
6525 6 : if( FD_UNLIKELY(err) ) return err;
6526 6 : if( self->versioned_epoch_stakes_len ) {
6527 0 : for( ulong i=0; i < self->versioned_epoch_stakes_len; i++ ) {
6528 0 : err = fd_versioned_epoch_stakes_pair_encode( self->versioned_epoch_stakes + i, ctx );
6529 0 : if( FD_UNLIKELY( err ) ) return err;
6530 0 : }
6531 0 : }
6532 6 : if( self->lthash != NULL ) {
6533 0 : err = fd_bincode_bool_encode( 1, ctx );
6534 0 : if( FD_UNLIKELY( err ) ) return err;
6535 0 : err = fd_slot_lthash_encode( self->lthash, ctx );
6536 0 : if( FD_UNLIKELY( err ) ) return err;
6537 6 : } else {
6538 6 : err = fd_bincode_bool_encode( 0, ctx );
6539 6 : if( FD_UNLIKELY( err ) ) return err;
6540 6 : }
6541 6 : return FD_BINCODE_SUCCESS;
6542 6 : }
6543 9 : int fd_solana_manifest_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6544 9 : *total_sz += sizeof(fd_solana_manifest_t);
6545 9 : void const * start_data = ctx->data;
6546 9 : int err = fd_solana_manifest_decode_footprint_inner( ctx, total_sz );
6547 9 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6548 9 : ctx->data = start_data;
6549 9 : return err;
6550 9 : }
6551 9 : int fd_solana_manifest_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6552 9 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6553 9 : int err = 0;
6554 9 : err = fd_versioned_bank_decode_footprint_inner( ctx, total_sz );
6555 9 : if( FD_UNLIKELY( err ) ) return err;
6556 6 : err = fd_solana_accounts_db_fields_decode_footprint_inner( ctx, total_sz );
6557 6 : if( FD_UNLIKELY( err ) ) return err;
6558 6 : err = fd_bincode_uint64_decode_footprint( ctx );
6559 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6560 6 : if( ctx->data == ctx->dataend ) return FD_BINCODE_SUCCESS;
6561 6 : {
6562 6 : uchar o;
6563 6 : err = fd_bincode_bool_decode( &o, ctx );
6564 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6565 6 : if( o ) {
6566 0 : *total_sz += FD_BANK_INCREMENTAL_SNAPSHOT_PERSISTENCE_ALIGN + FD_BANK_INCREMENTAL_SNAPSHOT_PERSISTENCE_FOOTPRINT;
6567 0 : err = fd_bank_incremental_snapshot_persistence_decode_footprint_inner( ctx, total_sz );
6568 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6569 0 : }
6570 6 : }
6571 6 : if( ctx->data == ctx->dataend ) return FD_BINCODE_SUCCESS;
6572 6 : {
6573 6 : uchar o;
6574 6 : err = fd_bincode_bool_decode( &o, ctx );
6575 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6576 6 : if( o ) {
6577 0 : *total_sz += FD_HASH_ALIGN + FD_HASH_FOOTPRINT;
6578 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
6579 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6580 0 : }
6581 6 : }
6582 6 : if( ctx->data == ctx->dataend ) return FD_BINCODE_SUCCESS;
6583 6 : ulong versioned_epoch_stakes_len;
6584 6 : err = fd_bincode_uint64_decode( &versioned_epoch_stakes_len, ctx );
6585 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6586 6 : if( versioned_epoch_stakes_len ) {
6587 0 : *total_sz += FD_VERSIONED_EPOCH_STAKES_PAIR_ALIGN + FD_VERSIONED_EPOCH_STAKES_PAIR_FOOTPRINT*versioned_epoch_stakes_len;
6588 0 : for( ulong i=0; i < versioned_epoch_stakes_len; i++ ) {
6589 0 : err = fd_versioned_epoch_stakes_pair_decode_footprint_inner( ctx, total_sz );
6590 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6591 0 : }
6592 0 : }
6593 6 : if( ctx->data == ctx->dataend ) return FD_BINCODE_SUCCESS;
6594 6 : {
6595 6 : uchar o;
6596 6 : err = fd_bincode_bool_decode( &o, ctx );
6597 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6598 6 : if( o ) {
6599 0 : *total_sz += FD_SLOT_LTHASH_ALIGN + FD_SLOT_LTHASH_FOOTPRINT;
6600 0 : err = fd_slot_lthash_decode_footprint_inner( ctx, total_sz );
6601 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6602 0 : }
6603 6 : }
6604 6 : return 0;
6605 6 : }
6606 6 : void * fd_solana_manifest_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6607 6 : fd_solana_manifest_t * self = (fd_solana_manifest_t *)mem;
6608 6 : fd_solana_manifest_new( self );
6609 6 : void * alloc_region = (uchar *)mem + sizeof(fd_solana_manifest_t);
6610 6 : void * * alloc_mem = &alloc_region;
6611 6 : fd_solana_manifest_decode_inner( mem, alloc_mem, ctx );
6612 6 : return self;
6613 6 : }
6614 6 : void fd_solana_manifest_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6615 6 : fd_solana_manifest_t * self = (fd_solana_manifest_t *)struct_mem;
6616 6 : fd_versioned_bank_decode_inner( &self->bank, alloc_mem, ctx );
6617 6 : fd_solana_accounts_db_fields_decode_inner( &self->accounts_db, alloc_mem, ctx );
6618 6 : fd_bincode_uint64_decode_unsafe( &self->lamports_per_signature, ctx );
6619 6 : if( ctx->data == ctx->dataend ) return;
6620 6 : {
6621 6 : uchar o;
6622 6 : fd_bincode_bool_decode_unsafe( &o, ctx );
6623 6 : if( o ) {
6624 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, FD_BANK_INCREMENTAL_SNAPSHOT_PERSISTENCE_ALIGN );
6625 0 : self->bank_incremental_snapshot_persistence = *alloc_mem;
6626 0 : *alloc_mem = (uchar *)*alloc_mem + FD_BANK_INCREMENTAL_SNAPSHOT_PERSISTENCE_FOOTPRINT;
6627 0 : fd_bank_incremental_snapshot_persistence_new( self->bank_incremental_snapshot_persistence );
6628 0 : fd_bank_incremental_snapshot_persistence_decode_inner( self->bank_incremental_snapshot_persistence, alloc_mem, ctx );
6629 6 : } else {
6630 6 : self->bank_incremental_snapshot_persistence = NULL;
6631 6 : }
6632 6 : }
6633 6 : if( ctx->data == ctx->dataend ) return;
6634 6 : {
6635 6 : uchar o;
6636 6 : fd_bincode_bool_decode_unsafe( &o, ctx );
6637 6 : if( o ) {
6638 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, FD_HASH_ALIGN );
6639 0 : self->epoch_account_hash = *alloc_mem;
6640 0 : *alloc_mem = (uchar *)*alloc_mem + FD_HASH_FOOTPRINT;
6641 0 : fd_hash_new( self->epoch_account_hash );
6642 0 : fd_hash_decode_inner( self->epoch_account_hash, alloc_mem, ctx );
6643 6 : } else {
6644 6 : self->epoch_account_hash = NULL;
6645 6 : }
6646 6 : }
6647 6 : if( ctx->data == ctx->dataend ) return;
6648 6 : fd_bincode_uint64_decode_unsafe( &self->versioned_epoch_stakes_len, ctx );
6649 6 : if( self->versioned_epoch_stakes_len ) {
6650 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_VERSIONED_EPOCH_STAKES_PAIR_ALIGN );
6651 0 : self->versioned_epoch_stakes = *alloc_mem;
6652 0 : *alloc_mem = (uchar *)(*alloc_mem) + FD_VERSIONED_EPOCH_STAKES_PAIR_FOOTPRINT*self->versioned_epoch_stakes_len;
6653 0 : for( ulong i=0; i < self->versioned_epoch_stakes_len; i++ ) {
6654 0 : fd_versioned_epoch_stakes_pair_new( self->versioned_epoch_stakes + i );
6655 0 : fd_versioned_epoch_stakes_pair_decode_inner( self->versioned_epoch_stakes + i, alloc_mem, ctx );
6656 0 : }
6657 0 : } else
6658 6 : self->versioned_epoch_stakes = NULL;
6659 6 : if( ctx->data == ctx->dataend ) return;
6660 6 : {
6661 6 : uchar o;
6662 6 : fd_bincode_bool_decode_unsafe( &o, ctx );
6663 6 : if( o ) {
6664 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, FD_SLOT_LTHASH_ALIGN );
6665 0 : self->lthash = *alloc_mem;
6666 0 : *alloc_mem = (uchar *)*alloc_mem + FD_SLOT_LTHASH_FOOTPRINT;
6667 0 : fd_slot_lthash_new( self->lthash );
6668 0 : fd_slot_lthash_decode_inner( self->lthash, alloc_mem, ctx );
6669 6 : } else {
6670 6 : self->lthash = NULL;
6671 6 : }
6672 6 : }
6673 6 : }
6674 0 : void * fd_solana_manifest_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6675 0 : fd_solana_manifest_global_t * self = (fd_solana_manifest_global_t *)mem;
6676 0 : fd_solana_manifest_new( (fd_solana_manifest_t *)self );
6677 0 : void * alloc_region = (uchar *)mem + sizeof(fd_solana_manifest_global_t);
6678 0 : void * * alloc_mem = &alloc_region;
6679 0 : fd_solana_manifest_decode_inner_global( mem, alloc_mem, ctx );
6680 0 : return self;
6681 0 : }
6682 0 : void fd_solana_manifest_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6683 0 : fd_solana_manifest_global_t * self = (fd_solana_manifest_global_t *)struct_mem;
6684 0 : fd_versioned_bank_decode_inner_global( &self->bank, alloc_mem, ctx );
6685 0 : fd_solana_accounts_db_fields_decode_inner_global( &self->accounts_db, alloc_mem, ctx );
6686 0 : fd_bincode_uint64_decode_unsafe( &self->lamports_per_signature, ctx );
6687 0 : if( ctx->data == ctx->dataend ) return;
6688 0 : {
6689 0 : uchar o;
6690 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
6691 0 : if( o ) {
6692 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, FD_BANK_INCREMENTAL_SNAPSHOT_PERSISTENCE_ALIGN );
6693 0 : self->bank_incremental_snapshot_persistence_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
6694 0 : fd_bank_incremental_snapshot_persistence_new( *alloc_mem );
6695 0 : *alloc_mem = (uchar *)*alloc_mem + FD_BANK_INCREMENTAL_SNAPSHOT_PERSISTENCE_FOOTPRINT;
6696 0 : fd_bank_incremental_snapshot_persistence_decode_inner_global( fd_wksp_laddr_fast( ctx->wksp, self->bank_incremental_snapshot_persistence_gaddr ), alloc_mem, ctx );
6697 0 : } else {
6698 0 : self->bank_incremental_snapshot_persistence_gaddr = 0UL;
6699 0 : }
6700 0 : }
6701 0 : if( ctx->data == ctx->dataend ) return;
6702 0 : {
6703 0 : uchar o;
6704 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
6705 0 : if( o ) {
6706 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, FD_HASH_ALIGN );
6707 0 : self->epoch_account_hash_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
6708 0 : fd_hash_new( *alloc_mem );
6709 0 : *alloc_mem = (uchar *)*alloc_mem + FD_HASH_FOOTPRINT;
6710 0 : fd_hash_decode_inner_global( fd_wksp_laddr_fast( ctx->wksp, self->epoch_account_hash_gaddr ), alloc_mem, ctx );
6711 0 : } else {
6712 0 : self->epoch_account_hash_gaddr = 0UL;
6713 0 : }
6714 0 : }
6715 0 : if( ctx->data == ctx->dataend ) return;
6716 0 : fd_bincode_uint64_decode_unsafe( &self->versioned_epoch_stakes_len, ctx );
6717 0 : if( self->versioned_epoch_stakes_len ) {
6718 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_VERSIONED_EPOCH_STAKES_PAIR_ALIGN );
6719 0 : self->versioned_epoch_stakes_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
6720 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
6721 0 : *alloc_mem = (uchar *)(*alloc_mem) + FD_VERSIONED_EPOCH_STAKES_PAIR_FOOTPRINT*self->versioned_epoch_stakes_len;
6722 0 : for( ulong i=0; i < self->versioned_epoch_stakes_len; i++ ) {
6723 0 : fd_versioned_epoch_stakes_pair_new( (fd_versioned_epoch_stakes_pair_t *)(cur_mem + FD_VERSIONED_EPOCH_STAKES_PAIR_FOOTPRINT * i) );
6724 0 : fd_versioned_epoch_stakes_pair_decode_inner_global( cur_mem + FD_VERSIONED_EPOCH_STAKES_PAIR_FOOTPRINT * i, alloc_mem, ctx );
6725 0 : }
6726 0 : } else
6727 0 : self->versioned_epoch_stakes_gaddr = 0UL;
6728 0 : if( ctx->data == ctx->dataend ) return;
6729 0 : {
6730 0 : uchar o;
6731 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
6732 0 : if( o ) {
6733 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, FD_SLOT_LTHASH_ALIGN );
6734 0 : self->lthash_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
6735 0 : fd_slot_lthash_new( *alloc_mem );
6736 0 : *alloc_mem = (uchar *)*alloc_mem + FD_SLOT_LTHASH_FOOTPRINT;
6737 0 : fd_slot_lthash_decode_inner_global( fd_wksp_laddr_fast( ctx->wksp, self->lthash_gaddr ), alloc_mem, ctx );
6738 0 : } else {
6739 0 : self->lthash_gaddr = 0UL;
6740 0 : }
6741 0 : }
6742 0 : }
6743 0 : int fd_solana_manifest_convert_global_to_local( void const * global_self, fd_solana_manifest_t * self, fd_bincode_decode_ctx_t * ctx ) {
6744 0 : int err = 0;
6745 0 : fd_solana_manifest_global_t const * mem = (fd_solana_manifest_global_t const *)global_self;
6746 0 : err = fd_versioned_bank_convert_global_to_local( &mem->bank, &self->bank, ctx );
6747 0 : if( FD_UNLIKELY( err ) ) return err;
6748 0 : err = fd_solana_accounts_db_fields_convert_global_to_local( &mem->accounts_db, &self->accounts_db, ctx );
6749 0 : if( FD_UNLIKELY( err ) ) return err;
6750 0 : self->lamports_per_signature = mem->lamports_per_signature;
6751 0 : self->bank_incremental_snapshot_persistence = fd_wksp_laddr_fast( ctx->wksp, mem->bank_incremental_snapshot_persistence_gaddr );
6752 0 : self->epoch_account_hash = fd_wksp_laddr_fast( ctx->wksp, mem->epoch_account_hash_gaddr );
6753 0 : self->versioned_epoch_stakes_len = mem->versioned_epoch_stakes_len;
6754 0 : self->versioned_epoch_stakes = fd_wksp_laddr_fast( ctx->wksp, mem->versioned_epoch_stakes_gaddr );
6755 0 : self->lthash = fd_wksp_laddr_fast( ctx->wksp, mem->lthash_gaddr );
6756 0 : return FD_BINCODE_SUCCESS;
6757 0 : }
6758 6 : void fd_solana_manifest_new(fd_solana_manifest_t * self) {
6759 6 : fd_memset( self, 0, sizeof(fd_solana_manifest_t) );
6760 6 : fd_versioned_bank_new( &self->bank );
6761 6 : fd_solana_accounts_db_fields_new( &self->accounts_db );
6762 6 : }
6763 0 : void fd_solana_manifest_destroy( fd_solana_manifest_t * self ) {
6764 0 : fd_versioned_bank_destroy( &self->bank );
6765 0 : fd_solana_accounts_db_fields_destroy( &self->accounts_db );
6766 0 : if( self->bank_incremental_snapshot_persistence ) {
6767 0 : fd_bank_incremental_snapshot_persistence_destroy( self->bank_incremental_snapshot_persistence );
6768 0 : self->bank_incremental_snapshot_persistence = NULL;
6769 0 : }
6770 0 : if( self->epoch_account_hash ) {
6771 0 : fd_hash_destroy( self->epoch_account_hash );
6772 0 : self->epoch_account_hash = NULL;
6773 0 : }
6774 0 : if( self->versioned_epoch_stakes ) {
6775 0 : for( ulong i=0; i < self->versioned_epoch_stakes_len; i++ )
6776 0 : fd_versioned_epoch_stakes_pair_destroy( self->versioned_epoch_stakes + i );
6777 0 : self->versioned_epoch_stakes = NULL;
6778 0 : }
6779 0 : if( self->lthash ) {
6780 0 : fd_slot_lthash_destroy( self->lthash );
6781 0 : self->lthash = NULL;
6782 0 : }
6783 0 : }
6784 :
6785 0 : ulong fd_solana_manifest_footprint( void ){ return FD_SOLANA_MANIFEST_FOOTPRINT; }
6786 6 : ulong fd_solana_manifest_align( void ){ return FD_SOLANA_MANIFEST_ALIGN; }
6787 :
6788 0 : void fd_solana_manifest_walk( void * w, fd_solana_manifest_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
6789 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_solana_manifest", level++ );
6790 0 : fd_versioned_bank_walk( w, &self->bank, fun, "bank", level );
6791 0 : fd_solana_accounts_db_fields_walk( w, &self->accounts_db, fun, "accounts_db", level );
6792 0 : fun( w, &self->lamports_per_signature, "lamports_per_signature", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
6793 0 : if( !self->bank_incremental_snapshot_persistence ) {
6794 0 : fun( w, NULL, "bank_incremental_snapshot_persistence", FD_FLAMENCO_TYPE_NULL, "bank_incremental_snapshot_persistence", level );
6795 0 : } else {
6796 0 : fd_bank_incremental_snapshot_persistence_walk( w, self->bank_incremental_snapshot_persistence, fun, "bank_incremental_snapshot_persistence", level );
6797 0 : }
6798 0 : if( !self->epoch_account_hash ) {
6799 0 : fun( w, NULL, "epoch_account_hash", FD_FLAMENCO_TYPE_NULL, "hash", level );
6800 0 : } else {
6801 0 : fd_hash_walk( w, self->epoch_account_hash, fun, "epoch_account_hash", level );
6802 0 : }
6803 0 : if( self->versioned_epoch_stakes_len ) {
6804 0 : fun( w, NULL, "versioned_epoch_stakes", FD_FLAMENCO_TYPE_ARR, "array", level++ );
6805 0 : for( ulong i=0; i < self->versioned_epoch_stakes_len; i++ )
6806 0 : fd_versioned_epoch_stakes_pair_walk(w, self->versioned_epoch_stakes + i, fun, "versioned_epoch_stakes_pair", level );
6807 0 : fun( w, NULL, "versioned_epoch_stakes", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
6808 0 : }
6809 0 : if( !self->lthash ) {
6810 0 : fun( w, NULL, "lthash", FD_FLAMENCO_TYPE_NULL, "slot_lthash", level );
6811 0 : } else {
6812 0 : fd_slot_lthash_walk( w, self->lthash, fun, "lthash", level );
6813 0 : }
6814 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_solana_manifest", level-- );
6815 0 : }
6816 6 : ulong fd_solana_manifest_size( fd_solana_manifest_t const * self ) {
6817 6 : ulong size = 0;
6818 6 : size += fd_versioned_bank_size( &self->bank );
6819 6 : size += fd_solana_accounts_db_fields_size( &self->accounts_db );
6820 6 : size += sizeof(ulong);
6821 6 : size += sizeof(char);
6822 6 : if( NULL != self->bank_incremental_snapshot_persistence ) {
6823 0 : size += fd_bank_incremental_snapshot_persistence_size( self->bank_incremental_snapshot_persistence );
6824 0 : }
6825 6 : size += sizeof(char);
6826 6 : if( NULL != self->epoch_account_hash ) {
6827 0 : size += fd_hash_size( self->epoch_account_hash );
6828 0 : }
6829 6 : do {
6830 6 : size += sizeof(ulong);
6831 6 : for( ulong i=0; i < self->versioned_epoch_stakes_len; i++ )
6832 0 : size += fd_versioned_epoch_stakes_pair_size( self->versioned_epoch_stakes + i );
6833 6 : } while(0);
6834 6 : size += sizeof(char);
6835 6 : if( NULL != self->lthash ) {
6836 0 : size += fd_slot_lthash_size( self->lthash );
6837 0 : }
6838 6 : return size;
6839 6 : }
6840 :
6841 9 : int fd_rust_duration_encode( fd_rust_duration_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6842 9 : int err;
6843 9 : err = fd_bincode_uint64_encode( self->seconds, ctx );
6844 9 : if( FD_UNLIKELY( err ) ) return err;
6845 9 : err = fd_bincode_uint32_encode( self->nanoseconds, ctx );
6846 9 : if( FD_UNLIKELY( err ) ) return err;
6847 9 : return FD_BINCODE_SUCCESS;
6848 9 : }
6849 0 : int fd_rust_duration_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6850 0 : *total_sz += sizeof(fd_rust_duration_t);
6851 0 : void const * start_data = ctx->data;
6852 0 : int err = fd_rust_duration_decode_footprint_inner( ctx, total_sz );
6853 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6854 0 : ctx->data = start_data;
6855 0 : return err;
6856 0 : }
6857 0 : int fd_rust_duration_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6858 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6859 0 : int err = 0;
6860 0 : err = fd_bincode_uint64_decode_footprint( ctx );
6861 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6862 0 : err = fd_bincode_uint32_decode_footprint( ctx );
6863 0 : if( FD_UNLIKELY( err ) ) return err;
6864 0 : return 0;
6865 0 : }
6866 0 : void * fd_rust_duration_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6867 0 : fd_rust_duration_t * self = (fd_rust_duration_t *)mem;
6868 0 : fd_rust_duration_new( self );
6869 0 : void * alloc_region = (uchar *)mem + sizeof(fd_rust_duration_t);
6870 0 : void * * alloc_mem = &alloc_region;
6871 0 : fd_rust_duration_decode_inner( mem, alloc_mem, ctx );
6872 0 : return self;
6873 0 : }
6874 0 : void fd_rust_duration_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6875 0 : fd_rust_duration_t * self = (fd_rust_duration_t *)struct_mem;
6876 0 : fd_bincode_uint64_decode_unsafe( &self->seconds, ctx );
6877 0 : fd_bincode_uint32_decode_unsafe( &self->nanoseconds, ctx );
6878 0 : }
6879 0 : void * fd_rust_duration_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6880 0 : fd_rust_duration_global_t * self = (fd_rust_duration_global_t *)mem;
6881 0 : fd_rust_duration_new( (fd_rust_duration_t *)self );
6882 0 : void * alloc_region = (uchar *)mem + sizeof(fd_rust_duration_global_t);
6883 0 : void * * alloc_mem = &alloc_region;
6884 0 : fd_rust_duration_decode_inner_global( mem, alloc_mem, ctx );
6885 0 : return self;
6886 0 : }
6887 0 : void fd_rust_duration_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6888 0 : fd_rust_duration_global_t * self = (fd_rust_duration_global_t *)struct_mem;
6889 0 : fd_bincode_uint64_decode_unsafe( &self->seconds, ctx );
6890 0 : fd_bincode_uint32_decode_unsafe( &self->nanoseconds, ctx );
6891 0 : }
6892 0 : int fd_rust_duration_convert_global_to_local( void const * global_self, fd_rust_duration_t * self, fd_bincode_decode_ctx_t * ctx ) {
6893 0 : int err = 0;
6894 0 : fd_rust_duration_global_t const * mem = (fd_rust_duration_global_t const *)global_self;
6895 0 : self->seconds = mem->seconds;
6896 0 : self->nanoseconds = mem->nanoseconds;
6897 0 : return FD_BINCODE_SUCCESS;
6898 0 : }
6899 12 : void fd_rust_duration_new(fd_rust_duration_t * self) {
6900 12 : fd_memset( self, 0, sizeof(fd_rust_duration_t) );
6901 12 : }
6902 0 : void fd_rust_duration_destroy( fd_rust_duration_t * self ) {
6903 0 : }
6904 :
6905 0 : ulong fd_rust_duration_footprint( void ){ return FD_RUST_DURATION_FOOTPRINT; }
6906 0 : ulong fd_rust_duration_align( void ){ return FD_RUST_DURATION_ALIGN; }
6907 :
6908 0 : void fd_rust_duration_walk( void * w, fd_rust_duration_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
6909 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_rust_duration", level++ );
6910 0 : fun( w, &self->seconds, "seconds", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
6911 0 : fun( w, &self->nanoseconds, "nanoseconds", FD_FLAMENCO_TYPE_UINT, "uint", level );
6912 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_rust_duration", level-- );
6913 0 : }
6914 0 : ulong fd_rust_duration_size( fd_rust_duration_t const * self ) {
6915 0 : ulong size = 0;
6916 0 : size += sizeof(ulong);
6917 0 : size += sizeof(uint);
6918 0 : return size;
6919 0 : }
6920 :
6921 9 : int fd_poh_config_encode( fd_poh_config_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6922 9 : int err;
6923 9 : err = fd_rust_duration_encode( &self->target_tick_duration, ctx );
6924 9 : if( FD_UNLIKELY( err ) ) return err;
6925 9 : if( self->target_tick_count != NULL ) {
6926 0 : err = fd_bincode_bool_encode( 1, ctx );
6927 0 : if( FD_UNLIKELY( err ) ) return err;
6928 0 : err = fd_bincode_uint64_encode( self->target_tick_count[0], ctx );
6929 0 : if( FD_UNLIKELY( err ) ) return err;
6930 9 : } else {
6931 9 : err = fd_bincode_bool_encode( 0, ctx );
6932 9 : if( FD_UNLIKELY( err ) ) return err;
6933 9 : }
6934 9 : err = fd_bincode_bool_encode( self->has_hashes_per_tick, ctx );
6935 9 : if( FD_UNLIKELY( err ) ) return err;
6936 9 : if( self->has_hashes_per_tick ) {
6937 0 : err = fd_bincode_uint64_encode( self->hashes_per_tick, ctx );
6938 0 : if( FD_UNLIKELY( err ) ) return err;
6939 0 : }
6940 9 : return FD_BINCODE_SUCCESS;
6941 9 : }
6942 0 : int fd_poh_config_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6943 0 : *total_sz += sizeof(fd_poh_config_t);
6944 0 : void const * start_data = ctx->data;
6945 0 : int err = fd_poh_config_decode_footprint_inner( ctx, total_sz );
6946 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6947 0 : ctx->data = start_data;
6948 0 : return err;
6949 0 : }
6950 0 : int fd_poh_config_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6951 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6952 0 : int err = 0;
6953 0 : err = fd_rust_duration_decode_footprint_inner( ctx, total_sz );
6954 0 : if( FD_UNLIKELY( err ) ) return err;
6955 0 : {
6956 0 : uchar o;
6957 0 : err = fd_bincode_bool_decode( &o, ctx );
6958 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6959 0 : if( o ) {
6960 0 : *total_sz += 8UL + sizeof(ulong);
6961 0 : err = fd_bincode_uint64_decode_footprint( ctx );
6962 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6963 0 : }
6964 0 : }
6965 0 : {
6966 0 : uchar o;
6967 0 : err = fd_bincode_bool_decode( &o, ctx );
6968 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6969 0 : if( o ) {
6970 0 : err = fd_bincode_uint64_decode_footprint( ctx );
6971 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6972 0 : }
6973 0 : }
6974 0 : return 0;
6975 0 : }
6976 0 : void * fd_poh_config_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6977 0 : fd_poh_config_t * self = (fd_poh_config_t *)mem;
6978 0 : fd_poh_config_new( self );
6979 0 : void * alloc_region = (uchar *)mem + sizeof(fd_poh_config_t);
6980 0 : void * * alloc_mem = &alloc_region;
6981 0 : fd_poh_config_decode_inner( mem, alloc_mem, ctx );
6982 0 : return self;
6983 0 : }
6984 0 : void fd_poh_config_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6985 0 : fd_poh_config_t * self = (fd_poh_config_t *)struct_mem;
6986 0 : fd_rust_duration_decode_inner( &self->target_tick_duration, alloc_mem, ctx );
6987 0 : {
6988 0 : uchar o;
6989 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
6990 0 : if( o ) {
6991 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, 8UL );
6992 0 : self->target_tick_count = *alloc_mem;
6993 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(ulong);
6994 0 : fd_bincode_uint64_decode_unsafe( self->target_tick_count, ctx );
6995 0 : } else {
6996 0 : self->target_tick_count = NULL;
6997 0 : }
6998 0 : }
6999 0 : {
7000 0 : uchar o;
7001 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
7002 0 : self->has_hashes_per_tick = !!o;
7003 0 : if( o ) {
7004 0 : fd_bincode_uint64_decode_unsafe( &self->hashes_per_tick, ctx );
7005 0 : }
7006 0 : }
7007 0 : }
7008 0 : void * fd_poh_config_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7009 0 : fd_poh_config_global_t * self = (fd_poh_config_global_t *)mem;
7010 0 : fd_poh_config_new( (fd_poh_config_t *)self );
7011 0 : void * alloc_region = (uchar *)mem + sizeof(fd_poh_config_global_t);
7012 0 : void * * alloc_mem = &alloc_region;
7013 0 : fd_poh_config_decode_inner_global( mem, alloc_mem, ctx );
7014 0 : return self;
7015 0 : }
7016 0 : void fd_poh_config_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7017 0 : fd_poh_config_global_t * self = (fd_poh_config_global_t *)struct_mem;
7018 0 : fd_rust_duration_decode_inner_global( &self->target_tick_duration, alloc_mem, ctx );
7019 0 : {
7020 0 : uchar o;
7021 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
7022 0 : if( o ) {
7023 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, 8UL );
7024 0 : self->target_tick_count_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
7025 0 : fd_bincode_uint64_decode_unsafe( *alloc_mem, ctx );
7026 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(ulong);
7027 0 : } else {
7028 0 : self->target_tick_count_gaddr = 0UL;
7029 0 : }
7030 0 : }
7031 0 : {
7032 0 : uchar o;
7033 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
7034 0 : self->has_hashes_per_tick = !!o;
7035 0 : if( o ) {
7036 0 : fd_bincode_uint64_decode_unsafe( &self->hashes_per_tick, ctx );
7037 0 : }
7038 0 : }
7039 0 : }
7040 0 : int fd_poh_config_convert_global_to_local( void const * global_self, fd_poh_config_t * self, fd_bincode_decode_ctx_t * ctx ) {
7041 0 : int err = 0;
7042 0 : fd_poh_config_global_t const * mem = (fd_poh_config_global_t const *)global_self;
7043 0 : err = fd_rust_duration_convert_global_to_local( &mem->target_tick_duration, &self->target_tick_duration, ctx );
7044 0 : if( FD_UNLIKELY( err ) ) return err;
7045 0 : self->target_tick_count = fd_wksp_laddr_fast( ctx->wksp, mem->target_tick_count_gaddr );
7046 0 : self->hashes_per_tick = mem->hashes_per_tick;
7047 0 : self->has_hashes_per_tick = mem->has_hashes_per_tick;
7048 0 : return FD_BINCODE_SUCCESS;
7049 0 : }
7050 12 : void fd_poh_config_new(fd_poh_config_t * self) {
7051 12 : fd_memset( self, 0, sizeof(fd_poh_config_t) );
7052 12 : fd_rust_duration_new( &self->target_tick_duration );
7053 12 : }
7054 0 : void fd_poh_config_destroy( fd_poh_config_t * self ) {
7055 0 : fd_rust_duration_destroy( &self->target_tick_duration );
7056 0 : if( self->target_tick_count ) {
7057 0 : self->target_tick_count = NULL;
7058 0 : }
7059 0 : if( self->has_hashes_per_tick ) {
7060 0 : self->has_hashes_per_tick = 0;
7061 0 : }
7062 0 : }
7063 :
7064 0 : ulong fd_poh_config_footprint( void ){ return FD_POH_CONFIG_FOOTPRINT; }
7065 0 : ulong fd_poh_config_align( void ){ return FD_POH_CONFIG_ALIGN; }
7066 :
7067 0 : void fd_poh_config_walk( void * w, fd_poh_config_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
7068 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_poh_config", level++ );
7069 0 : fd_rust_duration_walk( w, &self->target_tick_duration, fun, "target_tick_duration", level );
7070 0 : if( !self->target_tick_count ) {
7071 0 : fun( w, NULL, "target_tick_count", FD_FLAMENCO_TYPE_NULL, "ulong", level );
7072 0 : } else {
7073 0 : fun( w, self->target_tick_count, "target_tick_count", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
7074 0 : }
7075 0 : if( !self->has_hashes_per_tick ) {
7076 0 : fun( w, NULL, "hashes_per_tick", FD_FLAMENCO_TYPE_NULL, "ulong", level );
7077 0 : } else {
7078 0 : fun( w, &self->hashes_per_tick, "hashes_per_tick", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
7079 0 : }
7080 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_poh_config", level-- );
7081 0 : }
7082 0 : ulong fd_poh_config_size( fd_poh_config_t const * self ) {
7083 0 : ulong size = 0;
7084 0 : size += fd_rust_duration_size( &self->target_tick_duration );
7085 0 : size += sizeof(char);
7086 0 : if( NULL != self->target_tick_count ) {
7087 0 : size += sizeof(ulong);
7088 0 : }
7089 0 : size += sizeof(char);
7090 0 : if( self->has_hashes_per_tick ) {
7091 0 : size += sizeof(ulong);
7092 0 : }
7093 0 : return size;
7094 0 : }
7095 :
7096 0 : int fd_string_pubkey_pair_encode( fd_string_pubkey_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7097 0 : int err;
7098 0 : err = fd_bincode_uint64_encode( self->string_len, ctx );
7099 0 : if( FD_UNLIKELY(err) ) return err;
7100 0 : if( self->string_len ) {
7101 0 : err = fd_bincode_bytes_encode( self->string, self->string_len, ctx );
7102 0 : if( FD_UNLIKELY( err ) ) return err;
7103 0 : }
7104 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
7105 0 : if( FD_UNLIKELY( err ) ) return err;
7106 0 : return FD_BINCODE_SUCCESS;
7107 0 : }
7108 0 : int fd_string_pubkey_pair_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7109 0 : *total_sz += sizeof(fd_string_pubkey_pair_t);
7110 0 : void const * start_data = ctx->data;
7111 0 : int err = fd_string_pubkey_pair_decode_footprint_inner( ctx, total_sz );
7112 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7113 0 : ctx->data = start_data;
7114 0 : return err;
7115 0 : }
7116 0 : int fd_string_pubkey_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7117 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7118 0 : int err = 0;
7119 0 : ulong string_len;
7120 0 : err = fd_bincode_uint64_decode( &string_len, ctx );
7121 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7122 0 : *total_sz += string_len;
7123 0 : if( string_len ) {
7124 0 : err = fd_bincode_bytes_decode_footprint( string_len, ctx );
7125 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7126 0 : err = !fd_utf8_verify( (char const *) ctx->data - string_len, string_len );
7127 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7128 0 : }
7129 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
7130 0 : if( FD_UNLIKELY( err ) ) return err;
7131 0 : return 0;
7132 0 : }
7133 0 : void * fd_string_pubkey_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7134 0 : fd_string_pubkey_pair_t * self = (fd_string_pubkey_pair_t *)mem;
7135 0 : fd_string_pubkey_pair_new( self );
7136 0 : void * alloc_region = (uchar *)mem + sizeof(fd_string_pubkey_pair_t);
7137 0 : void * * alloc_mem = &alloc_region;
7138 0 : fd_string_pubkey_pair_decode_inner( mem, alloc_mem, ctx );
7139 0 : return self;
7140 0 : }
7141 0 : void fd_string_pubkey_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7142 0 : fd_string_pubkey_pair_t * self = (fd_string_pubkey_pair_t *)struct_mem;
7143 0 : fd_bincode_uint64_decode_unsafe( &self->string_len, ctx );
7144 0 : if( self->string_len ) {
7145 0 : self->string = *alloc_mem;
7146 0 : fd_bincode_bytes_decode_unsafe( self->string, self->string_len, ctx );
7147 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->string_len;
7148 0 : } else
7149 0 : self->string = NULL;
7150 0 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
7151 0 : }
7152 0 : void * fd_string_pubkey_pair_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7153 0 : fd_string_pubkey_pair_global_t * self = (fd_string_pubkey_pair_global_t *)mem;
7154 0 : fd_string_pubkey_pair_new( (fd_string_pubkey_pair_t *)self );
7155 0 : void * alloc_region = (uchar *)mem + sizeof(fd_string_pubkey_pair_global_t);
7156 0 : void * * alloc_mem = &alloc_region;
7157 0 : fd_string_pubkey_pair_decode_inner_global( mem, alloc_mem, ctx );
7158 0 : return self;
7159 0 : }
7160 0 : void fd_string_pubkey_pair_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7161 0 : fd_string_pubkey_pair_global_t * self = (fd_string_pubkey_pair_global_t *)struct_mem;
7162 0 : fd_bincode_uint64_decode_unsafe( &self->string_len, ctx );
7163 0 : if( self->string_len ) {
7164 0 : self->string_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
7165 0 : fd_bincode_bytes_decode_unsafe( *alloc_mem, self->string_len, ctx );
7166 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->string_len;
7167 0 : } else
7168 0 : self->string_gaddr = 0UL;
7169 0 : fd_pubkey_decode_inner_global( &self->pubkey, alloc_mem, ctx );
7170 0 : }
7171 0 : int fd_string_pubkey_pair_convert_global_to_local( void const * global_self, fd_string_pubkey_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
7172 0 : int err = 0;
7173 0 : fd_string_pubkey_pair_global_t const * mem = (fd_string_pubkey_pair_global_t const *)global_self;
7174 0 : self->string_len = mem->string_len;
7175 0 : self->string = fd_wksp_laddr_fast( ctx->wksp, mem->string_gaddr );
7176 0 : err = fd_pubkey_convert_global_to_local( &mem->pubkey, &self->pubkey, ctx );
7177 0 : if( FD_UNLIKELY( err ) ) return err;
7178 0 : return FD_BINCODE_SUCCESS;
7179 0 : }
7180 0 : void fd_string_pubkey_pair_new(fd_string_pubkey_pair_t * self) {
7181 0 : fd_memset( self, 0, sizeof(fd_string_pubkey_pair_t) );
7182 0 : fd_pubkey_new( &self->pubkey );
7183 0 : }
7184 0 : void fd_string_pubkey_pair_destroy( fd_string_pubkey_pair_t * self ) {
7185 0 : if( self->string ) {
7186 0 : self->string = NULL;
7187 0 : }
7188 0 : fd_pubkey_destroy( &self->pubkey );
7189 0 : }
7190 :
7191 0 : ulong fd_string_pubkey_pair_footprint( void ){ return FD_STRING_PUBKEY_PAIR_FOOTPRINT; }
7192 0 : ulong fd_string_pubkey_pair_align( void ){ return FD_STRING_PUBKEY_PAIR_ALIGN; }
7193 :
7194 0 : void fd_string_pubkey_pair_walk( void * w, fd_string_pubkey_pair_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
7195 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_string_pubkey_pair", level++ );
7196 0 : fun(w, self->string, "string", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
7197 0 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level );
7198 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_string_pubkey_pair", level-- );
7199 0 : }
7200 0 : ulong fd_string_pubkey_pair_size( fd_string_pubkey_pair_t const * self ) {
7201 0 : ulong size = 0;
7202 0 : do {
7203 0 : size += sizeof(ulong);
7204 0 : size += self->string_len;
7205 0 : } while(0);
7206 0 : size += fd_pubkey_size( &self->pubkey );
7207 0 : return size;
7208 0 : }
7209 :
7210 144 : int fd_pubkey_account_pair_encode( fd_pubkey_account_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7211 144 : int err;
7212 144 : err = fd_pubkey_encode( &self->key, ctx );
7213 144 : if( FD_UNLIKELY( err ) ) return err;
7214 144 : err = fd_solana_account_encode( &self->account, ctx );
7215 144 : if( FD_UNLIKELY( err ) ) return err;
7216 144 : return FD_BINCODE_SUCCESS;
7217 144 : }
7218 0 : int fd_pubkey_account_pair_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7219 0 : *total_sz += sizeof(fd_pubkey_account_pair_t);
7220 0 : void const * start_data = ctx->data;
7221 0 : int err = fd_pubkey_account_pair_decode_footprint_inner( ctx, total_sz );
7222 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7223 0 : ctx->data = start_data;
7224 0 : return err;
7225 0 : }
7226 0 : int fd_pubkey_account_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7227 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7228 0 : int err = 0;
7229 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
7230 0 : if( FD_UNLIKELY( err ) ) return err;
7231 0 : err = fd_solana_account_decode_footprint_inner( ctx, total_sz );
7232 0 : if( FD_UNLIKELY( err ) ) return err;
7233 0 : return 0;
7234 0 : }
7235 0 : void * fd_pubkey_account_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7236 0 : fd_pubkey_account_pair_t * self = (fd_pubkey_account_pair_t *)mem;
7237 0 : fd_pubkey_account_pair_new( self );
7238 0 : void * alloc_region = (uchar *)mem + sizeof(fd_pubkey_account_pair_t);
7239 0 : void * * alloc_mem = &alloc_region;
7240 0 : fd_pubkey_account_pair_decode_inner( mem, alloc_mem, ctx );
7241 0 : return self;
7242 0 : }
7243 0 : void fd_pubkey_account_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7244 0 : fd_pubkey_account_pair_t * self = (fd_pubkey_account_pair_t *)struct_mem;
7245 0 : fd_pubkey_decode_inner( &self->key, alloc_mem, ctx );
7246 0 : fd_solana_account_decode_inner( &self->account, alloc_mem, ctx );
7247 0 : }
7248 0 : void * fd_pubkey_account_pair_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7249 0 : fd_pubkey_account_pair_global_t * self = (fd_pubkey_account_pair_global_t *)mem;
7250 0 : fd_pubkey_account_pair_new( (fd_pubkey_account_pair_t *)self );
7251 0 : void * alloc_region = (uchar *)mem + sizeof(fd_pubkey_account_pair_global_t);
7252 0 : void * * alloc_mem = &alloc_region;
7253 0 : fd_pubkey_account_pair_decode_inner_global( mem, alloc_mem, ctx );
7254 0 : return self;
7255 0 : }
7256 0 : void fd_pubkey_account_pair_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7257 0 : fd_pubkey_account_pair_global_t * self = (fd_pubkey_account_pair_global_t *)struct_mem;
7258 0 : fd_pubkey_decode_inner_global( &self->key, alloc_mem, ctx );
7259 0 : fd_solana_account_decode_inner_global( &self->account, alloc_mem, ctx );
7260 0 : }
7261 0 : int fd_pubkey_account_pair_convert_global_to_local( void const * global_self, fd_pubkey_account_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
7262 0 : int err = 0;
7263 0 : fd_pubkey_account_pair_global_t const * mem = (fd_pubkey_account_pair_global_t const *)global_self;
7264 0 : err = fd_pubkey_convert_global_to_local( &mem->key, &self->key, ctx );
7265 0 : if( FD_UNLIKELY( err ) ) return err;
7266 0 : err = fd_solana_account_convert_global_to_local( &mem->account, &self->account, ctx );
7267 0 : if( FD_UNLIKELY( err ) ) return err;
7268 0 : return FD_BINCODE_SUCCESS;
7269 0 : }
7270 0 : void fd_pubkey_account_pair_new(fd_pubkey_account_pair_t * self) {
7271 0 : fd_memset( self, 0, sizeof(fd_pubkey_account_pair_t) );
7272 0 : fd_pubkey_new( &self->key );
7273 0 : fd_solana_account_new( &self->account );
7274 0 : }
7275 0 : void fd_pubkey_account_pair_destroy( fd_pubkey_account_pair_t * self ) {
7276 0 : fd_pubkey_destroy( &self->key );
7277 0 : fd_solana_account_destroy( &self->account );
7278 0 : }
7279 :
7280 0 : ulong fd_pubkey_account_pair_footprint( void ){ return FD_PUBKEY_ACCOUNT_PAIR_FOOTPRINT; }
7281 0 : ulong fd_pubkey_account_pair_align( void ){ return FD_PUBKEY_ACCOUNT_PAIR_ALIGN; }
7282 :
7283 0 : void fd_pubkey_account_pair_walk( void * w, fd_pubkey_account_pair_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
7284 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_pubkey_account_pair", level++ );
7285 0 : fd_pubkey_walk( w, &self->key, fun, "key", level );
7286 0 : fd_solana_account_walk( w, &self->account, fun, "account", level );
7287 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_pubkey_account_pair", level-- );
7288 0 : }
7289 0 : ulong fd_pubkey_account_pair_size( fd_pubkey_account_pair_t const * self ) {
7290 0 : ulong size = 0;
7291 0 : size += fd_pubkey_size( &self->key );
7292 0 : size += fd_solana_account_size( &self->account );
7293 0 : return size;
7294 0 : }
7295 :
7296 12 : int fd_genesis_solana_encode( fd_genesis_solana_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7297 12 : int err;
7298 12 : err = fd_bincode_uint64_encode( self->creation_time, ctx );
7299 12 : if( FD_UNLIKELY( err ) ) return err;
7300 9 : err = fd_bincode_uint64_encode( self->accounts_len, ctx );
7301 9 : if( FD_UNLIKELY(err) ) return err;
7302 9 : if( self->accounts_len ) {
7303 153 : for( ulong i=0; i < self->accounts_len; i++ ) {
7304 144 : err = fd_pubkey_account_pair_encode( self->accounts + i, ctx );
7305 144 : if( FD_UNLIKELY( err ) ) return err;
7306 144 : }
7307 9 : }
7308 9 : err = fd_bincode_uint64_encode( self->native_instruction_processors_len, ctx );
7309 9 : if( FD_UNLIKELY(err) ) return err;
7310 9 : if( self->native_instruction_processors_len ) {
7311 0 : for( ulong i=0; i < self->native_instruction_processors_len; i++ ) {
7312 0 : err = fd_string_pubkey_pair_encode( self->native_instruction_processors + i, ctx );
7313 0 : if( FD_UNLIKELY( err ) ) return err;
7314 0 : }
7315 0 : }
7316 9 : err = fd_bincode_uint64_encode( self->rewards_pools_len, ctx );
7317 9 : if( FD_UNLIKELY(err) ) return err;
7318 9 : if( self->rewards_pools_len ) {
7319 0 : for( ulong i=0; i < self->rewards_pools_len; i++ ) {
7320 0 : err = fd_pubkey_account_pair_encode( self->rewards_pools + i, ctx );
7321 0 : if( FD_UNLIKELY( err ) ) return err;
7322 0 : }
7323 0 : }
7324 9 : err = fd_bincode_uint64_encode( self->ticks_per_slot, ctx );
7325 9 : if( FD_UNLIKELY( err ) ) return err;
7326 9 : err = fd_bincode_uint64_encode( self->unused, ctx );
7327 9 : if( FD_UNLIKELY( err ) ) return err;
7328 9 : err = fd_poh_config_encode( &self->poh_config, ctx );
7329 9 : if( FD_UNLIKELY( err ) ) return err;
7330 9 : err = fd_bincode_uint64_encode( self->__backwards_compat_with_v0_23, ctx );
7331 9 : if( FD_UNLIKELY( err ) ) return err;
7332 9 : err = fd_fee_rate_governor_encode( &self->fee_rate_governor, ctx );
7333 9 : if( FD_UNLIKELY( err ) ) return err;
7334 9 : err = fd_rent_encode( &self->rent, ctx );
7335 9 : if( FD_UNLIKELY( err ) ) return err;
7336 9 : err = fd_inflation_encode( &self->inflation, ctx );
7337 9 : if( FD_UNLIKELY( err ) ) return err;
7338 9 : err = fd_epoch_schedule_encode( &self->epoch_schedule, ctx );
7339 9 : if( FD_UNLIKELY( err ) ) return err;
7340 9 : err = fd_bincode_uint32_encode( self->cluster_type, ctx );
7341 9 : if( FD_UNLIKELY( err ) ) return err;
7342 9 : return FD_BINCODE_SUCCESS;
7343 9 : }
7344 0 : int fd_genesis_solana_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7345 0 : *total_sz += sizeof(fd_genesis_solana_t);
7346 0 : void const * start_data = ctx->data;
7347 0 : int err = fd_genesis_solana_decode_footprint_inner( ctx, total_sz );
7348 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7349 0 : ctx->data = start_data;
7350 0 : return err;
7351 0 : }
7352 0 : int fd_genesis_solana_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7353 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7354 0 : int err = 0;
7355 0 : err = fd_bincode_uint64_decode_footprint( ctx );
7356 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7357 0 : ulong accounts_len;
7358 0 : err = fd_bincode_uint64_decode( &accounts_len, ctx );
7359 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7360 0 : if( accounts_len ) {
7361 0 : *total_sz += FD_PUBKEY_ACCOUNT_PAIR_ALIGN + FD_PUBKEY_ACCOUNT_PAIR_FOOTPRINT*accounts_len;
7362 0 : for( ulong i=0; i < accounts_len; i++ ) {
7363 0 : err = fd_pubkey_account_pair_decode_footprint_inner( ctx, total_sz );
7364 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7365 0 : }
7366 0 : }
7367 0 : ulong native_instruction_processors_len;
7368 0 : err = fd_bincode_uint64_decode( &native_instruction_processors_len, ctx );
7369 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7370 0 : if( native_instruction_processors_len ) {
7371 0 : *total_sz += FD_STRING_PUBKEY_PAIR_ALIGN + FD_STRING_PUBKEY_PAIR_FOOTPRINT*native_instruction_processors_len;
7372 0 : for( ulong i=0; i < native_instruction_processors_len; i++ ) {
7373 0 : err = fd_string_pubkey_pair_decode_footprint_inner( ctx, total_sz );
7374 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7375 0 : }
7376 0 : }
7377 0 : ulong rewards_pools_len;
7378 0 : err = fd_bincode_uint64_decode( &rewards_pools_len, ctx );
7379 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7380 0 : if( rewards_pools_len ) {
7381 0 : *total_sz += FD_PUBKEY_ACCOUNT_PAIR_ALIGN + FD_PUBKEY_ACCOUNT_PAIR_FOOTPRINT*rewards_pools_len;
7382 0 : for( ulong i=0; i < rewards_pools_len; i++ ) {
7383 0 : err = fd_pubkey_account_pair_decode_footprint_inner( ctx, total_sz );
7384 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7385 0 : }
7386 0 : }
7387 0 : err = fd_bincode_uint64_decode_footprint( ctx );
7388 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7389 0 : err = fd_bincode_uint64_decode_footprint( ctx );
7390 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7391 0 : err = fd_poh_config_decode_footprint_inner( ctx, total_sz );
7392 0 : if( FD_UNLIKELY( err ) ) return err;
7393 0 : err = fd_bincode_uint64_decode_footprint( ctx );
7394 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7395 0 : err = fd_fee_rate_governor_decode_footprint_inner( ctx, total_sz );
7396 0 : if( FD_UNLIKELY( err ) ) return err;
7397 0 : err = fd_rent_decode_footprint_inner( ctx, total_sz );
7398 0 : if( FD_UNLIKELY( err ) ) return err;
7399 0 : err = fd_inflation_decode_footprint_inner( ctx, total_sz );
7400 0 : if( FD_UNLIKELY( err ) ) return err;
7401 0 : err = fd_epoch_schedule_decode_footprint_inner( ctx, total_sz );
7402 0 : if( FD_UNLIKELY( err ) ) return err;
7403 0 : err = fd_bincode_uint32_decode_footprint( ctx );
7404 0 : if( FD_UNLIKELY( err ) ) return err;
7405 0 : return 0;
7406 0 : }
7407 0 : void * fd_genesis_solana_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7408 0 : fd_genesis_solana_t * self = (fd_genesis_solana_t *)mem;
7409 0 : fd_genesis_solana_new( self );
7410 0 : void * alloc_region = (uchar *)mem + sizeof(fd_genesis_solana_t);
7411 0 : void * * alloc_mem = &alloc_region;
7412 0 : fd_genesis_solana_decode_inner( mem, alloc_mem, ctx );
7413 0 : return self;
7414 0 : }
7415 0 : void fd_genesis_solana_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7416 0 : fd_genesis_solana_t * self = (fd_genesis_solana_t *)struct_mem;
7417 0 : fd_bincode_uint64_decode_unsafe( &self->creation_time, ctx );
7418 0 : fd_bincode_uint64_decode_unsafe( &self->accounts_len, ctx );
7419 0 : if( self->accounts_len ) {
7420 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_ACCOUNT_PAIR_ALIGN );
7421 0 : self->accounts = *alloc_mem;
7422 0 : *alloc_mem = (uchar *)(*alloc_mem) + FD_PUBKEY_ACCOUNT_PAIR_FOOTPRINT*self->accounts_len;
7423 0 : for( ulong i=0; i < self->accounts_len; i++ ) {
7424 0 : fd_pubkey_account_pair_new( self->accounts + i );
7425 0 : fd_pubkey_account_pair_decode_inner( self->accounts + i, alloc_mem, ctx );
7426 0 : }
7427 0 : } else
7428 0 : self->accounts = NULL;
7429 0 : fd_bincode_uint64_decode_unsafe( &self->native_instruction_processors_len, ctx );
7430 0 : if( self->native_instruction_processors_len ) {
7431 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_STRING_PUBKEY_PAIR_ALIGN );
7432 0 : self->native_instruction_processors = *alloc_mem;
7433 0 : *alloc_mem = (uchar *)(*alloc_mem) + FD_STRING_PUBKEY_PAIR_FOOTPRINT*self->native_instruction_processors_len;
7434 0 : for( ulong i=0; i < self->native_instruction_processors_len; i++ ) {
7435 0 : fd_string_pubkey_pair_new( self->native_instruction_processors + i );
7436 0 : fd_string_pubkey_pair_decode_inner( self->native_instruction_processors + i, alloc_mem, ctx );
7437 0 : }
7438 0 : } else
7439 0 : self->native_instruction_processors = NULL;
7440 0 : fd_bincode_uint64_decode_unsafe( &self->rewards_pools_len, ctx );
7441 0 : if( self->rewards_pools_len ) {
7442 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_ACCOUNT_PAIR_ALIGN );
7443 0 : self->rewards_pools = *alloc_mem;
7444 0 : *alloc_mem = (uchar *)(*alloc_mem) + FD_PUBKEY_ACCOUNT_PAIR_FOOTPRINT*self->rewards_pools_len;
7445 0 : for( ulong i=0; i < self->rewards_pools_len; i++ ) {
7446 0 : fd_pubkey_account_pair_new( self->rewards_pools + i );
7447 0 : fd_pubkey_account_pair_decode_inner( self->rewards_pools + i, alloc_mem, ctx );
7448 0 : }
7449 0 : } else
7450 0 : self->rewards_pools = NULL;
7451 0 : fd_bincode_uint64_decode_unsafe( &self->ticks_per_slot, ctx );
7452 0 : fd_bincode_uint64_decode_unsafe( &self->unused, ctx );
7453 0 : fd_poh_config_decode_inner( &self->poh_config, alloc_mem, ctx );
7454 0 : fd_bincode_uint64_decode_unsafe( &self->__backwards_compat_with_v0_23, ctx );
7455 0 : fd_fee_rate_governor_decode_inner( &self->fee_rate_governor, alloc_mem, ctx );
7456 0 : fd_rent_decode_inner( &self->rent, alloc_mem, ctx );
7457 0 : fd_inflation_decode_inner( &self->inflation, alloc_mem, ctx );
7458 0 : fd_epoch_schedule_decode_inner( &self->epoch_schedule, alloc_mem, ctx );
7459 0 : fd_bincode_uint32_decode_unsafe( &self->cluster_type, ctx );
7460 0 : }
7461 0 : void * fd_genesis_solana_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7462 0 : fd_genesis_solana_global_t * self = (fd_genesis_solana_global_t *)mem;
7463 0 : fd_genesis_solana_new( (fd_genesis_solana_t *)self );
7464 0 : void * alloc_region = (uchar *)mem + sizeof(fd_genesis_solana_global_t);
7465 0 : void * * alloc_mem = &alloc_region;
7466 0 : fd_genesis_solana_decode_inner_global( mem, alloc_mem, ctx );
7467 0 : return self;
7468 0 : }
7469 0 : void fd_genesis_solana_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7470 0 : fd_genesis_solana_global_t * self = (fd_genesis_solana_global_t *)struct_mem;
7471 0 : fd_bincode_uint64_decode_unsafe( &self->creation_time, ctx );
7472 0 : fd_bincode_uint64_decode_unsafe( &self->accounts_len, ctx );
7473 0 : if( self->accounts_len ) {
7474 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_ACCOUNT_PAIR_ALIGN );
7475 0 : self->accounts_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
7476 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
7477 0 : *alloc_mem = (uchar *)(*alloc_mem) + FD_PUBKEY_ACCOUNT_PAIR_FOOTPRINT*self->accounts_len;
7478 0 : for( ulong i=0; i < self->accounts_len; i++ ) {
7479 0 : fd_pubkey_account_pair_new( (fd_pubkey_account_pair_t *)(cur_mem + FD_PUBKEY_ACCOUNT_PAIR_FOOTPRINT * i) );
7480 0 : fd_pubkey_account_pair_decode_inner_global( cur_mem + FD_PUBKEY_ACCOUNT_PAIR_FOOTPRINT * i, alloc_mem, ctx );
7481 0 : }
7482 0 : } else
7483 0 : self->accounts_gaddr = 0UL;
7484 0 : fd_bincode_uint64_decode_unsafe( &self->native_instruction_processors_len, ctx );
7485 0 : if( self->native_instruction_processors_len ) {
7486 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_STRING_PUBKEY_PAIR_ALIGN );
7487 0 : self->native_instruction_processors_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
7488 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
7489 0 : *alloc_mem = (uchar *)(*alloc_mem) + FD_STRING_PUBKEY_PAIR_FOOTPRINT*self->native_instruction_processors_len;
7490 0 : for( ulong i=0; i < self->native_instruction_processors_len; i++ ) {
7491 0 : fd_string_pubkey_pair_new( (fd_string_pubkey_pair_t *)(cur_mem + FD_STRING_PUBKEY_PAIR_FOOTPRINT * i) );
7492 0 : fd_string_pubkey_pair_decode_inner_global( cur_mem + FD_STRING_PUBKEY_PAIR_FOOTPRINT * i, alloc_mem, ctx );
7493 0 : }
7494 0 : } else
7495 0 : self->native_instruction_processors_gaddr = 0UL;
7496 0 : fd_bincode_uint64_decode_unsafe( &self->rewards_pools_len, ctx );
7497 0 : if( self->rewards_pools_len ) {
7498 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_ACCOUNT_PAIR_ALIGN );
7499 0 : self->rewards_pools_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
7500 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
7501 0 : *alloc_mem = (uchar *)(*alloc_mem) + FD_PUBKEY_ACCOUNT_PAIR_FOOTPRINT*self->rewards_pools_len;
7502 0 : for( ulong i=0; i < self->rewards_pools_len; i++ ) {
7503 0 : fd_pubkey_account_pair_new( (fd_pubkey_account_pair_t *)(cur_mem + FD_PUBKEY_ACCOUNT_PAIR_FOOTPRINT * i) );
7504 0 : fd_pubkey_account_pair_decode_inner_global( cur_mem + FD_PUBKEY_ACCOUNT_PAIR_FOOTPRINT * i, alloc_mem, ctx );
7505 0 : }
7506 0 : } else
7507 0 : self->rewards_pools_gaddr = 0UL;
7508 0 : fd_bincode_uint64_decode_unsafe( &self->ticks_per_slot, ctx );
7509 0 : fd_bincode_uint64_decode_unsafe( &self->unused, ctx );
7510 0 : fd_poh_config_decode_inner_global( &self->poh_config, alloc_mem, ctx );
7511 0 : fd_bincode_uint64_decode_unsafe( &self->__backwards_compat_with_v0_23, ctx );
7512 0 : fd_fee_rate_governor_decode_inner_global( &self->fee_rate_governor, alloc_mem, ctx );
7513 0 : fd_rent_decode_inner_global( &self->rent, alloc_mem, ctx );
7514 0 : fd_inflation_decode_inner_global( &self->inflation, alloc_mem, ctx );
7515 0 : fd_epoch_schedule_decode_inner_global( &self->epoch_schedule, alloc_mem, ctx );
7516 0 : fd_bincode_uint32_decode_unsafe( &self->cluster_type, ctx );
7517 0 : }
7518 0 : int fd_genesis_solana_convert_global_to_local( void const * global_self, fd_genesis_solana_t * self, fd_bincode_decode_ctx_t * ctx ) {
7519 0 : int err = 0;
7520 0 : fd_genesis_solana_global_t const * mem = (fd_genesis_solana_global_t const *)global_self;
7521 0 : self->creation_time = mem->creation_time;
7522 0 : self->accounts_len = mem->accounts_len;
7523 0 : self->accounts = fd_wksp_laddr_fast( ctx->wksp, mem->accounts_gaddr );
7524 0 : self->native_instruction_processors_len = mem->native_instruction_processors_len;
7525 0 : self->native_instruction_processors = fd_wksp_laddr_fast( ctx->wksp, mem->native_instruction_processors_gaddr );
7526 0 : self->rewards_pools_len = mem->rewards_pools_len;
7527 0 : self->rewards_pools = fd_wksp_laddr_fast( ctx->wksp, mem->rewards_pools_gaddr );
7528 0 : self->ticks_per_slot = mem->ticks_per_slot;
7529 0 : self->unused = mem->unused;
7530 0 : err = fd_poh_config_convert_global_to_local( &mem->poh_config, &self->poh_config, ctx );
7531 0 : if( FD_UNLIKELY( err ) ) return err;
7532 0 : self->__backwards_compat_with_v0_23 = mem->__backwards_compat_with_v0_23;
7533 0 : err = fd_fee_rate_governor_convert_global_to_local( &mem->fee_rate_governor, &self->fee_rate_governor, ctx );
7534 0 : if( FD_UNLIKELY( err ) ) return err;
7535 0 : err = fd_rent_convert_global_to_local( &mem->rent, &self->rent, ctx );
7536 0 : if( FD_UNLIKELY( err ) ) return err;
7537 0 : err = fd_inflation_convert_global_to_local( &mem->inflation, &self->inflation, ctx );
7538 0 : if( FD_UNLIKELY( err ) ) return err;
7539 0 : err = fd_epoch_schedule_convert_global_to_local( &mem->epoch_schedule, &self->epoch_schedule, ctx );
7540 0 : if( FD_UNLIKELY( err ) ) return err;
7541 0 : self->cluster_type = mem->cluster_type;
7542 0 : return FD_BINCODE_SUCCESS;
7543 0 : }
7544 12 : void fd_genesis_solana_new(fd_genesis_solana_t * self) {
7545 12 : fd_memset( self, 0, sizeof(fd_genesis_solana_t) );
7546 12 : fd_poh_config_new( &self->poh_config );
7547 12 : fd_fee_rate_governor_new( &self->fee_rate_governor );
7548 12 : fd_rent_new( &self->rent );
7549 12 : fd_inflation_new( &self->inflation );
7550 12 : fd_epoch_schedule_new( &self->epoch_schedule );
7551 12 : }
7552 0 : void fd_genesis_solana_destroy( fd_genesis_solana_t * self ) {
7553 0 : if( self->accounts ) {
7554 0 : for( ulong i=0; i < self->accounts_len; i++ )
7555 0 : fd_pubkey_account_pair_destroy( self->accounts + i );
7556 0 : self->accounts = NULL;
7557 0 : }
7558 0 : if( self->native_instruction_processors ) {
7559 0 : for( ulong i=0; i < self->native_instruction_processors_len; i++ )
7560 0 : fd_string_pubkey_pair_destroy( self->native_instruction_processors + i );
7561 0 : self->native_instruction_processors = NULL;
7562 0 : }
7563 0 : if( self->rewards_pools ) {
7564 0 : for( ulong i=0; i < self->rewards_pools_len; i++ )
7565 0 : fd_pubkey_account_pair_destroy( self->rewards_pools + i );
7566 0 : self->rewards_pools = NULL;
7567 0 : }
7568 0 : fd_poh_config_destroy( &self->poh_config );
7569 0 : fd_fee_rate_governor_destroy( &self->fee_rate_governor );
7570 0 : fd_rent_destroy( &self->rent );
7571 0 : fd_inflation_destroy( &self->inflation );
7572 0 : fd_epoch_schedule_destroy( &self->epoch_schedule );
7573 0 : }
7574 :
7575 0 : ulong fd_genesis_solana_footprint( void ){ return FD_GENESIS_SOLANA_FOOTPRINT; }
7576 0 : ulong fd_genesis_solana_align( void ){ return FD_GENESIS_SOLANA_ALIGN; }
7577 :
7578 0 : void fd_genesis_solana_walk( void * w, fd_genesis_solana_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
7579 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_genesis_solana", level++ );
7580 0 : fun( w, &self->creation_time, "creation_time", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
7581 0 : if( self->accounts_len ) {
7582 0 : fun( w, NULL, "accounts", FD_FLAMENCO_TYPE_ARR, "array", level++ );
7583 0 : for( ulong i=0; i < self->accounts_len; i++ )
7584 0 : fd_pubkey_account_pair_walk(w, self->accounts + i, fun, "pubkey_account_pair", level );
7585 0 : fun( w, NULL, "accounts", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
7586 0 : }
7587 0 : if( self->native_instruction_processors_len ) {
7588 0 : fun( w, NULL, "native_instruction_processors", FD_FLAMENCO_TYPE_ARR, "array", level++ );
7589 0 : for( ulong i=0; i < self->native_instruction_processors_len; i++ )
7590 0 : fd_string_pubkey_pair_walk(w, self->native_instruction_processors + i, fun, "string_pubkey_pair", level );
7591 0 : fun( w, NULL, "native_instruction_processors", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
7592 0 : }
7593 0 : if( self->rewards_pools_len ) {
7594 0 : fun( w, NULL, "rewards_pools", FD_FLAMENCO_TYPE_ARR, "array", level++ );
7595 0 : for( ulong i=0; i < self->rewards_pools_len; i++ )
7596 0 : fd_pubkey_account_pair_walk(w, self->rewards_pools + i, fun, "pubkey_account_pair", level );
7597 0 : fun( w, NULL, "rewards_pools", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
7598 0 : }
7599 0 : fun( w, &self->ticks_per_slot, "ticks_per_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
7600 0 : fun( w, &self->unused, "unused", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
7601 0 : fd_poh_config_walk( w, &self->poh_config, fun, "poh_config", level );
7602 0 : fun( w, &self->__backwards_compat_with_v0_23, "__backwards_compat_with_v0_23", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
7603 0 : fd_fee_rate_governor_walk( w, &self->fee_rate_governor, fun, "fee_rate_governor", level );
7604 0 : fd_rent_walk( w, &self->rent, fun, "rent", level );
7605 0 : fd_inflation_walk( w, &self->inflation, fun, "inflation", level );
7606 0 : fd_epoch_schedule_walk( w, &self->epoch_schedule, fun, "epoch_schedule", level );
7607 0 : fun( w, &self->cluster_type, "cluster_type", FD_FLAMENCO_TYPE_UINT, "uint", level );
7608 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_genesis_solana", level-- );
7609 0 : }
7610 0 : ulong fd_genesis_solana_size( fd_genesis_solana_t const * self ) {
7611 0 : ulong size = 0;
7612 0 : size += sizeof(ulong);
7613 0 : do {
7614 0 : size += sizeof(ulong);
7615 0 : for( ulong i=0; i < self->accounts_len; i++ )
7616 0 : size += fd_pubkey_account_pair_size( self->accounts + i );
7617 0 : } while(0);
7618 0 : do {
7619 0 : size += sizeof(ulong);
7620 0 : for( ulong i=0; i < self->native_instruction_processors_len; i++ )
7621 0 : size += fd_string_pubkey_pair_size( self->native_instruction_processors + i );
7622 0 : } while(0);
7623 0 : do {
7624 0 : size += sizeof(ulong);
7625 0 : for( ulong i=0; i < self->rewards_pools_len; i++ )
7626 0 : size += fd_pubkey_account_pair_size( self->rewards_pools + i );
7627 0 : } while(0);
7628 0 : size += sizeof(ulong);
7629 0 : size += sizeof(ulong);
7630 0 : size += fd_poh_config_size( &self->poh_config );
7631 0 : size += sizeof(ulong);
7632 0 : size += fd_fee_rate_governor_size( &self->fee_rate_governor );
7633 0 : size += fd_rent_size( &self->rent );
7634 0 : size += fd_inflation_size( &self->inflation );
7635 0 : size += fd_epoch_schedule_size( &self->epoch_schedule );
7636 0 : size += sizeof(uint);
7637 0 : return size;
7638 0 : }
7639 :
7640 0 : int fd_sol_sysvar_clock_encode( fd_sol_sysvar_clock_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7641 0 : int err;
7642 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
7643 0 : if( FD_UNLIKELY( err ) ) return err;
7644 0 : err = fd_bincode_uint64_encode( (ulong)self->epoch_start_timestamp, ctx );
7645 0 : if( FD_UNLIKELY( err ) ) return err;
7646 0 : err = fd_bincode_uint64_encode( self->epoch, ctx );
7647 0 : if( FD_UNLIKELY( err ) ) return err;
7648 0 : err = fd_bincode_uint64_encode( self->leader_schedule_epoch, ctx );
7649 0 : if( FD_UNLIKELY( err ) ) return err;
7650 0 : err = fd_bincode_uint64_encode( (ulong)self->unix_timestamp, ctx );
7651 0 : if( FD_UNLIKELY( err ) ) return err;
7652 0 : return FD_BINCODE_SUCCESS;
7653 0 : }
7654 0 : int fd_sol_sysvar_clock_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7655 0 : *total_sz += sizeof(fd_sol_sysvar_clock_t);
7656 0 : void const * start_data = ctx->data;
7657 0 : int err = fd_sol_sysvar_clock_decode_footprint_inner( ctx, total_sz );
7658 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7659 0 : ctx->data = start_data;
7660 0 : return err;
7661 0 : }
7662 0 : int fd_sol_sysvar_clock_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7663 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7664 0 : int err = 0;
7665 0 : err = fd_bincode_uint64_decode_footprint( ctx );
7666 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7667 0 : err = fd_bincode_uint64_decode_footprint( ctx );
7668 0 : if( FD_UNLIKELY( err ) ) return err;
7669 0 : err = fd_bincode_uint64_decode_footprint( ctx );
7670 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7671 0 : err = fd_bincode_uint64_decode_footprint( ctx );
7672 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7673 0 : err = fd_bincode_uint64_decode_footprint( ctx );
7674 0 : if( FD_UNLIKELY( err ) ) return err;
7675 0 : return 0;
7676 0 : }
7677 0 : void * fd_sol_sysvar_clock_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7678 0 : fd_sol_sysvar_clock_t * self = (fd_sol_sysvar_clock_t *)mem;
7679 0 : fd_sol_sysvar_clock_new( self );
7680 0 : void * alloc_region = (uchar *)mem + sizeof(fd_sol_sysvar_clock_t);
7681 0 : void * * alloc_mem = &alloc_region;
7682 0 : fd_sol_sysvar_clock_decode_inner( mem, alloc_mem, ctx );
7683 0 : return self;
7684 0 : }
7685 0 : void fd_sol_sysvar_clock_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7686 0 : fd_sol_sysvar_clock_t * self = (fd_sol_sysvar_clock_t *)struct_mem;
7687 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
7688 0 : fd_bincode_uint64_decode_unsafe( (ulong *) &self->epoch_start_timestamp, ctx );
7689 0 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
7690 0 : fd_bincode_uint64_decode_unsafe( &self->leader_schedule_epoch, ctx );
7691 0 : fd_bincode_uint64_decode_unsafe( (ulong *) &self->unix_timestamp, ctx );
7692 0 : }
7693 0 : void * fd_sol_sysvar_clock_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7694 0 : fd_sol_sysvar_clock_global_t * self = (fd_sol_sysvar_clock_global_t *)mem;
7695 0 : fd_sol_sysvar_clock_new( (fd_sol_sysvar_clock_t *)self );
7696 0 : void * alloc_region = (uchar *)mem + sizeof(fd_sol_sysvar_clock_global_t);
7697 0 : void * * alloc_mem = &alloc_region;
7698 0 : fd_sol_sysvar_clock_decode_inner_global( mem, alloc_mem, ctx );
7699 0 : return self;
7700 0 : }
7701 0 : void fd_sol_sysvar_clock_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7702 0 : fd_sol_sysvar_clock_global_t * self = (fd_sol_sysvar_clock_global_t *)struct_mem;
7703 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
7704 0 : fd_bincode_uint64_decode_unsafe( (ulong *) &self->epoch_start_timestamp, ctx );
7705 0 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
7706 0 : fd_bincode_uint64_decode_unsafe( &self->leader_schedule_epoch, ctx );
7707 0 : fd_bincode_uint64_decode_unsafe( (ulong *) &self->unix_timestamp, ctx );
7708 0 : }
7709 0 : int fd_sol_sysvar_clock_convert_global_to_local( void const * global_self, fd_sol_sysvar_clock_t * self, fd_bincode_decode_ctx_t * ctx ) {
7710 0 : int err = 0;
7711 0 : fd_sol_sysvar_clock_global_t const * mem = (fd_sol_sysvar_clock_global_t const *)global_self;
7712 0 : self->slot = mem->slot;
7713 0 : self->epoch_start_timestamp = mem->epoch_start_timestamp;
7714 0 : self->epoch = mem->epoch;
7715 0 : self->leader_schedule_epoch = mem->leader_schedule_epoch;
7716 0 : self->unix_timestamp = mem->unix_timestamp;
7717 0 : return FD_BINCODE_SUCCESS;
7718 0 : }
7719 0 : void fd_sol_sysvar_clock_new(fd_sol_sysvar_clock_t * self) {
7720 0 : fd_memset( self, 0, sizeof(fd_sol_sysvar_clock_t) );
7721 0 : }
7722 0 : void fd_sol_sysvar_clock_destroy( fd_sol_sysvar_clock_t * self ) {
7723 0 : }
7724 :
7725 0 : ulong fd_sol_sysvar_clock_footprint( void ){ return FD_SOL_SYSVAR_CLOCK_FOOTPRINT; }
7726 0 : ulong fd_sol_sysvar_clock_align( void ){ return FD_SOL_SYSVAR_CLOCK_ALIGN; }
7727 :
7728 0 : void fd_sol_sysvar_clock_walk( void * w, fd_sol_sysvar_clock_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
7729 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_sol_sysvar_clock", level++ );
7730 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
7731 0 : fun( w, &self->epoch_start_timestamp, "epoch_start_timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level );
7732 0 : fun( w, &self->epoch, "epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
7733 0 : fun( w, &self->leader_schedule_epoch, "leader_schedule_epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
7734 0 : fun( w, &self->unix_timestamp, "unix_timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level );
7735 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_sol_sysvar_clock", level-- );
7736 0 : }
7737 0 : ulong fd_sol_sysvar_clock_size( fd_sol_sysvar_clock_t const * self ) {
7738 0 : ulong size = 0;
7739 0 : size += sizeof(ulong);
7740 0 : size += sizeof(long);
7741 0 : size += sizeof(ulong);
7742 0 : size += sizeof(ulong);
7743 0 : size += sizeof(long);
7744 0 : return size;
7745 0 : }
7746 :
7747 6 : int fd_sol_sysvar_last_restart_slot_encode( fd_sol_sysvar_last_restart_slot_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7748 6 : int err;
7749 6 : err = fd_bincode_uint64_encode( self->slot, ctx );
7750 6 : if( FD_UNLIKELY( err ) ) return err;
7751 6 : return FD_BINCODE_SUCCESS;
7752 6 : }
7753 0 : int fd_sol_sysvar_last_restart_slot_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7754 0 : *total_sz += sizeof(fd_sol_sysvar_last_restart_slot_t);
7755 0 : void const * start_data = ctx->data;
7756 0 : int err = fd_sol_sysvar_last_restart_slot_decode_footprint_inner( ctx, total_sz );
7757 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7758 0 : ctx->data = start_data;
7759 0 : return err;
7760 0 : }
7761 6 : int fd_sol_sysvar_last_restart_slot_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7762 6 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7763 6 : int err = 0;
7764 6 : err = fd_bincode_uint64_decode_footprint( ctx );
7765 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7766 6 : return 0;
7767 6 : }
7768 0 : void * fd_sol_sysvar_last_restart_slot_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7769 0 : fd_sol_sysvar_last_restart_slot_t * self = (fd_sol_sysvar_last_restart_slot_t *)mem;
7770 0 : fd_sol_sysvar_last_restart_slot_new( self );
7771 0 : void * alloc_region = (uchar *)mem + sizeof(fd_sol_sysvar_last_restart_slot_t);
7772 0 : void * * alloc_mem = &alloc_region;
7773 0 : fd_sol_sysvar_last_restart_slot_decode_inner( mem, alloc_mem, ctx );
7774 0 : return self;
7775 0 : }
7776 6 : void fd_sol_sysvar_last_restart_slot_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7777 6 : fd_sol_sysvar_last_restart_slot_t * self = (fd_sol_sysvar_last_restart_slot_t *)struct_mem;
7778 6 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
7779 6 : }
7780 0 : void * fd_sol_sysvar_last_restart_slot_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7781 0 : fd_sol_sysvar_last_restart_slot_global_t * self = (fd_sol_sysvar_last_restart_slot_global_t *)mem;
7782 0 : fd_sol_sysvar_last_restart_slot_new( (fd_sol_sysvar_last_restart_slot_t *)self );
7783 0 : void * alloc_region = (uchar *)mem + sizeof(fd_sol_sysvar_last_restart_slot_global_t);
7784 0 : void * * alloc_mem = &alloc_region;
7785 0 : fd_sol_sysvar_last_restart_slot_decode_inner_global( mem, alloc_mem, ctx );
7786 0 : return self;
7787 0 : }
7788 3 : void fd_sol_sysvar_last_restart_slot_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7789 3 : fd_sol_sysvar_last_restart_slot_global_t * self = (fd_sol_sysvar_last_restart_slot_global_t *)struct_mem;
7790 3 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
7791 3 : }
7792 3 : int fd_sol_sysvar_last_restart_slot_convert_global_to_local( void const * global_self, fd_sol_sysvar_last_restart_slot_t * self, fd_bincode_decode_ctx_t * ctx ) {
7793 3 : int err = 0;
7794 3 : fd_sol_sysvar_last_restart_slot_global_t const * mem = (fd_sol_sysvar_last_restart_slot_global_t const *)global_self;
7795 3 : self->slot = mem->slot;
7796 3 : return FD_BINCODE_SUCCESS;
7797 3 : }
7798 9 : void fd_sol_sysvar_last_restart_slot_new(fd_sol_sysvar_last_restart_slot_t * self) {
7799 9 : fd_memset( self, 0, sizeof(fd_sol_sysvar_last_restart_slot_t) );
7800 9 : }
7801 0 : void fd_sol_sysvar_last_restart_slot_destroy( fd_sol_sysvar_last_restart_slot_t * self ) {
7802 0 : }
7803 :
7804 0 : ulong fd_sol_sysvar_last_restart_slot_footprint( void ){ return FD_SOL_SYSVAR_LAST_RESTART_SLOT_FOOTPRINT; }
7805 0 : ulong fd_sol_sysvar_last_restart_slot_align( void ){ return FD_SOL_SYSVAR_LAST_RESTART_SLOT_ALIGN; }
7806 :
7807 3 : void fd_sol_sysvar_last_restart_slot_walk( void * w, fd_sol_sysvar_last_restart_slot_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
7808 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_sol_sysvar_last_restart_slot", level++ );
7809 3 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
7810 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_sol_sysvar_last_restart_slot", level-- );
7811 3 : }
7812 0 : ulong fd_sol_sysvar_last_restart_slot_size( fd_sol_sysvar_last_restart_slot_t const * self ) {
7813 0 : ulong size = 0;
7814 0 : size += sizeof(ulong);
7815 0 : return size;
7816 0 : }
7817 :
7818 192 : int fd_vote_lockout_encode( fd_vote_lockout_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7819 192 : int err;
7820 192 : err = fd_bincode_uint64_encode( self->slot, ctx );
7821 192 : if( FD_UNLIKELY( err ) ) return err;
7822 192 : err = fd_bincode_uint32_encode( self->confirmation_count, ctx );
7823 192 : if( FD_UNLIKELY( err ) ) return err;
7824 192 : return FD_BINCODE_SUCCESS;
7825 192 : }
7826 0 : int fd_vote_lockout_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7827 0 : *total_sz += sizeof(fd_vote_lockout_t);
7828 0 : void const * start_data = ctx->data;
7829 0 : int err = fd_vote_lockout_decode_footprint_inner( ctx, total_sz );
7830 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7831 0 : ctx->data = start_data;
7832 0 : return err;
7833 0 : }
7834 0 : int fd_vote_lockout_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7835 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7836 0 : int err = 0;
7837 0 : err = fd_bincode_uint64_decode_footprint( ctx );
7838 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7839 0 : err = fd_bincode_uint32_decode_footprint( ctx );
7840 0 : if( FD_UNLIKELY( err ) ) return err;
7841 0 : return 0;
7842 0 : }
7843 0 : void * fd_vote_lockout_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7844 0 : fd_vote_lockout_t * self = (fd_vote_lockout_t *)mem;
7845 0 : fd_vote_lockout_new( self );
7846 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_lockout_t);
7847 0 : void * * alloc_mem = &alloc_region;
7848 0 : fd_vote_lockout_decode_inner( mem, alloc_mem, ctx );
7849 0 : return self;
7850 0 : }
7851 192 : void fd_vote_lockout_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7852 192 : fd_vote_lockout_t * self = (fd_vote_lockout_t *)struct_mem;
7853 192 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
7854 192 : fd_bincode_uint32_decode_unsafe( &self->confirmation_count, ctx );
7855 192 : }
7856 0 : void * fd_vote_lockout_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7857 0 : fd_vote_lockout_global_t * self = (fd_vote_lockout_global_t *)mem;
7858 0 : fd_vote_lockout_new( (fd_vote_lockout_t *)self );
7859 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_lockout_global_t);
7860 0 : void * * alloc_mem = &alloc_region;
7861 0 : fd_vote_lockout_decode_inner_global( mem, alloc_mem, ctx );
7862 0 : return self;
7863 0 : }
7864 96 : void fd_vote_lockout_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7865 96 : fd_vote_lockout_global_t * self = (fd_vote_lockout_global_t *)struct_mem;
7866 96 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
7867 96 : fd_bincode_uint32_decode_unsafe( &self->confirmation_count, ctx );
7868 96 : }
7869 0 : int fd_vote_lockout_convert_global_to_local( void const * global_self, fd_vote_lockout_t * self, fd_bincode_decode_ctx_t * ctx ) {
7870 0 : int err = 0;
7871 0 : fd_vote_lockout_global_t const * mem = (fd_vote_lockout_global_t const *)global_self;
7872 0 : self->slot = mem->slot;
7873 0 : self->confirmation_count = mem->confirmation_count;
7874 0 : return FD_BINCODE_SUCCESS;
7875 0 : }
7876 288 : void fd_vote_lockout_new(fd_vote_lockout_t * self) {
7877 288 : fd_memset( self, 0, sizeof(fd_vote_lockout_t) );
7878 288 : }
7879 0 : void fd_vote_lockout_destroy( fd_vote_lockout_t * self ) {
7880 0 : }
7881 :
7882 0 : ulong fd_vote_lockout_footprint( void ){ return FD_VOTE_LOCKOUT_FOOTPRINT; }
7883 0 : ulong fd_vote_lockout_align( void ){ return FD_VOTE_LOCKOUT_ALIGN; }
7884 :
7885 96 : void fd_vote_lockout_walk( void * w, fd_vote_lockout_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
7886 96 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_lockout", level++ );
7887 96 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
7888 96 : fun( w, &self->confirmation_count, "confirmation_count", FD_FLAMENCO_TYPE_UINT, "uint", level );
7889 96 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_lockout", level-- );
7890 96 : }
7891 0 : ulong fd_vote_lockout_size( fd_vote_lockout_t const * self ) {
7892 0 : ulong size = 0;
7893 0 : size += sizeof(ulong);
7894 0 : size += sizeof(uint);
7895 0 : return size;
7896 0 : }
7897 :
7898 0 : int fd_lockout_offset_encode( fd_lockout_offset_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7899 0 : int err;
7900 0 : err = fd_bincode_varint_encode( self->offset, ctx );
7901 0 : if( FD_UNLIKELY( err ) ) return err;
7902 0 : err = fd_bincode_uint8_encode( (uchar)(self->confirmation_count), ctx );
7903 0 : if( FD_UNLIKELY( err ) ) return err;
7904 0 : return FD_BINCODE_SUCCESS;
7905 0 : }
7906 0 : int fd_lockout_offset_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7907 0 : *total_sz += sizeof(fd_lockout_offset_t);
7908 0 : void const * start_data = ctx->data;
7909 0 : int err = fd_lockout_offset_decode_footprint_inner( ctx, total_sz );
7910 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7911 0 : ctx->data = start_data;
7912 0 : return err;
7913 0 : }
7914 0 : int fd_lockout_offset_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7915 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7916 0 : int err = 0;
7917 0 : err = fd_bincode_varint_decode_footprint( ctx );
7918 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7919 0 : err = fd_bincode_uint8_decode_footprint( ctx );
7920 0 : if( FD_UNLIKELY( err ) ) return err;
7921 0 : return 0;
7922 0 : }
7923 0 : void * fd_lockout_offset_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7924 0 : fd_lockout_offset_t * self = (fd_lockout_offset_t *)mem;
7925 0 : fd_lockout_offset_new( self );
7926 0 : void * alloc_region = (uchar *)mem + sizeof(fd_lockout_offset_t);
7927 0 : void * * alloc_mem = &alloc_region;
7928 0 : fd_lockout_offset_decode_inner( mem, alloc_mem, ctx );
7929 0 : return self;
7930 0 : }
7931 0 : void fd_lockout_offset_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7932 0 : fd_lockout_offset_t * self = (fd_lockout_offset_t *)struct_mem;
7933 0 : fd_bincode_varint_decode_unsafe( &self->offset, ctx );
7934 0 : fd_bincode_uint8_decode_unsafe( &self->confirmation_count, ctx );
7935 0 : }
7936 0 : void * fd_lockout_offset_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7937 0 : fd_lockout_offset_global_t * self = (fd_lockout_offset_global_t *)mem;
7938 0 : fd_lockout_offset_new( (fd_lockout_offset_t *)self );
7939 0 : void * alloc_region = (uchar *)mem + sizeof(fd_lockout_offset_global_t);
7940 0 : void * * alloc_mem = &alloc_region;
7941 0 : fd_lockout_offset_decode_inner_global( mem, alloc_mem, ctx );
7942 0 : return self;
7943 0 : }
7944 0 : void fd_lockout_offset_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7945 0 : fd_lockout_offset_global_t * self = (fd_lockout_offset_global_t *)struct_mem;
7946 0 : fd_bincode_varint_decode_unsafe( &self->offset, ctx );
7947 0 : fd_bincode_uint8_decode_unsafe( &self->confirmation_count, ctx );
7948 0 : }
7949 0 : int fd_lockout_offset_convert_global_to_local( void const * global_self, fd_lockout_offset_t * self, fd_bincode_decode_ctx_t * ctx ) {
7950 0 : int err = 0;
7951 0 : fd_lockout_offset_global_t const * mem = (fd_lockout_offset_global_t const *)global_self;
7952 0 : self->offset = mem->offset;
7953 0 : self->confirmation_count = mem->confirmation_count;
7954 0 : return FD_BINCODE_SUCCESS;
7955 0 : }
7956 0 : void fd_lockout_offset_new(fd_lockout_offset_t * self) {
7957 0 : fd_memset( self, 0, sizeof(fd_lockout_offset_t) );
7958 0 : }
7959 0 : void fd_lockout_offset_destroy( fd_lockout_offset_t * self ) {
7960 0 : }
7961 :
7962 0 : ulong fd_lockout_offset_footprint( void ){ return FD_LOCKOUT_OFFSET_FOOTPRINT; }
7963 0 : ulong fd_lockout_offset_align( void ){ return FD_LOCKOUT_OFFSET_ALIGN; }
7964 :
7965 0 : void fd_lockout_offset_walk( void * w, fd_lockout_offset_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
7966 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_lockout_offset", level++ );
7967 0 : fun( w, &self->offset, "offset", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
7968 0 : fun( w, &self->confirmation_count, "confirmation_count", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
7969 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_lockout_offset", level-- );
7970 0 : }
7971 0 : ulong fd_lockout_offset_size( fd_lockout_offset_t const * self ) {
7972 0 : ulong size = 0;
7973 0 : size += fd_bincode_varint_size( self->offset );
7974 0 : size += sizeof(char);
7975 0 : return size;
7976 0 : }
7977 :
7978 24 : int fd_vote_authorized_voter_encode( fd_vote_authorized_voter_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7979 24 : int err;
7980 24 : err = fd_bincode_uint64_encode( self->epoch, ctx );
7981 24 : if( FD_UNLIKELY( err ) ) return err;
7982 24 : err = fd_pubkey_encode( &self->pubkey, ctx );
7983 24 : if( FD_UNLIKELY( err ) ) return err;
7984 24 : return FD_BINCODE_SUCCESS;
7985 24 : }
7986 0 : int fd_vote_authorized_voter_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7987 0 : *total_sz += sizeof(fd_vote_authorized_voter_t);
7988 0 : void const * start_data = ctx->data;
7989 0 : int err = fd_vote_authorized_voter_decode_footprint_inner( ctx, total_sz );
7990 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7991 0 : ctx->data = start_data;
7992 0 : return err;
7993 0 : }
7994 12 : int fd_vote_authorized_voter_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7995 12 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7996 12 : int err = 0;
7997 12 : err = fd_bincode_uint64_decode_footprint( ctx );
7998 12 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7999 12 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
8000 12 : if( FD_UNLIKELY( err ) ) return err;
8001 12 : return 0;
8002 12 : }
8003 0 : void * fd_vote_authorized_voter_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8004 0 : fd_vote_authorized_voter_t * self = (fd_vote_authorized_voter_t *)mem;
8005 0 : fd_vote_authorized_voter_new( self );
8006 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_authorized_voter_t);
8007 0 : void * * alloc_mem = &alloc_region;
8008 0 : fd_vote_authorized_voter_decode_inner( mem, alloc_mem, ctx );
8009 0 : return self;
8010 0 : }
8011 18 : void fd_vote_authorized_voter_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8012 18 : fd_vote_authorized_voter_t * self = (fd_vote_authorized_voter_t *)struct_mem;
8013 18 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
8014 18 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
8015 18 : }
8016 0 : void * fd_vote_authorized_voter_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8017 0 : fd_vote_authorized_voter_global_t * self = (fd_vote_authorized_voter_global_t *)mem;
8018 0 : fd_vote_authorized_voter_new( (fd_vote_authorized_voter_t *)self );
8019 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_authorized_voter_global_t);
8020 0 : void * * alloc_mem = &alloc_region;
8021 0 : fd_vote_authorized_voter_decode_inner_global( mem, alloc_mem, ctx );
8022 0 : return self;
8023 0 : }
8024 0 : void fd_vote_authorized_voter_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8025 0 : fd_vote_authorized_voter_global_t * self = (fd_vote_authorized_voter_global_t *)struct_mem;
8026 0 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
8027 0 : fd_pubkey_decode_inner_global( &self->pubkey, alloc_mem, ctx );
8028 0 : }
8029 0 : int fd_vote_authorized_voter_convert_global_to_local( void const * global_self, fd_vote_authorized_voter_t * self, fd_bincode_decode_ctx_t * ctx ) {
8030 0 : int err = 0;
8031 0 : fd_vote_authorized_voter_global_t const * mem = (fd_vote_authorized_voter_global_t const *)global_self;
8032 0 : self->epoch = mem->epoch;
8033 0 : err = fd_pubkey_convert_global_to_local( &mem->pubkey, &self->pubkey, ctx );
8034 0 : if( FD_UNLIKELY( err ) ) return err;
8035 0 : return FD_BINCODE_SUCCESS;
8036 0 : }
8037 18 : void fd_vote_authorized_voter_new(fd_vote_authorized_voter_t * self) {
8038 18 : fd_memset( self, 0, sizeof(fd_vote_authorized_voter_t) );
8039 18 : fd_pubkey_new( &self->pubkey );
8040 18 : }
8041 0 : void fd_vote_authorized_voter_destroy( fd_vote_authorized_voter_t * self ) {
8042 0 : fd_pubkey_destroy( &self->pubkey );
8043 0 : }
8044 :
8045 0 : ulong fd_vote_authorized_voter_footprint( void ){ return FD_VOTE_AUTHORIZED_VOTER_FOOTPRINT; }
8046 0 : ulong fd_vote_authorized_voter_align( void ){ return FD_VOTE_AUTHORIZED_VOTER_ALIGN; }
8047 :
8048 6 : void fd_vote_authorized_voter_walk( void * w, fd_vote_authorized_voter_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
8049 6 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_authorized_voter", level++ );
8050 6 : fun( w, &self->epoch, "epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
8051 6 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level );
8052 6 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_authorized_voter", level-- );
8053 6 : }
8054 0 : ulong fd_vote_authorized_voter_size( fd_vote_authorized_voter_t const * self ) {
8055 0 : ulong size = 0;
8056 0 : size += sizeof(ulong);
8057 0 : size += fd_pubkey_size( &self->pubkey );
8058 0 : return size;
8059 0 : }
8060 :
8061 768 : int fd_vote_prior_voter_encode( fd_vote_prior_voter_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8062 768 : int err;
8063 768 : err = fd_pubkey_encode( &self->pubkey, ctx );
8064 768 : if( FD_UNLIKELY( err ) ) return err;
8065 768 : err = fd_bincode_uint64_encode( self->epoch_start, ctx );
8066 768 : if( FD_UNLIKELY( err ) ) return err;
8067 768 : err = fd_bincode_uint64_encode( self->epoch_end, ctx );
8068 768 : if( FD_UNLIKELY( err ) ) return err;
8069 768 : return FD_BINCODE_SUCCESS;
8070 768 : }
8071 0 : int fd_vote_prior_voter_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8072 0 : *total_sz += sizeof(fd_vote_prior_voter_t);
8073 0 : void const * start_data = ctx->data;
8074 0 : int err = fd_vote_prior_voter_decode_footprint_inner( ctx, total_sz );
8075 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8076 0 : ctx->data = start_data;
8077 0 : return err;
8078 0 : }
8079 384 : int fd_vote_prior_voter_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8080 384 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8081 384 : int err = 0;
8082 384 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
8083 384 : if( FD_UNLIKELY( err ) ) return err;
8084 384 : err = fd_bincode_uint64_decode_footprint( ctx );
8085 384 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8086 384 : err = fd_bincode_uint64_decode_footprint( ctx );
8087 384 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8088 384 : return 0;
8089 384 : }
8090 0 : void * fd_vote_prior_voter_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8091 0 : fd_vote_prior_voter_t * self = (fd_vote_prior_voter_t *)mem;
8092 0 : fd_vote_prior_voter_new( self );
8093 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_prior_voter_t);
8094 0 : void * * alloc_mem = &alloc_region;
8095 0 : fd_vote_prior_voter_decode_inner( mem, alloc_mem, ctx );
8096 0 : return self;
8097 0 : }
8098 576 : void fd_vote_prior_voter_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8099 576 : fd_vote_prior_voter_t * self = (fd_vote_prior_voter_t *)struct_mem;
8100 576 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
8101 576 : fd_bincode_uint64_decode_unsafe( &self->epoch_start, ctx );
8102 576 : fd_bincode_uint64_decode_unsafe( &self->epoch_end, ctx );
8103 576 : }
8104 0 : void * fd_vote_prior_voter_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8105 0 : fd_vote_prior_voter_global_t * self = (fd_vote_prior_voter_global_t *)mem;
8106 0 : fd_vote_prior_voter_new( (fd_vote_prior_voter_t *)self );
8107 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_prior_voter_global_t);
8108 0 : void * * alloc_mem = &alloc_region;
8109 0 : fd_vote_prior_voter_decode_inner_global( mem, alloc_mem, ctx );
8110 0 : return self;
8111 0 : }
8112 0 : void fd_vote_prior_voter_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8113 0 : fd_vote_prior_voter_global_t * self = (fd_vote_prior_voter_global_t *)struct_mem;
8114 0 : fd_pubkey_decode_inner_global( &self->pubkey, alloc_mem, ctx );
8115 0 : fd_bincode_uint64_decode_unsafe( &self->epoch_start, ctx );
8116 0 : fd_bincode_uint64_decode_unsafe( &self->epoch_end, ctx );
8117 0 : }
8118 192 : int fd_vote_prior_voter_convert_global_to_local( void const * global_self, fd_vote_prior_voter_t * self, fd_bincode_decode_ctx_t * ctx ) {
8119 192 : int err = 0;
8120 192 : fd_vote_prior_voter_global_t const * mem = (fd_vote_prior_voter_global_t const *)global_self;
8121 192 : err = fd_pubkey_convert_global_to_local( &mem->pubkey, &self->pubkey, ctx );
8122 192 : if( FD_UNLIKELY( err ) ) return err;
8123 192 : self->epoch_start = mem->epoch_start;
8124 192 : self->epoch_end = mem->epoch_end;
8125 192 : return FD_BINCODE_SUCCESS;
8126 192 : }
8127 384 : void fd_vote_prior_voter_new(fd_vote_prior_voter_t * self) {
8128 384 : fd_memset( self, 0, sizeof(fd_vote_prior_voter_t) );
8129 384 : fd_pubkey_new( &self->pubkey );
8130 384 : }
8131 0 : void fd_vote_prior_voter_destroy( fd_vote_prior_voter_t * self ) {
8132 0 : fd_pubkey_destroy( &self->pubkey );
8133 0 : }
8134 :
8135 0 : ulong fd_vote_prior_voter_footprint( void ){ return FD_VOTE_PRIOR_VOTER_FOOTPRINT; }
8136 0 : ulong fd_vote_prior_voter_align( void ){ return FD_VOTE_PRIOR_VOTER_ALIGN; }
8137 :
8138 192 : void fd_vote_prior_voter_walk( void * w, fd_vote_prior_voter_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
8139 192 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_prior_voter", level++ );
8140 192 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level );
8141 192 : fun( w, &self->epoch_start, "epoch_start", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
8142 192 : fun( w, &self->epoch_end, "epoch_end", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
8143 192 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_prior_voter", level-- );
8144 192 : }
8145 0 : ulong fd_vote_prior_voter_size( fd_vote_prior_voter_t const * self ) {
8146 0 : ulong size = 0;
8147 0 : size += fd_pubkey_size( &self->pubkey );
8148 0 : size += sizeof(ulong);
8149 0 : size += sizeof(ulong);
8150 0 : return size;
8151 0 : }
8152 :
8153 0 : int fd_vote_prior_voter_0_23_5_encode( fd_vote_prior_voter_0_23_5_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8154 0 : int err;
8155 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
8156 0 : if( FD_UNLIKELY( err ) ) return err;
8157 0 : err = fd_bincode_uint64_encode( self->epoch_start, ctx );
8158 0 : if( FD_UNLIKELY( err ) ) return err;
8159 0 : err = fd_bincode_uint64_encode( self->epoch_end, ctx );
8160 0 : if( FD_UNLIKELY( err ) ) return err;
8161 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
8162 0 : if( FD_UNLIKELY( err ) ) return err;
8163 0 : return FD_BINCODE_SUCCESS;
8164 0 : }
8165 0 : int fd_vote_prior_voter_0_23_5_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8166 0 : *total_sz += sizeof(fd_vote_prior_voter_0_23_5_t);
8167 0 : void const * start_data = ctx->data;
8168 0 : int err = fd_vote_prior_voter_0_23_5_decode_footprint_inner( ctx, total_sz );
8169 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8170 0 : ctx->data = start_data;
8171 0 : return err;
8172 0 : }
8173 0 : int fd_vote_prior_voter_0_23_5_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8174 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8175 0 : int err = 0;
8176 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
8177 0 : if( FD_UNLIKELY( err ) ) return err;
8178 0 : err = fd_bincode_uint64_decode_footprint( ctx );
8179 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8180 0 : err = fd_bincode_uint64_decode_footprint( ctx );
8181 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8182 0 : err = fd_bincode_uint64_decode_footprint( ctx );
8183 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8184 0 : return 0;
8185 0 : }
8186 0 : void * fd_vote_prior_voter_0_23_5_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8187 0 : fd_vote_prior_voter_0_23_5_t * self = (fd_vote_prior_voter_0_23_5_t *)mem;
8188 0 : fd_vote_prior_voter_0_23_5_new( self );
8189 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_prior_voter_0_23_5_t);
8190 0 : void * * alloc_mem = &alloc_region;
8191 0 : fd_vote_prior_voter_0_23_5_decode_inner( mem, alloc_mem, ctx );
8192 0 : return self;
8193 0 : }
8194 0 : void fd_vote_prior_voter_0_23_5_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8195 0 : fd_vote_prior_voter_0_23_5_t * self = (fd_vote_prior_voter_0_23_5_t *)struct_mem;
8196 0 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
8197 0 : fd_bincode_uint64_decode_unsafe( &self->epoch_start, ctx );
8198 0 : fd_bincode_uint64_decode_unsafe( &self->epoch_end, ctx );
8199 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
8200 0 : }
8201 0 : void * fd_vote_prior_voter_0_23_5_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8202 0 : fd_vote_prior_voter_0_23_5_global_t * self = (fd_vote_prior_voter_0_23_5_global_t *)mem;
8203 0 : fd_vote_prior_voter_0_23_5_new( (fd_vote_prior_voter_0_23_5_t *)self );
8204 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_prior_voter_0_23_5_global_t);
8205 0 : void * * alloc_mem = &alloc_region;
8206 0 : fd_vote_prior_voter_0_23_5_decode_inner_global( mem, alloc_mem, ctx );
8207 0 : return self;
8208 0 : }
8209 0 : void fd_vote_prior_voter_0_23_5_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8210 0 : fd_vote_prior_voter_0_23_5_global_t * self = (fd_vote_prior_voter_0_23_5_global_t *)struct_mem;
8211 0 : fd_pubkey_decode_inner_global( &self->pubkey, alloc_mem, ctx );
8212 0 : fd_bincode_uint64_decode_unsafe( &self->epoch_start, ctx );
8213 0 : fd_bincode_uint64_decode_unsafe( &self->epoch_end, ctx );
8214 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
8215 0 : }
8216 0 : int fd_vote_prior_voter_0_23_5_convert_global_to_local( void const * global_self, fd_vote_prior_voter_0_23_5_t * self, fd_bincode_decode_ctx_t * ctx ) {
8217 0 : int err = 0;
8218 0 : fd_vote_prior_voter_0_23_5_global_t const * mem = (fd_vote_prior_voter_0_23_5_global_t const *)global_self;
8219 0 : err = fd_pubkey_convert_global_to_local( &mem->pubkey, &self->pubkey, ctx );
8220 0 : if( FD_UNLIKELY( err ) ) return err;
8221 0 : self->epoch_start = mem->epoch_start;
8222 0 : self->epoch_end = mem->epoch_end;
8223 0 : self->slot = mem->slot;
8224 0 : return FD_BINCODE_SUCCESS;
8225 0 : }
8226 0 : void fd_vote_prior_voter_0_23_5_new(fd_vote_prior_voter_0_23_5_t * self) {
8227 0 : fd_memset( self, 0, sizeof(fd_vote_prior_voter_0_23_5_t) );
8228 0 : fd_pubkey_new( &self->pubkey );
8229 0 : }
8230 0 : void fd_vote_prior_voter_0_23_5_destroy( fd_vote_prior_voter_0_23_5_t * self ) {
8231 0 : fd_pubkey_destroy( &self->pubkey );
8232 0 : }
8233 :
8234 0 : ulong fd_vote_prior_voter_0_23_5_footprint( void ){ return FD_VOTE_PRIOR_VOTER_0_23_5_FOOTPRINT; }
8235 0 : ulong fd_vote_prior_voter_0_23_5_align( void ){ return FD_VOTE_PRIOR_VOTER_0_23_5_ALIGN; }
8236 :
8237 0 : void fd_vote_prior_voter_0_23_5_walk( void * w, fd_vote_prior_voter_0_23_5_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
8238 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_prior_voter_0_23_5", level++ );
8239 0 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level );
8240 0 : fun( w, &self->epoch_start, "epoch_start", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
8241 0 : fun( w, &self->epoch_end, "epoch_end", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
8242 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
8243 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_prior_voter_0_23_5", level-- );
8244 0 : }
8245 0 : ulong fd_vote_prior_voter_0_23_5_size( fd_vote_prior_voter_0_23_5_t const * self ) {
8246 0 : ulong size = 0;
8247 0 : size += fd_pubkey_size( &self->pubkey );
8248 0 : size += sizeof(ulong);
8249 0 : size += sizeof(ulong);
8250 0 : size += sizeof(ulong);
8251 0 : return size;
8252 0 : }
8253 :
8254 390 : int fd_vote_epoch_credits_encode( fd_vote_epoch_credits_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8255 390 : int err;
8256 390 : err = fd_bincode_uint64_encode( self->epoch, ctx );
8257 390 : if( FD_UNLIKELY( err ) ) return err;
8258 390 : err = fd_bincode_uint64_encode( self->credits, ctx );
8259 390 : if( FD_UNLIKELY( err ) ) return err;
8260 390 : err = fd_bincode_uint64_encode( self->prev_credits, ctx );
8261 390 : if( FD_UNLIKELY( err ) ) return err;
8262 390 : return FD_BINCODE_SUCCESS;
8263 390 : }
8264 0 : int fd_vote_epoch_credits_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8265 0 : *total_sz += sizeof(fd_vote_epoch_credits_t);
8266 0 : void const * start_data = ctx->data;
8267 0 : int err = fd_vote_epoch_credits_decode_footprint_inner( ctx, total_sz );
8268 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8269 0 : ctx->data = start_data;
8270 0 : return err;
8271 0 : }
8272 0 : int fd_vote_epoch_credits_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8273 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8274 0 : int err = 0;
8275 0 : err = fd_bincode_uint64_decode_footprint( ctx );
8276 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8277 0 : err = fd_bincode_uint64_decode_footprint( ctx );
8278 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8279 0 : err = fd_bincode_uint64_decode_footprint( ctx );
8280 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8281 0 : return 0;
8282 0 : }
8283 0 : void * fd_vote_epoch_credits_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8284 0 : fd_vote_epoch_credits_t * self = (fd_vote_epoch_credits_t *)mem;
8285 0 : fd_vote_epoch_credits_new( self );
8286 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_epoch_credits_t);
8287 0 : void * * alloc_mem = &alloc_region;
8288 0 : fd_vote_epoch_credits_decode_inner( mem, alloc_mem, ctx );
8289 0 : return self;
8290 0 : }
8291 390 : void fd_vote_epoch_credits_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8292 390 : fd_vote_epoch_credits_t * self = (fd_vote_epoch_credits_t *)struct_mem;
8293 390 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
8294 390 : fd_bincode_uint64_decode_unsafe( &self->credits, ctx );
8295 390 : fd_bincode_uint64_decode_unsafe( &self->prev_credits, ctx );
8296 390 : }
8297 0 : void * fd_vote_epoch_credits_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8298 0 : fd_vote_epoch_credits_global_t * self = (fd_vote_epoch_credits_global_t *)mem;
8299 0 : fd_vote_epoch_credits_new( (fd_vote_epoch_credits_t *)self );
8300 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_epoch_credits_global_t);
8301 0 : void * * alloc_mem = &alloc_region;
8302 0 : fd_vote_epoch_credits_decode_inner_global( mem, alloc_mem, ctx );
8303 0 : return self;
8304 0 : }
8305 195 : void fd_vote_epoch_credits_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8306 195 : fd_vote_epoch_credits_global_t * self = (fd_vote_epoch_credits_global_t *)struct_mem;
8307 195 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
8308 195 : fd_bincode_uint64_decode_unsafe( &self->credits, ctx );
8309 195 : fd_bincode_uint64_decode_unsafe( &self->prev_credits, ctx );
8310 195 : }
8311 0 : int fd_vote_epoch_credits_convert_global_to_local( void const * global_self, fd_vote_epoch_credits_t * self, fd_bincode_decode_ctx_t * ctx ) {
8312 0 : int err = 0;
8313 0 : fd_vote_epoch_credits_global_t const * mem = (fd_vote_epoch_credits_global_t const *)global_self;
8314 0 : self->epoch = mem->epoch;
8315 0 : self->credits = mem->credits;
8316 0 : self->prev_credits = mem->prev_credits;
8317 0 : return FD_BINCODE_SUCCESS;
8318 0 : }
8319 585 : void fd_vote_epoch_credits_new(fd_vote_epoch_credits_t * self) {
8320 585 : fd_memset( self, 0, sizeof(fd_vote_epoch_credits_t) );
8321 585 : }
8322 0 : void fd_vote_epoch_credits_destroy( fd_vote_epoch_credits_t * self ) {
8323 0 : }
8324 :
8325 0 : ulong fd_vote_epoch_credits_footprint( void ){ return FD_VOTE_EPOCH_CREDITS_FOOTPRINT; }
8326 0 : ulong fd_vote_epoch_credits_align( void ){ return FD_VOTE_EPOCH_CREDITS_ALIGN; }
8327 :
8328 195 : void fd_vote_epoch_credits_walk( void * w, fd_vote_epoch_credits_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
8329 195 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_epoch_credits", level++ );
8330 195 : fun( w, &self->epoch, "epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
8331 195 : fun( w, &self->credits, "credits", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
8332 195 : fun( w, &self->prev_credits, "prev_credits", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
8333 195 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_epoch_credits", level-- );
8334 195 : }
8335 0 : ulong fd_vote_epoch_credits_size( fd_vote_epoch_credits_t const * self ) {
8336 0 : ulong size = 0;
8337 0 : size += sizeof(ulong);
8338 0 : size += sizeof(ulong);
8339 0 : size += sizeof(ulong);
8340 0 : return size;
8341 0 : }
8342 :
8343 24 : int fd_vote_block_timestamp_encode( fd_vote_block_timestamp_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8344 24 : int err;
8345 24 : err = fd_bincode_uint64_encode( self->slot, ctx );
8346 24 : if( FD_UNLIKELY( err ) ) return err;
8347 24 : err = fd_bincode_uint64_encode( (ulong)self->timestamp, ctx );
8348 24 : if( FD_UNLIKELY( err ) ) return err;
8349 24 : return FD_BINCODE_SUCCESS;
8350 24 : }
8351 0 : int fd_vote_block_timestamp_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8352 0 : *total_sz += sizeof(fd_vote_block_timestamp_t);
8353 0 : void const * start_data = ctx->data;
8354 0 : int err = fd_vote_block_timestamp_decode_footprint_inner( ctx, total_sz );
8355 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8356 0 : ctx->data = start_data;
8357 0 : return err;
8358 0 : }
8359 12 : int fd_vote_block_timestamp_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8360 12 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8361 12 : int err = 0;
8362 12 : err = fd_bincode_uint64_decode_footprint( ctx );
8363 12 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8364 12 : err = fd_bincode_uint64_decode_footprint( ctx );
8365 12 : if( FD_UNLIKELY( err ) ) return err;
8366 12 : return 0;
8367 12 : }
8368 0 : void * fd_vote_block_timestamp_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8369 0 : fd_vote_block_timestamp_t * self = (fd_vote_block_timestamp_t *)mem;
8370 0 : fd_vote_block_timestamp_new( self );
8371 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_block_timestamp_t);
8372 0 : void * * alloc_mem = &alloc_region;
8373 0 : fd_vote_block_timestamp_decode_inner( mem, alloc_mem, ctx );
8374 0 : return self;
8375 0 : }
8376 12 : void fd_vote_block_timestamp_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8377 12 : fd_vote_block_timestamp_t * self = (fd_vote_block_timestamp_t *)struct_mem;
8378 12 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
8379 12 : fd_bincode_uint64_decode_unsafe( (ulong *) &self->timestamp, ctx );
8380 12 : }
8381 0 : void * fd_vote_block_timestamp_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8382 0 : fd_vote_block_timestamp_global_t * self = (fd_vote_block_timestamp_global_t *)mem;
8383 0 : fd_vote_block_timestamp_new( (fd_vote_block_timestamp_t *)self );
8384 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_block_timestamp_global_t);
8385 0 : void * * alloc_mem = &alloc_region;
8386 0 : fd_vote_block_timestamp_decode_inner_global( mem, alloc_mem, ctx );
8387 0 : return self;
8388 0 : }
8389 6 : void fd_vote_block_timestamp_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8390 6 : fd_vote_block_timestamp_global_t * self = (fd_vote_block_timestamp_global_t *)struct_mem;
8391 6 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
8392 6 : fd_bincode_uint64_decode_unsafe( (ulong *) &self->timestamp, ctx );
8393 6 : }
8394 6 : int fd_vote_block_timestamp_convert_global_to_local( void const * global_self, fd_vote_block_timestamp_t * self, fd_bincode_decode_ctx_t * ctx ) {
8395 6 : int err = 0;
8396 6 : fd_vote_block_timestamp_global_t const * mem = (fd_vote_block_timestamp_global_t const *)global_self;
8397 6 : self->slot = mem->slot;
8398 6 : self->timestamp = mem->timestamp;
8399 6 : return FD_BINCODE_SUCCESS;
8400 6 : }
8401 12 : void fd_vote_block_timestamp_new(fd_vote_block_timestamp_t * self) {
8402 12 : fd_memset( self, 0, sizeof(fd_vote_block_timestamp_t) );
8403 12 : }
8404 0 : void fd_vote_block_timestamp_destroy( fd_vote_block_timestamp_t * self ) {
8405 0 : }
8406 :
8407 0 : ulong fd_vote_block_timestamp_footprint( void ){ return FD_VOTE_BLOCK_TIMESTAMP_FOOTPRINT; }
8408 0 : ulong fd_vote_block_timestamp_align( void ){ return FD_VOTE_BLOCK_TIMESTAMP_ALIGN; }
8409 :
8410 6 : void fd_vote_block_timestamp_walk( void * w, fd_vote_block_timestamp_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
8411 6 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_block_timestamp", level++ );
8412 6 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
8413 6 : fun( w, &self->timestamp, "timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level );
8414 6 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_block_timestamp", level-- );
8415 6 : }
8416 0 : ulong fd_vote_block_timestamp_size( fd_vote_block_timestamp_t const * self ) {
8417 0 : ulong size = 0;
8418 0 : size += sizeof(ulong);
8419 0 : size += sizeof(long);
8420 0 : return size;
8421 0 : }
8422 :
8423 24 : int fd_vote_prior_voters_encode( fd_vote_prior_voters_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8424 24 : int err;
8425 792 : for( ulong i=0; i<32; i++ ) {
8426 768 : err = fd_vote_prior_voter_encode( self->buf + i, ctx );
8427 768 : if( FD_UNLIKELY( err ) ) return err;
8428 768 : }
8429 24 : err = fd_bincode_uint64_encode( self->idx, ctx );
8430 24 : if( FD_UNLIKELY( err ) ) return err;
8431 24 : err = fd_bincode_bool_encode( (uchar)(self->is_empty), ctx );
8432 24 : if( FD_UNLIKELY( err ) ) return err;
8433 24 : return FD_BINCODE_SUCCESS;
8434 24 : }
8435 0 : int fd_vote_prior_voters_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8436 0 : *total_sz += sizeof(fd_vote_prior_voters_t);
8437 0 : void const * start_data = ctx->data;
8438 0 : int err = fd_vote_prior_voters_decode_footprint_inner( ctx, total_sz );
8439 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8440 0 : ctx->data = start_data;
8441 0 : return err;
8442 0 : }
8443 12 : int fd_vote_prior_voters_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8444 12 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8445 12 : int err = 0;
8446 396 : for( ulong i=0; i<32; i++ ) {
8447 384 : err = fd_vote_prior_voter_decode_footprint_inner( ctx, total_sz );
8448 384 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8449 384 : }
8450 12 : err = fd_bincode_uint64_decode_footprint( ctx );
8451 12 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8452 12 : err = fd_bincode_bool_decode_footprint( ctx );
8453 12 : if( FD_UNLIKELY( err ) ) return err;
8454 12 : return 0;
8455 12 : }
8456 0 : void * fd_vote_prior_voters_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8457 0 : fd_vote_prior_voters_t * self = (fd_vote_prior_voters_t *)mem;
8458 0 : fd_vote_prior_voters_new( self );
8459 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_prior_voters_t);
8460 0 : void * * alloc_mem = &alloc_region;
8461 0 : fd_vote_prior_voters_decode_inner( mem, alloc_mem, ctx );
8462 0 : return self;
8463 0 : }
8464 12 : void fd_vote_prior_voters_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8465 12 : fd_vote_prior_voters_t * self = (fd_vote_prior_voters_t *)struct_mem;
8466 396 : for( ulong i=0; i<32; i++ ) {
8467 384 : fd_vote_prior_voter_decode_inner( self->buf + i, alloc_mem, ctx );
8468 384 : }
8469 12 : fd_bincode_uint64_decode_unsafe( &self->idx, ctx );
8470 12 : fd_bincode_bool_decode_unsafe( &self->is_empty, ctx );
8471 12 : }
8472 0 : void * fd_vote_prior_voters_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8473 0 : fd_vote_prior_voters_global_t * self = (fd_vote_prior_voters_global_t *)mem;
8474 0 : fd_vote_prior_voters_new( (fd_vote_prior_voters_t *)self );
8475 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_prior_voters_global_t);
8476 0 : void * * alloc_mem = &alloc_region;
8477 0 : fd_vote_prior_voters_decode_inner_global( mem, alloc_mem, ctx );
8478 0 : return self;
8479 0 : }
8480 6 : void fd_vote_prior_voters_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8481 6 : fd_vote_prior_voters_global_t * self = (fd_vote_prior_voters_global_t *)struct_mem;
8482 198 : for( ulong i=0; i<32; i++ ) {
8483 192 : fd_vote_prior_voter_decode_inner( self->buf + i, alloc_mem, ctx );
8484 192 : }
8485 6 : fd_bincode_uint64_decode_unsafe( &self->idx, ctx );
8486 6 : fd_bincode_bool_decode_unsafe( &self->is_empty, ctx );
8487 6 : }
8488 6 : int fd_vote_prior_voters_convert_global_to_local( void const * global_self, fd_vote_prior_voters_t * self, fd_bincode_decode_ctx_t * ctx ) {
8489 6 : int err = 0;
8490 6 : fd_vote_prior_voters_global_t const * mem = (fd_vote_prior_voters_global_t const *)global_self;
8491 198 : for( ulong i=0; i<32; i++ ) {
8492 192 : fd_vote_prior_voter_convert_global_to_local( &mem->buf[i], &self->buf[i], ctx );
8493 192 : }
8494 6 : self->idx = mem->idx;
8495 6 : self->is_empty = mem->is_empty;
8496 6 : return FD_BINCODE_SUCCESS;
8497 6 : }
8498 12 : void fd_vote_prior_voters_new(fd_vote_prior_voters_t * self) {
8499 12 : fd_memset( self, 0, sizeof(fd_vote_prior_voters_t) );
8500 396 : for( ulong i=0; i<32; i++ )
8501 384 : fd_vote_prior_voter_new( self->buf + i );
8502 12 : }
8503 0 : void fd_vote_prior_voters_destroy( fd_vote_prior_voters_t * self ) {
8504 0 : for( ulong i=0; i<32; i++ )
8505 0 : fd_vote_prior_voter_destroy( self->buf + i );
8506 0 : }
8507 :
8508 0 : ulong fd_vote_prior_voters_footprint( void ){ return FD_VOTE_PRIOR_VOTERS_FOOTPRINT; }
8509 0 : ulong fd_vote_prior_voters_align( void ){ return FD_VOTE_PRIOR_VOTERS_ALIGN; }
8510 :
8511 6 : void fd_vote_prior_voters_walk( void * w, fd_vote_prior_voters_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
8512 6 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_prior_voters", level++ );
8513 6 : fun( w, NULL, "buf", FD_FLAMENCO_TYPE_ARR, "vote_prior_voter[]", level++ );
8514 198 : for( ulong i=0; i<32; i++ )
8515 192 : fd_vote_prior_voter_walk( w, self->buf + i, fun, "vote_prior_voter", level );
8516 6 : fun( w, NULL, "buf", FD_FLAMENCO_TYPE_ARR_END, "vote_prior_voter[]", level-- );
8517 6 : fun( w, &self->idx, "idx", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
8518 6 : fun( w, &self->is_empty, "is_empty", FD_FLAMENCO_TYPE_BOOL, "bool", level );
8519 6 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_prior_voters", level-- );
8520 6 : }
8521 0 : ulong fd_vote_prior_voters_size( fd_vote_prior_voters_t const * self ) {
8522 0 : ulong size = 0;
8523 0 : for( ulong i=0; i<32; i++ )
8524 0 : size += fd_vote_prior_voter_size( self->buf + i );
8525 0 : size += sizeof(ulong);
8526 0 : size += sizeof(char);
8527 0 : return size;
8528 0 : }
8529 :
8530 0 : int fd_vote_prior_voters_0_23_5_encode( fd_vote_prior_voters_0_23_5_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8531 0 : int err;
8532 0 : for( ulong i=0; i<32; i++ ) {
8533 0 : err = fd_vote_prior_voter_0_23_5_encode( self->buf + i, ctx );
8534 0 : if( FD_UNLIKELY( err ) ) return err;
8535 0 : }
8536 0 : err = fd_bincode_uint64_encode( self->idx, ctx );
8537 0 : if( FD_UNLIKELY( err ) ) return err;
8538 0 : return FD_BINCODE_SUCCESS;
8539 0 : }
8540 0 : int fd_vote_prior_voters_0_23_5_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8541 0 : *total_sz += sizeof(fd_vote_prior_voters_0_23_5_t);
8542 0 : void const * start_data = ctx->data;
8543 0 : int err = fd_vote_prior_voters_0_23_5_decode_footprint_inner( ctx, total_sz );
8544 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8545 0 : ctx->data = start_data;
8546 0 : return err;
8547 0 : }
8548 0 : int fd_vote_prior_voters_0_23_5_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8549 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8550 0 : int err = 0;
8551 0 : for( ulong i=0; i<32; i++ ) {
8552 0 : err = fd_vote_prior_voter_0_23_5_decode_footprint_inner( ctx, total_sz );
8553 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8554 0 : }
8555 0 : err = fd_bincode_uint64_decode_footprint( ctx );
8556 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8557 0 : return 0;
8558 0 : }
8559 0 : void * fd_vote_prior_voters_0_23_5_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8560 0 : fd_vote_prior_voters_0_23_5_t * self = (fd_vote_prior_voters_0_23_5_t *)mem;
8561 0 : fd_vote_prior_voters_0_23_5_new( self );
8562 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_prior_voters_0_23_5_t);
8563 0 : void * * alloc_mem = &alloc_region;
8564 0 : fd_vote_prior_voters_0_23_5_decode_inner( mem, alloc_mem, ctx );
8565 0 : return self;
8566 0 : }
8567 0 : void fd_vote_prior_voters_0_23_5_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8568 0 : fd_vote_prior_voters_0_23_5_t * self = (fd_vote_prior_voters_0_23_5_t *)struct_mem;
8569 0 : for( ulong i=0; i<32; i++ ) {
8570 0 : fd_vote_prior_voter_0_23_5_decode_inner( self->buf + i, alloc_mem, ctx );
8571 0 : }
8572 0 : fd_bincode_uint64_decode_unsafe( &self->idx, ctx );
8573 0 : }
8574 0 : void * fd_vote_prior_voters_0_23_5_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8575 0 : fd_vote_prior_voters_0_23_5_global_t * self = (fd_vote_prior_voters_0_23_5_global_t *)mem;
8576 0 : fd_vote_prior_voters_0_23_5_new( (fd_vote_prior_voters_0_23_5_t *)self );
8577 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_prior_voters_0_23_5_global_t);
8578 0 : void * * alloc_mem = &alloc_region;
8579 0 : fd_vote_prior_voters_0_23_5_decode_inner_global( mem, alloc_mem, ctx );
8580 0 : return self;
8581 0 : }
8582 0 : void fd_vote_prior_voters_0_23_5_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8583 0 : fd_vote_prior_voters_0_23_5_global_t * self = (fd_vote_prior_voters_0_23_5_global_t *)struct_mem;
8584 0 : for( ulong i=0; i<32; i++ ) {
8585 0 : fd_vote_prior_voter_0_23_5_decode_inner( self->buf + i, alloc_mem, ctx );
8586 0 : }
8587 0 : fd_bincode_uint64_decode_unsafe( &self->idx, ctx );
8588 0 : }
8589 0 : int fd_vote_prior_voters_0_23_5_convert_global_to_local( void const * global_self, fd_vote_prior_voters_0_23_5_t * self, fd_bincode_decode_ctx_t * ctx ) {
8590 0 : int err = 0;
8591 0 : fd_vote_prior_voters_0_23_5_global_t const * mem = (fd_vote_prior_voters_0_23_5_global_t const *)global_self;
8592 0 : for( ulong i=0; i<32; i++ ) {
8593 0 : fd_vote_prior_voter_0_23_5_convert_global_to_local( &mem->buf[i], &self->buf[i], ctx );
8594 0 : }
8595 0 : self->idx = mem->idx;
8596 0 : return FD_BINCODE_SUCCESS;
8597 0 : }
8598 0 : void fd_vote_prior_voters_0_23_5_new(fd_vote_prior_voters_0_23_5_t * self) {
8599 0 : fd_memset( self, 0, sizeof(fd_vote_prior_voters_0_23_5_t) );
8600 0 : for( ulong i=0; i<32; i++ )
8601 0 : fd_vote_prior_voter_0_23_5_new( self->buf + i );
8602 0 : }
8603 0 : void fd_vote_prior_voters_0_23_5_destroy( fd_vote_prior_voters_0_23_5_t * self ) {
8604 0 : for( ulong i=0; i<32; i++ )
8605 0 : fd_vote_prior_voter_0_23_5_destroy( self->buf + i );
8606 0 : }
8607 :
8608 0 : ulong fd_vote_prior_voters_0_23_5_footprint( void ){ return FD_VOTE_PRIOR_VOTERS_0_23_5_FOOTPRINT; }
8609 0 : ulong fd_vote_prior_voters_0_23_5_align( void ){ return FD_VOTE_PRIOR_VOTERS_0_23_5_ALIGN; }
8610 :
8611 0 : void fd_vote_prior_voters_0_23_5_walk( void * w, fd_vote_prior_voters_0_23_5_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
8612 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_prior_voters_0_23_5", level++ );
8613 0 : fun( w, NULL, "buf", FD_FLAMENCO_TYPE_ARR, "vote_prior_voter_0_23_5[]", level++ );
8614 0 : for( ulong i=0; i<32; i++ )
8615 0 : fd_vote_prior_voter_0_23_5_walk( w, self->buf + i, fun, "vote_prior_voter_0_23_5", level );
8616 0 : fun( w, NULL, "buf", FD_FLAMENCO_TYPE_ARR_END, "vote_prior_voter_0_23_5[]", level-- );
8617 0 : fun( w, &self->idx, "idx", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
8618 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_prior_voters_0_23_5", level-- );
8619 0 : }
8620 0 : ulong fd_vote_prior_voters_0_23_5_size( fd_vote_prior_voters_0_23_5_t const * self ) {
8621 0 : ulong size = 0;
8622 0 : for( ulong i=0; i<32; i++ )
8623 0 : size += fd_vote_prior_voter_0_23_5_size( self->buf + i );
8624 0 : size += sizeof(ulong);
8625 0 : return size;
8626 0 : }
8627 :
8628 192 : int fd_landed_vote_encode( fd_landed_vote_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8629 192 : int err;
8630 192 : err = fd_bincode_uint8_encode( (uchar)(self->latency), ctx );
8631 192 : if( FD_UNLIKELY( err ) ) return err;
8632 192 : err = fd_vote_lockout_encode( &self->lockout, ctx );
8633 192 : if( FD_UNLIKELY( err ) ) return err;
8634 192 : return FD_BINCODE_SUCCESS;
8635 192 : }
8636 0 : int fd_landed_vote_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8637 0 : *total_sz += sizeof(fd_landed_vote_t);
8638 0 : void const * start_data = ctx->data;
8639 0 : int err = fd_landed_vote_decode_footprint_inner( ctx, total_sz );
8640 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8641 0 : ctx->data = start_data;
8642 0 : return err;
8643 0 : }
8644 0 : int fd_landed_vote_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8645 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8646 0 : int err = 0;
8647 0 : err = fd_bincode_uint8_decode_footprint( ctx );
8648 0 : if( FD_UNLIKELY( err ) ) return err;
8649 0 : err = fd_vote_lockout_decode_footprint_inner( ctx, total_sz );
8650 0 : if( FD_UNLIKELY( err ) ) return err;
8651 0 : return 0;
8652 0 : }
8653 0 : void * fd_landed_vote_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8654 0 : fd_landed_vote_t * self = (fd_landed_vote_t *)mem;
8655 0 : fd_landed_vote_new( self );
8656 0 : void * alloc_region = (uchar *)mem + sizeof(fd_landed_vote_t);
8657 0 : void * * alloc_mem = &alloc_region;
8658 0 : fd_landed_vote_decode_inner( mem, alloc_mem, ctx );
8659 0 : return self;
8660 0 : }
8661 192 : void fd_landed_vote_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8662 192 : fd_landed_vote_t * self = (fd_landed_vote_t *)struct_mem;
8663 192 : fd_bincode_uint8_decode_unsafe( &self->latency, ctx );
8664 192 : fd_vote_lockout_decode_inner( &self->lockout, alloc_mem, ctx );
8665 192 : }
8666 0 : void * fd_landed_vote_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8667 0 : fd_landed_vote_global_t * self = (fd_landed_vote_global_t *)mem;
8668 0 : fd_landed_vote_new( (fd_landed_vote_t *)self );
8669 0 : void * alloc_region = (uchar *)mem + sizeof(fd_landed_vote_global_t);
8670 0 : void * * alloc_mem = &alloc_region;
8671 0 : fd_landed_vote_decode_inner_global( mem, alloc_mem, ctx );
8672 0 : return self;
8673 0 : }
8674 96 : void fd_landed_vote_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8675 96 : fd_landed_vote_global_t * self = (fd_landed_vote_global_t *)struct_mem;
8676 96 : fd_bincode_uint8_decode_unsafe( &self->latency, ctx );
8677 96 : fd_vote_lockout_decode_inner_global( &self->lockout, alloc_mem, ctx );
8678 96 : }
8679 0 : int fd_landed_vote_convert_global_to_local( void const * global_self, fd_landed_vote_t * self, fd_bincode_decode_ctx_t * ctx ) {
8680 0 : int err = 0;
8681 0 : fd_landed_vote_global_t const * mem = (fd_landed_vote_global_t const *)global_self;
8682 0 : self->latency = mem->latency;
8683 0 : err = fd_vote_lockout_convert_global_to_local( &mem->lockout, &self->lockout, ctx );
8684 0 : if( FD_UNLIKELY( err ) ) return err;
8685 0 : return FD_BINCODE_SUCCESS;
8686 0 : }
8687 288 : void fd_landed_vote_new(fd_landed_vote_t * self) {
8688 288 : fd_memset( self, 0, sizeof(fd_landed_vote_t) );
8689 288 : fd_vote_lockout_new( &self->lockout );
8690 288 : }
8691 0 : void fd_landed_vote_destroy( fd_landed_vote_t * self ) {
8692 0 : fd_vote_lockout_destroy( &self->lockout );
8693 0 : }
8694 :
8695 0 : ulong fd_landed_vote_footprint( void ){ return FD_LANDED_VOTE_FOOTPRINT; }
8696 0 : ulong fd_landed_vote_align( void ){ return FD_LANDED_VOTE_ALIGN; }
8697 :
8698 96 : void fd_landed_vote_walk( void * w, fd_landed_vote_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
8699 96 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_landed_vote", level++ );
8700 96 : fun( w, &self->latency, "latency", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
8701 96 : fd_vote_lockout_walk( w, &self->lockout, fun, "lockout", level );
8702 96 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_landed_vote", level-- );
8703 96 : }
8704 0 : ulong fd_landed_vote_size( fd_landed_vote_t const * self ) {
8705 0 : ulong size = 0;
8706 0 : size += sizeof(char);
8707 0 : size += fd_vote_lockout_size( &self->lockout );
8708 0 : return size;
8709 0 : }
8710 :
8711 0 : int fd_vote_state_0_23_5_encode( fd_vote_state_0_23_5_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8712 0 : int err;
8713 0 : err = fd_pubkey_encode( &self->node_pubkey, ctx );
8714 0 : if( FD_UNLIKELY( err ) ) return err;
8715 0 : err = fd_pubkey_encode( &self->authorized_voter, ctx );
8716 0 : if( FD_UNLIKELY( err ) ) return err;
8717 0 : err = fd_bincode_uint64_encode( self->authorized_voter_epoch, ctx );
8718 0 : if( FD_UNLIKELY( err ) ) return err;
8719 0 : err = fd_vote_prior_voters_0_23_5_encode( &self->prior_voters, ctx );
8720 0 : if( FD_UNLIKELY( err ) ) return err;
8721 0 : err = fd_pubkey_encode( &self->authorized_withdrawer, ctx );
8722 0 : if( FD_UNLIKELY( err ) ) return err;
8723 0 : err = fd_bincode_uint8_encode( (uchar)(self->commission), ctx );
8724 0 : if( FD_UNLIKELY( err ) ) return err;
8725 0 : if( self->votes ) {
8726 0 : ulong votes_len = deq_fd_vote_lockout_t_cnt( self->votes );
8727 0 : err = fd_bincode_uint64_encode( votes_len, ctx );
8728 0 : if( FD_UNLIKELY( err ) ) return err;
8729 0 : for( deq_fd_vote_lockout_t_iter_t iter = deq_fd_vote_lockout_t_iter_init( self->votes ); !deq_fd_vote_lockout_t_iter_done( self->votes, iter ); iter = deq_fd_vote_lockout_t_iter_next( self->votes, iter ) ) {
8730 0 : fd_vote_lockout_t const * ele = deq_fd_vote_lockout_t_iter_ele_const( self->votes, iter );
8731 0 : err = fd_vote_lockout_encode( ele, ctx );
8732 0 : if( FD_UNLIKELY( err ) ) return err;
8733 0 : }
8734 0 : } else {
8735 0 : ulong votes_len = 0;
8736 0 : err = fd_bincode_uint64_encode( votes_len, ctx );
8737 0 : if( FD_UNLIKELY( err ) ) return err;
8738 0 : }
8739 0 : err = fd_bincode_bool_encode( self->has_root_slot, ctx );
8740 0 : if( FD_UNLIKELY( err ) ) return err;
8741 0 : if( self->has_root_slot ) {
8742 0 : err = fd_bincode_uint64_encode( self->root_slot, ctx );
8743 0 : if( FD_UNLIKELY( err ) ) return err;
8744 0 : }
8745 0 : if( self->epoch_credits ) {
8746 0 : ulong epoch_credits_len = deq_fd_vote_epoch_credits_t_cnt( self->epoch_credits );
8747 0 : err = fd_bincode_uint64_encode( epoch_credits_len, ctx );
8748 0 : if( FD_UNLIKELY( err ) ) return err;
8749 0 : for( deq_fd_vote_epoch_credits_t_iter_t iter = deq_fd_vote_epoch_credits_t_iter_init( self->epoch_credits ); !deq_fd_vote_epoch_credits_t_iter_done( self->epoch_credits, iter ); iter = deq_fd_vote_epoch_credits_t_iter_next( self->epoch_credits, iter ) ) {
8750 0 : fd_vote_epoch_credits_t const * ele = deq_fd_vote_epoch_credits_t_iter_ele_const( self->epoch_credits, iter );
8751 0 : err = fd_vote_epoch_credits_encode( ele, ctx );
8752 0 : if( FD_UNLIKELY( err ) ) return err;
8753 0 : }
8754 0 : } else {
8755 0 : ulong epoch_credits_len = 0;
8756 0 : err = fd_bincode_uint64_encode( epoch_credits_len, ctx );
8757 0 : if( FD_UNLIKELY( err ) ) return err;
8758 0 : }
8759 0 : err = fd_vote_block_timestamp_encode( &self->last_timestamp, ctx );
8760 0 : if( FD_UNLIKELY( err ) ) return err;
8761 0 : return FD_BINCODE_SUCCESS;
8762 0 : }
8763 0 : int fd_vote_state_0_23_5_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8764 0 : *total_sz += sizeof(fd_vote_state_0_23_5_t);
8765 0 : void const * start_data = ctx->data;
8766 0 : int err = fd_vote_state_0_23_5_decode_footprint_inner( ctx, total_sz );
8767 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8768 0 : ctx->data = start_data;
8769 0 : return err;
8770 0 : }
8771 0 : int fd_vote_state_0_23_5_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8772 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8773 0 : int err = 0;
8774 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
8775 0 : if( FD_UNLIKELY( err ) ) return err;
8776 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
8777 0 : if( FD_UNLIKELY( err ) ) return err;
8778 0 : err = fd_bincode_uint64_decode_footprint( ctx );
8779 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8780 0 : err = fd_vote_prior_voters_0_23_5_decode_footprint_inner( ctx, total_sz );
8781 0 : if( FD_UNLIKELY( err ) ) return err;
8782 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
8783 0 : if( FD_UNLIKELY( err ) ) return err;
8784 0 : err = fd_bincode_uint8_decode_footprint( ctx );
8785 0 : if( FD_UNLIKELY( err ) ) return err;
8786 0 : ulong votes_len;
8787 0 : err = fd_bincode_uint64_decode( &votes_len, ctx );
8788 0 : if( FD_UNLIKELY( err ) ) return err;
8789 0 : ulong votes_max = fd_ulong_max( votes_len, 32 );
8790 0 : *total_sz += deq_fd_vote_lockout_t_align() + deq_fd_vote_lockout_t_footprint( votes_max );
8791 0 : ulong votes_sz;
8792 0 : if( FD_UNLIKELY( __builtin_umull_overflow( votes_len, 12, &votes_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
8793 0 : err = fd_bincode_bytes_decode_footprint( votes_sz, ctx );
8794 0 : if( FD_UNLIKELY( err ) ) return err;
8795 0 : {
8796 0 : uchar o;
8797 0 : err = fd_bincode_bool_decode( &o, ctx );
8798 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8799 0 : if( o ) {
8800 0 : err = fd_bincode_uint64_decode_footprint( ctx );
8801 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8802 0 : }
8803 0 : }
8804 0 : ulong epoch_credits_len;
8805 0 : err = fd_bincode_uint64_decode( &epoch_credits_len, ctx );
8806 0 : if( FD_UNLIKELY( err ) ) return err;
8807 0 : ulong epoch_credits_max = fd_ulong_max( epoch_credits_len, 64 );
8808 0 : *total_sz += deq_fd_vote_epoch_credits_t_align() + deq_fd_vote_epoch_credits_t_footprint( epoch_credits_max );
8809 0 : ulong epoch_credits_sz;
8810 0 : if( FD_UNLIKELY( __builtin_umull_overflow( epoch_credits_len, 24, &epoch_credits_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
8811 0 : err = fd_bincode_bytes_decode_footprint( epoch_credits_sz, ctx );
8812 0 : if( FD_UNLIKELY( err ) ) return err;
8813 0 : err = fd_vote_block_timestamp_decode_footprint_inner( ctx, total_sz );
8814 0 : if( FD_UNLIKELY( err ) ) return err;
8815 0 : return 0;
8816 0 : }
8817 0 : void * fd_vote_state_0_23_5_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8818 0 : fd_vote_state_0_23_5_t * self = (fd_vote_state_0_23_5_t *)mem;
8819 0 : fd_vote_state_0_23_5_new( self );
8820 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_state_0_23_5_t);
8821 0 : void * * alloc_mem = &alloc_region;
8822 0 : fd_vote_state_0_23_5_decode_inner( mem, alloc_mem, ctx );
8823 0 : return self;
8824 0 : }
8825 0 : void fd_vote_state_0_23_5_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8826 0 : fd_vote_state_0_23_5_t * self = (fd_vote_state_0_23_5_t *)struct_mem;
8827 0 : fd_pubkey_decode_inner( &self->node_pubkey, alloc_mem, ctx );
8828 0 : fd_pubkey_decode_inner( &self->authorized_voter, alloc_mem, ctx );
8829 0 : fd_bincode_uint64_decode_unsafe( &self->authorized_voter_epoch, ctx );
8830 0 : fd_vote_prior_voters_0_23_5_decode_inner( &self->prior_voters, alloc_mem, ctx );
8831 0 : fd_pubkey_decode_inner( &self->authorized_withdrawer, alloc_mem, ctx );
8832 0 : fd_bincode_uint8_decode_unsafe( &self->commission, ctx );
8833 0 : ulong votes_len;
8834 0 : fd_bincode_uint64_decode_unsafe( &votes_len, ctx );
8835 0 : ulong votes_max = fd_ulong_max( votes_len, 32 );
8836 0 : self->votes = deq_fd_vote_lockout_t_join_new( alloc_mem, votes_max );
8837 0 : for( ulong i=0; i < votes_len; i++ ) {
8838 0 : fd_vote_lockout_t * elem = deq_fd_vote_lockout_t_push_tail_nocopy( self->votes );
8839 0 : fd_vote_lockout_new( elem );
8840 0 : fd_vote_lockout_decode_inner( elem, alloc_mem, ctx );
8841 0 : }
8842 0 : {
8843 0 : uchar o;
8844 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
8845 0 : self->has_root_slot = !!o;
8846 0 : if( o ) {
8847 0 : fd_bincode_uint64_decode_unsafe( &self->root_slot, ctx );
8848 0 : }
8849 0 : }
8850 0 : ulong epoch_credits_len;
8851 0 : fd_bincode_uint64_decode_unsafe( &epoch_credits_len, ctx );
8852 0 : ulong epoch_credits_max = fd_ulong_max( epoch_credits_len, 64 );
8853 0 : self->epoch_credits = deq_fd_vote_epoch_credits_t_join_new( alloc_mem, epoch_credits_max );
8854 0 : for( ulong i=0; i < epoch_credits_len; i++ ) {
8855 0 : fd_vote_epoch_credits_t * elem = deq_fd_vote_epoch_credits_t_push_tail_nocopy( self->epoch_credits );
8856 0 : fd_vote_epoch_credits_new( elem );
8857 0 : fd_vote_epoch_credits_decode_inner( elem, alloc_mem, ctx );
8858 0 : }
8859 0 : fd_vote_block_timestamp_decode_inner( &self->last_timestamp, alloc_mem, ctx );
8860 0 : }
8861 0 : void * fd_vote_state_0_23_5_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8862 0 : fd_vote_state_0_23_5_global_t * self = (fd_vote_state_0_23_5_global_t *)mem;
8863 0 : fd_vote_state_0_23_5_new( (fd_vote_state_0_23_5_t *)self );
8864 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_state_0_23_5_global_t);
8865 0 : void * * alloc_mem = &alloc_region;
8866 0 : fd_vote_state_0_23_5_decode_inner_global( mem, alloc_mem, ctx );
8867 0 : return self;
8868 0 : }
8869 0 : void fd_vote_state_0_23_5_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8870 0 : fd_vote_state_0_23_5_global_t * self = (fd_vote_state_0_23_5_global_t *)struct_mem;
8871 0 : fd_pubkey_decode_inner_global( &self->node_pubkey, alloc_mem, ctx );
8872 0 : fd_pubkey_decode_inner_global( &self->authorized_voter, alloc_mem, ctx );
8873 0 : fd_bincode_uint64_decode_unsafe( &self->authorized_voter_epoch, ctx );
8874 0 : fd_vote_prior_voters_0_23_5_decode_inner_global( &self->prior_voters, alloc_mem, ctx );
8875 0 : fd_pubkey_decode_inner_global( &self->authorized_withdrawer, alloc_mem, ctx );
8876 0 : fd_bincode_uint8_decode_unsafe( &self->commission, ctx );
8877 0 : ulong votes_len;
8878 0 : fd_bincode_uint64_decode_unsafe( &votes_len, ctx );
8879 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, deq_fd_vote_lockout_t_align() );
8880 0 : ulong votes_max = fd_ulong_max( votes_len, 32 );
8881 0 : self->votes_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
8882 0 : fd_vote_lockout_t * votes = deq_fd_vote_lockout_t_join_new( alloc_mem, votes_max );
8883 0 : for( ulong i=0; i < votes_len; i++ ) {
8884 0 : fd_vote_lockout_t * elem = deq_fd_vote_lockout_t_push_tail_nocopy( votes );
8885 0 : fd_vote_lockout_new( elem );
8886 0 : fd_vote_lockout_decode_inner_global( elem, alloc_mem, ctx );
8887 0 : }
8888 0 : {
8889 0 : uchar o;
8890 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
8891 0 : self->has_root_slot = !!o;
8892 0 : if( o ) {
8893 0 : fd_bincode_uint64_decode_unsafe( &self->root_slot, ctx );
8894 0 : }
8895 0 : }
8896 0 : ulong epoch_credits_len;
8897 0 : fd_bincode_uint64_decode_unsafe( &epoch_credits_len, ctx );
8898 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, deq_fd_vote_epoch_credits_t_align() );
8899 0 : ulong epoch_credits_max = fd_ulong_max( epoch_credits_len, 64 );
8900 0 : self->epoch_credits_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
8901 0 : fd_vote_epoch_credits_t * epoch_credits = deq_fd_vote_epoch_credits_t_join_new( alloc_mem, epoch_credits_max );
8902 0 : for( ulong i=0; i < epoch_credits_len; i++ ) {
8903 0 : fd_vote_epoch_credits_t * elem = deq_fd_vote_epoch_credits_t_push_tail_nocopy( epoch_credits );
8904 0 : fd_vote_epoch_credits_new( elem );
8905 0 : fd_vote_epoch_credits_decode_inner_global( elem, alloc_mem, ctx );
8906 0 : }
8907 0 : fd_vote_block_timestamp_decode_inner_global( &self->last_timestamp, alloc_mem, ctx );
8908 0 : }
8909 0 : int fd_vote_state_0_23_5_convert_global_to_local( void const * global_self, fd_vote_state_0_23_5_t * self, fd_bincode_decode_ctx_t * ctx ) {
8910 0 : int err = 0;
8911 0 : fd_vote_state_0_23_5_global_t const * mem = (fd_vote_state_0_23_5_global_t const *)global_self;
8912 0 : err = fd_pubkey_convert_global_to_local( &mem->node_pubkey, &self->node_pubkey, ctx );
8913 0 : if( FD_UNLIKELY( err ) ) return err;
8914 0 : err = fd_pubkey_convert_global_to_local( &mem->authorized_voter, &self->authorized_voter, ctx );
8915 0 : if( FD_UNLIKELY( err ) ) return err;
8916 0 : self->authorized_voter_epoch = mem->authorized_voter_epoch;
8917 0 : err = fd_vote_prior_voters_0_23_5_convert_global_to_local( &mem->prior_voters, &self->prior_voters, ctx );
8918 0 : if( FD_UNLIKELY( err ) ) return err;
8919 0 : err = fd_pubkey_convert_global_to_local( &mem->authorized_withdrawer, &self->authorized_withdrawer, ctx );
8920 0 : if( FD_UNLIKELY( err ) ) return err;
8921 0 : self->commission = mem->commission;
8922 0 : self->votes = deq_fd_vote_lockout_t_join( fd_wksp_laddr_fast( ctx->wksp, mem->votes_gaddr ) );
8923 0 : self->root_slot = mem->root_slot;
8924 0 : self->has_root_slot = mem->has_root_slot;
8925 0 : self->epoch_credits = deq_fd_vote_epoch_credits_t_join( fd_wksp_laddr_fast( ctx->wksp, mem->epoch_credits_gaddr ) );
8926 0 : err = fd_vote_block_timestamp_convert_global_to_local( &mem->last_timestamp, &self->last_timestamp, ctx );
8927 0 : if( FD_UNLIKELY( err ) ) return err;
8928 0 : return FD_BINCODE_SUCCESS;
8929 0 : }
8930 0 : void fd_vote_state_0_23_5_new(fd_vote_state_0_23_5_t * self) {
8931 0 : fd_memset( self, 0, sizeof(fd_vote_state_0_23_5_t) );
8932 0 : fd_pubkey_new( &self->node_pubkey );
8933 0 : fd_pubkey_new( &self->authorized_voter );
8934 0 : fd_vote_prior_voters_0_23_5_new( &self->prior_voters );
8935 0 : fd_pubkey_new( &self->authorized_withdrawer );
8936 0 : fd_vote_block_timestamp_new( &self->last_timestamp );
8937 0 : }
8938 0 : void fd_vote_state_0_23_5_destroy( fd_vote_state_0_23_5_t * self ) {
8939 0 : fd_pubkey_destroy( &self->node_pubkey );
8940 0 : fd_pubkey_destroy( &self->authorized_voter );
8941 0 : fd_vote_prior_voters_0_23_5_destroy( &self->prior_voters );
8942 0 : fd_pubkey_destroy( &self->authorized_withdrawer );
8943 0 : if( self->votes ) {
8944 0 : for( deq_fd_vote_lockout_t_iter_t iter = deq_fd_vote_lockout_t_iter_init( self->votes ); !deq_fd_vote_lockout_t_iter_done( self->votes, iter ); iter = deq_fd_vote_lockout_t_iter_next( self->votes, iter ) ) {
8945 0 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->votes, iter );
8946 0 : fd_vote_lockout_destroy( ele );
8947 0 : }
8948 0 : self->votes = NULL;
8949 0 : }
8950 0 : if( self->has_root_slot ) {
8951 0 : self->has_root_slot = 0;
8952 0 : }
8953 0 : if( self->epoch_credits ) {
8954 0 : for( deq_fd_vote_epoch_credits_t_iter_t iter = deq_fd_vote_epoch_credits_t_iter_init( self->epoch_credits ); !deq_fd_vote_epoch_credits_t_iter_done( self->epoch_credits, iter ); iter = deq_fd_vote_epoch_credits_t_iter_next( self->epoch_credits, iter ) ) {
8955 0 : fd_vote_epoch_credits_t * ele = deq_fd_vote_epoch_credits_t_iter_ele( self->epoch_credits, iter );
8956 0 : fd_vote_epoch_credits_destroy( ele );
8957 0 : }
8958 0 : self->epoch_credits = NULL;
8959 0 : }
8960 0 : fd_vote_block_timestamp_destroy( &self->last_timestamp );
8961 0 : }
8962 :
8963 0 : ulong fd_vote_state_0_23_5_footprint( void ){ return FD_VOTE_STATE_0_23_5_FOOTPRINT; }
8964 0 : ulong fd_vote_state_0_23_5_align( void ){ return FD_VOTE_STATE_0_23_5_ALIGN; }
8965 :
8966 0 : void fd_vote_state_0_23_5_walk( void * w, fd_vote_state_0_23_5_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
8967 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_state_0_23_5", level++ );
8968 0 : fd_pubkey_walk( w, &self->node_pubkey, fun, "node_pubkey", level );
8969 0 : fd_pubkey_walk( w, &self->authorized_voter, fun, "authorized_voter", level );
8970 0 : fun( w, &self->authorized_voter_epoch, "authorized_voter_epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
8971 0 : fd_vote_prior_voters_0_23_5_walk( w, &self->prior_voters, fun, "prior_voters", level );
8972 0 : fd_pubkey_walk( w, &self->authorized_withdrawer, fun, "authorized_withdrawer", level );
8973 0 : fun( w, &self->commission, "commission", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
8974 :
8975 : /* Walk deque */
8976 0 : fun( w, self->votes, "votes", FD_FLAMENCO_TYPE_ARR, "votes", level++ );
8977 0 : if( self->votes ) {
8978 0 : for( deq_fd_vote_lockout_t_iter_t iter = deq_fd_vote_lockout_t_iter_init( self->votes );
8979 0 : !deq_fd_vote_lockout_t_iter_done( self->votes, iter );
8980 0 : iter = deq_fd_vote_lockout_t_iter_next( self->votes, iter ) ) {
8981 0 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->votes, iter );
8982 0 : fd_vote_lockout_walk(w, ele, fun, "votes", level );
8983 0 : }
8984 0 : }
8985 0 : fun( w, self->votes, "votes", FD_FLAMENCO_TYPE_ARR_END, "votes", level-- );
8986 : /* Done walking deque */
8987 :
8988 0 : if( !self->has_root_slot ) {
8989 0 : fun( w, NULL, "root_slot", FD_FLAMENCO_TYPE_NULL, "ulong", level );
8990 0 : } else {
8991 0 : fun( w, &self->root_slot, "root_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
8992 0 : }
8993 :
8994 : /* Walk deque */
8995 0 : fun( w, self->epoch_credits, "epoch_credits", FD_FLAMENCO_TYPE_ARR, "epoch_credits", level++ );
8996 0 : if( self->epoch_credits ) {
8997 0 : for( deq_fd_vote_epoch_credits_t_iter_t iter = deq_fd_vote_epoch_credits_t_iter_init( self->epoch_credits );
8998 0 : !deq_fd_vote_epoch_credits_t_iter_done( self->epoch_credits, iter );
8999 0 : iter = deq_fd_vote_epoch_credits_t_iter_next( self->epoch_credits, iter ) ) {
9000 0 : fd_vote_epoch_credits_t * ele = deq_fd_vote_epoch_credits_t_iter_ele( self->epoch_credits, iter );
9001 0 : fd_vote_epoch_credits_walk(w, ele, fun, "epoch_credits", level );
9002 0 : }
9003 0 : }
9004 0 : fun( w, self->epoch_credits, "epoch_credits", FD_FLAMENCO_TYPE_ARR_END, "epoch_credits", level-- );
9005 : /* Done walking deque */
9006 :
9007 0 : fd_vote_block_timestamp_walk( w, &self->last_timestamp, fun, "last_timestamp", level );
9008 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_state_0_23_5", level-- );
9009 0 : }
9010 0 : ulong fd_vote_state_0_23_5_size( fd_vote_state_0_23_5_t const * self ) {
9011 0 : ulong size = 0;
9012 0 : size += fd_pubkey_size( &self->node_pubkey );
9013 0 : size += fd_pubkey_size( &self->authorized_voter );
9014 0 : size += sizeof(ulong);
9015 0 : size += fd_vote_prior_voters_0_23_5_size( &self->prior_voters );
9016 0 : size += fd_pubkey_size( &self->authorized_withdrawer );
9017 0 : size += sizeof(char);
9018 0 : if( self->votes ) {
9019 0 : size += sizeof(ulong);
9020 0 : for( deq_fd_vote_lockout_t_iter_t iter = deq_fd_vote_lockout_t_iter_init( self->votes ); !deq_fd_vote_lockout_t_iter_done( self->votes, iter ); iter = deq_fd_vote_lockout_t_iter_next( self->votes, iter ) ) {
9021 0 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->votes, iter );
9022 0 : size += fd_vote_lockout_size( ele );
9023 0 : }
9024 0 : } else {
9025 0 : size += sizeof(ulong);
9026 0 : }
9027 0 : size += sizeof(char);
9028 0 : if( self->has_root_slot ) {
9029 0 : size += sizeof(ulong);
9030 0 : }
9031 0 : if( self->epoch_credits ) {
9032 0 : size += sizeof(ulong);
9033 0 : for( deq_fd_vote_epoch_credits_t_iter_t iter = deq_fd_vote_epoch_credits_t_iter_init( self->epoch_credits ); !deq_fd_vote_epoch_credits_t_iter_done( self->epoch_credits, iter ); iter = deq_fd_vote_epoch_credits_t_iter_next( self->epoch_credits, iter ) ) {
9034 0 : fd_vote_epoch_credits_t * ele = deq_fd_vote_epoch_credits_t_iter_ele( self->epoch_credits, iter );
9035 0 : size += fd_vote_epoch_credits_size( ele );
9036 0 : }
9037 0 : } else {
9038 0 : size += sizeof(ulong);
9039 0 : }
9040 0 : size += fd_vote_block_timestamp_size( &self->last_timestamp );
9041 0 : return size;
9042 0 : }
9043 :
9044 24 : int fd_vote_authorized_voters_encode( fd_vote_authorized_voters_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9045 24 : int err;
9046 24 : if( self->treap ) {
9047 24 : ulong fd_vote_authorized_voters_len = fd_vote_authorized_voters_treap_ele_cnt( self->treap );
9048 24 : err = fd_bincode_uint64_encode( fd_vote_authorized_voters_len, ctx );
9049 24 : if( FD_UNLIKELY( err ) ) return err;
9050 24 : for( fd_vote_authorized_voters_treap_fwd_iter_t iter = fd_vote_authorized_voters_treap_fwd_iter_init( self->treap, self->pool );
9051 48 : !fd_vote_authorized_voters_treap_fwd_iter_done( iter );
9052 24 : iter = fd_vote_authorized_voters_treap_fwd_iter_next( iter, self->pool ) ) {
9053 24 : fd_vote_authorized_voter_t * ele = fd_vote_authorized_voters_treap_fwd_iter_ele( iter, self->pool );
9054 24 : err = fd_vote_authorized_voter_encode( ele, ctx );
9055 24 : if( FD_UNLIKELY( err ) ) return err;
9056 24 : }
9057 24 : } else {
9058 0 : ulong fd_vote_authorized_voters_len = 0;
9059 0 : err = fd_bincode_uint64_encode( fd_vote_authorized_voters_len, ctx );
9060 0 : if( FD_UNLIKELY( err ) ) return err;
9061 0 : }
9062 24 : return FD_BINCODE_SUCCESS;
9063 24 : }
9064 0 : int fd_vote_authorized_voters_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9065 0 : *total_sz += sizeof(fd_vote_authorized_voters_t);
9066 0 : void const * start_data = ctx->data;
9067 0 : int err = fd_vote_authorized_voters_decode_footprint_inner( ctx, total_sz );
9068 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9069 0 : ctx->data = start_data;
9070 0 : return err;
9071 0 : }
9072 12 : int fd_vote_authorized_voters_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9073 12 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9074 12 : int err = 0;
9075 12 : ulong fd_vote_authorized_voters_treap_len;
9076 12 : err = fd_bincode_uint64_decode( &fd_vote_authorized_voters_treap_len, ctx );
9077 12 : if( FD_UNLIKELY( err ) ) return err;
9078 12 : 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 );
9079 12 : *total_sz += fd_vote_authorized_voters_pool_align() + fd_vote_authorized_voters_pool_footprint( fd_vote_authorized_voters_treap_max );
9080 12 : *total_sz += fd_vote_authorized_voters_treap_align() + fd_vote_authorized_voters_treap_footprint( fd_vote_authorized_voters_treap_max );
9081 24 : for( ulong i=0; i < fd_vote_authorized_voters_treap_len; i++ ) {
9082 12 : err = fd_vote_authorized_voter_decode_footprint_inner( ctx, total_sz );
9083 12 : if( FD_UNLIKELY ( err ) ) return err;
9084 12 : }
9085 12 : return 0;
9086 12 : }
9087 0 : void * fd_vote_authorized_voters_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9088 0 : fd_vote_authorized_voters_t * self = (fd_vote_authorized_voters_t *)mem;
9089 0 : fd_vote_authorized_voters_new( self );
9090 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_authorized_voters_t);
9091 0 : void * * alloc_mem = &alloc_region;
9092 0 : fd_vote_authorized_voters_decode_inner( mem, alloc_mem, ctx );
9093 0 : return self;
9094 0 : }
9095 12 : void fd_vote_authorized_voters_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9096 12 : fd_vote_authorized_voters_t * self = (fd_vote_authorized_voters_t *)struct_mem;
9097 12 : ulong fd_vote_authorized_voters_treap_len;
9098 12 : fd_bincode_uint64_decode_unsafe( &fd_vote_authorized_voters_treap_len, ctx );
9099 12 : ulong fd_vote_authorized_voters_treap_max = fd_ulong_max( fd_vote_authorized_voters_treap_len, FD_VOTE_AUTHORIZED_VOTERS_MIN );
9100 12 : self->pool = fd_vote_authorized_voters_pool_join_new( alloc_mem, fd_vote_authorized_voters_treap_max );
9101 12 : self->treap = fd_vote_authorized_voters_treap_join_new( alloc_mem, fd_vote_authorized_voters_treap_max );
9102 24 : for( ulong i=0; i < fd_vote_authorized_voters_treap_len; i++ ) {
9103 12 : fd_vote_authorized_voter_t * ele = fd_vote_authorized_voters_pool_ele_acquire( self->pool );
9104 12 : fd_vote_authorized_voter_new( ele );
9105 12 : fd_vote_authorized_voter_decode_inner( ele, alloc_mem, ctx );
9106 12 : fd_vote_authorized_voter_t * repeated_entry = fd_vote_authorized_voters_treap_ele_query( self->treap, ele->epoch, self->pool );
9107 12 : if( repeated_entry ) {
9108 0 : fd_vote_authorized_voters_treap_ele_remove( self->treap, repeated_entry, self->pool ); // Remove the element before inserting it back to avoid duplication
9109 0 : fd_vote_authorized_voters_pool_ele_release( self->pool, repeated_entry );
9110 0 : }
9111 12 : fd_vote_authorized_voters_treap_ele_insert( self->treap, ele, self->pool ); /* this cannot fail */
9112 12 : }
9113 12 : }
9114 0 : void * fd_vote_authorized_voters_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9115 0 : fd_vote_authorized_voters_global_t * self = (fd_vote_authorized_voters_global_t *)mem;
9116 0 : fd_vote_authorized_voters_new( (fd_vote_authorized_voters_t *)self );
9117 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_authorized_voters_global_t);
9118 0 : void * * alloc_mem = &alloc_region;
9119 0 : fd_vote_authorized_voters_decode_inner_global( mem, alloc_mem, ctx );
9120 0 : return self;
9121 0 : }
9122 6 : void fd_vote_authorized_voters_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9123 6 : fd_vote_authorized_voters_global_t * self = (fd_vote_authorized_voters_global_t *)struct_mem;
9124 6 : ulong fd_vote_authorized_voters_treap_len;
9125 6 : fd_bincode_uint64_decode_unsafe( &fd_vote_authorized_voters_treap_len, ctx );
9126 6 : ulong fd_vote_authorized_voters_treap_max = fd_ulong_max( fd_vote_authorized_voters_treap_len, FD_VOTE_AUTHORIZED_VOTERS_MIN );
9127 6 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, fd_vote_authorized_voters_pool_align() );
9128 6 : self->pool_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
9129 6 : fd_vote_authorized_voter_t * pool = fd_vote_authorized_voters_pool_join_new( alloc_mem, fd_vote_authorized_voters_treap_max );
9130 6 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, fd_vote_authorized_voters_treap_align() );
9131 6 : self->treap_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
9132 6 : fd_vote_authorized_voters_treap_t * treap = fd_vote_authorized_voters_treap_join_new( alloc_mem, fd_vote_authorized_voters_treap_max );
9133 12 : for( ulong i=0; i < fd_vote_authorized_voters_treap_len; i++ ) {
9134 6 : fd_vote_authorized_voter_t * ele = fd_vote_authorized_voters_pool_ele_acquire( pool );
9135 6 : fd_vote_authorized_voter_new( ele );
9136 6 : fd_vote_authorized_voter_decode_inner( ele, alloc_mem, ctx );
9137 6 : fd_vote_authorized_voter_t * repeated_entry = fd_vote_authorized_voters_treap_ele_query( treap, ele->epoch, pool );
9138 6 : if( repeated_entry ) {
9139 0 : fd_vote_authorized_voters_treap_ele_remove( treap, repeated_entry, pool ); // Remove the element before inserting it back to avoid duplication
9140 0 : fd_vote_authorized_voters_pool_ele_release( pool, repeated_entry );
9141 0 : }
9142 6 : fd_vote_authorized_voters_treap_ele_insert( treap, ele, pool ); /* this cannot fail */
9143 6 : }
9144 6 : }
9145 6 : int fd_vote_authorized_voters_convert_global_to_local( void const * global_self, fd_vote_authorized_voters_t * self, fd_bincode_decode_ctx_t * ctx ) {
9146 6 : int err = 0;
9147 6 : fd_vote_authorized_voters_global_t const * mem = (fd_vote_authorized_voters_global_t const *)global_self;
9148 6 : self->pool = fd_vote_authorized_voters_pool_join( fd_wksp_laddr_fast( ctx->wksp, mem->pool_gaddr ) );
9149 6 : self->treap = fd_vote_authorized_voters_treap_join( fd_wksp_laddr_fast( ctx->wksp, mem->treap_gaddr ) );
9150 6 : return FD_BINCODE_SUCCESS;
9151 6 : }
9152 12 : void fd_vote_authorized_voters_new(fd_vote_authorized_voters_t * self) {
9153 12 : fd_memset( self, 0, sizeof(fd_vote_authorized_voters_t) );
9154 12 : }
9155 0 : void fd_vote_authorized_voters_destroy( fd_vote_authorized_voters_t * self ) {
9156 0 : if( !self->treap || !self->pool ) return;
9157 0 : for( fd_vote_authorized_voters_treap_fwd_iter_t iter = fd_vote_authorized_voters_treap_fwd_iter_init( self->treap, self->pool );
9158 0 : !fd_vote_authorized_voters_treap_fwd_iter_done( iter );
9159 0 : iter = fd_vote_authorized_voters_treap_fwd_iter_next( iter, self->pool ) ) {
9160 0 : fd_vote_authorized_voter_t * ele = fd_vote_authorized_voters_treap_fwd_iter_ele( iter, self->pool );
9161 0 : fd_vote_authorized_voter_destroy( ele );
9162 0 : }
9163 0 : self->pool = NULL;
9164 0 : self->treap = NULL;
9165 0 : }
9166 :
9167 0 : ulong fd_vote_authorized_voters_footprint( void ){ return FD_VOTE_AUTHORIZED_VOTERS_FOOTPRINT; }
9168 0 : ulong fd_vote_authorized_voters_align( void ){ return FD_VOTE_AUTHORIZED_VOTERS_ALIGN; }
9169 :
9170 6 : void fd_vote_authorized_voters_walk( void * w, fd_vote_authorized_voters_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
9171 6 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_authorized_voters", level++ );
9172 6 : if( self->treap ) {
9173 6 : for( fd_vote_authorized_voters_treap_fwd_iter_t iter = fd_vote_authorized_voters_treap_fwd_iter_init( self->treap, self->pool );
9174 12 : !fd_vote_authorized_voters_treap_fwd_iter_done( iter );
9175 6 : iter = fd_vote_authorized_voters_treap_fwd_iter_next( iter, self->pool ) ) {
9176 6 : fd_vote_authorized_voter_t * ele = fd_vote_authorized_voters_treap_fwd_iter_ele( iter, self->pool );
9177 6 : fd_vote_authorized_voter_walk( w, ele, fun, "fd_vote_authorized_voter_t", level );
9178 6 : }
9179 6 : }
9180 6 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_authorized_voters", level-- );
9181 6 : }
9182 0 : ulong fd_vote_authorized_voters_size( fd_vote_authorized_voters_t const * self ) {
9183 0 : ulong size = 0;
9184 0 : size += sizeof(ulong);
9185 0 : if( self->treap ) {
9186 0 : for( fd_vote_authorized_voters_treap_fwd_iter_t iter = fd_vote_authorized_voters_treap_fwd_iter_init( self->treap, self->pool );
9187 0 : !fd_vote_authorized_voters_treap_fwd_iter_done( iter );
9188 0 : iter = fd_vote_authorized_voters_treap_fwd_iter_next( iter, self->pool ) ) {
9189 0 : fd_vote_authorized_voter_t * ele = fd_vote_authorized_voters_treap_fwd_iter_ele( iter, self->pool );
9190 0 : size += fd_vote_authorized_voter_size( ele );
9191 0 : }
9192 0 : }
9193 0 : return size;
9194 0 : }
9195 :
9196 0 : int fd_vote_state_1_14_11_encode( fd_vote_state_1_14_11_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9197 0 : int err;
9198 0 : err = fd_pubkey_encode( &self->node_pubkey, ctx );
9199 0 : if( FD_UNLIKELY( err ) ) return err;
9200 0 : err = fd_pubkey_encode( &self->authorized_withdrawer, ctx );
9201 0 : if( FD_UNLIKELY( err ) ) return err;
9202 0 : err = fd_bincode_uint8_encode( (uchar)(self->commission), ctx );
9203 0 : if( FD_UNLIKELY( err ) ) return err;
9204 0 : if( self->votes ) {
9205 0 : ulong votes_len = deq_fd_vote_lockout_t_cnt( self->votes );
9206 0 : err = fd_bincode_uint64_encode( votes_len, ctx );
9207 0 : if( FD_UNLIKELY( err ) ) return err;
9208 0 : for( deq_fd_vote_lockout_t_iter_t iter = deq_fd_vote_lockout_t_iter_init( self->votes ); !deq_fd_vote_lockout_t_iter_done( self->votes, iter ); iter = deq_fd_vote_lockout_t_iter_next( self->votes, iter ) ) {
9209 0 : fd_vote_lockout_t const * ele = deq_fd_vote_lockout_t_iter_ele_const( self->votes, iter );
9210 0 : err = fd_vote_lockout_encode( ele, ctx );
9211 0 : if( FD_UNLIKELY( err ) ) return err;
9212 0 : }
9213 0 : } else {
9214 0 : ulong votes_len = 0;
9215 0 : err = fd_bincode_uint64_encode( votes_len, ctx );
9216 0 : if( FD_UNLIKELY( err ) ) return err;
9217 0 : }
9218 0 : err = fd_bincode_bool_encode( self->has_root_slot, ctx );
9219 0 : if( FD_UNLIKELY( err ) ) return err;
9220 0 : if( self->has_root_slot ) {
9221 0 : err = fd_bincode_uint64_encode( self->root_slot, ctx );
9222 0 : if( FD_UNLIKELY( err ) ) return err;
9223 0 : }
9224 0 : err = fd_vote_authorized_voters_encode( &self->authorized_voters, ctx );
9225 0 : if( FD_UNLIKELY( err ) ) return err;
9226 0 : err = fd_vote_prior_voters_encode( &self->prior_voters, ctx );
9227 0 : if( FD_UNLIKELY( err ) ) return err;
9228 0 : if( self->epoch_credits ) {
9229 0 : ulong epoch_credits_len = deq_fd_vote_epoch_credits_t_cnt( self->epoch_credits );
9230 0 : err = fd_bincode_uint64_encode( epoch_credits_len, ctx );
9231 0 : if( FD_UNLIKELY( err ) ) return err;
9232 0 : for( deq_fd_vote_epoch_credits_t_iter_t iter = deq_fd_vote_epoch_credits_t_iter_init( self->epoch_credits ); !deq_fd_vote_epoch_credits_t_iter_done( self->epoch_credits, iter ); iter = deq_fd_vote_epoch_credits_t_iter_next( self->epoch_credits, iter ) ) {
9233 0 : fd_vote_epoch_credits_t const * ele = deq_fd_vote_epoch_credits_t_iter_ele_const( self->epoch_credits, iter );
9234 0 : err = fd_vote_epoch_credits_encode( ele, ctx );
9235 0 : if( FD_UNLIKELY( err ) ) return err;
9236 0 : }
9237 0 : } else {
9238 0 : ulong epoch_credits_len = 0;
9239 0 : err = fd_bincode_uint64_encode( epoch_credits_len, ctx );
9240 0 : if( FD_UNLIKELY( err ) ) return err;
9241 0 : }
9242 0 : err = fd_vote_block_timestamp_encode( &self->last_timestamp, ctx );
9243 0 : if( FD_UNLIKELY( err ) ) return err;
9244 0 : return FD_BINCODE_SUCCESS;
9245 0 : }
9246 0 : int fd_vote_state_1_14_11_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9247 0 : *total_sz += sizeof(fd_vote_state_1_14_11_t);
9248 0 : void const * start_data = ctx->data;
9249 0 : int err = fd_vote_state_1_14_11_decode_footprint_inner( ctx, total_sz );
9250 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9251 0 : ctx->data = start_data;
9252 0 : return err;
9253 0 : }
9254 0 : int fd_vote_state_1_14_11_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9255 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9256 0 : int err = 0;
9257 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
9258 0 : if( FD_UNLIKELY( err ) ) return err;
9259 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
9260 0 : if( FD_UNLIKELY( err ) ) return err;
9261 0 : err = fd_bincode_uint8_decode_footprint( ctx );
9262 0 : if( FD_UNLIKELY( err ) ) return err;
9263 0 : ulong votes_len;
9264 0 : err = fd_bincode_uint64_decode( &votes_len, ctx );
9265 0 : if( FD_UNLIKELY( err ) ) return err;
9266 0 : ulong votes_max = fd_ulong_max( votes_len, 32 );
9267 0 : *total_sz += deq_fd_vote_lockout_t_align() + deq_fd_vote_lockout_t_footprint( votes_max );
9268 0 : ulong votes_sz;
9269 0 : if( FD_UNLIKELY( __builtin_umull_overflow( votes_len, 12, &votes_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
9270 0 : err = fd_bincode_bytes_decode_footprint( votes_sz, ctx );
9271 0 : if( FD_UNLIKELY( err ) ) return err;
9272 0 : {
9273 0 : uchar o;
9274 0 : err = fd_bincode_bool_decode( &o, ctx );
9275 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9276 0 : if( o ) {
9277 0 : err = fd_bincode_uint64_decode_footprint( ctx );
9278 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9279 0 : }
9280 0 : }
9281 0 : err = fd_vote_authorized_voters_decode_footprint_inner( ctx, total_sz );
9282 0 : if( FD_UNLIKELY( err ) ) return err;
9283 0 : err = fd_vote_prior_voters_decode_footprint_inner( ctx, total_sz );
9284 0 : if( FD_UNLIKELY( err ) ) return err;
9285 0 : ulong epoch_credits_len;
9286 0 : err = fd_bincode_uint64_decode( &epoch_credits_len, ctx );
9287 0 : if( FD_UNLIKELY( err ) ) return err;
9288 0 : ulong epoch_credits_max = fd_ulong_max( epoch_credits_len, 64 );
9289 0 : *total_sz += deq_fd_vote_epoch_credits_t_align() + deq_fd_vote_epoch_credits_t_footprint( epoch_credits_max );
9290 0 : ulong epoch_credits_sz;
9291 0 : if( FD_UNLIKELY( __builtin_umull_overflow( epoch_credits_len, 24, &epoch_credits_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
9292 0 : err = fd_bincode_bytes_decode_footprint( epoch_credits_sz, ctx );
9293 0 : if( FD_UNLIKELY( err ) ) return err;
9294 0 : err = fd_vote_block_timestamp_decode_footprint_inner( ctx, total_sz );
9295 0 : if( FD_UNLIKELY( err ) ) return err;
9296 0 : return 0;
9297 0 : }
9298 0 : void * fd_vote_state_1_14_11_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9299 0 : fd_vote_state_1_14_11_t * self = (fd_vote_state_1_14_11_t *)mem;
9300 0 : fd_vote_state_1_14_11_new( self );
9301 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_state_1_14_11_t);
9302 0 : void * * alloc_mem = &alloc_region;
9303 0 : fd_vote_state_1_14_11_decode_inner( mem, alloc_mem, ctx );
9304 0 : return self;
9305 0 : }
9306 0 : void fd_vote_state_1_14_11_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9307 0 : fd_vote_state_1_14_11_t * self = (fd_vote_state_1_14_11_t *)struct_mem;
9308 0 : fd_pubkey_decode_inner( &self->node_pubkey, alloc_mem, ctx );
9309 0 : fd_pubkey_decode_inner( &self->authorized_withdrawer, alloc_mem, ctx );
9310 0 : fd_bincode_uint8_decode_unsafe( &self->commission, ctx );
9311 0 : ulong votes_len;
9312 0 : fd_bincode_uint64_decode_unsafe( &votes_len, ctx );
9313 0 : ulong votes_max = fd_ulong_max( votes_len, 32 );
9314 0 : self->votes = deq_fd_vote_lockout_t_join_new( alloc_mem, votes_max );
9315 0 : for( ulong i=0; i < votes_len; i++ ) {
9316 0 : fd_vote_lockout_t * elem = deq_fd_vote_lockout_t_push_tail_nocopy( self->votes );
9317 0 : fd_vote_lockout_new( elem );
9318 0 : fd_vote_lockout_decode_inner( elem, alloc_mem, ctx );
9319 0 : }
9320 0 : {
9321 0 : uchar o;
9322 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
9323 0 : self->has_root_slot = !!o;
9324 0 : if( o ) {
9325 0 : fd_bincode_uint64_decode_unsafe( &self->root_slot, ctx );
9326 0 : }
9327 0 : }
9328 0 : fd_vote_authorized_voters_decode_inner( &self->authorized_voters, alloc_mem, ctx );
9329 0 : fd_vote_prior_voters_decode_inner( &self->prior_voters, alloc_mem, ctx );
9330 0 : ulong epoch_credits_len;
9331 0 : fd_bincode_uint64_decode_unsafe( &epoch_credits_len, ctx );
9332 0 : ulong epoch_credits_max = fd_ulong_max( epoch_credits_len, 64 );
9333 0 : self->epoch_credits = deq_fd_vote_epoch_credits_t_join_new( alloc_mem, epoch_credits_max );
9334 0 : for( ulong i=0; i < epoch_credits_len; i++ ) {
9335 0 : fd_vote_epoch_credits_t * elem = deq_fd_vote_epoch_credits_t_push_tail_nocopy( self->epoch_credits );
9336 0 : fd_vote_epoch_credits_new( elem );
9337 0 : fd_vote_epoch_credits_decode_inner( elem, alloc_mem, ctx );
9338 0 : }
9339 0 : fd_vote_block_timestamp_decode_inner( &self->last_timestamp, alloc_mem, ctx );
9340 0 : }
9341 0 : void * fd_vote_state_1_14_11_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9342 0 : fd_vote_state_1_14_11_global_t * self = (fd_vote_state_1_14_11_global_t *)mem;
9343 0 : fd_vote_state_1_14_11_new( (fd_vote_state_1_14_11_t *)self );
9344 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_state_1_14_11_global_t);
9345 0 : void * * alloc_mem = &alloc_region;
9346 0 : fd_vote_state_1_14_11_decode_inner_global( mem, alloc_mem, ctx );
9347 0 : return self;
9348 0 : }
9349 0 : void fd_vote_state_1_14_11_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9350 0 : fd_vote_state_1_14_11_global_t * self = (fd_vote_state_1_14_11_global_t *)struct_mem;
9351 0 : fd_pubkey_decode_inner_global( &self->node_pubkey, alloc_mem, ctx );
9352 0 : fd_pubkey_decode_inner_global( &self->authorized_withdrawer, alloc_mem, ctx );
9353 0 : fd_bincode_uint8_decode_unsafe( &self->commission, ctx );
9354 0 : ulong votes_len;
9355 0 : fd_bincode_uint64_decode_unsafe( &votes_len, ctx );
9356 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, deq_fd_vote_lockout_t_align() );
9357 0 : ulong votes_max = fd_ulong_max( votes_len, 32 );
9358 0 : self->votes_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
9359 0 : fd_vote_lockout_t * votes = deq_fd_vote_lockout_t_join_new( alloc_mem, votes_max );
9360 0 : for( ulong i=0; i < votes_len; i++ ) {
9361 0 : fd_vote_lockout_t * elem = deq_fd_vote_lockout_t_push_tail_nocopy( votes );
9362 0 : fd_vote_lockout_new( elem );
9363 0 : fd_vote_lockout_decode_inner_global( elem, alloc_mem, ctx );
9364 0 : }
9365 0 : {
9366 0 : uchar o;
9367 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
9368 0 : self->has_root_slot = !!o;
9369 0 : if( o ) {
9370 0 : fd_bincode_uint64_decode_unsafe( &self->root_slot, ctx );
9371 0 : }
9372 0 : }
9373 0 : fd_vote_authorized_voters_decode_inner_global( &self->authorized_voters, alloc_mem, ctx );
9374 0 : fd_vote_prior_voters_decode_inner_global( &self->prior_voters, alloc_mem, ctx );
9375 0 : ulong epoch_credits_len;
9376 0 : fd_bincode_uint64_decode_unsafe( &epoch_credits_len, ctx );
9377 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, deq_fd_vote_epoch_credits_t_align() );
9378 0 : ulong epoch_credits_max = fd_ulong_max( epoch_credits_len, 64 );
9379 0 : self->epoch_credits_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
9380 0 : fd_vote_epoch_credits_t * epoch_credits = deq_fd_vote_epoch_credits_t_join_new( alloc_mem, epoch_credits_max );
9381 0 : for( ulong i=0; i < epoch_credits_len; i++ ) {
9382 0 : fd_vote_epoch_credits_t * elem = deq_fd_vote_epoch_credits_t_push_tail_nocopy( epoch_credits );
9383 0 : fd_vote_epoch_credits_new( elem );
9384 0 : fd_vote_epoch_credits_decode_inner_global( elem, alloc_mem, ctx );
9385 0 : }
9386 0 : fd_vote_block_timestamp_decode_inner_global( &self->last_timestamp, alloc_mem, ctx );
9387 0 : }
9388 0 : int fd_vote_state_1_14_11_convert_global_to_local( void const * global_self, fd_vote_state_1_14_11_t * self, fd_bincode_decode_ctx_t * ctx ) {
9389 0 : int err = 0;
9390 0 : fd_vote_state_1_14_11_global_t const * mem = (fd_vote_state_1_14_11_global_t const *)global_self;
9391 0 : err = fd_pubkey_convert_global_to_local( &mem->node_pubkey, &self->node_pubkey, ctx );
9392 0 : if( FD_UNLIKELY( err ) ) return err;
9393 0 : err = fd_pubkey_convert_global_to_local( &mem->authorized_withdrawer, &self->authorized_withdrawer, ctx );
9394 0 : if( FD_UNLIKELY( err ) ) return err;
9395 0 : self->commission = mem->commission;
9396 0 : self->votes = deq_fd_vote_lockout_t_join( fd_wksp_laddr_fast( ctx->wksp, mem->votes_gaddr ) );
9397 0 : self->root_slot = mem->root_slot;
9398 0 : self->has_root_slot = mem->has_root_slot;
9399 0 : err = fd_vote_authorized_voters_convert_global_to_local( &mem->authorized_voters, &self->authorized_voters, ctx );
9400 0 : if( FD_UNLIKELY( err ) ) return err;
9401 0 : err = fd_vote_prior_voters_convert_global_to_local( &mem->prior_voters, &self->prior_voters, ctx );
9402 0 : if( FD_UNLIKELY( err ) ) return err;
9403 0 : self->epoch_credits = deq_fd_vote_epoch_credits_t_join( fd_wksp_laddr_fast( ctx->wksp, mem->epoch_credits_gaddr ) );
9404 0 : err = fd_vote_block_timestamp_convert_global_to_local( &mem->last_timestamp, &self->last_timestamp, ctx );
9405 0 : if( FD_UNLIKELY( err ) ) return err;
9406 0 : return FD_BINCODE_SUCCESS;
9407 0 : }
9408 0 : void fd_vote_state_1_14_11_new(fd_vote_state_1_14_11_t * self) {
9409 0 : fd_memset( self, 0, sizeof(fd_vote_state_1_14_11_t) );
9410 0 : fd_pubkey_new( &self->node_pubkey );
9411 0 : fd_pubkey_new( &self->authorized_withdrawer );
9412 0 : fd_vote_authorized_voters_new( &self->authorized_voters );
9413 0 : fd_vote_prior_voters_new( &self->prior_voters );
9414 0 : fd_vote_block_timestamp_new( &self->last_timestamp );
9415 0 : }
9416 0 : void fd_vote_state_1_14_11_destroy( fd_vote_state_1_14_11_t * self ) {
9417 0 : fd_pubkey_destroy( &self->node_pubkey );
9418 0 : fd_pubkey_destroy( &self->authorized_withdrawer );
9419 0 : if( self->votes ) {
9420 0 : for( deq_fd_vote_lockout_t_iter_t iter = deq_fd_vote_lockout_t_iter_init( self->votes ); !deq_fd_vote_lockout_t_iter_done( self->votes, iter ); iter = deq_fd_vote_lockout_t_iter_next( self->votes, iter ) ) {
9421 0 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->votes, iter );
9422 0 : fd_vote_lockout_destroy( ele );
9423 0 : }
9424 0 : self->votes = NULL;
9425 0 : }
9426 0 : if( self->has_root_slot ) {
9427 0 : self->has_root_slot = 0;
9428 0 : }
9429 0 : fd_vote_authorized_voters_destroy( &self->authorized_voters );
9430 0 : fd_vote_prior_voters_destroy( &self->prior_voters );
9431 0 : if( self->epoch_credits ) {
9432 0 : for( deq_fd_vote_epoch_credits_t_iter_t iter = deq_fd_vote_epoch_credits_t_iter_init( self->epoch_credits ); !deq_fd_vote_epoch_credits_t_iter_done( self->epoch_credits, iter ); iter = deq_fd_vote_epoch_credits_t_iter_next( self->epoch_credits, iter ) ) {
9433 0 : fd_vote_epoch_credits_t * ele = deq_fd_vote_epoch_credits_t_iter_ele( self->epoch_credits, iter );
9434 0 : fd_vote_epoch_credits_destroy( ele );
9435 0 : }
9436 0 : self->epoch_credits = NULL;
9437 0 : }
9438 0 : fd_vote_block_timestamp_destroy( &self->last_timestamp );
9439 0 : }
9440 :
9441 0 : ulong fd_vote_state_1_14_11_footprint( void ){ return FD_VOTE_STATE_1_14_11_FOOTPRINT; }
9442 0 : ulong fd_vote_state_1_14_11_align( void ){ return FD_VOTE_STATE_1_14_11_ALIGN; }
9443 :
9444 0 : void fd_vote_state_1_14_11_walk( void * w, fd_vote_state_1_14_11_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
9445 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_state_1_14_11", level++ );
9446 0 : fd_pubkey_walk( w, &self->node_pubkey, fun, "node_pubkey", level );
9447 0 : fd_pubkey_walk( w, &self->authorized_withdrawer, fun, "authorized_withdrawer", level );
9448 0 : fun( w, &self->commission, "commission", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
9449 :
9450 : /* Walk deque */
9451 0 : fun( w, self->votes, "votes", FD_FLAMENCO_TYPE_ARR, "votes", level++ );
9452 0 : if( self->votes ) {
9453 0 : for( deq_fd_vote_lockout_t_iter_t iter = deq_fd_vote_lockout_t_iter_init( self->votes );
9454 0 : !deq_fd_vote_lockout_t_iter_done( self->votes, iter );
9455 0 : iter = deq_fd_vote_lockout_t_iter_next( self->votes, iter ) ) {
9456 0 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->votes, iter );
9457 0 : fd_vote_lockout_walk(w, ele, fun, "votes", level );
9458 0 : }
9459 0 : }
9460 0 : fun( w, self->votes, "votes", FD_FLAMENCO_TYPE_ARR_END, "votes", level-- );
9461 : /* Done walking deque */
9462 :
9463 0 : if( !self->has_root_slot ) {
9464 0 : fun( w, NULL, "root_slot", FD_FLAMENCO_TYPE_NULL, "ulong", level );
9465 0 : } else {
9466 0 : fun( w, &self->root_slot, "root_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
9467 0 : }
9468 0 : fd_vote_authorized_voters_walk( w, &self->authorized_voters, fun, "authorized_voters", level );
9469 0 : fd_vote_prior_voters_walk( w, &self->prior_voters, fun, "prior_voters", level );
9470 :
9471 : /* Walk deque */
9472 0 : fun( w, self->epoch_credits, "epoch_credits", FD_FLAMENCO_TYPE_ARR, "epoch_credits", level++ );
9473 0 : if( self->epoch_credits ) {
9474 0 : for( deq_fd_vote_epoch_credits_t_iter_t iter = deq_fd_vote_epoch_credits_t_iter_init( self->epoch_credits );
9475 0 : !deq_fd_vote_epoch_credits_t_iter_done( self->epoch_credits, iter );
9476 0 : iter = deq_fd_vote_epoch_credits_t_iter_next( self->epoch_credits, iter ) ) {
9477 0 : fd_vote_epoch_credits_t * ele = deq_fd_vote_epoch_credits_t_iter_ele( self->epoch_credits, iter );
9478 0 : fd_vote_epoch_credits_walk(w, ele, fun, "epoch_credits", level );
9479 0 : }
9480 0 : }
9481 0 : fun( w, self->epoch_credits, "epoch_credits", FD_FLAMENCO_TYPE_ARR_END, "epoch_credits", level-- );
9482 : /* Done walking deque */
9483 :
9484 0 : fd_vote_block_timestamp_walk( w, &self->last_timestamp, fun, "last_timestamp", level );
9485 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_state_1_14_11", level-- );
9486 0 : }
9487 0 : ulong fd_vote_state_1_14_11_size( fd_vote_state_1_14_11_t const * self ) {
9488 0 : ulong size = 0;
9489 0 : size += fd_pubkey_size( &self->node_pubkey );
9490 0 : size += fd_pubkey_size( &self->authorized_withdrawer );
9491 0 : size += sizeof(char);
9492 0 : if( self->votes ) {
9493 0 : size += sizeof(ulong);
9494 0 : for( deq_fd_vote_lockout_t_iter_t iter = deq_fd_vote_lockout_t_iter_init( self->votes ); !deq_fd_vote_lockout_t_iter_done( self->votes, iter ); iter = deq_fd_vote_lockout_t_iter_next( self->votes, iter ) ) {
9495 0 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->votes, iter );
9496 0 : size += fd_vote_lockout_size( ele );
9497 0 : }
9498 0 : } else {
9499 0 : size += sizeof(ulong);
9500 0 : }
9501 0 : size += sizeof(char);
9502 0 : if( self->has_root_slot ) {
9503 0 : size += sizeof(ulong);
9504 0 : }
9505 0 : size += fd_vote_authorized_voters_size( &self->authorized_voters );
9506 0 : size += fd_vote_prior_voters_size( &self->prior_voters );
9507 0 : if( self->epoch_credits ) {
9508 0 : size += sizeof(ulong);
9509 0 : for( deq_fd_vote_epoch_credits_t_iter_t iter = deq_fd_vote_epoch_credits_t_iter_init( self->epoch_credits ); !deq_fd_vote_epoch_credits_t_iter_done( self->epoch_credits, iter ); iter = deq_fd_vote_epoch_credits_t_iter_next( self->epoch_credits, iter ) ) {
9510 0 : fd_vote_epoch_credits_t * ele = deq_fd_vote_epoch_credits_t_iter_ele( self->epoch_credits, iter );
9511 0 : size += fd_vote_epoch_credits_size( ele );
9512 0 : }
9513 0 : } else {
9514 0 : size += sizeof(ulong);
9515 0 : }
9516 0 : size += fd_vote_block_timestamp_size( &self->last_timestamp );
9517 0 : return size;
9518 0 : }
9519 :
9520 24 : int fd_vote_state_encode( fd_vote_state_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9521 24 : int err;
9522 24 : err = fd_pubkey_encode( &self->node_pubkey, ctx );
9523 24 : if( FD_UNLIKELY( err ) ) return err;
9524 24 : err = fd_pubkey_encode( &self->authorized_withdrawer, ctx );
9525 24 : if( FD_UNLIKELY( err ) ) return err;
9526 24 : err = fd_bincode_uint8_encode( (uchar)(self->commission), ctx );
9527 24 : if( FD_UNLIKELY( err ) ) return err;
9528 24 : if( self->votes ) {
9529 12 : ulong votes_len = deq_fd_landed_vote_t_cnt( self->votes );
9530 12 : err = fd_bincode_uint64_encode( votes_len, ctx );
9531 12 : if( FD_UNLIKELY( err ) ) return err;
9532 204 : 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 ) ) {
9533 192 : fd_landed_vote_t const * ele = deq_fd_landed_vote_t_iter_ele_const( self->votes, iter );
9534 192 : err = fd_landed_vote_encode( ele, ctx );
9535 192 : if( FD_UNLIKELY( err ) ) return err;
9536 192 : }
9537 12 : } else {
9538 12 : ulong votes_len = 0;
9539 12 : err = fd_bincode_uint64_encode( votes_len, ctx );
9540 12 : if( FD_UNLIKELY( err ) ) return err;
9541 12 : }
9542 24 : err = fd_bincode_bool_encode( self->has_root_slot, ctx );
9543 24 : if( FD_UNLIKELY( err ) ) return err;
9544 24 : if( self->has_root_slot ) {
9545 12 : err = fd_bincode_uint64_encode( self->root_slot, ctx );
9546 12 : if( FD_UNLIKELY( err ) ) return err;
9547 12 : }
9548 24 : err = fd_vote_authorized_voters_encode( &self->authorized_voters, ctx );
9549 24 : if( FD_UNLIKELY( err ) ) return err;
9550 24 : err = fd_vote_prior_voters_encode( &self->prior_voters, ctx );
9551 24 : if( FD_UNLIKELY( err ) ) return err;
9552 24 : if( self->epoch_credits ) {
9553 12 : ulong epoch_credits_len = deq_fd_vote_epoch_credits_t_cnt( self->epoch_credits );
9554 12 : err = fd_bincode_uint64_encode( epoch_credits_len, ctx );
9555 12 : if( FD_UNLIKELY( err ) ) return err;
9556 402 : 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 ) ) {
9557 390 : fd_vote_epoch_credits_t const * ele = deq_fd_vote_epoch_credits_t_iter_ele_const( self->epoch_credits, iter );
9558 390 : err = fd_vote_epoch_credits_encode( ele, ctx );
9559 390 : if( FD_UNLIKELY( err ) ) return err;
9560 390 : }
9561 12 : } else {
9562 12 : ulong epoch_credits_len = 0;
9563 12 : err = fd_bincode_uint64_encode( epoch_credits_len, ctx );
9564 12 : if( FD_UNLIKELY( err ) ) return err;
9565 12 : }
9566 24 : err = fd_vote_block_timestamp_encode( &self->last_timestamp, ctx );
9567 24 : if( FD_UNLIKELY( err ) ) return err;
9568 24 : return FD_BINCODE_SUCCESS;
9569 24 : }
9570 0 : int fd_vote_state_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9571 0 : *total_sz += sizeof(fd_vote_state_t);
9572 0 : void const * start_data = ctx->data;
9573 0 : int err = fd_vote_state_decode_footprint_inner( ctx, total_sz );
9574 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9575 0 : ctx->data = start_data;
9576 0 : return err;
9577 0 : }
9578 12 : int fd_vote_state_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9579 12 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9580 12 : int err = 0;
9581 12 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
9582 12 : if( FD_UNLIKELY( err ) ) return err;
9583 12 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
9584 12 : if( FD_UNLIKELY( err ) ) return err;
9585 12 : err = fd_bincode_uint8_decode_footprint( ctx );
9586 12 : if( FD_UNLIKELY( err ) ) return err;
9587 12 : ulong votes_len;
9588 12 : err = fd_bincode_uint64_decode( &votes_len, ctx );
9589 12 : if( FD_UNLIKELY( err ) ) return err;
9590 12 : ulong votes_max = fd_ulong_max( votes_len, 32 );
9591 12 : *total_sz += deq_fd_landed_vote_t_align() + deq_fd_landed_vote_t_footprint( votes_max );
9592 12 : ulong votes_sz;
9593 12 : if( FD_UNLIKELY( __builtin_umull_overflow( votes_len, 13, &votes_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
9594 12 : err = fd_bincode_bytes_decode_footprint( votes_sz, ctx );
9595 12 : if( FD_UNLIKELY( err ) ) return err;
9596 12 : {
9597 12 : uchar o;
9598 12 : err = fd_bincode_bool_decode( &o, ctx );
9599 12 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9600 12 : if( o ) {
9601 12 : err = fd_bincode_uint64_decode_footprint( ctx );
9602 12 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9603 12 : }
9604 12 : }
9605 12 : err = fd_vote_authorized_voters_decode_footprint_inner( ctx, total_sz );
9606 12 : if( FD_UNLIKELY( err ) ) return err;
9607 12 : err = fd_vote_prior_voters_decode_footprint_inner( ctx, total_sz );
9608 12 : if( FD_UNLIKELY( err ) ) return err;
9609 12 : ulong epoch_credits_len;
9610 12 : err = fd_bincode_uint64_decode( &epoch_credits_len, ctx );
9611 12 : if( FD_UNLIKELY( err ) ) return err;
9612 12 : ulong epoch_credits_max = fd_ulong_max( epoch_credits_len, 64 );
9613 12 : *total_sz += deq_fd_vote_epoch_credits_t_align() + deq_fd_vote_epoch_credits_t_footprint( epoch_credits_max );
9614 12 : ulong epoch_credits_sz;
9615 12 : if( FD_UNLIKELY( __builtin_umull_overflow( epoch_credits_len, 24, &epoch_credits_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
9616 12 : err = fd_bincode_bytes_decode_footprint( epoch_credits_sz, ctx );
9617 12 : if( FD_UNLIKELY( err ) ) return err;
9618 12 : err = fd_vote_block_timestamp_decode_footprint_inner( ctx, total_sz );
9619 12 : if( FD_UNLIKELY( err ) ) return err;
9620 12 : return 0;
9621 12 : }
9622 0 : void * fd_vote_state_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9623 0 : fd_vote_state_t * self = (fd_vote_state_t *)mem;
9624 0 : fd_vote_state_new( self );
9625 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_state_t);
9626 0 : void * * alloc_mem = &alloc_region;
9627 0 : fd_vote_state_decode_inner( mem, alloc_mem, ctx );
9628 0 : return self;
9629 0 : }
9630 12 : void fd_vote_state_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9631 12 : fd_vote_state_t * self = (fd_vote_state_t *)struct_mem;
9632 12 : fd_pubkey_decode_inner( &self->node_pubkey, alloc_mem, ctx );
9633 12 : fd_pubkey_decode_inner( &self->authorized_withdrawer, alloc_mem, ctx );
9634 12 : fd_bincode_uint8_decode_unsafe( &self->commission, ctx );
9635 12 : ulong votes_len;
9636 12 : fd_bincode_uint64_decode_unsafe( &votes_len, ctx );
9637 12 : ulong votes_max = fd_ulong_max( votes_len, 32 );
9638 12 : self->votes = deq_fd_landed_vote_t_join_new( alloc_mem, votes_max );
9639 204 : for( ulong i=0; i < votes_len; i++ ) {
9640 192 : fd_landed_vote_t * elem = deq_fd_landed_vote_t_push_tail_nocopy( self->votes );
9641 192 : fd_landed_vote_new( elem );
9642 192 : fd_landed_vote_decode_inner( elem, alloc_mem, ctx );
9643 192 : }
9644 12 : {
9645 12 : uchar o;
9646 12 : fd_bincode_bool_decode_unsafe( &o, ctx );
9647 12 : self->has_root_slot = !!o;
9648 12 : if( o ) {
9649 12 : fd_bincode_uint64_decode_unsafe( &self->root_slot, ctx );
9650 12 : }
9651 12 : }
9652 12 : fd_vote_authorized_voters_decode_inner( &self->authorized_voters, alloc_mem, ctx );
9653 12 : fd_vote_prior_voters_decode_inner( &self->prior_voters, alloc_mem, ctx );
9654 12 : ulong epoch_credits_len;
9655 12 : fd_bincode_uint64_decode_unsafe( &epoch_credits_len, ctx );
9656 12 : ulong epoch_credits_max = fd_ulong_max( epoch_credits_len, 64 );
9657 12 : self->epoch_credits = deq_fd_vote_epoch_credits_t_join_new( alloc_mem, epoch_credits_max );
9658 402 : for( ulong i=0; i < epoch_credits_len; i++ ) {
9659 390 : fd_vote_epoch_credits_t * elem = deq_fd_vote_epoch_credits_t_push_tail_nocopy( self->epoch_credits );
9660 390 : fd_vote_epoch_credits_new( elem );
9661 390 : fd_vote_epoch_credits_decode_inner( elem, alloc_mem, ctx );
9662 390 : }
9663 12 : fd_vote_block_timestamp_decode_inner( &self->last_timestamp, alloc_mem, ctx );
9664 12 : }
9665 0 : void * fd_vote_state_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9666 0 : fd_vote_state_global_t * self = (fd_vote_state_global_t *)mem;
9667 0 : fd_vote_state_new( (fd_vote_state_t *)self );
9668 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_state_global_t);
9669 0 : void * * alloc_mem = &alloc_region;
9670 0 : fd_vote_state_decode_inner_global( mem, alloc_mem, ctx );
9671 0 : return self;
9672 0 : }
9673 6 : void fd_vote_state_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9674 6 : fd_vote_state_global_t * self = (fd_vote_state_global_t *)struct_mem;
9675 6 : fd_pubkey_decode_inner_global( &self->node_pubkey, alloc_mem, ctx );
9676 6 : fd_pubkey_decode_inner_global( &self->authorized_withdrawer, alloc_mem, ctx );
9677 6 : fd_bincode_uint8_decode_unsafe( &self->commission, ctx );
9678 6 : ulong votes_len;
9679 6 : fd_bincode_uint64_decode_unsafe( &votes_len, ctx );
9680 6 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, deq_fd_landed_vote_t_align() );
9681 6 : ulong votes_max = fd_ulong_max( votes_len, 32 );
9682 6 : self->votes_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
9683 6 : fd_landed_vote_t * votes = deq_fd_landed_vote_t_join_new( alloc_mem, votes_max );
9684 102 : for( ulong i=0; i < votes_len; i++ ) {
9685 96 : fd_landed_vote_t * elem = deq_fd_landed_vote_t_push_tail_nocopy( votes );
9686 96 : fd_landed_vote_new( elem );
9687 96 : fd_landed_vote_decode_inner_global( elem, alloc_mem, ctx );
9688 96 : }
9689 6 : {
9690 6 : uchar o;
9691 6 : fd_bincode_bool_decode_unsafe( &o, ctx );
9692 6 : self->has_root_slot = !!o;
9693 6 : if( o ) {
9694 6 : fd_bincode_uint64_decode_unsafe( &self->root_slot, ctx );
9695 6 : }
9696 6 : }
9697 6 : fd_vote_authorized_voters_decode_inner_global( &self->authorized_voters, alloc_mem, ctx );
9698 6 : fd_vote_prior_voters_decode_inner_global( &self->prior_voters, alloc_mem, ctx );
9699 6 : ulong epoch_credits_len;
9700 6 : fd_bincode_uint64_decode_unsafe( &epoch_credits_len, ctx );
9701 6 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, deq_fd_vote_epoch_credits_t_align() );
9702 6 : ulong epoch_credits_max = fd_ulong_max( epoch_credits_len, 64 );
9703 6 : self->epoch_credits_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
9704 6 : fd_vote_epoch_credits_t * epoch_credits = deq_fd_vote_epoch_credits_t_join_new( alloc_mem, epoch_credits_max );
9705 201 : for( ulong i=0; i < epoch_credits_len; i++ ) {
9706 195 : fd_vote_epoch_credits_t * elem = deq_fd_vote_epoch_credits_t_push_tail_nocopy( epoch_credits );
9707 195 : fd_vote_epoch_credits_new( elem );
9708 195 : fd_vote_epoch_credits_decode_inner_global( elem, alloc_mem, ctx );
9709 195 : }
9710 6 : fd_vote_block_timestamp_decode_inner_global( &self->last_timestamp, alloc_mem, ctx );
9711 6 : }
9712 6 : int fd_vote_state_convert_global_to_local( void const * global_self, fd_vote_state_t * self, fd_bincode_decode_ctx_t * ctx ) {
9713 6 : int err = 0;
9714 6 : fd_vote_state_global_t const * mem = (fd_vote_state_global_t const *)global_self;
9715 6 : err = fd_pubkey_convert_global_to_local( &mem->node_pubkey, &self->node_pubkey, ctx );
9716 6 : if( FD_UNLIKELY( err ) ) return err;
9717 6 : err = fd_pubkey_convert_global_to_local( &mem->authorized_withdrawer, &self->authorized_withdrawer, ctx );
9718 6 : if( FD_UNLIKELY( err ) ) return err;
9719 6 : self->commission = mem->commission;
9720 6 : self->votes = deq_fd_landed_vote_t_join( fd_wksp_laddr_fast( ctx->wksp, mem->votes_gaddr ) );
9721 6 : self->root_slot = mem->root_slot;
9722 6 : self->has_root_slot = mem->has_root_slot;
9723 6 : err = fd_vote_authorized_voters_convert_global_to_local( &mem->authorized_voters, &self->authorized_voters, ctx );
9724 6 : if( FD_UNLIKELY( err ) ) return err;
9725 6 : err = fd_vote_prior_voters_convert_global_to_local( &mem->prior_voters, &self->prior_voters, ctx );
9726 6 : if( FD_UNLIKELY( err ) ) return err;
9727 6 : self->epoch_credits = deq_fd_vote_epoch_credits_t_join( fd_wksp_laddr_fast( ctx->wksp, mem->epoch_credits_gaddr ) );
9728 6 : err = fd_vote_block_timestamp_convert_global_to_local( &mem->last_timestamp, &self->last_timestamp, ctx );
9729 6 : if( FD_UNLIKELY( err ) ) return err;
9730 6 : return FD_BINCODE_SUCCESS;
9731 6 : }
9732 12 : void fd_vote_state_new(fd_vote_state_t * self) {
9733 12 : fd_memset( self, 0, sizeof(fd_vote_state_t) );
9734 12 : fd_pubkey_new( &self->node_pubkey );
9735 12 : fd_pubkey_new( &self->authorized_withdrawer );
9736 12 : fd_vote_authorized_voters_new( &self->authorized_voters );
9737 12 : fd_vote_prior_voters_new( &self->prior_voters );
9738 12 : fd_vote_block_timestamp_new( &self->last_timestamp );
9739 12 : }
9740 0 : void fd_vote_state_destroy( fd_vote_state_t * self ) {
9741 0 : fd_pubkey_destroy( &self->node_pubkey );
9742 0 : fd_pubkey_destroy( &self->authorized_withdrawer );
9743 0 : if( self->votes ) {
9744 0 : for( deq_fd_landed_vote_t_iter_t iter = deq_fd_landed_vote_t_iter_init( self->votes ); !deq_fd_landed_vote_t_iter_done( self->votes, iter ); iter = deq_fd_landed_vote_t_iter_next( self->votes, iter ) ) {
9745 0 : fd_landed_vote_t * ele = deq_fd_landed_vote_t_iter_ele( self->votes, iter );
9746 0 : fd_landed_vote_destroy( ele );
9747 0 : }
9748 0 : self->votes = NULL;
9749 0 : }
9750 0 : if( self->has_root_slot ) {
9751 0 : self->has_root_slot = 0;
9752 0 : }
9753 0 : fd_vote_authorized_voters_destroy( &self->authorized_voters );
9754 0 : fd_vote_prior_voters_destroy( &self->prior_voters );
9755 0 : if( self->epoch_credits ) {
9756 0 : for( deq_fd_vote_epoch_credits_t_iter_t iter = deq_fd_vote_epoch_credits_t_iter_init( self->epoch_credits ); !deq_fd_vote_epoch_credits_t_iter_done( self->epoch_credits, iter ); iter = deq_fd_vote_epoch_credits_t_iter_next( self->epoch_credits, iter ) ) {
9757 0 : fd_vote_epoch_credits_t * ele = deq_fd_vote_epoch_credits_t_iter_ele( self->epoch_credits, iter );
9758 0 : fd_vote_epoch_credits_destroy( ele );
9759 0 : }
9760 0 : self->epoch_credits = NULL;
9761 0 : }
9762 0 : fd_vote_block_timestamp_destroy( &self->last_timestamp );
9763 0 : }
9764 :
9765 0 : ulong fd_vote_state_footprint( void ){ return FD_VOTE_STATE_FOOTPRINT; }
9766 0 : ulong fd_vote_state_align( void ){ return FD_VOTE_STATE_ALIGN; }
9767 :
9768 6 : void fd_vote_state_walk( void * w, fd_vote_state_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
9769 6 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_state", level++ );
9770 6 : fd_pubkey_walk( w, &self->node_pubkey, fun, "node_pubkey", level );
9771 6 : fd_pubkey_walk( w, &self->authorized_withdrawer, fun, "authorized_withdrawer", level );
9772 6 : fun( w, &self->commission, "commission", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
9773 :
9774 : /* Walk deque */
9775 6 : fun( w, self->votes, "votes", FD_FLAMENCO_TYPE_ARR, "votes", level++ );
9776 6 : if( self->votes ) {
9777 6 : for( deq_fd_landed_vote_t_iter_t iter = deq_fd_landed_vote_t_iter_init( self->votes );
9778 102 : !deq_fd_landed_vote_t_iter_done( self->votes, iter );
9779 96 : iter = deq_fd_landed_vote_t_iter_next( self->votes, iter ) ) {
9780 96 : fd_landed_vote_t * ele = deq_fd_landed_vote_t_iter_ele( self->votes, iter );
9781 96 : fd_landed_vote_walk(w, ele, fun, "votes", level );
9782 96 : }
9783 6 : }
9784 6 : fun( w, self->votes, "votes", FD_FLAMENCO_TYPE_ARR_END, "votes", level-- );
9785 : /* Done walking deque */
9786 :
9787 6 : if( !self->has_root_slot ) {
9788 0 : fun( w, NULL, "root_slot", FD_FLAMENCO_TYPE_NULL, "ulong", level );
9789 6 : } else {
9790 6 : fun( w, &self->root_slot, "root_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
9791 6 : }
9792 6 : fd_vote_authorized_voters_walk( w, &self->authorized_voters, fun, "authorized_voters", level );
9793 6 : fd_vote_prior_voters_walk( w, &self->prior_voters, fun, "prior_voters", level );
9794 :
9795 : /* Walk deque */
9796 6 : fun( w, self->epoch_credits, "epoch_credits", FD_FLAMENCO_TYPE_ARR, "epoch_credits", level++ );
9797 6 : if( self->epoch_credits ) {
9798 6 : for( deq_fd_vote_epoch_credits_t_iter_t iter = deq_fd_vote_epoch_credits_t_iter_init( self->epoch_credits );
9799 201 : !deq_fd_vote_epoch_credits_t_iter_done( self->epoch_credits, iter );
9800 195 : iter = deq_fd_vote_epoch_credits_t_iter_next( self->epoch_credits, iter ) ) {
9801 195 : fd_vote_epoch_credits_t * ele = deq_fd_vote_epoch_credits_t_iter_ele( self->epoch_credits, iter );
9802 195 : fd_vote_epoch_credits_walk(w, ele, fun, "epoch_credits", level );
9803 195 : }
9804 6 : }
9805 6 : fun( w, self->epoch_credits, "epoch_credits", FD_FLAMENCO_TYPE_ARR_END, "epoch_credits", level-- );
9806 : /* Done walking deque */
9807 :
9808 6 : fd_vote_block_timestamp_walk( w, &self->last_timestamp, fun, "last_timestamp", level );
9809 6 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_state", level-- );
9810 6 : }
9811 0 : ulong fd_vote_state_size( fd_vote_state_t const * self ) {
9812 0 : ulong size = 0;
9813 0 : size += fd_pubkey_size( &self->node_pubkey );
9814 0 : size += fd_pubkey_size( &self->authorized_withdrawer );
9815 0 : size += sizeof(char);
9816 0 : if( self->votes ) {
9817 0 : size += sizeof(ulong);
9818 0 : for( deq_fd_landed_vote_t_iter_t iter = deq_fd_landed_vote_t_iter_init( self->votes ); !deq_fd_landed_vote_t_iter_done( self->votes, iter ); iter = deq_fd_landed_vote_t_iter_next( self->votes, iter ) ) {
9819 0 : fd_landed_vote_t * ele = deq_fd_landed_vote_t_iter_ele( self->votes, iter );
9820 0 : size += fd_landed_vote_size( ele );
9821 0 : }
9822 0 : } else {
9823 0 : size += sizeof(ulong);
9824 0 : }
9825 0 : size += sizeof(char);
9826 0 : if( self->has_root_slot ) {
9827 0 : size += sizeof(ulong);
9828 0 : }
9829 0 : size += fd_vote_authorized_voters_size( &self->authorized_voters );
9830 0 : size += fd_vote_prior_voters_size( &self->prior_voters );
9831 0 : if( self->epoch_credits ) {
9832 0 : size += sizeof(ulong);
9833 0 : for( deq_fd_vote_epoch_credits_t_iter_t iter = deq_fd_vote_epoch_credits_t_iter_init( self->epoch_credits ); !deq_fd_vote_epoch_credits_t_iter_done( self->epoch_credits, iter ); iter = deq_fd_vote_epoch_credits_t_iter_next( self->epoch_credits, iter ) ) {
9834 0 : fd_vote_epoch_credits_t * ele = deq_fd_vote_epoch_credits_t_iter_ele( self->epoch_credits, iter );
9835 0 : size += fd_vote_epoch_credits_size( ele );
9836 0 : }
9837 0 : } else {
9838 0 : size += sizeof(ulong);
9839 0 : }
9840 0 : size += fd_vote_block_timestamp_size( &self->last_timestamp );
9841 0 : return size;
9842 0 : }
9843 :
9844 0 : FD_FN_PURE uchar fd_vote_state_versioned_is_v0_23_5(fd_vote_state_versioned_t const * self) {
9845 0 : return self->discriminant == 0;
9846 0 : }
9847 0 : FD_FN_PURE uchar fd_vote_state_versioned_is_v1_14_11(fd_vote_state_versioned_t const * self) {
9848 0 : return self->discriminant == 1;
9849 0 : }
9850 0 : FD_FN_PURE uchar fd_vote_state_versioned_is_current(fd_vote_state_versioned_t const * self) {
9851 0 : return self->discriminant == 2;
9852 0 : }
9853 : void fd_vote_state_versioned_inner_new( fd_vote_state_versioned_inner_t * self, uint discriminant );
9854 12 : int fd_vote_state_versioned_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9855 12 : int err;
9856 12 : switch (discriminant) {
9857 0 : case 0: {
9858 0 : err = fd_vote_state_0_23_5_decode_footprint_inner( ctx, total_sz );
9859 0 : if( FD_UNLIKELY( err ) ) return err;
9860 0 : return FD_BINCODE_SUCCESS;
9861 0 : }
9862 0 : case 1: {
9863 0 : err = fd_vote_state_1_14_11_decode_footprint_inner( ctx, total_sz );
9864 0 : if( FD_UNLIKELY( err ) ) return err;
9865 0 : return FD_BINCODE_SUCCESS;
9866 0 : }
9867 12 : case 2: {
9868 12 : err = fd_vote_state_decode_footprint_inner( ctx, total_sz );
9869 12 : if( FD_UNLIKELY( err ) ) return err;
9870 12 : return FD_BINCODE_SUCCESS;
9871 12 : }
9872 0 : default: return FD_BINCODE_ERR_ENCODING;
9873 12 : }
9874 12 : }
9875 12 : int fd_vote_state_versioned_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9876 12 : *total_sz += sizeof(fd_vote_state_versioned_t);
9877 12 : void const * start_data = ctx->data;
9878 12 : int err = fd_vote_state_versioned_decode_footprint_inner( ctx, total_sz );
9879 12 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9880 12 : ctx->data = start_data;
9881 12 : return err;
9882 12 : }
9883 12 : int fd_vote_state_versioned_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9884 12 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9885 12 : uint discriminant = 0;
9886 12 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
9887 12 : if( FD_UNLIKELY( err ) ) return err;
9888 12 : return fd_vote_state_versioned_inner_decode_footprint( discriminant, ctx, total_sz );
9889 12 : }
9890 12 : 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 ) {
9891 12 : switch (discriminant) {
9892 0 : case 0: {
9893 0 : fd_vote_state_0_23_5_decode_inner( &self->v0_23_5, alloc_mem, ctx );
9894 0 : break;
9895 0 : }
9896 0 : case 1: {
9897 0 : fd_vote_state_1_14_11_decode_inner( &self->v1_14_11, alloc_mem, ctx );
9898 0 : break;
9899 0 : }
9900 12 : case 2: {
9901 12 : fd_vote_state_decode_inner( &self->current, alloc_mem, ctx );
9902 12 : break;
9903 0 : }
9904 12 : }
9905 12 : }
9906 6 : void fd_vote_state_versioned_inner_decode_inner_global( fd_vote_state_versioned_inner_global_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
9907 6 : switch (discriminant) {
9908 0 : case 0: {
9909 0 : fd_vote_state_0_23_5_decode_inner_global( &self->v0_23_5, alloc_mem, ctx );
9910 0 : break;
9911 0 : }
9912 0 : case 1: {
9913 0 : fd_vote_state_1_14_11_decode_inner_global( &self->v1_14_11, alloc_mem, ctx );
9914 0 : break;
9915 0 : }
9916 6 : case 2: {
9917 6 : fd_vote_state_decode_inner_global( &self->current, alloc_mem, ctx );
9918 6 : break;
9919 0 : }
9920 6 : }
9921 6 : }
9922 6 : int fd_vote_state_versioned_convert_global_to_local_inner( fd_vote_state_versioned_inner_global_t const * mem, fd_vote_state_versioned_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
9923 6 : int err = 0;
9924 6 : switch( discriminant ) {
9925 0 : case 0: {
9926 0 : err = fd_vote_state_0_23_5_convert_global_to_local( &mem->v0_23_5, &self->v0_23_5, ctx );
9927 0 : if( FD_UNLIKELY( err ) ) return err;
9928 0 : break;
9929 0 : }
9930 0 : case 1: {
9931 0 : err = fd_vote_state_1_14_11_convert_global_to_local( &mem->v1_14_11, &self->v1_14_11, ctx );
9932 0 : if( FD_UNLIKELY( err ) ) return err;
9933 0 : break;
9934 0 : }
9935 6 : case 2: {
9936 6 : err = fd_vote_state_convert_global_to_local( &mem->current, &self->current, ctx );
9937 6 : if( FD_UNLIKELY( err ) ) return err;
9938 6 : break;
9939 6 : }
9940 6 : }
9941 6 : return FD_BINCODE_SUCCESS;
9942 6 : }
9943 6 : int fd_vote_state_versioned_convert_global_to_local( void const * global_self, fd_vote_state_versioned_t * self, fd_bincode_decode_ctx_t * ctx ) {
9944 6 : fd_vote_state_versioned_global_t const * mem = (fd_vote_state_versioned_global_t const *)global_self;
9945 6 : uint discriminant = mem->discriminant;
9946 6 : self->discriminant = mem->discriminant;
9947 6 : int err = fd_vote_state_versioned_convert_global_to_local_inner( &mem->inner, &self->inner, discriminant, ctx );
9948 6 : return FD_BINCODE_SUCCESS;
9949 6 : }
9950 12 : void fd_vote_state_versioned_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9951 12 : fd_vote_state_versioned_t * self = (fd_vote_state_versioned_t *)struct_mem;
9952 12 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
9953 12 : fd_vote_state_versioned_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
9954 12 : }
9955 12 : void * fd_vote_state_versioned_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9956 12 : fd_vote_state_versioned_t * self = (fd_vote_state_versioned_t *)mem;
9957 12 : fd_vote_state_versioned_new( self );
9958 12 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_state_versioned_t);
9959 12 : void * * alloc_mem = &alloc_region;
9960 12 : fd_vote_state_versioned_decode_inner( mem, alloc_mem, ctx );
9961 12 : return self;
9962 12 : }
9963 6 : void * fd_vote_state_versioned_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9964 6 : fd_vote_state_versioned_t * self = (fd_vote_state_versioned_t *)mem;
9965 6 : fd_vote_state_versioned_new( self );
9966 6 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_state_versioned_t);
9967 6 : void * * alloc_mem = &alloc_region;
9968 6 : fd_vote_state_versioned_decode_inner_global( mem, alloc_mem, ctx );
9969 6 : return self;
9970 6 : }
9971 6 : void fd_vote_state_versioned_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9972 6 : fd_vote_state_versioned_global_t * self = (fd_vote_state_versioned_global_t *)struct_mem;
9973 6 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
9974 6 : fd_vote_state_versioned_inner_decode_inner_global( &self->inner, alloc_mem, self->discriminant, ctx );
9975 6 : }
9976 30 : void fd_vote_state_versioned_inner_new( fd_vote_state_versioned_inner_t * self, uint discriminant ) {
9977 30 : switch( discriminant ) {
9978 0 : case 0: {
9979 0 : fd_vote_state_0_23_5_new( &self->v0_23_5 );
9980 0 : break;
9981 0 : }
9982 0 : case 1: {
9983 0 : fd_vote_state_1_14_11_new( &self->v1_14_11 );
9984 0 : break;
9985 0 : }
9986 12 : case 2: {
9987 12 : fd_vote_state_new( &self->current );
9988 12 : break;
9989 0 : }
9990 18 : default: break; // FD_LOG_ERR(( "unhandled type"));
9991 30 : }
9992 30 : }
9993 30 : void fd_vote_state_versioned_new_disc( fd_vote_state_versioned_t * self, uint discriminant ) {
9994 30 : self->discriminant = discriminant;
9995 30 : fd_vote_state_versioned_inner_new( &self->inner, self->discriminant );
9996 30 : }
9997 18 : void fd_vote_state_versioned_new( fd_vote_state_versioned_t * self ) {
9998 18 : fd_memset( self, 0, sizeof(fd_vote_state_versioned_t) );
9999 18 : fd_vote_state_versioned_new_disc( self, UINT_MAX );
10000 18 : }
10001 0 : void fd_vote_state_versioned_inner_destroy( fd_vote_state_versioned_inner_t * self, uint discriminant ) {
10002 0 : switch( discriminant ) {
10003 0 : case 0: {
10004 0 : fd_vote_state_0_23_5_destroy( &self->v0_23_5 );
10005 0 : break;
10006 0 : }
10007 0 : case 1: {
10008 0 : fd_vote_state_1_14_11_destroy( &self->v1_14_11 );
10009 0 : break;
10010 0 : }
10011 0 : case 2: {
10012 0 : fd_vote_state_destroy( &self->current );
10013 0 : break;
10014 0 : }
10015 0 : default: break; // FD_LOG_ERR(( "unhandled type" ));
10016 0 : }
10017 0 : }
10018 0 : void fd_vote_state_versioned_destroy( fd_vote_state_versioned_t * self ) {
10019 0 : fd_vote_state_versioned_inner_destroy( &self->inner, self->discriminant );
10020 0 : }
10021 :
10022 6 : ulong fd_vote_state_versioned_footprint( void ){ return FD_VOTE_STATE_VERSIONED_FOOTPRINT; }
10023 30 : ulong fd_vote_state_versioned_align( void ){ return FD_VOTE_STATE_VERSIONED_ALIGN; }
10024 :
10025 6 : void fd_vote_state_versioned_walk( void * w, fd_vote_state_versioned_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
10026 6 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_vote_state_versioned", level++);
10027 6 : switch( self->discriminant ) {
10028 0 : case 0: {
10029 0 : fun( w, self, "v0_23_5", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
10030 0 : fd_vote_state_0_23_5_walk( w, &self->inner.v0_23_5, fun, "v0_23_5", level );
10031 0 : break;
10032 0 : }
10033 0 : case 1: {
10034 0 : fun( w, self, "v1_14_11", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
10035 0 : fd_vote_state_1_14_11_walk( w, &self->inner.v1_14_11, fun, "v1_14_11", level );
10036 0 : break;
10037 0 : }
10038 6 : case 2: {
10039 6 : fun( w, self, "current", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
10040 6 : fd_vote_state_walk( w, &self->inner.current, fun, "current", level );
10041 6 : break;
10042 0 : }
10043 6 : }
10044 6 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_vote_state_versioned", level-- );
10045 6 : }
10046 0 : ulong fd_vote_state_versioned_size( fd_vote_state_versioned_t const * self ) {
10047 0 : ulong size = 0;
10048 0 : size += sizeof(uint);
10049 0 : switch (self->discriminant) {
10050 0 : case 0: {
10051 0 : size += fd_vote_state_0_23_5_size( &self->inner.v0_23_5 );
10052 0 : break;
10053 0 : }
10054 0 : case 1: {
10055 0 : size += fd_vote_state_1_14_11_size( &self->inner.v1_14_11 );
10056 0 : break;
10057 0 : }
10058 0 : case 2: {
10059 0 : size += fd_vote_state_size( &self->inner.current );
10060 0 : break;
10061 0 : }
10062 0 : }
10063 0 : return size;
10064 0 : }
10065 :
10066 24 : int fd_vote_state_versioned_inner_encode( fd_vote_state_versioned_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
10067 24 : int err;
10068 24 : switch (discriminant) {
10069 0 : case 0: {
10070 0 : err = fd_vote_state_0_23_5_encode( &self->v0_23_5, ctx );
10071 0 : if( FD_UNLIKELY( err ) ) return err;
10072 0 : break;
10073 0 : }
10074 0 : case 1: {
10075 0 : err = fd_vote_state_1_14_11_encode( &self->v1_14_11, ctx );
10076 0 : if( FD_UNLIKELY( err ) ) return err;
10077 0 : break;
10078 0 : }
10079 24 : case 2: {
10080 24 : err = fd_vote_state_encode( &self->current, ctx );
10081 24 : if( FD_UNLIKELY( err ) ) return err;
10082 24 : break;
10083 24 : }
10084 24 : }
10085 24 : return FD_BINCODE_SUCCESS;
10086 24 : }
10087 24 : int fd_vote_state_versioned_encode( fd_vote_state_versioned_t const * self, fd_bincode_encode_ctx_t * ctx ) {
10088 24 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
10089 24 : if( FD_UNLIKELY( err ) ) return err;
10090 24 : return fd_vote_state_versioned_inner_encode( &self->inner, self->discriminant, ctx );
10091 24 : }
10092 :
10093 0 : int fd_vote_state_update_encode( fd_vote_state_update_t const * self, fd_bincode_encode_ctx_t * ctx ) {
10094 0 : int err;
10095 0 : if( self->lockouts ) {
10096 0 : ulong lockouts_len = deq_fd_vote_lockout_t_cnt( self->lockouts );
10097 0 : err = fd_bincode_uint64_encode( lockouts_len, ctx );
10098 0 : if( FD_UNLIKELY( err ) ) return err;
10099 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 ) ) {
10100 0 : fd_vote_lockout_t const * ele = deq_fd_vote_lockout_t_iter_ele_const( self->lockouts, iter );
10101 0 : err = fd_vote_lockout_encode( ele, ctx );
10102 0 : if( FD_UNLIKELY( err ) ) return err;
10103 0 : }
10104 0 : } else {
10105 0 : ulong lockouts_len = 0;
10106 0 : err = fd_bincode_uint64_encode( lockouts_len, ctx );
10107 0 : if( FD_UNLIKELY( err ) ) return err;
10108 0 : }
10109 0 : err = fd_bincode_bool_encode( self->has_root, ctx );
10110 0 : if( FD_UNLIKELY( err ) ) return err;
10111 0 : if( self->has_root ) {
10112 0 : err = fd_bincode_uint64_encode( self->root, ctx );
10113 0 : if( FD_UNLIKELY( err ) ) return err;
10114 0 : }
10115 0 : err = fd_hash_encode( &self->hash, ctx );
10116 0 : if( FD_UNLIKELY( err ) ) return err;
10117 0 : err = fd_bincode_bool_encode( self->has_timestamp, ctx );
10118 0 : if( FD_UNLIKELY( err ) ) return err;
10119 0 : if( self->has_timestamp ) {
10120 0 : err = fd_bincode_int64_encode( self->timestamp, ctx );
10121 0 : if( FD_UNLIKELY( err ) ) return err;
10122 0 : }
10123 0 : return FD_BINCODE_SUCCESS;
10124 0 : }
10125 0 : int fd_vote_state_update_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10126 0 : *total_sz += sizeof(fd_vote_state_update_t);
10127 0 : void const * start_data = ctx->data;
10128 0 : int err = fd_vote_state_update_decode_footprint_inner( ctx, total_sz );
10129 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10130 0 : ctx->data = start_data;
10131 0 : return err;
10132 0 : }
10133 0 : int fd_vote_state_update_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10134 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10135 0 : int err = 0;
10136 0 : ulong lockouts_len;
10137 0 : err = fd_bincode_uint64_decode( &lockouts_len, ctx );
10138 0 : if( FD_UNLIKELY( err ) ) return err;
10139 0 : ulong lockouts_max = fd_ulong_max( lockouts_len, 32 );
10140 0 : *total_sz += deq_fd_vote_lockout_t_align() + deq_fd_vote_lockout_t_footprint( lockouts_max );
10141 0 : ulong lockouts_sz;
10142 0 : if( FD_UNLIKELY( __builtin_umull_overflow( lockouts_len, 12, &lockouts_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
10143 0 : err = fd_bincode_bytes_decode_footprint( lockouts_sz, ctx );
10144 0 : if( FD_UNLIKELY( err ) ) return err;
10145 0 : {
10146 0 : uchar o;
10147 0 : err = fd_bincode_bool_decode( &o, ctx );
10148 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10149 0 : if( o ) {
10150 0 : err = fd_bincode_uint64_decode_footprint( ctx );
10151 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10152 0 : }
10153 0 : }
10154 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
10155 0 : if( FD_UNLIKELY( err ) ) return err;
10156 0 : {
10157 0 : uchar o;
10158 0 : err = fd_bincode_bool_decode( &o, ctx );
10159 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10160 0 : if( o ) {
10161 0 : err = fd_bincode_int64_decode_footprint( ctx );
10162 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10163 0 : }
10164 0 : }
10165 0 : return 0;
10166 0 : }
10167 0 : void * fd_vote_state_update_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
10168 0 : fd_vote_state_update_t * self = (fd_vote_state_update_t *)mem;
10169 0 : fd_vote_state_update_new( self );
10170 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_state_update_t);
10171 0 : void * * alloc_mem = &alloc_region;
10172 0 : fd_vote_state_update_decode_inner( mem, alloc_mem, ctx );
10173 0 : return self;
10174 0 : }
10175 0 : void fd_vote_state_update_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
10176 0 : fd_vote_state_update_t * self = (fd_vote_state_update_t *)struct_mem;
10177 0 : ulong lockouts_len;
10178 0 : fd_bincode_uint64_decode_unsafe( &lockouts_len, ctx );
10179 0 : ulong lockouts_max = fd_ulong_max( lockouts_len, 32 );
10180 0 : self->lockouts = deq_fd_vote_lockout_t_join_new( alloc_mem, lockouts_max );
10181 0 : for( ulong i=0; i < lockouts_len; i++ ) {
10182 0 : fd_vote_lockout_t * elem = deq_fd_vote_lockout_t_push_tail_nocopy( self->lockouts );
10183 0 : fd_vote_lockout_new( elem );
10184 0 : fd_vote_lockout_decode_inner( elem, alloc_mem, ctx );
10185 0 : }
10186 0 : {
10187 0 : uchar o;
10188 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
10189 0 : self->has_root = !!o;
10190 0 : if( o ) {
10191 0 : fd_bincode_uint64_decode_unsafe( &self->root, ctx );
10192 0 : }
10193 0 : }
10194 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
10195 0 : {
10196 0 : uchar o;
10197 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
10198 0 : self->has_timestamp = !!o;
10199 0 : if( o ) {
10200 0 : fd_bincode_int64_decode_unsafe( &self->timestamp, ctx );
10201 0 : }
10202 0 : }
10203 0 : }
10204 0 : void * fd_vote_state_update_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
10205 0 : fd_vote_state_update_global_t * self = (fd_vote_state_update_global_t *)mem;
10206 0 : fd_vote_state_update_new( (fd_vote_state_update_t *)self );
10207 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_state_update_global_t);
10208 0 : void * * alloc_mem = &alloc_region;
10209 0 : fd_vote_state_update_decode_inner_global( mem, alloc_mem, ctx );
10210 0 : return self;
10211 0 : }
10212 0 : void fd_vote_state_update_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
10213 0 : fd_vote_state_update_global_t * self = (fd_vote_state_update_global_t *)struct_mem;
10214 0 : ulong lockouts_len;
10215 0 : fd_bincode_uint64_decode_unsafe( &lockouts_len, ctx );
10216 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, deq_fd_vote_lockout_t_align() );
10217 0 : ulong lockouts_max = fd_ulong_max( lockouts_len, 32 );
10218 0 : self->lockouts_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
10219 0 : fd_vote_lockout_t * lockouts = deq_fd_vote_lockout_t_join_new( alloc_mem, lockouts_max );
10220 0 : for( ulong i=0; i < lockouts_len; i++ ) {
10221 0 : fd_vote_lockout_t * elem = deq_fd_vote_lockout_t_push_tail_nocopy( lockouts );
10222 0 : fd_vote_lockout_new( elem );
10223 0 : fd_vote_lockout_decode_inner_global( elem, alloc_mem, ctx );
10224 0 : }
10225 0 : {
10226 0 : uchar o;
10227 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
10228 0 : self->has_root = !!o;
10229 0 : if( o ) {
10230 0 : fd_bincode_uint64_decode_unsafe( &self->root, ctx );
10231 0 : }
10232 0 : }
10233 0 : fd_hash_decode_inner_global( &self->hash, alloc_mem, ctx );
10234 0 : {
10235 0 : uchar o;
10236 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
10237 0 : self->has_timestamp = !!o;
10238 0 : if( o ) {
10239 0 : fd_bincode_int64_decode_unsafe( &self->timestamp, ctx );
10240 0 : }
10241 0 : }
10242 0 : }
10243 0 : int fd_vote_state_update_convert_global_to_local( void const * global_self, fd_vote_state_update_t * self, fd_bincode_decode_ctx_t * ctx ) {
10244 0 : int err = 0;
10245 0 : fd_vote_state_update_global_t const * mem = (fd_vote_state_update_global_t const *)global_self;
10246 0 : self->lockouts = deq_fd_vote_lockout_t_join( fd_wksp_laddr_fast( ctx->wksp, mem->lockouts_gaddr ) );
10247 0 : self->root = mem->root;
10248 0 : self->has_root = mem->has_root;
10249 0 : err = fd_hash_convert_global_to_local( &mem->hash, &self->hash, ctx );
10250 0 : if( FD_UNLIKELY( err ) ) return err;
10251 0 : self->timestamp = mem->timestamp;
10252 0 : self->has_timestamp = mem->has_timestamp;
10253 0 : return FD_BINCODE_SUCCESS;
10254 0 : }
10255 0 : void fd_vote_state_update_new(fd_vote_state_update_t * self) {
10256 0 : fd_memset( self, 0, sizeof(fd_vote_state_update_t) );
10257 0 : fd_hash_new( &self->hash );
10258 0 : }
10259 0 : void fd_vote_state_update_destroy( fd_vote_state_update_t * self ) {
10260 0 : if( self->lockouts ) {
10261 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 ) ) {
10262 0 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->lockouts, iter );
10263 0 : fd_vote_lockout_destroy( ele );
10264 0 : }
10265 0 : self->lockouts = NULL;
10266 0 : }
10267 0 : if( self->has_root ) {
10268 0 : self->has_root = 0;
10269 0 : }
10270 0 : fd_hash_destroy( &self->hash );
10271 0 : if( self->has_timestamp ) {
10272 0 : self->has_timestamp = 0;
10273 0 : }
10274 0 : }
10275 :
10276 0 : ulong fd_vote_state_update_footprint( void ){ return FD_VOTE_STATE_UPDATE_FOOTPRINT; }
10277 0 : ulong fd_vote_state_update_align( void ){ return FD_VOTE_STATE_UPDATE_ALIGN; }
10278 :
10279 0 : void fd_vote_state_update_walk( void * w, fd_vote_state_update_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
10280 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_state_update", level++ );
10281 :
10282 : /* Walk deque */
10283 0 : fun( w, self->lockouts, "lockouts", FD_FLAMENCO_TYPE_ARR, "lockouts", level++ );
10284 0 : if( self->lockouts ) {
10285 0 : for( deq_fd_vote_lockout_t_iter_t iter = deq_fd_vote_lockout_t_iter_init( self->lockouts );
10286 0 : !deq_fd_vote_lockout_t_iter_done( self->lockouts, iter );
10287 0 : iter = deq_fd_vote_lockout_t_iter_next( self->lockouts, iter ) ) {
10288 0 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->lockouts, iter );
10289 0 : fd_vote_lockout_walk(w, ele, fun, "lockouts", level );
10290 0 : }
10291 0 : }
10292 0 : fun( w, self->lockouts, "lockouts", FD_FLAMENCO_TYPE_ARR_END, "lockouts", level-- );
10293 : /* Done walking deque */
10294 :
10295 0 : if( !self->has_root ) {
10296 0 : fun( w, NULL, "root", FD_FLAMENCO_TYPE_NULL, "ulong", level );
10297 0 : } else {
10298 0 : fun( w, &self->root, "root", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
10299 0 : }
10300 0 : fd_hash_walk( w, &self->hash, fun, "hash", level );
10301 0 : if( !self->has_timestamp ) {
10302 0 : fun( w, NULL, "timestamp", FD_FLAMENCO_TYPE_NULL, "long", level );
10303 0 : } else {
10304 0 : fun( w, &self->timestamp, "timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level );
10305 0 : }
10306 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_state_update", level-- );
10307 0 : }
10308 0 : ulong fd_vote_state_update_size( fd_vote_state_update_t const * self ) {
10309 0 : ulong size = 0;
10310 0 : if( self->lockouts ) {
10311 0 : size += sizeof(ulong);
10312 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 ) ) {
10313 0 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->lockouts, iter );
10314 0 : size += fd_vote_lockout_size( ele );
10315 0 : }
10316 0 : } else {
10317 0 : size += sizeof(ulong);
10318 0 : }
10319 0 : size += sizeof(char);
10320 0 : if( self->has_root ) {
10321 0 : size += sizeof(ulong);
10322 0 : }
10323 0 : size += fd_hash_size( &self->hash );
10324 0 : size += sizeof(char);
10325 0 : if( self->has_timestamp ) {
10326 0 : size += sizeof(long);
10327 0 : }
10328 0 : return size;
10329 0 : }
10330 :
10331 0 : int fd_compact_vote_state_update_encode( fd_compact_vote_state_update_t const * self, fd_bincode_encode_ctx_t * ctx ) {
10332 0 : int err;
10333 0 : err = fd_bincode_uint64_encode( self->root, ctx );
10334 0 : if( FD_UNLIKELY( err ) ) return err;
10335 0 : err = fd_bincode_compact_u16_encode( &self->lockouts_len, ctx );
10336 0 : if( FD_UNLIKELY(err) ) return err;
10337 0 : if( self->lockouts_len ) {
10338 0 : for( ulong i=0; i < self->lockouts_len; i++ ) {
10339 0 : err = fd_lockout_offset_encode( self->lockouts + i, ctx );
10340 0 : if( FD_UNLIKELY( err ) ) return err;
10341 0 : }
10342 0 : }
10343 0 : err = fd_hash_encode( &self->hash, ctx );
10344 0 : if( FD_UNLIKELY( err ) ) return err;
10345 0 : err = fd_bincode_bool_encode( self->has_timestamp, ctx );
10346 0 : if( FD_UNLIKELY( err ) ) return err;
10347 0 : if( self->has_timestamp ) {
10348 0 : err = fd_bincode_int64_encode( self->timestamp, ctx );
10349 0 : if( FD_UNLIKELY( err ) ) return err;
10350 0 : }
10351 0 : return FD_BINCODE_SUCCESS;
10352 0 : }
10353 0 : int fd_compact_vote_state_update_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10354 0 : *total_sz += sizeof(fd_compact_vote_state_update_t);
10355 0 : void const * start_data = ctx->data;
10356 0 : int err = fd_compact_vote_state_update_decode_footprint_inner( ctx, total_sz );
10357 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10358 0 : ctx->data = start_data;
10359 0 : return err;
10360 0 : }
10361 0 : int fd_compact_vote_state_update_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10362 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10363 0 : int err = 0;
10364 0 : err = fd_bincode_uint64_decode_footprint( ctx );
10365 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10366 0 : ushort lockouts_len;
10367 0 : err = fd_bincode_compact_u16_decode( &lockouts_len, ctx );
10368 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10369 0 : if( lockouts_len ) {
10370 0 : *total_sz += FD_LOCKOUT_OFFSET_ALIGN + FD_LOCKOUT_OFFSET_FOOTPRINT*lockouts_len;
10371 0 : for( ulong i=0; i < lockouts_len; i++ ) {
10372 0 : err = fd_lockout_offset_decode_footprint_inner( ctx, total_sz );
10373 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10374 0 : }
10375 0 : }
10376 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
10377 0 : if( FD_UNLIKELY( err ) ) return err;
10378 0 : {
10379 0 : uchar o;
10380 0 : err = fd_bincode_bool_decode( &o, ctx );
10381 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10382 0 : if( o ) {
10383 0 : err = fd_bincode_int64_decode_footprint( ctx );
10384 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10385 0 : }
10386 0 : }
10387 0 : return 0;
10388 0 : }
10389 0 : void * fd_compact_vote_state_update_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
10390 0 : fd_compact_vote_state_update_t * self = (fd_compact_vote_state_update_t *)mem;
10391 0 : fd_compact_vote_state_update_new( self );
10392 0 : void * alloc_region = (uchar *)mem + sizeof(fd_compact_vote_state_update_t);
10393 0 : void * * alloc_mem = &alloc_region;
10394 0 : fd_compact_vote_state_update_decode_inner( mem, alloc_mem, ctx );
10395 0 : return self;
10396 0 : }
10397 0 : void fd_compact_vote_state_update_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
10398 0 : fd_compact_vote_state_update_t * self = (fd_compact_vote_state_update_t *)struct_mem;
10399 0 : fd_bincode_uint64_decode_unsafe( &self->root, ctx );
10400 0 : fd_bincode_compact_u16_decode_unsafe( &self->lockouts_len, ctx );
10401 0 : if( self->lockouts_len ) {
10402 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_LOCKOUT_OFFSET_ALIGN );
10403 0 : self->lockouts = *alloc_mem;
10404 0 : *alloc_mem = (uchar *)(*alloc_mem) + FD_LOCKOUT_OFFSET_FOOTPRINT*self->lockouts_len;
10405 0 : for( ulong i=0; i < self->lockouts_len; i++ ) {
10406 0 : fd_lockout_offset_new( self->lockouts + i );
10407 0 : fd_lockout_offset_decode_inner( self->lockouts + i, alloc_mem, ctx );
10408 0 : }
10409 0 : } else
10410 0 : self->lockouts = NULL;
10411 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
10412 0 : {
10413 0 : uchar o;
10414 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
10415 0 : self->has_timestamp = !!o;
10416 0 : if( o ) {
10417 0 : fd_bincode_int64_decode_unsafe( &self->timestamp, ctx );
10418 0 : }
10419 0 : }
10420 0 : }
10421 0 : void * fd_compact_vote_state_update_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
10422 0 : fd_compact_vote_state_update_global_t * self = (fd_compact_vote_state_update_global_t *)mem;
10423 0 : fd_compact_vote_state_update_new( (fd_compact_vote_state_update_t *)self );
10424 0 : void * alloc_region = (uchar *)mem + sizeof(fd_compact_vote_state_update_global_t);
10425 0 : void * * alloc_mem = &alloc_region;
10426 0 : fd_compact_vote_state_update_decode_inner_global( mem, alloc_mem, ctx );
10427 0 : return self;
10428 0 : }
10429 0 : void fd_compact_vote_state_update_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
10430 0 : fd_compact_vote_state_update_global_t * self = (fd_compact_vote_state_update_global_t *)struct_mem;
10431 0 : fd_bincode_uint64_decode_unsafe( &self->root, ctx );
10432 0 : fd_bincode_compact_u16_decode_unsafe( &self->lockouts_len, ctx );
10433 0 : if( self->lockouts_len ) {
10434 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_LOCKOUT_OFFSET_ALIGN );
10435 0 : self->lockouts_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
10436 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
10437 0 : *alloc_mem = (uchar *)(*alloc_mem) + FD_LOCKOUT_OFFSET_FOOTPRINT*self->lockouts_len;
10438 0 : for( ulong i=0; i < self->lockouts_len; i++ ) {
10439 0 : fd_lockout_offset_new( (fd_lockout_offset_t *)(cur_mem + FD_LOCKOUT_OFFSET_FOOTPRINT * i) );
10440 0 : fd_lockout_offset_decode_inner_global( cur_mem + FD_LOCKOUT_OFFSET_FOOTPRINT * i, alloc_mem, ctx );
10441 0 : }
10442 0 : } else
10443 0 : self->lockouts_gaddr = 0UL;
10444 0 : fd_hash_decode_inner_global( &self->hash, alloc_mem, ctx );
10445 0 : {
10446 0 : uchar o;
10447 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
10448 0 : self->has_timestamp = !!o;
10449 0 : if( o ) {
10450 0 : fd_bincode_int64_decode_unsafe( &self->timestamp, ctx );
10451 0 : }
10452 0 : }
10453 0 : }
10454 0 : int fd_compact_vote_state_update_convert_global_to_local( void const * global_self, fd_compact_vote_state_update_t * self, fd_bincode_decode_ctx_t * ctx ) {
10455 0 : int err = 0;
10456 0 : fd_compact_vote_state_update_global_t const * mem = (fd_compact_vote_state_update_global_t const *)global_self;
10457 0 : self->root = mem->root;
10458 0 : self->lockouts_len = mem->lockouts_len;
10459 0 : self->lockouts = fd_wksp_laddr_fast( ctx->wksp, mem->lockouts_gaddr );
10460 0 : err = fd_hash_convert_global_to_local( &mem->hash, &self->hash, ctx );
10461 0 : if( FD_UNLIKELY( err ) ) return err;
10462 0 : self->timestamp = mem->timestamp;
10463 0 : self->has_timestamp = mem->has_timestamp;
10464 0 : return FD_BINCODE_SUCCESS;
10465 0 : }
10466 0 : void fd_compact_vote_state_update_new(fd_compact_vote_state_update_t * self) {
10467 0 : fd_memset( self, 0, sizeof(fd_compact_vote_state_update_t) );
10468 0 : fd_hash_new( &self->hash );
10469 0 : }
10470 0 : void fd_compact_vote_state_update_destroy( fd_compact_vote_state_update_t * self ) {
10471 0 : if( self->lockouts ) {
10472 0 : for( ulong i=0; i < self->lockouts_len; i++ )
10473 0 : fd_lockout_offset_destroy( self->lockouts + i );
10474 0 : self->lockouts = NULL;
10475 0 : }
10476 0 : fd_hash_destroy( &self->hash );
10477 0 : if( self->has_timestamp ) {
10478 0 : self->has_timestamp = 0;
10479 0 : }
10480 0 : }
10481 :
10482 0 : ulong fd_compact_vote_state_update_footprint( void ){ return FD_COMPACT_VOTE_STATE_UPDATE_FOOTPRINT; }
10483 0 : ulong fd_compact_vote_state_update_align( void ){ return FD_COMPACT_VOTE_STATE_UPDATE_ALIGN; }
10484 :
10485 0 : void fd_compact_vote_state_update_walk( void * w, fd_compact_vote_state_update_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
10486 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_compact_vote_state_update", level++ );
10487 0 : fun( w, &self->root, "root", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
10488 0 : if( self->lockouts_len ) {
10489 0 : fun( w, NULL, "lockouts", FD_FLAMENCO_TYPE_ARR, "array", level++ );
10490 0 : for( ulong i=0; i < self->lockouts_len; i++ )
10491 0 : fd_lockout_offset_walk(w, self->lockouts + i, fun, "lockout_offset", level );
10492 0 : fun( w, NULL, "lockouts", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
10493 0 : }
10494 0 : fd_hash_walk( w, &self->hash, fun, "hash", level );
10495 0 : if( !self->has_timestamp ) {
10496 0 : fun( w, NULL, "timestamp", FD_FLAMENCO_TYPE_NULL, "long", level );
10497 0 : } else {
10498 0 : fun( w, &self->timestamp, "timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level );
10499 0 : }
10500 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_compact_vote_state_update", level-- );
10501 0 : }
10502 0 : ulong fd_compact_vote_state_update_size( fd_compact_vote_state_update_t const * self ) {
10503 0 : ulong size = 0;
10504 0 : size += sizeof(ulong);
10505 0 : do {
10506 0 : ushort tmp = (ushort)self->lockouts_len;
10507 0 : size += fd_bincode_compact_u16_size( &tmp );
10508 0 : for( ulong i=0; i < self->lockouts_len; i++ )
10509 0 : size += fd_lockout_offset_size( self->lockouts + i );
10510 0 : } while(0);
10511 0 : size += fd_hash_size( &self->hash );
10512 0 : size += sizeof(char);
10513 0 : if( self->has_timestamp ) {
10514 0 : size += sizeof(long);
10515 0 : }
10516 0 : return size;
10517 0 : }
10518 :
10519 0 : int fd_compact_vote_state_update_switch_encode( fd_compact_vote_state_update_switch_t const * self, fd_bincode_encode_ctx_t * ctx ) {
10520 0 : int err;
10521 0 : err = fd_compact_vote_state_update_encode( &self->compact_vote_state_update, ctx );
10522 0 : if( FD_UNLIKELY( err ) ) return err;
10523 0 : err = fd_hash_encode( &self->hash, ctx );
10524 0 : if( FD_UNLIKELY( err ) ) return err;
10525 0 : return FD_BINCODE_SUCCESS;
10526 0 : }
10527 0 : int fd_compact_vote_state_update_switch_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10528 0 : *total_sz += sizeof(fd_compact_vote_state_update_switch_t);
10529 0 : void const * start_data = ctx->data;
10530 0 : int err = fd_compact_vote_state_update_switch_decode_footprint_inner( ctx, total_sz );
10531 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10532 0 : ctx->data = start_data;
10533 0 : return err;
10534 0 : }
10535 0 : int fd_compact_vote_state_update_switch_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10536 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10537 0 : int err = 0;
10538 0 : err = fd_compact_vote_state_update_decode_footprint_inner( ctx, total_sz );
10539 0 : if( FD_UNLIKELY( err ) ) return err;
10540 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
10541 0 : if( FD_UNLIKELY( err ) ) return err;
10542 0 : return 0;
10543 0 : }
10544 0 : void * fd_compact_vote_state_update_switch_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
10545 0 : fd_compact_vote_state_update_switch_t * self = (fd_compact_vote_state_update_switch_t *)mem;
10546 0 : fd_compact_vote_state_update_switch_new( self );
10547 0 : void * alloc_region = (uchar *)mem + sizeof(fd_compact_vote_state_update_switch_t);
10548 0 : void * * alloc_mem = &alloc_region;
10549 0 : fd_compact_vote_state_update_switch_decode_inner( mem, alloc_mem, ctx );
10550 0 : return self;
10551 0 : }
10552 0 : void fd_compact_vote_state_update_switch_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
10553 0 : fd_compact_vote_state_update_switch_t * self = (fd_compact_vote_state_update_switch_t *)struct_mem;
10554 0 : fd_compact_vote_state_update_decode_inner( &self->compact_vote_state_update, alloc_mem, ctx );
10555 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
10556 0 : }
10557 0 : void * fd_compact_vote_state_update_switch_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
10558 0 : fd_compact_vote_state_update_switch_global_t * self = (fd_compact_vote_state_update_switch_global_t *)mem;
10559 0 : fd_compact_vote_state_update_switch_new( (fd_compact_vote_state_update_switch_t *)self );
10560 0 : void * alloc_region = (uchar *)mem + sizeof(fd_compact_vote_state_update_switch_global_t);
10561 0 : void * * alloc_mem = &alloc_region;
10562 0 : fd_compact_vote_state_update_switch_decode_inner_global( mem, alloc_mem, ctx );
10563 0 : return self;
10564 0 : }
10565 0 : void fd_compact_vote_state_update_switch_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
10566 0 : fd_compact_vote_state_update_switch_global_t * self = (fd_compact_vote_state_update_switch_global_t *)struct_mem;
10567 0 : fd_compact_vote_state_update_decode_inner_global( &self->compact_vote_state_update, alloc_mem, ctx );
10568 0 : fd_hash_decode_inner_global( &self->hash, alloc_mem, ctx );
10569 0 : }
10570 0 : int fd_compact_vote_state_update_switch_convert_global_to_local( void const * global_self, fd_compact_vote_state_update_switch_t * self, fd_bincode_decode_ctx_t * ctx ) {
10571 0 : int err = 0;
10572 0 : fd_compact_vote_state_update_switch_global_t const * mem = (fd_compact_vote_state_update_switch_global_t const *)global_self;
10573 0 : err = fd_compact_vote_state_update_convert_global_to_local( &mem->compact_vote_state_update, &self->compact_vote_state_update, ctx );
10574 0 : if( FD_UNLIKELY( err ) ) return err;
10575 0 : err = fd_hash_convert_global_to_local( &mem->hash, &self->hash, ctx );
10576 0 : if( FD_UNLIKELY( err ) ) return err;
10577 0 : return FD_BINCODE_SUCCESS;
10578 0 : }
10579 0 : void fd_compact_vote_state_update_switch_new(fd_compact_vote_state_update_switch_t * self) {
10580 0 : fd_memset( self, 0, sizeof(fd_compact_vote_state_update_switch_t) );
10581 0 : fd_compact_vote_state_update_new( &self->compact_vote_state_update );
10582 0 : fd_hash_new( &self->hash );
10583 0 : }
10584 0 : void fd_compact_vote_state_update_switch_destroy( fd_compact_vote_state_update_switch_t * self ) {
10585 0 : fd_compact_vote_state_update_destroy( &self->compact_vote_state_update );
10586 0 : fd_hash_destroy( &self->hash );
10587 0 : }
10588 :
10589 0 : ulong fd_compact_vote_state_update_switch_footprint( void ){ return FD_COMPACT_VOTE_STATE_UPDATE_SWITCH_FOOTPRINT; }
10590 0 : ulong fd_compact_vote_state_update_switch_align( void ){ return FD_COMPACT_VOTE_STATE_UPDATE_SWITCH_ALIGN; }
10591 :
10592 0 : void fd_compact_vote_state_update_switch_walk( void * w, fd_compact_vote_state_update_switch_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
10593 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_compact_vote_state_update_switch", level++ );
10594 0 : fd_compact_vote_state_update_walk( w, &self->compact_vote_state_update, fun, "compact_vote_state_update", level );
10595 0 : fd_hash_walk( w, &self->hash, fun, "hash", level );
10596 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_compact_vote_state_update_switch", level-- );
10597 0 : }
10598 0 : ulong fd_compact_vote_state_update_switch_size( fd_compact_vote_state_update_switch_t const * self ) {
10599 0 : ulong size = 0;
10600 0 : size += fd_compact_vote_state_update_size( &self->compact_vote_state_update );
10601 0 : size += fd_hash_size( &self->hash );
10602 0 : return size;
10603 0 : }
10604 :
10605 0 : int fd_compact_tower_sync_encode( fd_compact_tower_sync_t const * self, fd_bincode_encode_ctx_t * ctx ) {
10606 0 : int err;
10607 0 : err = fd_bincode_uint64_encode( self->root, ctx );
10608 0 : if( FD_UNLIKELY( err ) ) return err;
10609 0 : if( self->lockout_offsets ) {
10610 0 : ushort lockout_offsets_len = (ushort)deq_fd_lockout_offset_t_cnt( self->lockout_offsets );
10611 0 : err = fd_bincode_compact_u16_encode( &lockout_offsets_len, ctx );
10612 0 : if( FD_UNLIKELY( err ) ) return err;
10613 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 ) ) {
10614 0 : fd_lockout_offset_t const * ele = deq_fd_lockout_offset_t_iter_ele_const( self->lockout_offsets, iter );
10615 0 : err = fd_lockout_offset_encode( ele, ctx );
10616 0 : if( FD_UNLIKELY( err ) ) return err;
10617 0 : }
10618 0 : } else {
10619 0 : ushort lockout_offsets_len = 0;
10620 0 : err = fd_bincode_compact_u16_encode( &lockout_offsets_len, ctx );
10621 0 : if( FD_UNLIKELY( err ) ) return err;
10622 0 : }
10623 0 : err = fd_hash_encode( &self->hash, ctx );
10624 0 : if( FD_UNLIKELY( err ) ) return err;
10625 0 : err = fd_bincode_bool_encode( self->has_timestamp, ctx );
10626 0 : if( FD_UNLIKELY( err ) ) return err;
10627 0 : if( self->has_timestamp ) {
10628 0 : err = fd_bincode_int64_encode( self->timestamp, ctx );
10629 0 : if( FD_UNLIKELY( err ) ) return err;
10630 0 : }
10631 0 : err = fd_hash_encode( &self->block_id, ctx );
10632 0 : if( FD_UNLIKELY( err ) ) return err;
10633 0 : return FD_BINCODE_SUCCESS;
10634 0 : }
10635 0 : int fd_compact_tower_sync_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10636 0 : *total_sz += sizeof(fd_compact_tower_sync_t);
10637 0 : void const * start_data = ctx->data;
10638 0 : int err = fd_compact_tower_sync_decode_footprint_inner( ctx, total_sz );
10639 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10640 0 : ctx->data = start_data;
10641 0 : return err;
10642 0 : }
10643 0 : int fd_compact_tower_sync_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10644 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10645 0 : int err = 0;
10646 0 : err = fd_bincode_uint64_decode_footprint( ctx );
10647 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10648 0 : ushort lockout_offsets_len;
10649 0 : err = fd_bincode_compact_u16_decode( &lockout_offsets_len, ctx );
10650 0 : if( FD_UNLIKELY( err ) ) return err;
10651 0 : ulong lockout_offsets_max = fd_ulong_max( lockout_offsets_len, 32 );
10652 0 : *total_sz += deq_fd_lockout_offset_t_align() + deq_fd_lockout_offset_t_footprint( lockout_offsets_max );
10653 0 : for( ulong i = 0; i < lockout_offsets_len; ++i ) {
10654 0 : err = fd_lockout_offset_decode_footprint_inner( ctx, total_sz );
10655 0 : if( FD_UNLIKELY( err ) ) return err;
10656 0 : }
10657 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
10658 0 : if( FD_UNLIKELY( err ) ) return err;
10659 0 : {
10660 0 : uchar o;
10661 0 : err = fd_bincode_bool_decode( &o, ctx );
10662 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10663 0 : if( o ) {
10664 0 : err = fd_bincode_int64_decode_footprint( ctx );
10665 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10666 0 : }
10667 0 : }
10668 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
10669 0 : if( FD_UNLIKELY( err ) ) return err;
10670 0 : return 0;
10671 0 : }
10672 0 : void * fd_compact_tower_sync_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
10673 0 : fd_compact_tower_sync_t * self = (fd_compact_tower_sync_t *)mem;
10674 0 : fd_compact_tower_sync_new( self );
10675 0 : void * alloc_region = (uchar *)mem + sizeof(fd_compact_tower_sync_t);
10676 0 : void * * alloc_mem = &alloc_region;
10677 0 : fd_compact_tower_sync_decode_inner( mem, alloc_mem, ctx );
10678 0 : return self;
10679 0 : }
10680 0 : void fd_compact_tower_sync_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
10681 0 : fd_compact_tower_sync_t * self = (fd_compact_tower_sync_t *)struct_mem;
10682 0 : fd_bincode_uint64_decode_unsafe( &self->root, ctx );
10683 0 : ushort lockout_offsets_len;
10684 0 : fd_bincode_compact_u16_decode_unsafe( &lockout_offsets_len, ctx );
10685 0 : ulong lockout_offsets_max = fd_ulong_max( lockout_offsets_len, 32 );
10686 0 : self->lockout_offsets = deq_fd_lockout_offset_t_join_new( alloc_mem, lockout_offsets_max );
10687 0 : for( ulong i=0; i < lockout_offsets_len; i++ ) {
10688 0 : fd_lockout_offset_t * elem = deq_fd_lockout_offset_t_push_tail_nocopy( self->lockout_offsets );
10689 0 : fd_lockout_offset_new( elem );
10690 0 : fd_lockout_offset_decode_inner( elem, alloc_mem, ctx );
10691 0 : }
10692 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
10693 0 : {
10694 0 : uchar o;
10695 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
10696 0 : self->has_timestamp = !!o;
10697 0 : if( o ) {
10698 0 : fd_bincode_int64_decode_unsafe( &self->timestamp, ctx );
10699 0 : }
10700 0 : }
10701 0 : fd_hash_decode_inner( &self->block_id, alloc_mem, ctx );
10702 0 : }
10703 0 : void * fd_compact_tower_sync_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
10704 0 : fd_compact_tower_sync_global_t * self = (fd_compact_tower_sync_global_t *)mem;
10705 0 : fd_compact_tower_sync_new( (fd_compact_tower_sync_t *)self );
10706 0 : void * alloc_region = (uchar *)mem + sizeof(fd_compact_tower_sync_global_t);
10707 0 : void * * alloc_mem = &alloc_region;
10708 0 : fd_compact_tower_sync_decode_inner_global( mem, alloc_mem, ctx );
10709 0 : return self;
10710 0 : }
10711 0 : void fd_compact_tower_sync_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
10712 0 : fd_compact_tower_sync_global_t * self = (fd_compact_tower_sync_global_t *)struct_mem;
10713 0 : fd_bincode_uint64_decode_unsafe( &self->root, ctx );
10714 0 : ushort lockout_offsets_len;
10715 0 : fd_bincode_compact_u16_decode_unsafe( &lockout_offsets_len, ctx );
10716 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, deq_fd_lockout_offset_t_align() );
10717 0 : ulong lockout_offsets_max = fd_ulong_max( lockout_offsets_len, 32 );
10718 0 : self->lockout_offsets_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
10719 0 : fd_lockout_offset_t * lockout_offsets = deq_fd_lockout_offset_t_join_new( alloc_mem, lockout_offsets_max );
10720 0 : for( ulong i=0; i < lockout_offsets_len; i++ ) {
10721 0 : fd_lockout_offset_t * elem = deq_fd_lockout_offset_t_push_tail_nocopy( lockout_offsets );
10722 0 : fd_lockout_offset_new( elem );
10723 0 : fd_lockout_offset_decode_inner_global( elem, alloc_mem, ctx );
10724 0 : }
10725 0 : fd_hash_decode_inner_global( &self->hash, alloc_mem, ctx );
10726 0 : {
10727 0 : uchar o;
10728 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
10729 0 : self->has_timestamp = !!o;
10730 0 : if( o ) {
10731 0 : fd_bincode_int64_decode_unsafe( &self->timestamp, ctx );
10732 0 : }
10733 0 : }
10734 0 : fd_hash_decode_inner_global( &self->block_id, alloc_mem, ctx );
10735 0 : }
10736 0 : int fd_compact_tower_sync_convert_global_to_local( void const * global_self, fd_compact_tower_sync_t * self, fd_bincode_decode_ctx_t * ctx ) {
10737 0 : int err = 0;
10738 0 : fd_compact_tower_sync_global_t const * mem = (fd_compact_tower_sync_global_t const *)global_self;
10739 0 : self->root = mem->root;
10740 0 : self->lockout_offsets = deq_fd_lockout_offset_t_join( fd_wksp_laddr_fast( ctx->wksp, mem->lockout_offsets_gaddr ) );
10741 0 : err = fd_hash_convert_global_to_local( &mem->hash, &self->hash, ctx );
10742 0 : if( FD_UNLIKELY( err ) ) return err;
10743 0 : self->timestamp = mem->timestamp;
10744 0 : self->has_timestamp = mem->has_timestamp;
10745 0 : err = fd_hash_convert_global_to_local( &mem->block_id, &self->block_id, ctx );
10746 0 : if( FD_UNLIKELY( err ) ) return err;
10747 0 : return FD_BINCODE_SUCCESS;
10748 0 : }
10749 0 : void fd_compact_tower_sync_new(fd_compact_tower_sync_t * self) {
10750 0 : fd_memset( self, 0, sizeof(fd_compact_tower_sync_t) );
10751 0 : fd_hash_new( &self->hash );
10752 0 : fd_hash_new( &self->block_id );
10753 0 : }
10754 0 : void fd_compact_tower_sync_destroy( fd_compact_tower_sync_t * self ) {
10755 0 : if( self->lockout_offsets ) {
10756 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 ) ) {
10757 0 : fd_lockout_offset_t * ele = deq_fd_lockout_offset_t_iter_ele( self->lockout_offsets, iter );
10758 0 : fd_lockout_offset_destroy( ele );
10759 0 : }
10760 0 : self->lockout_offsets = NULL;
10761 0 : }
10762 0 : fd_hash_destroy( &self->hash );
10763 0 : if( self->has_timestamp ) {
10764 0 : self->has_timestamp = 0;
10765 0 : }
10766 0 : fd_hash_destroy( &self->block_id );
10767 0 : }
10768 :
10769 0 : ulong fd_compact_tower_sync_footprint( void ){ return FD_COMPACT_TOWER_SYNC_FOOTPRINT; }
10770 0 : ulong fd_compact_tower_sync_align( void ){ return FD_COMPACT_TOWER_SYNC_ALIGN; }
10771 :
10772 0 : void fd_compact_tower_sync_walk( void * w, fd_compact_tower_sync_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
10773 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_compact_tower_sync", level++ );
10774 0 : fun( w, &self->root, "root", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
10775 :
10776 : /* Walk deque */
10777 0 : fun( w, self->lockout_offsets, "lockout_offsets", FD_FLAMENCO_TYPE_ARR, "lockout_offsets", level++ );
10778 0 : if( self->lockout_offsets ) {
10779 0 : for( deq_fd_lockout_offset_t_iter_t iter = deq_fd_lockout_offset_t_iter_init( self->lockout_offsets );
10780 0 : !deq_fd_lockout_offset_t_iter_done( self->lockout_offsets, iter );
10781 0 : iter = deq_fd_lockout_offset_t_iter_next( self->lockout_offsets, iter ) ) {
10782 0 : fd_lockout_offset_t * ele = deq_fd_lockout_offset_t_iter_ele( self->lockout_offsets, iter );
10783 0 : fd_lockout_offset_walk(w, ele, fun, "lockout_offsets", level );
10784 0 : }
10785 0 : }
10786 0 : fun( w, self->lockout_offsets, "lockout_offsets", FD_FLAMENCO_TYPE_ARR_END, "lockout_offsets", level-- );
10787 : /* Done walking deque */
10788 :
10789 0 : fd_hash_walk( w, &self->hash, fun, "hash", level );
10790 0 : if( !self->has_timestamp ) {
10791 0 : fun( w, NULL, "timestamp", FD_FLAMENCO_TYPE_NULL, "long", level );
10792 0 : } else {
10793 0 : fun( w, &self->timestamp, "timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level );
10794 0 : }
10795 0 : fd_hash_walk( w, &self->block_id, fun, "block_id", level );
10796 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_compact_tower_sync", level-- );
10797 0 : }
10798 0 : ulong fd_compact_tower_sync_size( fd_compact_tower_sync_t const * self ) {
10799 0 : ulong size = 0;
10800 0 : size += sizeof(ulong);
10801 0 : if( self->lockout_offsets ) {
10802 0 : ushort lockout_offsets_len = (ushort)deq_fd_lockout_offset_t_cnt( self->lockout_offsets );
10803 0 : size += fd_bincode_compact_u16_size( &lockout_offsets_len );
10804 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 ) ) {
10805 0 : fd_lockout_offset_t * ele = deq_fd_lockout_offset_t_iter_ele( self->lockout_offsets, iter );
10806 0 : size += fd_lockout_offset_size( ele );
10807 0 : }
10808 0 : } else {
10809 0 : size += 1;
10810 0 : }
10811 0 : size += fd_hash_size( &self->hash );
10812 0 : size += sizeof(char);
10813 0 : if( self->has_timestamp ) {
10814 0 : size += sizeof(long);
10815 0 : }
10816 0 : size += fd_hash_size( &self->block_id );
10817 0 : return size;
10818 0 : }
10819 :
10820 0 : int fd_tower_sync_convert_global_to_local( void const * global_self, fd_tower_sync_t * self, fd_bincode_decode_ctx_t * ctx ) {
10821 0 : int err = 0;
10822 0 : fd_tower_sync_global_t const * mem = (fd_tower_sync_global_t const *)global_self;
10823 0 : self->lockouts = deq_fd_vote_lockout_t_join( fd_wksp_laddr_fast( ctx->wksp, mem->lockouts_gaddr ) );
10824 0 : self->lockouts_cnt = mem->lockouts_cnt;
10825 0 : self->root = mem->root;
10826 0 : self->has_root = mem->has_root;
10827 0 : err = fd_hash_convert_global_to_local( &mem->hash, &self->hash, ctx );
10828 0 : if( FD_UNLIKELY( err ) ) return err;
10829 0 : self->timestamp = mem->timestamp;
10830 0 : self->has_timestamp = mem->has_timestamp;
10831 0 : err = fd_hash_convert_global_to_local( &mem->block_id, &self->block_id, ctx );
10832 0 : if( FD_UNLIKELY( err ) ) return err;
10833 0 : return FD_BINCODE_SUCCESS;
10834 0 : }
10835 0 : void fd_tower_sync_new(fd_tower_sync_t * self) {
10836 0 : fd_memset( self, 0, sizeof(fd_tower_sync_t) );
10837 0 : fd_hash_new( &self->hash );
10838 0 : fd_hash_new( &self->block_id );
10839 0 : }
10840 0 : void fd_tower_sync_destroy( fd_tower_sync_t * self ) {
10841 0 : if( self->lockouts ) {
10842 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 ) ) {
10843 0 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->lockouts, iter );
10844 0 : fd_vote_lockout_destroy( ele );
10845 0 : }
10846 0 : self->lockouts = NULL;
10847 0 : }
10848 0 : if( self->has_root ) {
10849 0 : self->has_root = 0;
10850 0 : }
10851 0 : fd_hash_destroy( &self->hash );
10852 0 : if( self->has_timestamp ) {
10853 0 : self->has_timestamp = 0;
10854 0 : }
10855 0 : fd_hash_destroy( &self->block_id );
10856 0 : }
10857 :
10858 0 : ulong fd_tower_sync_footprint( void ){ return FD_TOWER_SYNC_FOOTPRINT; }
10859 0 : ulong fd_tower_sync_align( void ){ return FD_TOWER_SYNC_ALIGN; }
10860 :
10861 0 : void fd_tower_sync_walk( void * w, fd_tower_sync_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
10862 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_tower_sync", level++ );
10863 :
10864 : /* Walk deque */
10865 0 : fun( w, self->lockouts, "lockouts", FD_FLAMENCO_TYPE_ARR, "lockouts", level++ );
10866 0 : if( self->lockouts ) {
10867 0 : for( deq_fd_vote_lockout_t_iter_t iter = deq_fd_vote_lockout_t_iter_init( self->lockouts );
10868 0 : !deq_fd_vote_lockout_t_iter_done( self->lockouts, iter );
10869 0 : iter = deq_fd_vote_lockout_t_iter_next( self->lockouts, iter ) ) {
10870 0 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->lockouts, iter );
10871 0 : fd_vote_lockout_walk(w, ele, fun, "lockouts", level );
10872 0 : }
10873 0 : }
10874 0 : fun( w, self->lockouts, "lockouts", FD_FLAMENCO_TYPE_ARR_END, "lockouts", level-- );
10875 : /* Done walking deque */
10876 :
10877 0 : fun( w, &self->lockouts_cnt, "lockouts_cnt", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
10878 0 : if( !self->has_root ) {
10879 0 : fun( w, NULL, "root", FD_FLAMENCO_TYPE_NULL, "ulong", level );
10880 0 : } else {
10881 0 : fun( w, &self->root, "root", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
10882 0 : }
10883 0 : fd_hash_walk( w, &self->hash, fun, "hash", level );
10884 0 : if( !self->has_timestamp ) {
10885 0 : fun( w, NULL, "timestamp", FD_FLAMENCO_TYPE_NULL, "long", level );
10886 0 : } else {
10887 0 : fun( w, &self->timestamp, "timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level );
10888 0 : }
10889 0 : fd_hash_walk( w, &self->block_id, fun, "block_id", level );
10890 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_tower_sync", level-- );
10891 0 : }
10892 0 : ulong fd_tower_sync_size( fd_tower_sync_t const * self ) {
10893 0 : ulong size = 0;
10894 0 : if( self->lockouts ) {
10895 0 : size += sizeof(ulong);
10896 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 ) ) {
10897 0 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->lockouts, iter );
10898 0 : size += fd_vote_lockout_size( ele );
10899 0 : }
10900 0 : } else {
10901 0 : size += sizeof(ulong);
10902 0 : }
10903 0 : size += sizeof(ulong);
10904 0 : size += sizeof(char);
10905 0 : if( self->has_root ) {
10906 0 : size += sizeof(ulong);
10907 0 : }
10908 0 : size += fd_hash_size( &self->hash );
10909 0 : size += sizeof(char);
10910 0 : if( self->has_timestamp ) {
10911 0 : size += sizeof(long);
10912 0 : }
10913 0 : size += fd_hash_size( &self->block_id );
10914 0 : return size;
10915 0 : }
10916 :
10917 0 : int fd_tower_sync_switch_encode( fd_tower_sync_switch_t const * self, fd_bincode_encode_ctx_t * ctx ) {
10918 0 : int err;
10919 0 : err = fd_tower_sync_encode( &self->tower_sync, ctx );
10920 0 : if( FD_UNLIKELY( err ) ) return err;
10921 0 : err = fd_hash_encode( &self->hash, ctx );
10922 0 : if( FD_UNLIKELY( err ) ) return err;
10923 0 : return FD_BINCODE_SUCCESS;
10924 0 : }
10925 0 : int fd_tower_sync_switch_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10926 0 : *total_sz += sizeof(fd_tower_sync_switch_t);
10927 0 : void const * start_data = ctx->data;
10928 0 : int err = fd_tower_sync_switch_decode_footprint_inner( ctx, total_sz );
10929 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10930 0 : ctx->data = start_data;
10931 0 : return err;
10932 0 : }
10933 0 : int fd_tower_sync_switch_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10934 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10935 0 : int err = 0;
10936 0 : err = fd_tower_sync_decode_footprint_inner( ctx, total_sz );
10937 0 : if( FD_UNLIKELY( err ) ) return err;
10938 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
10939 0 : if( FD_UNLIKELY( err ) ) return err;
10940 0 : return 0;
10941 0 : }
10942 0 : void * fd_tower_sync_switch_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
10943 0 : fd_tower_sync_switch_t * self = (fd_tower_sync_switch_t *)mem;
10944 0 : fd_tower_sync_switch_new( self );
10945 0 : void * alloc_region = (uchar *)mem + sizeof(fd_tower_sync_switch_t);
10946 0 : void * * alloc_mem = &alloc_region;
10947 0 : fd_tower_sync_switch_decode_inner( mem, alloc_mem, ctx );
10948 0 : return self;
10949 0 : }
10950 0 : void fd_tower_sync_switch_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
10951 0 : fd_tower_sync_switch_t * self = (fd_tower_sync_switch_t *)struct_mem;
10952 0 : fd_tower_sync_decode_inner( &self->tower_sync, alloc_mem, ctx );
10953 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
10954 0 : }
10955 0 : void * fd_tower_sync_switch_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
10956 0 : fd_tower_sync_switch_global_t * self = (fd_tower_sync_switch_global_t *)mem;
10957 0 : fd_tower_sync_switch_new( (fd_tower_sync_switch_t *)self );
10958 0 : void * alloc_region = (uchar *)mem + sizeof(fd_tower_sync_switch_global_t);
10959 0 : void * * alloc_mem = &alloc_region;
10960 0 : fd_tower_sync_switch_decode_inner_global( mem, alloc_mem, ctx );
10961 0 : return self;
10962 0 : }
10963 0 : void fd_tower_sync_switch_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
10964 0 : fd_tower_sync_switch_global_t * self = (fd_tower_sync_switch_global_t *)struct_mem;
10965 0 : fd_tower_sync_decode_inner_global( &self->tower_sync, alloc_mem, ctx );
10966 0 : fd_hash_decode_inner_global( &self->hash, alloc_mem, ctx );
10967 0 : }
10968 0 : int fd_tower_sync_switch_convert_global_to_local( void const * global_self, fd_tower_sync_switch_t * self, fd_bincode_decode_ctx_t * ctx ) {
10969 0 : int err = 0;
10970 0 : fd_tower_sync_switch_global_t const * mem = (fd_tower_sync_switch_global_t const *)global_self;
10971 0 : err = fd_tower_sync_convert_global_to_local( &mem->tower_sync, &self->tower_sync, ctx );
10972 0 : if( FD_UNLIKELY( err ) ) return err;
10973 0 : err = fd_hash_convert_global_to_local( &mem->hash, &self->hash, ctx );
10974 0 : if( FD_UNLIKELY( err ) ) return err;
10975 0 : return FD_BINCODE_SUCCESS;
10976 0 : }
10977 0 : void fd_tower_sync_switch_new(fd_tower_sync_switch_t * self) {
10978 0 : fd_memset( self, 0, sizeof(fd_tower_sync_switch_t) );
10979 0 : fd_tower_sync_new( &self->tower_sync );
10980 0 : fd_hash_new( &self->hash );
10981 0 : }
10982 0 : void fd_tower_sync_switch_destroy( fd_tower_sync_switch_t * self ) {
10983 0 : fd_tower_sync_destroy( &self->tower_sync );
10984 0 : fd_hash_destroy( &self->hash );
10985 0 : }
10986 :
10987 0 : ulong fd_tower_sync_switch_footprint( void ){ return FD_TOWER_SYNC_SWITCH_FOOTPRINT; }
10988 0 : ulong fd_tower_sync_switch_align( void ){ return FD_TOWER_SYNC_SWITCH_ALIGN; }
10989 :
10990 0 : void fd_tower_sync_switch_walk( void * w, fd_tower_sync_switch_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
10991 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_tower_sync_switch", level++ );
10992 0 : fd_tower_sync_walk( w, &self->tower_sync, fun, "tower_sync", level );
10993 0 : fd_hash_walk( w, &self->hash, fun, "hash", level );
10994 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_tower_sync_switch", level-- );
10995 0 : }
10996 0 : ulong fd_tower_sync_switch_size( fd_tower_sync_switch_t const * self ) {
10997 0 : ulong size = 0;
10998 0 : size += fd_tower_sync_size( &self->tower_sync );
10999 0 : size += fd_hash_size( &self->hash );
11000 0 : return size;
11001 0 : }
11002 :
11003 0 : int fd_slot_history_inner_encode( fd_slot_history_inner_t const * self, fd_bincode_encode_ctx_t * ctx ) {
11004 0 : int err;
11005 0 : err = fd_bincode_uint64_encode( self->blocks_len, ctx );
11006 0 : if( FD_UNLIKELY(err) ) return err;
11007 0 : if( self->blocks_len ) {
11008 0 : for( ulong i=0; i < self->blocks_len; i++ ) {
11009 0 : err = fd_bincode_uint64_encode( self->blocks[i], ctx );
11010 0 : }
11011 0 : }
11012 0 : return FD_BINCODE_SUCCESS;
11013 0 : }
11014 0 : int fd_slot_history_inner_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11015 0 : *total_sz += sizeof(fd_slot_history_inner_t);
11016 0 : void const * start_data = ctx->data;
11017 0 : int err = fd_slot_history_inner_decode_footprint_inner( ctx, total_sz );
11018 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11019 0 : ctx->data = start_data;
11020 0 : return err;
11021 0 : }
11022 0 : int fd_slot_history_inner_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11023 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11024 0 : int err = 0;
11025 0 : ulong blocks_len;
11026 0 : err = fd_bincode_uint64_decode( &blocks_len, ctx );
11027 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11028 0 : if( blocks_len ) {
11029 0 : *total_sz += 8UL + sizeof(ulong)*blocks_len;
11030 0 : for( ulong i=0; i < blocks_len; i++ ) {
11031 0 : err = fd_bincode_uint64_decode_footprint( ctx );
11032 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11033 0 : }
11034 0 : }
11035 0 : return 0;
11036 0 : }
11037 0 : void * fd_slot_history_inner_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
11038 0 : fd_slot_history_inner_t * self = (fd_slot_history_inner_t *)mem;
11039 0 : fd_slot_history_inner_new( self );
11040 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_history_inner_t);
11041 0 : void * * alloc_mem = &alloc_region;
11042 0 : fd_slot_history_inner_decode_inner( mem, alloc_mem, ctx );
11043 0 : return self;
11044 0 : }
11045 0 : void fd_slot_history_inner_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
11046 0 : fd_slot_history_inner_t * self = (fd_slot_history_inner_t *)struct_mem;
11047 0 : fd_bincode_uint64_decode_unsafe( &self->blocks_len, ctx );
11048 0 : if( self->blocks_len ) {
11049 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), 8UL );
11050 0 : self->blocks = *alloc_mem;
11051 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(ulong)*self->blocks_len;
11052 0 : for( ulong i=0; i < self->blocks_len; i++ ) {
11053 0 : fd_bincode_uint64_decode_unsafe( self->blocks + i, ctx );
11054 0 : }
11055 0 : } else
11056 0 : self->blocks = NULL;
11057 0 : }
11058 0 : void * fd_slot_history_inner_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
11059 0 : fd_slot_history_inner_global_t * self = (fd_slot_history_inner_global_t *)mem;
11060 0 : fd_slot_history_inner_new( (fd_slot_history_inner_t *)self );
11061 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_history_inner_global_t);
11062 0 : void * * alloc_mem = &alloc_region;
11063 0 : fd_slot_history_inner_decode_inner_global( mem, alloc_mem, ctx );
11064 0 : return self;
11065 0 : }
11066 0 : void fd_slot_history_inner_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
11067 0 : fd_slot_history_inner_global_t * self = (fd_slot_history_inner_global_t *)struct_mem;
11068 0 : fd_bincode_uint64_decode_unsafe( &self->blocks_len, ctx );
11069 0 : if( self->blocks_len ) {
11070 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), 8UL );
11071 0 : self->blocks_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
11072 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
11073 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(ulong)*self->blocks_len;
11074 0 : for( ulong i=0; i < self->blocks_len; i++ ) {
11075 0 : fd_bincode_uint64_decode_unsafe( (ulong*)(cur_mem + sizeof(ulong) * i), ctx );
11076 0 : }
11077 0 : } else
11078 0 : self->blocks_gaddr = 0UL;
11079 0 : }
11080 0 : int fd_slot_history_inner_convert_global_to_local( void const * global_self, fd_slot_history_inner_t * self, fd_bincode_decode_ctx_t * ctx ) {
11081 0 : int err = 0;
11082 0 : fd_slot_history_inner_global_t const * mem = (fd_slot_history_inner_global_t const *)global_self;
11083 0 : self->blocks_len = mem->blocks_len;
11084 0 : self->blocks = fd_wksp_laddr_fast( ctx->wksp, mem->blocks_gaddr );
11085 0 : return FD_BINCODE_SUCCESS;
11086 0 : }
11087 0 : void fd_slot_history_inner_new(fd_slot_history_inner_t * self) {
11088 0 : fd_memset( self, 0, sizeof(fd_slot_history_inner_t) );
11089 0 : }
11090 0 : void fd_slot_history_inner_destroy( fd_slot_history_inner_t * self ) {
11091 0 : if( self->blocks ) {
11092 0 : self->blocks = NULL;
11093 0 : }
11094 0 : }
11095 :
11096 0 : ulong fd_slot_history_inner_footprint( void ){ return FD_SLOT_HISTORY_INNER_FOOTPRINT; }
11097 0 : ulong fd_slot_history_inner_align( void ){ return FD_SLOT_HISTORY_INNER_ALIGN; }
11098 :
11099 0 : void fd_slot_history_inner_walk( void * w, fd_slot_history_inner_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
11100 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_slot_history_inner", level++ );
11101 0 : if( self->blocks_len ) {
11102 0 : fun( w, NULL, "blocks", FD_FLAMENCO_TYPE_ARR, "array", level++ );
11103 0 : for( ulong i=0; i < self->blocks_len; i++ )
11104 0 : fun( w, self->blocks + i, "blocks", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
11105 0 : fun( w, NULL, "blocks", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
11106 0 : }
11107 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_slot_history_inner", level-- );
11108 0 : }
11109 0 : ulong fd_slot_history_inner_size( fd_slot_history_inner_t const * self ) {
11110 0 : ulong size = 0;
11111 0 : do {
11112 0 : size += sizeof(ulong);
11113 0 : size += self->blocks_len * sizeof(ulong);
11114 0 : } while(0);
11115 0 : return size;
11116 0 : }
11117 :
11118 0 : int fd_slot_history_bitvec_encode( fd_slot_history_bitvec_t const * self, fd_bincode_encode_ctx_t * ctx ) {
11119 0 : int err;
11120 0 : if( self->bits != NULL ) {
11121 0 : err = fd_bincode_bool_encode( 1, ctx );
11122 0 : if( FD_UNLIKELY( err ) ) return err;
11123 0 : err = fd_slot_history_inner_encode( self->bits, ctx );
11124 0 : if( FD_UNLIKELY( err ) ) return err;
11125 0 : } else {
11126 0 : err = fd_bincode_bool_encode( 0, ctx );
11127 0 : if( FD_UNLIKELY( err ) ) return err;
11128 0 : }
11129 0 : err = fd_bincode_uint64_encode( self->len, ctx );
11130 0 : if( FD_UNLIKELY( err ) ) return err;
11131 0 : return FD_BINCODE_SUCCESS;
11132 0 : }
11133 0 : int fd_slot_history_bitvec_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11134 0 : *total_sz += sizeof(fd_slot_history_bitvec_t);
11135 0 : void const * start_data = ctx->data;
11136 0 : int err = fd_slot_history_bitvec_decode_footprint_inner( ctx, total_sz );
11137 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11138 0 : ctx->data = start_data;
11139 0 : return err;
11140 0 : }
11141 0 : int fd_slot_history_bitvec_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11142 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11143 0 : int err = 0;
11144 0 : {
11145 0 : uchar o;
11146 0 : err = fd_bincode_bool_decode( &o, ctx );
11147 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11148 0 : if( o ) {
11149 0 : *total_sz += FD_SLOT_HISTORY_INNER_ALIGN + FD_SLOT_HISTORY_INNER_FOOTPRINT;
11150 0 : err = fd_slot_history_inner_decode_footprint_inner( ctx, total_sz );
11151 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11152 0 : }
11153 0 : }
11154 0 : err = fd_bincode_uint64_decode_footprint( ctx );
11155 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11156 0 : return 0;
11157 0 : }
11158 0 : void * fd_slot_history_bitvec_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
11159 0 : fd_slot_history_bitvec_t * self = (fd_slot_history_bitvec_t *)mem;
11160 0 : fd_slot_history_bitvec_new( self );
11161 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_history_bitvec_t);
11162 0 : void * * alloc_mem = &alloc_region;
11163 0 : fd_slot_history_bitvec_decode_inner( mem, alloc_mem, ctx );
11164 0 : return self;
11165 0 : }
11166 0 : void fd_slot_history_bitvec_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
11167 0 : fd_slot_history_bitvec_t * self = (fd_slot_history_bitvec_t *)struct_mem;
11168 0 : {
11169 0 : uchar o;
11170 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
11171 0 : if( o ) {
11172 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, FD_SLOT_HISTORY_INNER_ALIGN );
11173 0 : self->bits = *alloc_mem;
11174 0 : *alloc_mem = (uchar *)*alloc_mem + FD_SLOT_HISTORY_INNER_FOOTPRINT;
11175 0 : fd_slot_history_inner_new( self->bits );
11176 0 : fd_slot_history_inner_decode_inner( self->bits, alloc_mem, ctx );
11177 0 : } else {
11178 0 : self->bits = NULL;
11179 0 : }
11180 0 : }
11181 0 : fd_bincode_uint64_decode_unsafe( &self->len, ctx );
11182 0 : }
11183 0 : void * fd_slot_history_bitvec_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
11184 0 : fd_slot_history_bitvec_global_t * self = (fd_slot_history_bitvec_global_t *)mem;
11185 0 : fd_slot_history_bitvec_new( (fd_slot_history_bitvec_t *)self );
11186 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_history_bitvec_global_t);
11187 0 : void * * alloc_mem = &alloc_region;
11188 0 : fd_slot_history_bitvec_decode_inner_global( mem, alloc_mem, ctx );
11189 0 : return self;
11190 0 : }
11191 0 : void fd_slot_history_bitvec_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
11192 0 : fd_slot_history_bitvec_global_t * self = (fd_slot_history_bitvec_global_t *)struct_mem;
11193 0 : {
11194 0 : uchar o;
11195 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
11196 0 : if( o ) {
11197 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, FD_SLOT_HISTORY_INNER_ALIGN );
11198 0 : self->bits_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
11199 0 : fd_slot_history_inner_new( *alloc_mem );
11200 0 : *alloc_mem = (uchar *)*alloc_mem + FD_SLOT_HISTORY_INNER_FOOTPRINT;
11201 0 : fd_slot_history_inner_decode_inner_global( fd_wksp_laddr_fast( ctx->wksp, self->bits_gaddr ), alloc_mem, ctx );
11202 0 : } else {
11203 0 : self->bits_gaddr = 0UL;
11204 0 : }
11205 0 : }
11206 0 : fd_bincode_uint64_decode_unsafe( &self->len, ctx );
11207 0 : }
11208 0 : int fd_slot_history_bitvec_convert_global_to_local( void const * global_self, fd_slot_history_bitvec_t * self, fd_bincode_decode_ctx_t * ctx ) {
11209 0 : int err = 0;
11210 0 : fd_slot_history_bitvec_global_t const * mem = (fd_slot_history_bitvec_global_t const *)global_self;
11211 0 : self->bits = fd_wksp_laddr_fast( ctx->wksp, mem->bits_gaddr );
11212 0 : self->len = mem->len;
11213 0 : return FD_BINCODE_SUCCESS;
11214 0 : }
11215 0 : void fd_slot_history_bitvec_new(fd_slot_history_bitvec_t * self) {
11216 0 : fd_memset( self, 0, sizeof(fd_slot_history_bitvec_t) );
11217 0 : }
11218 0 : void fd_slot_history_bitvec_destroy( fd_slot_history_bitvec_t * self ) {
11219 0 : if( self->bits ) {
11220 0 : fd_slot_history_inner_destroy( self->bits );
11221 0 : self->bits = NULL;
11222 0 : }
11223 0 : }
11224 :
11225 0 : ulong fd_slot_history_bitvec_footprint( void ){ return FD_SLOT_HISTORY_BITVEC_FOOTPRINT; }
11226 0 : ulong fd_slot_history_bitvec_align( void ){ return FD_SLOT_HISTORY_BITVEC_ALIGN; }
11227 :
11228 0 : void fd_slot_history_bitvec_walk( void * w, fd_slot_history_bitvec_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
11229 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_slot_history_bitvec", level++ );
11230 0 : if( !self->bits ) {
11231 0 : fun( w, NULL, "bits", FD_FLAMENCO_TYPE_NULL, "slot_history_inner", level );
11232 0 : } else {
11233 0 : fd_slot_history_inner_walk( w, self->bits, fun, "bits", level );
11234 0 : }
11235 0 : fun( w, &self->len, "len", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
11236 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_slot_history_bitvec", level-- );
11237 0 : }
11238 0 : ulong fd_slot_history_bitvec_size( fd_slot_history_bitvec_t const * self ) {
11239 0 : ulong size = 0;
11240 0 : size += sizeof(char);
11241 0 : if( NULL != self->bits ) {
11242 0 : size += fd_slot_history_inner_size( self->bits );
11243 0 : }
11244 0 : size += sizeof(ulong);
11245 0 : return size;
11246 0 : }
11247 :
11248 0 : int fd_slot_history_encode( fd_slot_history_t const * self, fd_bincode_encode_ctx_t * ctx ) {
11249 0 : int err;
11250 0 : err = fd_slot_history_bitvec_encode( &self->bits, ctx );
11251 0 : if( FD_UNLIKELY( err ) ) return err;
11252 0 : err = fd_bincode_uint64_encode( self->next_slot, ctx );
11253 0 : if( FD_UNLIKELY( err ) ) return err;
11254 0 : return FD_BINCODE_SUCCESS;
11255 0 : }
11256 0 : int fd_slot_history_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11257 0 : *total_sz += sizeof(fd_slot_history_t);
11258 0 : void const * start_data = ctx->data;
11259 0 : int err = fd_slot_history_decode_footprint_inner( ctx, total_sz );
11260 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11261 0 : ctx->data = start_data;
11262 0 : return err;
11263 0 : }
11264 0 : int fd_slot_history_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11265 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11266 0 : int err = 0;
11267 0 : err = fd_slot_history_bitvec_decode_footprint_inner( ctx, total_sz );
11268 0 : if( FD_UNLIKELY( err ) ) return err;
11269 0 : err = fd_bincode_uint64_decode_footprint( ctx );
11270 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11271 0 : return 0;
11272 0 : }
11273 0 : void * fd_slot_history_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
11274 0 : fd_slot_history_t * self = (fd_slot_history_t *)mem;
11275 0 : fd_slot_history_new( self );
11276 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_history_t);
11277 0 : void * * alloc_mem = &alloc_region;
11278 0 : fd_slot_history_decode_inner( mem, alloc_mem, ctx );
11279 0 : return self;
11280 0 : }
11281 0 : void fd_slot_history_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
11282 0 : fd_slot_history_t * self = (fd_slot_history_t *)struct_mem;
11283 0 : fd_slot_history_bitvec_decode_inner( &self->bits, alloc_mem, ctx );
11284 0 : fd_bincode_uint64_decode_unsafe( &self->next_slot, ctx );
11285 0 : }
11286 0 : void * fd_slot_history_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
11287 0 : fd_slot_history_global_t * self = (fd_slot_history_global_t *)mem;
11288 0 : fd_slot_history_new( (fd_slot_history_t *)self );
11289 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_history_global_t);
11290 0 : void * * alloc_mem = &alloc_region;
11291 0 : fd_slot_history_decode_inner_global( mem, alloc_mem, ctx );
11292 0 : return self;
11293 0 : }
11294 0 : void fd_slot_history_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
11295 0 : fd_slot_history_global_t * self = (fd_slot_history_global_t *)struct_mem;
11296 0 : fd_slot_history_bitvec_decode_inner_global( &self->bits, alloc_mem, ctx );
11297 0 : fd_bincode_uint64_decode_unsafe( &self->next_slot, ctx );
11298 0 : }
11299 0 : int fd_slot_history_convert_global_to_local( void const * global_self, fd_slot_history_t * self, fd_bincode_decode_ctx_t * ctx ) {
11300 0 : int err = 0;
11301 0 : fd_slot_history_global_t const * mem = (fd_slot_history_global_t const *)global_self;
11302 0 : err = fd_slot_history_bitvec_convert_global_to_local( &mem->bits, &self->bits, ctx );
11303 0 : if( FD_UNLIKELY( err ) ) return err;
11304 0 : self->next_slot = mem->next_slot;
11305 0 : return FD_BINCODE_SUCCESS;
11306 0 : }
11307 0 : void fd_slot_history_new(fd_slot_history_t * self) {
11308 0 : fd_memset( self, 0, sizeof(fd_slot_history_t) );
11309 0 : fd_slot_history_bitvec_new( &self->bits );
11310 0 : }
11311 0 : void fd_slot_history_destroy( fd_slot_history_t * self ) {
11312 0 : fd_slot_history_bitvec_destroy( &self->bits );
11313 0 : }
11314 :
11315 0 : ulong fd_slot_history_footprint( void ){ return FD_SLOT_HISTORY_FOOTPRINT; }
11316 0 : ulong fd_slot_history_align( void ){ return FD_SLOT_HISTORY_ALIGN; }
11317 :
11318 0 : void fd_slot_history_walk( void * w, fd_slot_history_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
11319 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_slot_history", level++ );
11320 0 : fd_slot_history_bitvec_walk( w, &self->bits, fun, "bits", level );
11321 0 : fun( w, &self->next_slot, "next_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
11322 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_slot_history", level-- );
11323 0 : }
11324 0 : ulong fd_slot_history_size( fd_slot_history_t const * self ) {
11325 0 : ulong size = 0;
11326 0 : size += fd_slot_history_bitvec_size( &self->bits );
11327 0 : size += sizeof(ulong);
11328 0 : return size;
11329 0 : }
11330 :
11331 0 : int fd_slot_hash_encode( fd_slot_hash_t const * self, fd_bincode_encode_ctx_t * ctx ) {
11332 0 : int err;
11333 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
11334 0 : if( FD_UNLIKELY( err ) ) return err;
11335 0 : err = fd_hash_encode( &self->hash, ctx );
11336 0 : if( FD_UNLIKELY( err ) ) return err;
11337 0 : return FD_BINCODE_SUCCESS;
11338 0 : }
11339 0 : int fd_slot_hash_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11340 0 : *total_sz += sizeof(fd_slot_hash_t);
11341 0 : void const * start_data = ctx->data;
11342 0 : int err = fd_slot_hash_decode_footprint_inner( ctx, total_sz );
11343 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11344 0 : ctx->data = start_data;
11345 0 : return err;
11346 0 : }
11347 3 : int fd_slot_hash_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11348 3 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11349 3 : int err = 0;
11350 3 : err = fd_bincode_uint64_decode_footprint( ctx );
11351 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11352 3 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
11353 3 : if( FD_UNLIKELY( err ) ) return err;
11354 3 : return 0;
11355 3 : }
11356 0 : void * fd_slot_hash_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
11357 0 : fd_slot_hash_t * self = (fd_slot_hash_t *)mem;
11358 0 : fd_slot_hash_new( self );
11359 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_hash_t);
11360 0 : void * * alloc_mem = &alloc_region;
11361 0 : fd_slot_hash_decode_inner( mem, alloc_mem, ctx );
11362 0 : return self;
11363 0 : }
11364 3 : void fd_slot_hash_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
11365 3 : fd_slot_hash_t * self = (fd_slot_hash_t *)struct_mem;
11366 3 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
11367 3 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
11368 3 : }
11369 0 : void * fd_slot_hash_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
11370 0 : fd_slot_hash_global_t * self = (fd_slot_hash_global_t *)mem;
11371 0 : fd_slot_hash_new( (fd_slot_hash_t *)self );
11372 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_hash_global_t);
11373 0 : void * * alloc_mem = &alloc_region;
11374 0 : fd_slot_hash_decode_inner_global( mem, alloc_mem, ctx );
11375 0 : return self;
11376 0 : }
11377 0 : void fd_slot_hash_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
11378 0 : fd_slot_hash_global_t * self = (fd_slot_hash_global_t *)struct_mem;
11379 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
11380 0 : fd_hash_decode_inner_global( &self->hash, alloc_mem, ctx );
11381 0 : }
11382 0 : int fd_slot_hash_convert_global_to_local( void const * global_self, fd_slot_hash_t * self, fd_bincode_decode_ctx_t * ctx ) {
11383 0 : int err = 0;
11384 0 : fd_slot_hash_global_t const * mem = (fd_slot_hash_global_t const *)global_self;
11385 0 : self->slot = mem->slot;
11386 0 : err = fd_hash_convert_global_to_local( &mem->hash, &self->hash, ctx );
11387 0 : if( FD_UNLIKELY( err ) ) return err;
11388 0 : return FD_BINCODE_SUCCESS;
11389 0 : }
11390 3 : void fd_slot_hash_new(fd_slot_hash_t * self) {
11391 3 : fd_memset( self, 0, sizeof(fd_slot_hash_t) );
11392 3 : fd_hash_new( &self->hash );
11393 3 : }
11394 0 : void fd_slot_hash_destroy( fd_slot_hash_t * self ) {
11395 0 : fd_hash_destroy( &self->hash );
11396 0 : }
11397 :
11398 0 : ulong fd_slot_hash_footprint( void ){ return FD_SLOT_HASH_FOOTPRINT; }
11399 0 : ulong fd_slot_hash_align( void ){ return FD_SLOT_HASH_ALIGN; }
11400 :
11401 3 : void fd_slot_hash_walk( void * w, fd_slot_hash_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
11402 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_slot_hash", level++ );
11403 3 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
11404 3 : fd_hash_walk( w, &self->hash, fun, "hash", level );
11405 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_slot_hash", level-- );
11406 3 : }
11407 0 : ulong fd_slot_hash_size( fd_slot_hash_t const * self ) {
11408 0 : ulong size = 0;
11409 0 : size += sizeof(ulong);
11410 0 : size += fd_hash_size( &self->hash );
11411 0 : return size;
11412 0 : }
11413 :
11414 0 : int fd_slot_hashes_encode( fd_slot_hashes_t const * self, fd_bincode_encode_ctx_t * ctx ) {
11415 0 : int err;
11416 0 : if( self->hashes ) {
11417 0 : ulong hashes_len = deq_fd_slot_hash_t_cnt( self->hashes );
11418 0 : err = fd_bincode_uint64_encode( hashes_len, ctx );
11419 0 : if( FD_UNLIKELY( err ) ) return err;
11420 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 ) ) {
11421 0 : fd_slot_hash_t const * ele = deq_fd_slot_hash_t_iter_ele_const( self->hashes, iter );
11422 0 : err = fd_slot_hash_encode( ele, ctx );
11423 0 : if( FD_UNLIKELY( err ) ) return err;
11424 0 : }
11425 0 : } else {
11426 0 : ulong hashes_len = 0;
11427 0 : err = fd_bincode_uint64_encode( hashes_len, ctx );
11428 0 : if( FD_UNLIKELY( err ) ) return err;
11429 0 : }
11430 0 : return FD_BINCODE_SUCCESS;
11431 0 : }
11432 0 : int fd_slot_hashes_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11433 0 : *total_sz += sizeof(fd_slot_hashes_t);
11434 0 : void const * start_data = ctx->data;
11435 0 : int err = fd_slot_hashes_decode_footprint_inner( ctx, total_sz );
11436 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11437 0 : ctx->data = start_data;
11438 0 : return err;
11439 0 : }
11440 0 : int fd_slot_hashes_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11441 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11442 0 : int err = 0;
11443 0 : ulong hashes_len;
11444 0 : err = fd_bincode_uint64_decode( &hashes_len, ctx );
11445 0 : if( FD_UNLIKELY( err ) ) return err;
11446 0 : ulong hashes_max = fd_ulong_max( hashes_len, 512 );
11447 0 : *total_sz += deq_fd_slot_hash_t_align() + deq_fd_slot_hash_t_footprint( hashes_max );
11448 0 : ulong hashes_sz;
11449 0 : if( FD_UNLIKELY( __builtin_umull_overflow( hashes_len, 40, &hashes_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
11450 0 : err = fd_bincode_bytes_decode_footprint( hashes_sz, ctx );
11451 0 : if( FD_UNLIKELY( err ) ) return err;
11452 0 : return 0;
11453 0 : }
11454 0 : void * fd_slot_hashes_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
11455 0 : fd_slot_hashes_t * self = (fd_slot_hashes_t *)mem;
11456 0 : fd_slot_hashes_new( self );
11457 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_hashes_t);
11458 0 : void * * alloc_mem = &alloc_region;
11459 0 : fd_slot_hashes_decode_inner( mem, alloc_mem, ctx );
11460 0 : return self;
11461 0 : }
11462 0 : void fd_slot_hashes_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
11463 0 : fd_slot_hashes_t * self = (fd_slot_hashes_t *)struct_mem;
11464 0 : ulong hashes_len;
11465 0 : fd_bincode_uint64_decode_unsafe( &hashes_len, ctx );
11466 0 : ulong hashes_max = fd_ulong_max( hashes_len, 512 );
11467 0 : self->hashes = deq_fd_slot_hash_t_join_new( alloc_mem, hashes_max );
11468 0 : for( ulong i=0; i < hashes_len; i++ ) {
11469 0 : fd_slot_hash_t * elem = deq_fd_slot_hash_t_push_tail_nocopy( self->hashes );
11470 0 : fd_slot_hash_new( elem );
11471 0 : fd_slot_hash_decode_inner( elem, alloc_mem, ctx );
11472 0 : }
11473 0 : }
11474 0 : void * fd_slot_hashes_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
11475 0 : fd_slot_hashes_global_t * self = (fd_slot_hashes_global_t *)mem;
11476 0 : fd_slot_hashes_new( (fd_slot_hashes_t *)self );
11477 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_hashes_global_t);
11478 0 : void * * alloc_mem = &alloc_region;
11479 0 : fd_slot_hashes_decode_inner_global( mem, alloc_mem, ctx );
11480 0 : return self;
11481 0 : }
11482 0 : void fd_slot_hashes_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
11483 0 : fd_slot_hashes_global_t * self = (fd_slot_hashes_global_t *)struct_mem;
11484 0 : ulong hashes_len;
11485 0 : fd_bincode_uint64_decode_unsafe( &hashes_len, ctx );
11486 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, deq_fd_slot_hash_t_align() );
11487 0 : ulong hashes_max = fd_ulong_max( hashes_len, 512 );
11488 0 : self->hashes_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
11489 0 : fd_slot_hash_t * hashes = deq_fd_slot_hash_t_join_new( alloc_mem, hashes_max );
11490 0 : for( ulong i=0; i < hashes_len; i++ ) {
11491 0 : fd_slot_hash_t * elem = deq_fd_slot_hash_t_push_tail_nocopy( hashes );
11492 0 : fd_slot_hash_new( elem );
11493 0 : fd_slot_hash_decode_inner_global( elem, alloc_mem, ctx );
11494 0 : }
11495 0 : }
11496 0 : int fd_slot_hashes_convert_global_to_local( void const * global_self, fd_slot_hashes_t * self, fd_bincode_decode_ctx_t * ctx ) {
11497 0 : int err = 0;
11498 0 : fd_slot_hashes_global_t const * mem = (fd_slot_hashes_global_t const *)global_self;
11499 0 : self->hashes = deq_fd_slot_hash_t_join( fd_wksp_laddr_fast( ctx->wksp, mem->hashes_gaddr ) );
11500 0 : return FD_BINCODE_SUCCESS;
11501 0 : }
11502 0 : void fd_slot_hashes_new(fd_slot_hashes_t * self) {
11503 0 : fd_memset( self, 0, sizeof(fd_slot_hashes_t) );
11504 0 : }
11505 0 : void fd_slot_hashes_destroy( fd_slot_hashes_t * self ) {
11506 0 : if( self->hashes ) {
11507 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 ) ) {
11508 0 : fd_slot_hash_t * ele = deq_fd_slot_hash_t_iter_ele( self->hashes, iter );
11509 0 : fd_slot_hash_destroy( ele );
11510 0 : }
11511 0 : self->hashes = NULL;
11512 0 : }
11513 0 : }
11514 :
11515 0 : ulong fd_slot_hashes_footprint( void ){ return FD_SLOT_HASHES_FOOTPRINT; }
11516 0 : ulong fd_slot_hashes_align( void ){ return FD_SLOT_HASHES_ALIGN; }
11517 :
11518 0 : void fd_slot_hashes_walk( void * w, fd_slot_hashes_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
11519 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_slot_hashes", level++ );
11520 :
11521 : /* Walk deque */
11522 0 : fun( w, self->hashes, "hashes", FD_FLAMENCO_TYPE_ARR, "hashes", level++ );
11523 0 : if( self->hashes ) {
11524 0 : for( deq_fd_slot_hash_t_iter_t iter = deq_fd_slot_hash_t_iter_init( self->hashes );
11525 0 : !deq_fd_slot_hash_t_iter_done( self->hashes, iter );
11526 0 : iter = deq_fd_slot_hash_t_iter_next( self->hashes, iter ) ) {
11527 0 : fd_slot_hash_t * ele = deq_fd_slot_hash_t_iter_ele( self->hashes, iter );
11528 0 : fd_slot_hash_walk(w, ele, fun, "hashes", level );
11529 0 : }
11530 0 : }
11531 0 : fun( w, self->hashes, "hashes", FD_FLAMENCO_TYPE_ARR_END, "hashes", level-- );
11532 : /* Done walking deque */
11533 :
11534 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_slot_hashes", level-- );
11535 0 : }
11536 0 : ulong fd_slot_hashes_size( fd_slot_hashes_t const * self ) {
11537 0 : ulong size = 0;
11538 0 : if( self->hashes ) {
11539 0 : size += sizeof(ulong);
11540 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 ) ) {
11541 0 : fd_slot_hash_t * ele = deq_fd_slot_hash_t_iter_ele( self->hashes, iter );
11542 0 : size += fd_slot_hash_size( ele );
11543 0 : }
11544 0 : } else {
11545 0 : size += sizeof(ulong);
11546 0 : }
11547 0 : return size;
11548 0 : }
11549 :
11550 0 : int fd_block_block_hash_entry_encode( fd_block_block_hash_entry_t const * self, fd_bincode_encode_ctx_t * ctx ) {
11551 0 : int err;
11552 0 : err = fd_hash_encode( &self->blockhash, ctx );
11553 0 : if( FD_UNLIKELY( err ) ) return err;
11554 0 : err = fd_fee_calculator_encode( &self->fee_calculator, ctx );
11555 0 : if( FD_UNLIKELY( err ) ) return err;
11556 0 : return FD_BINCODE_SUCCESS;
11557 0 : }
11558 0 : int fd_block_block_hash_entry_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11559 0 : *total_sz += sizeof(fd_block_block_hash_entry_t);
11560 0 : void const * start_data = ctx->data;
11561 0 : int err = fd_block_block_hash_entry_decode_footprint_inner( ctx, total_sz );
11562 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11563 0 : ctx->data = start_data;
11564 0 : return err;
11565 0 : }
11566 0 : int fd_block_block_hash_entry_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11567 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11568 0 : int err = 0;
11569 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
11570 0 : if( FD_UNLIKELY( err ) ) return err;
11571 0 : err = fd_fee_calculator_decode_footprint_inner( ctx, total_sz );
11572 0 : if( FD_UNLIKELY( err ) ) return err;
11573 0 : return 0;
11574 0 : }
11575 0 : void * fd_block_block_hash_entry_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
11576 0 : fd_block_block_hash_entry_t * self = (fd_block_block_hash_entry_t *)mem;
11577 0 : fd_block_block_hash_entry_new( self );
11578 0 : void * alloc_region = (uchar *)mem + sizeof(fd_block_block_hash_entry_t);
11579 0 : void * * alloc_mem = &alloc_region;
11580 0 : fd_block_block_hash_entry_decode_inner( mem, alloc_mem, ctx );
11581 0 : return self;
11582 0 : }
11583 0 : void fd_block_block_hash_entry_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
11584 0 : fd_block_block_hash_entry_t * self = (fd_block_block_hash_entry_t *)struct_mem;
11585 0 : fd_hash_decode_inner( &self->blockhash, alloc_mem, ctx );
11586 0 : fd_fee_calculator_decode_inner( &self->fee_calculator, alloc_mem, ctx );
11587 0 : }
11588 0 : void * fd_block_block_hash_entry_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
11589 0 : fd_block_block_hash_entry_global_t * self = (fd_block_block_hash_entry_global_t *)mem;
11590 0 : fd_block_block_hash_entry_new( (fd_block_block_hash_entry_t *)self );
11591 0 : void * alloc_region = (uchar *)mem + sizeof(fd_block_block_hash_entry_global_t);
11592 0 : void * * alloc_mem = &alloc_region;
11593 0 : fd_block_block_hash_entry_decode_inner_global( mem, alloc_mem, ctx );
11594 0 : return self;
11595 0 : }
11596 0 : void fd_block_block_hash_entry_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
11597 0 : fd_block_block_hash_entry_global_t * self = (fd_block_block_hash_entry_global_t *)struct_mem;
11598 0 : fd_hash_decode_inner_global( &self->blockhash, alloc_mem, ctx );
11599 0 : fd_fee_calculator_decode_inner_global( &self->fee_calculator, alloc_mem, ctx );
11600 0 : }
11601 0 : int fd_block_block_hash_entry_convert_global_to_local( void const * global_self, fd_block_block_hash_entry_t * self, fd_bincode_decode_ctx_t * ctx ) {
11602 0 : int err = 0;
11603 0 : fd_block_block_hash_entry_global_t const * mem = (fd_block_block_hash_entry_global_t const *)global_self;
11604 0 : err = fd_hash_convert_global_to_local( &mem->blockhash, &self->blockhash, ctx );
11605 0 : if( FD_UNLIKELY( err ) ) return err;
11606 0 : err = fd_fee_calculator_convert_global_to_local( &mem->fee_calculator, &self->fee_calculator, ctx );
11607 0 : if( FD_UNLIKELY( err ) ) return err;
11608 0 : return FD_BINCODE_SUCCESS;
11609 0 : }
11610 0 : void fd_block_block_hash_entry_new(fd_block_block_hash_entry_t * self) {
11611 0 : fd_memset( self, 0, sizeof(fd_block_block_hash_entry_t) );
11612 0 : fd_hash_new( &self->blockhash );
11613 0 : fd_fee_calculator_new( &self->fee_calculator );
11614 0 : }
11615 0 : void fd_block_block_hash_entry_destroy( fd_block_block_hash_entry_t * self ) {
11616 0 : fd_hash_destroy( &self->blockhash );
11617 0 : fd_fee_calculator_destroy( &self->fee_calculator );
11618 0 : }
11619 :
11620 0 : ulong fd_block_block_hash_entry_footprint( void ){ return FD_BLOCK_BLOCK_HASH_ENTRY_FOOTPRINT; }
11621 0 : ulong fd_block_block_hash_entry_align( void ){ return FD_BLOCK_BLOCK_HASH_ENTRY_ALIGN; }
11622 :
11623 0 : void fd_block_block_hash_entry_walk( void * w, fd_block_block_hash_entry_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
11624 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_block_block_hash_entry", level++ );
11625 0 : fd_hash_walk( w, &self->blockhash, fun, "blockhash", level );
11626 0 : fd_fee_calculator_walk( w, &self->fee_calculator, fun, "fee_calculator", level );
11627 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_block_block_hash_entry", level-- );
11628 0 : }
11629 0 : ulong fd_block_block_hash_entry_size( fd_block_block_hash_entry_t const * self ) {
11630 0 : ulong size = 0;
11631 0 : size += fd_hash_size( &self->blockhash );
11632 0 : size += fd_fee_calculator_size( &self->fee_calculator );
11633 0 : return size;
11634 0 : }
11635 :
11636 0 : int fd_recent_block_hashes_encode( fd_recent_block_hashes_t const * self, fd_bincode_encode_ctx_t * ctx ) {
11637 0 : int err;
11638 0 : if( self->hashes ) {
11639 0 : ulong hashes_len = deq_fd_block_block_hash_entry_t_cnt( self->hashes );
11640 0 : err = fd_bincode_uint64_encode( hashes_len, ctx );
11641 0 : if( FD_UNLIKELY( err ) ) return err;
11642 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 ) ) {
11643 0 : fd_block_block_hash_entry_t const * ele = deq_fd_block_block_hash_entry_t_iter_ele_const( self->hashes, iter );
11644 0 : err = fd_block_block_hash_entry_encode( ele, ctx );
11645 0 : if( FD_UNLIKELY( err ) ) return err;
11646 0 : }
11647 0 : } else {
11648 0 : ulong hashes_len = 0;
11649 0 : err = fd_bincode_uint64_encode( hashes_len, ctx );
11650 0 : if( FD_UNLIKELY( err ) ) return err;
11651 0 : }
11652 0 : return FD_BINCODE_SUCCESS;
11653 0 : }
11654 0 : int fd_recent_block_hashes_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11655 0 : *total_sz += sizeof(fd_recent_block_hashes_t);
11656 0 : void const * start_data = ctx->data;
11657 0 : int err = fd_recent_block_hashes_decode_footprint_inner( ctx, total_sz );
11658 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11659 0 : ctx->data = start_data;
11660 0 : return err;
11661 0 : }
11662 0 : int fd_recent_block_hashes_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11663 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11664 0 : int err = 0;
11665 0 : ulong hashes_len;
11666 0 : err = fd_bincode_uint64_decode( &hashes_len, ctx );
11667 0 : if( FD_UNLIKELY( err ) ) return err;
11668 0 : ulong hashes_max = fd_ulong_max( hashes_len, 151 );
11669 0 : *total_sz += deq_fd_block_block_hash_entry_t_align() + deq_fd_block_block_hash_entry_t_footprint( hashes_max );
11670 0 : ulong hashes_sz;
11671 0 : if( FD_UNLIKELY( __builtin_umull_overflow( hashes_len, 40, &hashes_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
11672 0 : err = fd_bincode_bytes_decode_footprint( hashes_sz, ctx );
11673 0 : if( FD_UNLIKELY( err ) ) return err;
11674 0 : return 0;
11675 0 : }
11676 0 : void * fd_recent_block_hashes_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
11677 0 : fd_recent_block_hashes_t * self = (fd_recent_block_hashes_t *)mem;
11678 0 : fd_recent_block_hashes_new( self );
11679 0 : void * alloc_region = (uchar *)mem + sizeof(fd_recent_block_hashes_t);
11680 0 : void * * alloc_mem = &alloc_region;
11681 0 : fd_recent_block_hashes_decode_inner( mem, alloc_mem, ctx );
11682 0 : return self;
11683 0 : }
11684 0 : void fd_recent_block_hashes_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
11685 0 : fd_recent_block_hashes_t * self = (fd_recent_block_hashes_t *)struct_mem;
11686 0 : ulong hashes_len;
11687 0 : fd_bincode_uint64_decode_unsafe( &hashes_len, ctx );
11688 0 : ulong hashes_max = fd_ulong_max( hashes_len, 151 );
11689 0 : self->hashes = deq_fd_block_block_hash_entry_t_join_new( alloc_mem, hashes_max );
11690 0 : for( ulong i=0; i < hashes_len; i++ ) {
11691 0 : fd_block_block_hash_entry_t * elem = deq_fd_block_block_hash_entry_t_push_tail_nocopy( self->hashes );
11692 0 : fd_block_block_hash_entry_new( elem );
11693 0 : fd_block_block_hash_entry_decode_inner( elem, alloc_mem, ctx );
11694 0 : }
11695 0 : }
11696 0 : void * fd_recent_block_hashes_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
11697 0 : fd_recent_block_hashes_global_t * self = (fd_recent_block_hashes_global_t *)mem;
11698 0 : fd_recent_block_hashes_new( (fd_recent_block_hashes_t *)self );
11699 0 : void * alloc_region = (uchar *)mem + sizeof(fd_recent_block_hashes_global_t);
11700 0 : void * * alloc_mem = &alloc_region;
11701 0 : fd_recent_block_hashes_decode_inner_global( mem, alloc_mem, ctx );
11702 0 : return self;
11703 0 : }
11704 0 : void fd_recent_block_hashes_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
11705 0 : fd_recent_block_hashes_global_t * self = (fd_recent_block_hashes_global_t *)struct_mem;
11706 0 : ulong hashes_len;
11707 0 : fd_bincode_uint64_decode_unsafe( &hashes_len, ctx );
11708 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, deq_fd_block_block_hash_entry_t_align() );
11709 0 : ulong hashes_max = fd_ulong_max( hashes_len, 151 );
11710 0 : self->hashes_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
11711 0 : fd_block_block_hash_entry_t * hashes = deq_fd_block_block_hash_entry_t_join_new( alloc_mem, hashes_max );
11712 0 : for( ulong i=0; i < hashes_len; i++ ) {
11713 0 : fd_block_block_hash_entry_t * elem = deq_fd_block_block_hash_entry_t_push_tail_nocopy( hashes );
11714 0 : fd_block_block_hash_entry_new( elem );
11715 0 : fd_block_block_hash_entry_decode_inner_global( elem, alloc_mem, ctx );
11716 0 : }
11717 0 : }
11718 0 : int fd_recent_block_hashes_convert_global_to_local( void const * global_self, fd_recent_block_hashes_t * self, fd_bincode_decode_ctx_t * ctx ) {
11719 0 : int err = 0;
11720 0 : fd_recent_block_hashes_global_t const * mem = (fd_recent_block_hashes_global_t const *)global_self;
11721 0 : self->hashes = deq_fd_block_block_hash_entry_t_join( fd_wksp_laddr_fast( ctx->wksp, mem->hashes_gaddr ) );
11722 0 : return FD_BINCODE_SUCCESS;
11723 0 : }
11724 0 : void fd_recent_block_hashes_new(fd_recent_block_hashes_t * self) {
11725 0 : fd_memset( self, 0, sizeof(fd_recent_block_hashes_t) );
11726 0 : }
11727 0 : void fd_recent_block_hashes_destroy( fd_recent_block_hashes_t * self ) {
11728 0 : if( self->hashes ) {
11729 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 ) ) {
11730 0 : fd_block_block_hash_entry_t * ele = deq_fd_block_block_hash_entry_t_iter_ele( self->hashes, iter );
11731 0 : fd_block_block_hash_entry_destroy( ele );
11732 0 : }
11733 0 : self->hashes = NULL;
11734 0 : }
11735 0 : }
11736 :
11737 0 : ulong fd_recent_block_hashes_footprint( void ){ return FD_RECENT_BLOCK_HASHES_FOOTPRINT; }
11738 0 : ulong fd_recent_block_hashes_align( void ){ return FD_RECENT_BLOCK_HASHES_ALIGN; }
11739 :
11740 0 : void fd_recent_block_hashes_walk( void * w, fd_recent_block_hashes_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
11741 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_recent_block_hashes", level++ );
11742 :
11743 : /* Walk deque */
11744 0 : fun( w, self->hashes, "hashes", FD_FLAMENCO_TYPE_ARR, "hashes", level++ );
11745 0 : if( self->hashes ) {
11746 0 : for( deq_fd_block_block_hash_entry_t_iter_t iter = deq_fd_block_block_hash_entry_t_iter_init( self->hashes );
11747 0 : !deq_fd_block_block_hash_entry_t_iter_done( self->hashes, iter );
11748 0 : iter = deq_fd_block_block_hash_entry_t_iter_next( self->hashes, iter ) ) {
11749 0 : fd_block_block_hash_entry_t * ele = deq_fd_block_block_hash_entry_t_iter_ele( self->hashes, iter );
11750 0 : fd_block_block_hash_entry_walk(w, ele, fun, "hashes", level );
11751 0 : }
11752 0 : }
11753 0 : fun( w, self->hashes, "hashes", FD_FLAMENCO_TYPE_ARR_END, "hashes", level-- );
11754 : /* Done walking deque */
11755 :
11756 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_recent_block_hashes", level-- );
11757 0 : }
11758 0 : ulong fd_recent_block_hashes_size( fd_recent_block_hashes_t const * self ) {
11759 0 : ulong size = 0;
11760 0 : if( self->hashes ) {
11761 0 : size += sizeof(ulong);
11762 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 ) ) {
11763 0 : fd_block_block_hash_entry_t * ele = deq_fd_block_block_hash_entry_t_iter_ele( self->hashes, iter );
11764 0 : size += fd_block_block_hash_entry_size( ele );
11765 0 : }
11766 0 : } else {
11767 0 : size += sizeof(ulong);
11768 0 : }
11769 0 : return size;
11770 0 : }
11771 :
11772 0 : int fd_slot_meta_encode( fd_slot_meta_t const * self, fd_bincode_encode_ctx_t * ctx ) {
11773 0 : int err;
11774 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
11775 0 : if( FD_UNLIKELY( err ) ) return err;
11776 0 : err = fd_bincode_uint64_encode( self->consumed, ctx );
11777 0 : if( FD_UNLIKELY( err ) ) return err;
11778 0 : err = fd_bincode_uint64_encode( self->received, ctx );
11779 0 : if( FD_UNLIKELY( err ) ) return err;
11780 0 : err = fd_bincode_uint64_encode( (ulong)self->first_shred_timestamp, ctx );
11781 0 : if( FD_UNLIKELY( err ) ) return err;
11782 0 : err = fd_bincode_uint64_encode( self->last_index, ctx );
11783 0 : if( FD_UNLIKELY( err ) ) return err;
11784 0 : err = fd_bincode_uint64_encode( self->parent_slot, ctx );
11785 0 : if( FD_UNLIKELY( err ) ) return err;
11786 0 : err = fd_bincode_uint64_encode( self->next_slot_len, ctx );
11787 0 : if( FD_UNLIKELY(err) ) return err;
11788 0 : if( self->next_slot_len ) {
11789 0 : for( ulong i=0; i < self->next_slot_len; i++ ) {
11790 0 : err = fd_bincode_uint64_encode( self->next_slot[i], ctx );
11791 0 : }
11792 0 : }
11793 0 : err = fd_bincode_uint8_encode( (uchar)(self->is_connected), ctx );
11794 0 : if( FD_UNLIKELY( err ) ) return err;
11795 0 : err = fd_bincode_uint64_encode( self->entry_end_indexes_len, ctx );
11796 0 : if( FD_UNLIKELY(err) ) return err;
11797 0 : if( self->entry_end_indexes_len ) {
11798 0 : for( ulong i=0; i < self->entry_end_indexes_len; i++ ) {
11799 0 : err = fd_bincode_uint32_encode( self->entry_end_indexes[i], ctx );
11800 0 : }
11801 0 : }
11802 0 : return FD_BINCODE_SUCCESS;
11803 0 : }
11804 0 : int fd_slot_meta_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11805 0 : *total_sz += sizeof(fd_slot_meta_t);
11806 0 : void const * start_data = ctx->data;
11807 0 : int err = fd_slot_meta_decode_footprint_inner( ctx, total_sz );
11808 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11809 0 : ctx->data = start_data;
11810 0 : return err;
11811 0 : }
11812 0 : int fd_slot_meta_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11813 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11814 0 : int err = 0;
11815 0 : err = fd_bincode_uint64_decode_footprint( ctx );
11816 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11817 0 : err = fd_bincode_uint64_decode_footprint( ctx );
11818 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11819 0 : err = fd_bincode_uint64_decode_footprint( ctx );
11820 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11821 0 : err = fd_bincode_uint64_decode_footprint( ctx );
11822 0 : if( FD_UNLIKELY( err ) ) return err;
11823 0 : err = fd_bincode_uint64_decode_footprint( ctx );
11824 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11825 0 : err = fd_bincode_uint64_decode_footprint( ctx );
11826 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11827 0 : ulong next_slot_len;
11828 0 : err = fd_bincode_uint64_decode( &next_slot_len, ctx );
11829 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11830 0 : if( next_slot_len ) {
11831 0 : *total_sz += 8UL + sizeof(ulong)*next_slot_len;
11832 0 : for( ulong i=0; i < next_slot_len; i++ ) {
11833 0 : err = fd_bincode_uint64_decode_footprint( ctx );
11834 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11835 0 : }
11836 0 : }
11837 0 : err = fd_bincode_uint8_decode_footprint( ctx );
11838 0 : if( FD_UNLIKELY( err ) ) return err;
11839 0 : ulong entry_end_indexes_len;
11840 0 : err = fd_bincode_uint64_decode( &entry_end_indexes_len, ctx );
11841 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11842 0 : if( entry_end_indexes_len ) {
11843 0 : *total_sz += 8UL + sizeof(uint)*entry_end_indexes_len;
11844 0 : for( ulong i=0; i < entry_end_indexes_len; i++ ) {
11845 0 : err = fd_bincode_uint32_decode_footprint( ctx );
11846 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11847 0 : }
11848 0 : }
11849 0 : return 0;
11850 0 : }
11851 0 : void * fd_slot_meta_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
11852 0 : fd_slot_meta_t * self = (fd_slot_meta_t *)mem;
11853 0 : fd_slot_meta_new( self );
11854 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_meta_t);
11855 0 : void * * alloc_mem = &alloc_region;
11856 0 : fd_slot_meta_decode_inner( mem, alloc_mem, ctx );
11857 0 : return self;
11858 0 : }
11859 0 : void fd_slot_meta_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
11860 0 : fd_slot_meta_t * self = (fd_slot_meta_t *)struct_mem;
11861 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
11862 0 : fd_bincode_uint64_decode_unsafe( &self->consumed, ctx );
11863 0 : fd_bincode_uint64_decode_unsafe( &self->received, ctx );
11864 0 : fd_bincode_uint64_decode_unsafe( (ulong *) &self->first_shred_timestamp, ctx );
11865 0 : fd_bincode_uint64_decode_unsafe( &self->last_index, ctx );
11866 0 : fd_bincode_uint64_decode_unsafe( &self->parent_slot, ctx );
11867 0 : fd_bincode_uint64_decode_unsafe( &self->next_slot_len, ctx );
11868 0 : if( self->next_slot_len ) {
11869 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), 8UL );
11870 0 : self->next_slot = *alloc_mem;
11871 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(ulong)*self->next_slot_len;
11872 0 : for( ulong i=0; i < self->next_slot_len; i++ ) {
11873 0 : fd_bincode_uint64_decode_unsafe( self->next_slot + i, ctx );
11874 0 : }
11875 0 : } else
11876 0 : self->next_slot = NULL;
11877 0 : fd_bincode_uint8_decode_unsafe( &self->is_connected, ctx );
11878 0 : fd_bincode_uint64_decode_unsafe( &self->entry_end_indexes_len, ctx );
11879 0 : if( self->entry_end_indexes_len ) {
11880 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), 8UL );
11881 0 : self->entry_end_indexes = *alloc_mem;
11882 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(uint)*self->entry_end_indexes_len;
11883 0 : for( ulong i=0; i < self->entry_end_indexes_len; i++ ) {
11884 0 : fd_bincode_uint32_decode_unsafe( self->entry_end_indexes + i, ctx );
11885 0 : }
11886 0 : } else
11887 0 : self->entry_end_indexes = NULL;
11888 0 : }
11889 0 : void * fd_slot_meta_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
11890 0 : fd_slot_meta_global_t * self = (fd_slot_meta_global_t *)mem;
11891 0 : fd_slot_meta_new( (fd_slot_meta_t *)self );
11892 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_meta_global_t);
11893 0 : void * * alloc_mem = &alloc_region;
11894 0 : fd_slot_meta_decode_inner_global( mem, alloc_mem, ctx );
11895 0 : return self;
11896 0 : }
11897 0 : void fd_slot_meta_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
11898 0 : fd_slot_meta_global_t * self = (fd_slot_meta_global_t *)struct_mem;
11899 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
11900 0 : fd_bincode_uint64_decode_unsafe( &self->consumed, ctx );
11901 0 : fd_bincode_uint64_decode_unsafe( &self->received, ctx );
11902 0 : fd_bincode_uint64_decode_unsafe( (ulong *) &self->first_shred_timestamp, ctx );
11903 0 : fd_bincode_uint64_decode_unsafe( &self->last_index, ctx );
11904 0 : fd_bincode_uint64_decode_unsafe( &self->parent_slot, ctx );
11905 0 : fd_bincode_uint64_decode_unsafe( &self->next_slot_len, ctx );
11906 0 : if( self->next_slot_len ) {
11907 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), 8UL );
11908 0 : self->next_slot_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
11909 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
11910 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(ulong)*self->next_slot_len;
11911 0 : for( ulong i=0; i < self->next_slot_len; i++ ) {
11912 0 : fd_bincode_uint64_decode_unsafe( (ulong*)(cur_mem + sizeof(ulong) * i), ctx );
11913 0 : }
11914 0 : } else
11915 0 : self->next_slot_gaddr = 0UL;
11916 0 : fd_bincode_uint8_decode_unsafe( &self->is_connected, ctx );
11917 0 : fd_bincode_uint64_decode_unsafe( &self->entry_end_indexes_len, ctx );
11918 0 : if( self->entry_end_indexes_len ) {
11919 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), 8UL );
11920 0 : self->entry_end_indexes_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
11921 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
11922 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(uint)*self->entry_end_indexes_len;
11923 0 : for( ulong i=0; i < self->entry_end_indexes_len; i++ ) {
11924 0 : fd_bincode_uint32_decode_unsafe( (uint*)(cur_mem + sizeof(uint) * i), ctx );
11925 0 : }
11926 0 : } else
11927 0 : self->entry_end_indexes_gaddr = 0UL;
11928 0 : }
11929 0 : int fd_slot_meta_convert_global_to_local( void const * global_self, fd_slot_meta_t * self, fd_bincode_decode_ctx_t * ctx ) {
11930 0 : int err = 0;
11931 0 : fd_slot_meta_global_t const * mem = (fd_slot_meta_global_t const *)global_self;
11932 0 : self->slot = mem->slot;
11933 0 : self->consumed = mem->consumed;
11934 0 : self->received = mem->received;
11935 0 : self->first_shred_timestamp = mem->first_shred_timestamp;
11936 0 : self->last_index = mem->last_index;
11937 0 : self->parent_slot = mem->parent_slot;
11938 0 : self->next_slot_len = mem->next_slot_len;
11939 0 : self->next_slot = fd_wksp_laddr_fast( ctx->wksp, mem->next_slot_gaddr );
11940 0 : self->is_connected = mem->is_connected;
11941 0 : self->entry_end_indexes_len = mem->entry_end_indexes_len;
11942 0 : self->entry_end_indexes = fd_wksp_laddr_fast( ctx->wksp, mem->entry_end_indexes_gaddr );
11943 0 : return FD_BINCODE_SUCCESS;
11944 0 : }
11945 0 : void fd_slot_meta_new(fd_slot_meta_t * self) {
11946 0 : fd_memset( self, 0, sizeof(fd_slot_meta_t) );
11947 0 : }
11948 0 : void fd_slot_meta_destroy( fd_slot_meta_t * self ) {
11949 0 : if( self->next_slot ) {
11950 0 : self->next_slot = NULL;
11951 0 : }
11952 0 : if( self->entry_end_indexes ) {
11953 0 : self->entry_end_indexes = NULL;
11954 0 : }
11955 0 : }
11956 :
11957 0 : ulong fd_slot_meta_footprint( void ){ return FD_SLOT_META_FOOTPRINT; }
11958 0 : ulong fd_slot_meta_align( void ){ return FD_SLOT_META_ALIGN; }
11959 :
11960 0 : void fd_slot_meta_walk( void * w, fd_slot_meta_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
11961 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_slot_meta", level++ );
11962 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
11963 0 : fun( w, &self->consumed, "consumed", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
11964 0 : fun( w, &self->received, "received", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
11965 0 : fun( w, &self->first_shred_timestamp, "first_shred_timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level );
11966 0 : fun( w, &self->last_index, "last_index", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
11967 0 : fun( w, &self->parent_slot, "parent_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
11968 0 : if( self->next_slot_len ) {
11969 0 : fun( w, NULL, "next_slot", FD_FLAMENCO_TYPE_ARR, "array", level++ );
11970 0 : for( ulong i=0; i < self->next_slot_len; i++ )
11971 0 : fun( w, self->next_slot + i, "next_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
11972 0 : fun( w, NULL, "next_slot", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
11973 0 : }
11974 0 : fun( w, &self->is_connected, "is_connected", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
11975 0 : if( self->entry_end_indexes_len ) {
11976 0 : fun( w, NULL, "entry_end_indexes", FD_FLAMENCO_TYPE_ARR, "array", level++ );
11977 0 : for( ulong i=0; i < self->entry_end_indexes_len; i++ )
11978 0 : fun( w, self->entry_end_indexes + i, "entry_end_indexes", FD_FLAMENCO_TYPE_UINT, "uint", level );
11979 0 : fun( w, NULL, "entry_end_indexes", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
11980 0 : }
11981 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_slot_meta", level-- );
11982 0 : }
11983 0 : ulong fd_slot_meta_size( fd_slot_meta_t const * self ) {
11984 0 : ulong size = 0;
11985 0 : size += sizeof(ulong);
11986 0 : size += sizeof(ulong);
11987 0 : size += sizeof(ulong);
11988 0 : size += sizeof(long);
11989 0 : size += sizeof(ulong);
11990 0 : size += sizeof(ulong);
11991 0 : do {
11992 0 : size += sizeof(ulong);
11993 0 : size += self->next_slot_len * sizeof(ulong);
11994 0 : } while(0);
11995 0 : size += sizeof(char);
11996 0 : do {
11997 0 : size += sizeof(ulong);
11998 0 : size += self->entry_end_indexes_len * sizeof(uint);
11999 0 : } while(0);
12000 0 : return size;
12001 0 : }
12002 :
12003 26460 : int fd_clock_timestamp_vote_encode( fd_clock_timestamp_vote_t const * self, fd_bincode_encode_ctx_t * ctx ) {
12004 26460 : int err;
12005 26460 : err = fd_pubkey_encode( &self->pubkey, ctx );
12006 26460 : if( FD_UNLIKELY( err ) ) return err;
12007 26460 : err = fd_bincode_uint64_encode( (ulong)self->timestamp, ctx );
12008 26460 : if( FD_UNLIKELY( err ) ) return err;
12009 26460 : err = fd_bincode_uint64_encode( self->slot, ctx );
12010 26460 : if( FD_UNLIKELY( err ) ) return err;
12011 26460 : return FD_BINCODE_SUCCESS;
12012 26460 : }
12013 0 : int fd_clock_timestamp_vote_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12014 0 : *total_sz += sizeof(fd_clock_timestamp_vote_t);
12015 0 : void const * start_data = ctx->data;
12016 0 : int err = fd_clock_timestamp_vote_decode_footprint_inner( ctx, total_sz );
12017 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12018 0 : ctx->data = start_data;
12019 0 : return err;
12020 0 : }
12021 26460 : int fd_clock_timestamp_vote_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12022 26460 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12023 26460 : int err = 0;
12024 26460 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
12025 26460 : if( FD_UNLIKELY( err ) ) return err;
12026 26460 : err = fd_bincode_uint64_decode_footprint( ctx );
12027 26460 : if( FD_UNLIKELY( err ) ) return err;
12028 26460 : err = fd_bincode_uint64_decode_footprint( ctx );
12029 26460 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12030 26460 : return 0;
12031 26460 : }
12032 0 : void * fd_clock_timestamp_vote_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
12033 0 : fd_clock_timestamp_vote_t * self = (fd_clock_timestamp_vote_t *)mem;
12034 0 : fd_clock_timestamp_vote_new( self );
12035 0 : void * alloc_region = (uchar *)mem + sizeof(fd_clock_timestamp_vote_t);
12036 0 : void * * alloc_mem = &alloc_region;
12037 0 : fd_clock_timestamp_vote_decode_inner( mem, alloc_mem, ctx );
12038 0 : return self;
12039 0 : }
12040 39690 : void fd_clock_timestamp_vote_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
12041 39690 : fd_clock_timestamp_vote_t * self = (fd_clock_timestamp_vote_t *)struct_mem;
12042 39690 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
12043 39690 : fd_bincode_uint64_decode_unsafe( (ulong *) &self->timestamp, ctx );
12044 39690 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
12045 39690 : }
12046 0 : void * fd_clock_timestamp_vote_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
12047 0 : fd_clock_timestamp_vote_global_t * self = (fd_clock_timestamp_vote_global_t *)mem;
12048 0 : fd_clock_timestamp_vote_new( (fd_clock_timestamp_vote_t *)self );
12049 0 : void * alloc_region = (uchar *)mem + sizeof(fd_clock_timestamp_vote_global_t);
12050 0 : void * * alloc_mem = &alloc_region;
12051 0 : fd_clock_timestamp_vote_decode_inner_global( mem, alloc_mem, ctx );
12052 0 : return self;
12053 0 : }
12054 0 : void fd_clock_timestamp_vote_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
12055 0 : fd_clock_timestamp_vote_global_t * self = (fd_clock_timestamp_vote_global_t *)struct_mem;
12056 0 : fd_pubkey_decode_inner_global( &self->pubkey, alloc_mem, ctx );
12057 0 : fd_bincode_uint64_decode_unsafe( (ulong *) &self->timestamp, ctx );
12058 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
12059 0 : }
12060 0 : int fd_clock_timestamp_vote_convert_global_to_local( void const * global_self, fd_clock_timestamp_vote_t * self, fd_bincode_decode_ctx_t * ctx ) {
12061 0 : int err = 0;
12062 0 : fd_clock_timestamp_vote_global_t const * mem = (fd_clock_timestamp_vote_global_t const *)global_self;
12063 0 : err = fd_pubkey_convert_global_to_local( &mem->pubkey, &self->pubkey, ctx );
12064 0 : if( FD_UNLIKELY( err ) ) return err;
12065 0 : self->timestamp = mem->timestamp;
12066 0 : self->slot = mem->slot;
12067 0 : return FD_BINCODE_SUCCESS;
12068 0 : }
12069 39690 : void fd_clock_timestamp_vote_new(fd_clock_timestamp_vote_t * self) {
12070 39690 : fd_memset( self, 0, sizeof(fd_clock_timestamp_vote_t) );
12071 39690 : fd_pubkey_new( &self->pubkey );
12072 39690 : }
12073 0 : void fd_clock_timestamp_vote_destroy( fd_clock_timestamp_vote_t * self ) {
12074 0 : fd_pubkey_destroy( &self->pubkey );
12075 0 : }
12076 :
12077 0 : ulong fd_clock_timestamp_vote_footprint( void ){ return FD_CLOCK_TIMESTAMP_VOTE_FOOTPRINT; }
12078 0 : ulong fd_clock_timestamp_vote_align( void ){ return FD_CLOCK_TIMESTAMP_VOTE_ALIGN; }
12079 :
12080 13230 : void fd_clock_timestamp_vote_walk( void * w, fd_clock_timestamp_vote_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
12081 13230 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_clock_timestamp_vote", level++ );
12082 13230 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level );
12083 13230 : fun( w, &self->timestamp, "timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level );
12084 13230 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
12085 13230 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_clock_timestamp_vote", level-- );
12086 13230 : }
12087 0 : ulong fd_clock_timestamp_vote_size( fd_clock_timestamp_vote_t const * self ) {
12088 0 : ulong size = 0;
12089 0 : size += fd_pubkey_size( &self->pubkey );
12090 0 : size += sizeof(long);
12091 0 : size += sizeof(ulong);
12092 0 : return size;
12093 0 : }
12094 :
12095 6 : int fd_clock_timestamp_votes_encode( fd_clock_timestamp_votes_t const * self, fd_bincode_encode_ctx_t * ctx ) {
12096 6 : int err;
12097 6 : if( self->votes_root ) {
12098 6 : ulong votes_len = fd_clock_timestamp_vote_t_map_size( self->votes_pool, self->votes_root );
12099 6 : err = fd_bincode_uint64_encode( votes_len, ctx );
12100 6 : if( FD_UNLIKELY( err ) ) return err;
12101 26466 : for( fd_clock_timestamp_vote_t_mapnode_t * n = fd_clock_timestamp_vote_t_map_minimum( self->votes_pool, self->votes_root ); n; n = fd_clock_timestamp_vote_t_map_successor( self->votes_pool, n ) ) {
12102 26460 : err = fd_clock_timestamp_vote_encode( &n->elem, ctx );
12103 26460 : if( FD_UNLIKELY( err ) ) return err;
12104 26460 : }
12105 6 : } else {
12106 0 : ulong votes_len = 0;
12107 0 : err = fd_bincode_uint64_encode( votes_len, ctx );
12108 0 : if( FD_UNLIKELY( err ) ) return err;
12109 0 : }
12110 6 : return FD_BINCODE_SUCCESS;
12111 6 : }
12112 0 : int fd_clock_timestamp_votes_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12113 0 : *total_sz += sizeof(fd_clock_timestamp_votes_t);
12114 0 : void const * start_data = ctx->data;
12115 0 : int err = fd_clock_timestamp_votes_decode_footprint_inner( ctx, total_sz );
12116 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12117 0 : ctx->data = start_data;
12118 0 : return err;
12119 0 : }
12120 6 : int fd_clock_timestamp_votes_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12121 6 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12122 6 : int err = 0;
12123 6 : ulong votes_len = 0UL;
12124 6 : err = fd_bincode_uint64_decode( &votes_len, ctx );
12125 6 : ulong votes_cnt = fd_ulong_max( votes_len, 15000 );
12126 6 : *total_sz += fd_clock_timestamp_vote_t_map_align() + fd_clock_timestamp_vote_t_map_footprint( votes_cnt );
12127 6 : if( FD_UNLIKELY( err ) ) return err;
12128 26466 : for( ulong i=0; i < votes_len; i++ ) {
12129 26460 : err = fd_clock_timestamp_vote_decode_footprint_inner( ctx, total_sz );
12130 26460 : if( FD_UNLIKELY( err ) ) return err;
12131 26460 : }
12132 6 : return 0;
12133 6 : }
12134 0 : void * fd_clock_timestamp_votes_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
12135 0 : fd_clock_timestamp_votes_t * self = (fd_clock_timestamp_votes_t *)mem;
12136 0 : fd_clock_timestamp_votes_new( self );
12137 0 : void * alloc_region = (uchar *)mem + sizeof(fd_clock_timestamp_votes_t);
12138 0 : void * * alloc_mem = &alloc_region;
12139 0 : fd_clock_timestamp_votes_decode_inner( mem, alloc_mem, ctx );
12140 0 : return self;
12141 0 : }
12142 6 : void fd_clock_timestamp_votes_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
12143 6 : fd_clock_timestamp_votes_t * self = (fd_clock_timestamp_votes_t *)struct_mem;
12144 6 : ulong votes_len;
12145 6 : fd_bincode_uint64_decode_unsafe( &votes_len, ctx );
12146 6 : self->votes_pool = fd_clock_timestamp_vote_t_map_join_new( alloc_mem, fd_ulong_max( votes_len, 15000 ) );
12147 6 : self->votes_root = NULL;
12148 26466 : for( ulong i=0; i < votes_len; i++ ) {
12149 26460 : fd_clock_timestamp_vote_t_mapnode_t * node = fd_clock_timestamp_vote_t_map_acquire( self->votes_pool );
12150 26460 : fd_clock_timestamp_vote_new( &node->elem );
12151 26460 : fd_clock_timestamp_vote_decode_inner( &node->elem, alloc_mem, ctx );
12152 26460 : fd_clock_timestamp_vote_t_map_insert( self->votes_pool, &self->votes_root, node );
12153 26460 : }
12154 6 : }
12155 0 : void * fd_clock_timestamp_votes_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
12156 0 : fd_clock_timestamp_votes_global_t * self = (fd_clock_timestamp_votes_global_t *)mem;
12157 0 : fd_clock_timestamp_votes_new( (fd_clock_timestamp_votes_t *)self );
12158 0 : void * alloc_region = (uchar *)mem + sizeof(fd_clock_timestamp_votes_global_t);
12159 0 : void * * alloc_mem = &alloc_region;
12160 0 : fd_clock_timestamp_votes_decode_inner_global( mem, alloc_mem, ctx );
12161 0 : return self;
12162 0 : }
12163 3 : void fd_clock_timestamp_votes_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
12164 3 : fd_clock_timestamp_votes_global_t * self = (fd_clock_timestamp_votes_global_t *)struct_mem;
12165 3 : ulong votes_len;
12166 3 : fd_bincode_uint64_decode_unsafe( &votes_len, ctx );
12167 3 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, fd_clock_timestamp_vote_t_map_align() );
12168 3 : fd_clock_timestamp_vote_t_mapnode_t * votes_pool = fd_clock_timestamp_vote_t_map_join_new( alloc_mem, fd_ulong_max( votes_len, 15000 ) );
12169 3 : fd_clock_timestamp_vote_t_mapnode_t * votes_root = NULL;
12170 3 : self->votes_root_gaddr = 0UL;
12171 13233 : for( ulong i=0; i < votes_len; i++ ) {
12172 13230 : fd_clock_timestamp_vote_t_mapnode_t * node = fd_clock_timestamp_vote_t_map_acquire( votes_pool );
12173 13230 : fd_clock_timestamp_vote_new( &node->elem );
12174 13230 : fd_clock_timestamp_vote_decode_inner( &node->elem, alloc_mem, ctx );
12175 13230 : fd_clock_timestamp_vote_t_map_insert( votes_pool, &votes_root, node );
12176 13230 : }
12177 3 : self->votes_pool_gaddr = fd_wksp_gaddr_fast( ctx->wksp, votes_pool );
12178 3 : self->votes_root_gaddr = fd_wksp_gaddr_fast( ctx->wksp, votes_root );
12179 3 : }
12180 3 : int fd_clock_timestamp_votes_convert_global_to_local( void const * global_self, fd_clock_timestamp_votes_t * self, fd_bincode_decode_ctx_t * ctx ) {
12181 3 : int err = 0;
12182 3 : fd_clock_timestamp_votes_global_t const * mem = (fd_clock_timestamp_votes_global_t const *)global_self;
12183 3 : self->votes_pool = fd_wksp_laddr_fast( ctx->wksp, mem->votes_pool_gaddr );
12184 3 : self->votes_root = fd_wksp_laddr_fast( ctx->wksp, mem->votes_root_gaddr );
12185 3 : return FD_BINCODE_SUCCESS;
12186 3 : }
12187 9 : void fd_clock_timestamp_votes_new(fd_clock_timestamp_votes_t * self) {
12188 9 : fd_memset( self, 0, sizeof(fd_clock_timestamp_votes_t) );
12189 9 : }
12190 0 : void fd_clock_timestamp_votes_destroy( fd_clock_timestamp_votes_t * self ) {
12191 0 : for( fd_clock_timestamp_vote_t_mapnode_t * n = fd_clock_timestamp_vote_t_map_minimum(self->votes_pool, self->votes_root ); n; n = fd_clock_timestamp_vote_t_map_successor(self->votes_pool, n) ) {
12192 0 : fd_clock_timestamp_vote_destroy( &n->elem );
12193 0 : }
12194 0 : self->votes_pool = NULL;
12195 0 : self->votes_root = NULL;
12196 0 : }
12197 :
12198 0 : ulong fd_clock_timestamp_votes_footprint( void ){ return FD_CLOCK_TIMESTAMP_VOTES_FOOTPRINT; }
12199 0 : ulong fd_clock_timestamp_votes_align( void ){ return FD_CLOCK_TIMESTAMP_VOTES_ALIGN; }
12200 :
12201 3 : void fd_clock_timestamp_votes_walk( void * w, fd_clock_timestamp_votes_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
12202 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_clock_timestamp_votes", level++ );
12203 3 : if( self->votes_root ) {
12204 13233 : for( fd_clock_timestamp_vote_t_mapnode_t * n = fd_clock_timestamp_vote_t_map_minimum(self->votes_pool, self->votes_root ); n; n = fd_clock_timestamp_vote_t_map_successor( self->votes_pool, n ) ) {
12205 13230 : fd_clock_timestamp_vote_walk(w, &n->elem, fun, "votes", level );
12206 13230 : }
12207 3 : }
12208 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_clock_timestamp_votes", level-- );
12209 3 : }
12210 0 : ulong fd_clock_timestamp_votes_size( fd_clock_timestamp_votes_t const * self ) {
12211 0 : ulong size = 0;
12212 0 : if( self->votes_root ) {
12213 0 : size += sizeof(ulong);
12214 0 : for( fd_clock_timestamp_vote_t_mapnode_t * n = fd_clock_timestamp_vote_t_map_minimum( self->votes_pool, self->votes_root ); n; n = fd_clock_timestamp_vote_t_map_successor( self->votes_pool, n ) ) {
12215 0 : size += fd_clock_timestamp_vote_size( &n->elem );
12216 0 : }
12217 0 : } else {
12218 0 : size += sizeof(ulong);
12219 0 : }
12220 0 : return size;
12221 0 : }
12222 :
12223 0 : int fd_sysvar_fees_encode( fd_sysvar_fees_t const * self, fd_bincode_encode_ctx_t * ctx ) {
12224 0 : int err;
12225 0 : err = fd_fee_calculator_encode( &self->fee_calculator, ctx );
12226 0 : if( FD_UNLIKELY( err ) ) return err;
12227 0 : return FD_BINCODE_SUCCESS;
12228 0 : }
12229 0 : int fd_sysvar_fees_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12230 0 : *total_sz += sizeof(fd_sysvar_fees_t);
12231 0 : void const * start_data = ctx->data;
12232 0 : int err = fd_sysvar_fees_decode_footprint_inner( ctx, total_sz );
12233 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12234 0 : ctx->data = start_data;
12235 0 : return err;
12236 0 : }
12237 0 : int fd_sysvar_fees_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12238 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12239 0 : int err = 0;
12240 0 : err = fd_fee_calculator_decode_footprint_inner( ctx, total_sz );
12241 0 : if( FD_UNLIKELY( err ) ) return err;
12242 0 : return 0;
12243 0 : }
12244 0 : void * fd_sysvar_fees_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
12245 0 : fd_sysvar_fees_t * self = (fd_sysvar_fees_t *)mem;
12246 0 : fd_sysvar_fees_new( self );
12247 0 : void * alloc_region = (uchar *)mem + sizeof(fd_sysvar_fees_t);
12248 0 : void * * alloc_mem = &alloc_region;
12249 0 : fd_sysvar_fees_decode_inner( mem, alloc_mem, ctx );
12250 0 : return self;
12251 0 : }
12252 0 : void fd_sysvar_fees_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
12253 0 : fd_sysvar_fees_t * self = (fd_sysvar_fees_t *)struct_mem;
12254 0 : fd_fee_calculator_decode_inner( &self->fee_calculator, alloc_mem, ctx );
12255 0 : }
12256 0 : void * fd_sysvar_fees_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
12257 0 : fd_sysvar_fees_global_t * self = (fd_sysvar_fees_global_t *)mem;
12258 0 : fd_sysvar_fees_new( (fd_sysvar_fees_t *)self );
12259 0 : void * alloc_region = (uchar *)mem + sizeof(fd_sysvar_fees_global_t);
12260 0 : void * * alloc_mem = &alloc_region;
12261 0 : fd_sysvar_fees_decode_inner_global( mem, alloc_mem, ctx );
12262 0 : return self;
12263 0 : }
12264 0 : void fd_sysvar_fees_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
12265 0 : fd_sysvar_fees_global_t * self = (fd_sysvar_fees_global_t *)struct_mem;
12266 0 : fd_fee_calculator_decode_inner_global( &self->fee_calculator, alloc_mem, ctx );
12267 0 : }
12268 0 : int fd_sysvar_fees_convert_global_to_local( void const * global_self, fd_sysvar_fees_t * self, fd_bincode_decode_ctx_t * ctx ) {
12269 0 : int err = 0;
12270 0 : fd_sysvar_fees_global_t const * mem = (fd_sysvar_fees_global_t const *)global_self;
12271 0 : err = fd_fee_calculator_convert_global_to_local( &mem->fee_calculator, &self->fee_calculator, ctx );
12272 0 : if( FD_UNLIKELY( err ) ) return err;
12273 0 : return FD_BINCODE_SUCCESS;
12274 0 : }
12275 0 : void fd_sysvar_fees_new(fd_sysvar_fees_t * self) {
12276 0 : fd_memset( self, 0, sizeof(fd_sysvar_fees_t) );
12277 0 : fd_fee_calculator_new( &self->fee_calculator );
12278 0 : }
12279 0 : void fd_sysvar_fees_destroy( fd_sysvar_fees_t * self ) {
12280 0 : fd_fee_calculator_destroy( &self->fee_calculator );
12281 0 : }
12282 :
12283 0 : ulong fd_sysvar_fees_footprint( void ){ return FD_SYSVAR_FEES_FOOTPRINT; }
12284 0 : ulong fd_sysvar_fees_align( void ){ return FD_SYSVAR_FEES_ALIGN; }
12285 :
12286 0 : void fd_sysvar_fees_walk( void * w, fd_sysvar_fees_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
12287 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_sysvar_fees", level++ );
12288 0 : fd_fee_calculator_walk( w, &self->fee_calculator, fun, "fee_calculator", level );
12289 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_sysvar_fees", level-- );
12290 0 : }
12291 0 : ulong fd_sysvar_fees_size( fd_sysvar_fees_t const * self ) {
12292 0 : ulong size = 0;
12293 0 : size += fd_fee_calculator_size( &self->fee_calculator );
12294 0 : return size;
12295 0 : }
12296 :
12297 0 : int fd_sysvar_epoch_rewards_encode( fd_sysvar_epoch_rewards_t const * self, fd_bincode_encode_ctx_t * ctx ) {
12298 0 : int err;
12299 0 : err = fd_bincode_uint64_encode( self->distribution_starting_block_height, ctx );
12300 0 : if( FD_UNLIKELY( err ) ) return err;
12301 0 : err = fd_bincode_uint64_encode( self->num_partitions, ctx );
12302 0 : if( FD_UNLIKELY( err ) ) return err;
12303 0 : err = fd_hash_encode( &self->parent_blockhash, ctx );
12304 0 : if( FD_UNLIKELY( err ) ) return err;
12305 0 : err = fd_bincode_uint128_encode( self->total_points, ctx );
12306 0 : if( FD_UNLIKELY( err ) ) return err;
12307 0 : err = fd_bincode_uint64_encode( self->total_rewards, ctx );
12308 0 : if( FD_UNLIKELY( err ) ) return err;
12309 0 : err = fd_bincode_uint64_encode( self->distributed_rewards, ctx );
12310 0 : if( FD_UNLIKELY( err ) ) return err;
12311 0 : err = fd_bincode_bool_encode( (uchar)(self->active), ctx );
12312 0 : if( FD_UNLIKELY( err ) ) return err;
12313 0 : return FD_BINCODE_SUCCESS;
12314 0 : }
12315 0 : int fd_sysvar_epoch_rewards_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12316 0 : *total_sz += sizeof(fd_sysvar_epoch_rewards_t);
12317 0 : void const * start_data = ctx->data;
12318 0 : int err = fd_sysvar_epoch_rewards_decode_footprint_inner( ctx, total_sz );
12319 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12320 0 : ctx->data = start_data;
12321 0 : return err;
12322 0 : }
12323 0 : int fd_sysvar_epoch_rewards_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12324 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12325 0 : int err = 0;
12326 0 : err = fd_bincode_uint64_decode_footprint( ctx );
12327 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12328 0 : err = fd_bincode_uint64_decode_footprint( ctx );
12329 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12330 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
12331 0 : if( FD_UNLIKELY( err ) ) return err;
12332 0 : err = fd_bincode_uint128_decode_footprint( ctx );
12333 0 : if( FD_UNLIKELY( err ) ) return err;
12334 0 : err = fd_bincode_uint64_decode_footprint( ctx );
12335 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12336 0 : err = fd_bincode_uint64_decode_footprint( ctx );
12337 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12338 0 : err = fd_bincode_bool_decode_footprint( ctx );
12339 0 : if( FD_UNLIKELY( err ) ) return err;
12340 0 : return 0;
12341 0 : }
12342 0 : void * fd_sysvar_epoch_rewards_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
12343 0 : fd_sysvar_epoch_rewards_t * self = (fd_sysvar_epoch_rewards_t *)mem;
12344 0 : fd_sysvar_epoch_rewards_new( self );
12345 0 : void * alloc_region = (uchar *)mem + sizeof(fd_sysvar_epoch_rewards_t);
12346 0 : void * * alloc_mem = &alloc_region;
12347 0 : fd_sysvar_epoch_rewards_decode_inner( mem, alloc_mem, ctx );
12348 0 : return self;
12349 0 : }
12350 0 : void fd_sysvar_epoch_rewards_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
12351 0 : fd_sysvar_epoch_rewards_t * self = (fd_sysvar_epoch_rewards_t *)struct_mem;
12352 0 : fd_bincode_uint64_decode_unsafe( &self->distribution_starting_block_height, ctx );
12353 0 : fd_bincode_uint64_decode_unsafe( &self->num_partitions, ctx );
12354 0 : fd_hash_decode_inner( &self->parent_blockhash, alloc_mem, ctx );
12355 0 : fd_bincode_uint128_decode_unsafe( &self->total_points, ctx );
12356 0 : fd_bincode_uint64_decode_unsafe( &self->total_rewards, ctx );
12357 0 : fd_bincode_uint64_decode_unsafe( &self->distributed_rewards, ctx );
12358 0 : fd_bincode_bool_decode_unsafe( &self->active, ctx );
12359 0 : }
12360 0 : void * fd_sysvar_epoch_rewards_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
12361 0 : fd_sysvar_epoch_rewards_global_t * self = (fd_sysvar_epoch_rewards_global_t *)mem;
12362 0 : fd_sysvar_epoch_rewards_new( (fd_sysvar_epoch_rewards_t *)self );
12363 0 : void * alloc_region = (uchar *)mem + sizeof(fd_sysvar_epoch_rewards_global_t);
12364 0 : void * * alloc_mem = &alloc_region;
12365 0 : fd_sysvar_epoch_rewards_decode_inner_global( mem, alloc_mem, ctx );
12366 0 : return self;
12367 0 : }
12368 0 : void fd_sysvar_epoch_rewards_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
12369 0 : fd_sysvar_epoch_rewards_global_t * self = (fd_sysvar_epoch_rewards_global_t *)struct_mem;
12370 0 : fd_bincode_uint64_decode_unsafe( &self->distribution_starting_block_height, ctx );
12371 0 : fd_bincode_uint64_decode_unsafe( &self->num_partitions, ctx );
12372 0 : fd_hash_decode_inner_global( &self->parent_blockhash, alloc_mem, ctx );
12373 0 : fd_bincode_uint128_decode_unsafe( &self->total_points, ctx );
12374 0 : fd_bincode_uint64_decode_unsafe( &self->total_rewards, ctx );
12375 0 : fd_bincode_uint64_decode_unsafe( &self->distributed_rewards, ctx );
12376 0 : fd_bincode_bool_decode_unsafe( &self->active, ctx );
12377 0 : }
12378 0 : int fd_sysvar_epoch_rewards_convert_global_to_local( void const * global_self, fd_sysvar_epoch_rewards_t * self, fd_bincode_decode_ctx_t * ctx ) {
12379 0 : int err = 0;
12380 0 : fd_sysvar_epoch_rewards_global_t const * mem = (fd_sysvar_epoch_rewards_global_t const *)global_self;
12381 0 : self->distribution_starting_block_height = mem->distribution_starting_block_height;
12382 0 : self->num_partitions = mem->num_partitions;
12383 0 : err = fd_hash_convert_global_to_local( &mem->parent_blockhash, &self->parent_blockhash, ctx );
12384 0 : if( FD_UNLIKELY( err ) ) return err;
12385 0 : self->total_points = mem->total_points;
12386 0 : self->total_rewards = mem->total_rewards;
12387 0 : self->distributed_rewards = mem->distributed_rewards;
12388 0 : self->active = mem->active;
12389 0 : return FD_BINCODE_SUCCESS;
12390 0 : }
12391 0 : void fd_sysvar_epoch_rewards_new(fd_sysvar_epoch_rewards_t * self) {
12392 0 : fd_memset( self, 0, sizeof(fd_sysvar_epoch_rewards_t) );
12393 0 : fd_hash_new( &self->parent_blockhash );
12394 0 : }
12395 0 : void fd_sysvar_epoch_rewards_destroy( fd_sysvar_epoch_rewards_t * self ) {
12396 0 : fd_hash_destroy( &self->parent_blockhash );
12397 0 : }
12398 :
12399 0 : ulong fd_sysvar_epoch_rewards_footprint( void ){ return FD_SYSVAR_EPOCH_REWARDS_FOOTPRINT; }
12400 0 : ulong fd_sysvar_epoch_rewards_align( void ){ return FD_SYSVAR_EPOCH_REWARDS_ALIGN; }
12401 :
12402 0 : void fd_sysvar_epoch_rewards_walk( void * w, fd_sysvar_epoch_rewards_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
12403 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_sysvar_epoch_rewards", level++ );
12404 0 : fun( w, &self->distribution_starting_block_height, "distribution_starting_block_height", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
12405 0 : fun( w, &self->num_partitions, "num_partitions", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
12406 0 : fd_hash_walk( w, &self->parent_blockhash, fun, "parent_blockhash", level );
12407 0 : fun( w, &self->total_points, "total_points", FD_FLAMENCO_TYPE_UINT128, "uint128", level );
12408 0 : fun( w, &self->total_rewards, "total_rewards", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
12409 0 : fun( w, &self->distributed_rewards, "distributed_rewards", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
12410 0 : fun( w, &self->active, "active", FD_FLAMENCO_TYPE_BOOL, "bool", level );
12411 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_sysvar_epoch_rewards", level-- );
12412 0 : }
12413 0 : ulong fd_sysvar_epoch_rewards_size( fd_sysvar_epoch_rewards_t const * self ) {
12414 0 : ulong size = 0;
12415 0 : size += sizeof(ulong);
12416 0 : size += sizeof(ulong);
12417 0 : size += fd_hash_size( &self->parent_blockhash );
12418 0 : size += sizeof(uint128);
12419 0 : size += sizeof(ulong);
12420 0 : size += sizeof(ulong);
12421 0 : size += sizeof(char);
12422 0 : return size;
12423 0 : }
12424 :
12425 0 : int fd_config_keys_pair_encode( fd_config_keys_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
12426 0 : int err;
12427 0 : err = fd_pubkey_encode( &self->key, ctx );
12428 0 : if( FD_UNLIKELY( err ) ) return err;
12429 0 : err = fd_bincode_bool_encode( (uchar)(self->signer), ctx );
12430 0 : if( FD_UNLIKELY( err ) ) return err;
12431 0 : return FD_BINCODE_SUCCESS;
12432 0 : }
12433 0 : int fd_config_keys_pair_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12434 0 : *total_sz += sizeof(fd_config_keys_pair_t);
12435 0 : void const * start_data = ctx->data;
12436 0 : int err = fd_config_keys_pair_decode_footprint_inner( ctx, total_sz );
12437 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12438 0 : ctx->data = start_data;
12439 0 : return err;
12440 0 : }
12441 0 : int fd_config_keys_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12442 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12443 0 : int err = 0;
12444 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
12445 0 : if( FD_UNLIKELY( err ) ) return err;
12446 0 : err = fd_bincode_bool_decode_footprint( ctx );
12447 0 : if( FD_UNLIKELY( err ) ) return err;
12448 0 : return 0;
12449 0 : }
12450 0 : void * fd_config_keys_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
12451 0 : fd_config_keys_pair_t * self = (fd_config_keys_pair_t *)mem;
12452 0 : fd_config_keys_pair_new( self );
12453 0 : void * alloc_region = (uchar *)mem + sizeof(fd_config_keys_pair_t);
12454 0 : void * * alloc_mem = &alloc_region;
12455 0 : fd_config_keys_pair_decode_inner( mem, alloc_mem, ctx );
12456 0 : return self;
12457 0 : }
12458 0 : void fd_config_keys_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
12459 0 : fd_config_keys_pair_t * self = (fd_config_keys_pair_t *)struct_mem;
12460 0 : fd_pubkey_decode_inner( &self->key, alloc_mem, ctx );
12461 0 : fd_bincode_bool_decode_unsafe( &self->signer, ctx );
12462 0 : }
12463 0 : void * fd_config_keys_pair_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
12464 0 : fd_config_keys_pair_global_t * self = (fd_config_keys_pair_global_t *)mem;
12465 0 : fd_config_keys_pair_new( (fd_config_keys_pair_t *)self );
12466 0 : void * alloc_region = (uchar *)mem + sizeof(fd_config_keys_pair_global_t);
12467 0 : void * * alloc_mem = &alloc_region;
12468 0 : fd_config_keys_pair_decode_inner_global( mem, alloc_mem, ctx );
12469 0 : return self;
12470 0 : }
12471 0 : void fd_config_keys_pair_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
12472 0 : fd_config_keys_pair_global_t * self = (fd_config_keys_pair_global_t *)struct_mem;
12473 0 : fd_pubkey_decode_inner_global( &self->key, alloc_mem, ctx );
12474 0 : fd_bincode_bool_decode_unsafe( &self->signer, ctx );
12475 0 : }
12476 0 : int fd_config_keys_pair_convert_global_to_local( void const * global_self, fd_config_keys_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
12477 0 : int err = 0;
12478 0 : fd_config_keys_pair_global_t const * mem = (fd_config_keys_pair_global_t const *)global_self;
12479 0 : err = fd_pubkey_convert_global_to_local( &mem->key, &self->key, ctx );
12480 0 : if( FD_UNLIKELY( err ) ) return err;
12481 0 : self->signer = mem->signer;
12482 0 : return FD_BINCODE_SUCCESS;
12483 0 : }
12484 0 : void fd_config_keys_pair_new(fd_config_keys_pair_t * self) {
12485 0 : fd_memset( self, 0, sizeof(fd_config_keys_pair_t) );
12486 0 : fd_pubkey_new( &self->key );
12487 0 : }
12488 0 : void fd_config_keys_pair_destroy( fd_config_keys_pair_t * self ) {
12489 0 : fd_pubkey_destroy( &self->key );
12490 0 : }
12491 :
12492 0 : ulong fd_config_keys_pair_footprint( void ){ return FD_CONFIG_KEYS_PAIR_FOOTPRINT; }
12493 0 : ulong fd_config_keys_pair_align( void ){ return FD_CONFIG_KEYS_PAIR_ALIGN; }
12494 :
12495 0 : void fd_config_keys_pair_walk( void * w, fd_config_keys_pair_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
12496 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_config_keys_pair", level++ );
12497 0 : fd_pubkey_walk( w, &self->key, fun, "key", level );
12498 0 : fun( w, &self->signer, "signer", FD_FLAMENCO_TYPE_BOOL, "bool", level );
12499 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_config_keys_pair", level-- );
12500 0 : }
12501 0 : ulong fd_config_keys_pair_size( fd_config_keys_pair_t const * self ) {
12502 0 : ulong size = 0;
12503 0 : size += fd_pubkey_size( &self->key );
12504 0 : size += sizeof(char);
12505 0 : return size;
12506 0 : }
12507 :
12508 12 : int fd_stake_config_encode( fd_stake_config_t const * self, fd_bincode_encode_ctx_t * ctx ) {
12509 12 : int err;
12510 12 : err = fd_bincode_compact_u16_encode( &self->config_keys_len, ctx );
12511 12 : if( FD_UNLIKELY(err) ) return err;
12512 12 : if( self->config_keys_len ) {
12513 0 : for( ulong i=0; i < self->config_keys_len; i++ ) {
12514 0 : err = fd_config_keys_pair_encode( self->config_keys + i, ctx );
12515 0 : if( FD_UNLIKELY( err ) ) return err;
12516 0 : }
12517 0 : }
12518 12 : err = fd_bincode_double_encode( self->warmup_cooldown_rate, ctx );
12519 12 : if( FD_UNLIKELY( err ) ) return err;
12520 12 : err = fd_bincode_uint8_encode( (uchar)(self->slash_penalty), ctx );
12521 12 : if( FD_UNLIKELY( err ) ) return err;
12522 12 : return FD_BINCODE_SUCCESS;
12523 12 : }
12524 0 : int fd_stake_config_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12525 0 : *total_sz += sizeof(fd_stake_config_t);
12526 0 : void const * start_data = ctx->data;
12527 0 : int err = fd_stake_config_decode_footprint_inner( ctx, total_sz );
12528 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12529 0 : ctx->data = start_data;
12530 0 : return err;
12531 0 : }
12532 0 : int fd_stake_config_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12533 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12534 0 : int err = 0;
12535 0 : ushort config_keys_len;
12536 0 : err = fd_bincode_compact_u16_decode( &config_keys_len, ctx );
12537 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12538 0 : if( config_keys_len ) {
12539 0 : *total_sz += FD_CONFIG_KEYS_PAIR_ALIGN + FD_CONFIG_KEYS_PAIR_FOOTPRINT*config_keys_len;
12540 0 : for( ulong i=0; i < config_keys_len; i++ ) {
12541 0 : err = fd_config_keys_pair_decode_footprint_inner( ctx, total_sz );
12542 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12543 0 : }
12544 0 : }
12545 0 : err = fd_bincode_double_decode_footprint( ctx );
12546 0 : if( FD_UNLIKELY( err ) ) return err;
12547 0 : err = fd_bincode_uint8_decode_footprint( ctx );
12548 0 : if( FD_UNLIKELY( err ) ) return err;
12549 0 : return 0;
12550 0 : }
12551 0 : void * fd_stake_config_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
12552 0 : fd_stake_config_t * self = (fd_stake_config_t *)mem;
12553 0 : fd_stake_config_new( self );
12554 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_config_t);
12555 0 : void * * alloc_mem = &alloc_region;
12556 0 : fd_stake_config_decode_inner( mem, alloc_mem, ctx );
12557 0 : return self;
12558 0 : }
12559 0 : void fd_stake_config_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
12560 0 : fd_stake_config_t * self = (fd_stake_config_t *)struct_mem;
12561 0 : fd_bincode_compact_u16_decode_unsafe( &self->config_keys_len, ctx );
12562 0 : if( self->config_keys_len ) {
12563 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_CONFIG_KEYS_PAIR_ALIGN );
12564 0 : self->config_keys = *alloc_mem;
12565 0 : *alloc_mem = (uchar *)(*alloc_mem) + FD_CONFIG_KEYS_PAIR_FOOTPRINT*self->config_keys_len;
12566 0 : for( ulong i=0; i < self->config_keys_len; i++ ) {
12567 0 : fd_config_keys_pair_new( self->config_keys + i );
12568 0 : fd_config_keys_pair_decode_inner( self->config_keys + i, alloc_mem, ctx );
12569 0 : }
12570 0 : } else
12571 0 : self->config_keys = NULL;
12572 0 : fd_bincode_double_decode_unsafe( &self->warmup_cooldown_rate, ctx );
12573 0 : fd_bincode_uint8_decode_unsafe( &self->slash_penalty, ctx );
12574 0 : }
12575 0 : void * fd_stake_config_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
12576 0 : fd_stake_config_global_t * self = (fd_stake_config_global_t *)mem;
12577 0 : fd_stake_config_new( (fd_stake_config_t *)self );
12578 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_config_global_t);
12579 0 : void * * alloc_mem = &alloc_region;
12580 0 : fd_stake_config_decode_inner_global( mem, alloc_mem, ctx );
12581 0 : return self;
12582 0 : }
12583 0 : void fd_stake_config_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
12584 0 : fd_stake_config_global_t * self = (fd_stake_config_global_t *)struct_mem;
12585 0 : fd_bincode_compact_u16_decode_unsafe( &self->config_keys_len, ctx );
12586 0 : if( self->config_keys_len ) {
12587 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_CONFIG_KEYS_PAIR_ALIGN );
12588 0 : self->config_keys_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
12589 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
12590 0 : *alloc_mem = (uchar *)(*alloc_mem) + FD_CONFIG_KEYS_PAIR_FOOTPRINT*self->config_keys_len;
12591 0 : for( ulong i=0; i < self->config_keys_len; i++ ) {
12592 0 : fd_config_keys_pair_new( (fd_config_keys_pair_t *)(cur_mem + FD_CONFIG_KEYS_PAIR_FOOTPRINT * i) );
12593 0 : fd_config_keys_pair_decode_inner_global( cur_mem + FD_CONFIG_KEYS_PAIR_FOOTPRINT * i, alloc_mem, ctx );
12594 0 : }
12595 0 : } else
12596 0 : self->config_keys_gaddr = 0UL;
12597 0 : fd_bincode_double_decode_unsafe( &self->warmup_cooldown_rate, ctx );
12598 0 : fd_bincode_uint8_decode_unsafe( &self->slash_penalty, ctx );
12599 0 : }
12600 0 : int fd_stake_config_convert_global_to_local( void const * global_self, fd_stake_config_t * self, fd_bincode_decode_ctx_t * ctx ) {
12601 0 : int err = 0;
12602 0 : fd_stake_config_global_t const * mem = (fd_stake_config_global_t const *)global_self;
12603 0 : self->config_keys_len = mem->config_keys_len;
12604 0 : self->config_keys = fd_wksp_laddr_fast( ctx->wksp, mem->config_keys_gaddr );
12605 0 : self->warmup_cooldown_rate = mem->warmup_cooldown_rate;
12606 0 : self->slash_penalty = mem->slash_penalty;
12607 0 : return FD_BINCODE_SUCCESS;
12608 0 : }
12609 0 : void fd_stake_config_new(fd_stake_config_t * self) {
12610 0 : fd_memset( self, 0, sizeof(fd_stake_config_t) );
12611 0 : }
12612 0 : void fd_stake_config_destroy( fd_stake_config_t * self ) {
12613 0 : if( self->config_keys ) {
12614 0 : for( ulong i=0; i < self->config_keys_len; i++ )
12615 0 : fd_config_keys_pair_destroy( self->config_keys + i );
12616 0 : self->config_keys = NULL;
12617 0 : }
12618 0 : }
12619 :
12620 0 : ulong fd_stake_config_footprint( void ){ return FD_STAKE_CONFIG_FOOTPRINT; }
12621 0 : ulong fd_stake_config_align( void ){ return FD_STAKE_CONFIG_ALIGN; }
12622 :
12623 0 : void fd_stake_config_walk( void * w, fd_stake_config_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
12624 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_config", level++ );
12625 0 : if( self->config_keys_len ) {
12626 0 : fun( w, NULL, "config_keys", FD_FLAMENCO_TYPE_ARR, "array", level++ );
12627 0 : for( ulong i=0; i < self->config_keys_len; i++ )
12628 0 : fd_config_keys_pair_walk(w, self->config_keys + i, fun, "config_keys_pair", level );
12629 0 : fun( w, NULL, "config_keys", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
12630 0 : }
12631 0 : fun( w, &self->warmup_cooldown_rate, "warmup_cooldown_rate", FD_FLAMENCO_TYPE_DOUBLE, "double", level );
12632 0 : fun( w, &self->slash_penalty, "slash_penalty", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
12633 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_config", level-- );
12634 0 : }
12635 0 : ulong fd_stake_config_size( fd_stake_config_t const * self ) {
12636 0 : ulong size = 0;
12637 0 : do {
12638 0 : ushort tmp = (ushort)self->config_keys_len;
12639 0 : size += fd_bincode_compact_u16_size( &tmp );
12640 0 : for( ulong i=0; i < self->config_keys_len; i++ )
12641 0 : size += fd_config_keys_pair_size( self->config_keys + i );
12642 0 : } while(0);
12643 0 : size += sizeof(double);
12644 0 : size += sizeof(char);
12645 0 : return size;
12646 0 : }
12647 :
12648 0 : int fd_feature_entry_encode( fd_feature_entry_t const * self, fd_bincode_encode_ctx_t * ctx ) {
12649 0 : int err;
12650 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
12651 0 : if( FD_UNLIKELY( err ) ) return err;
12652 0 : err = fd_bincode_uint64_encode( self->description_len, ctx );
12653 0 : if( FD_UNLIKELY(err) ) return err;
12654 0 : if( self->description_len ) {
12655 0 : err = fd_bincode_bytes_encode( self->description, self->description_len, ctx );
12656 0 : if( FD_UNLIKELY( err ) ) return err;
12657 0 : }
12658 0 : err = fd_bincode_uint64_encode( self->since_slot, ctx );
12659 0 : if( FD_UNLIKELY( err ) ) return err;
12660 0 : return FD_BINCODE_SUCCESS;
12661 0 : }
12662 0 : int fd_feature_entry_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12663 0 : *total_sz += sizeof(fd_feature_entry_t);
12664 0 : void const * start_data = ctx->data;
12665 0 : int err = fd_feature_entry_decode_footprint_inner( ctx, total_sz );
12666 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12667 0 : ctx->data = start_data;
12668 0 : return err;
12669 0 : }
12670 0 : int fd_feature_entry_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12671 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12672 0 : int err = 0;
12673 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
12674 0 : if( FD_UNLIKELY( err ) ) return err;
12675 0 : ulong description_len;
12676 0 : err = fd_bincode_uint64_decode( &description_len, ctx );
12677 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12678 0 : *total_sz += description_len;
12679 0 : if( description_len ) {
12680 0 : err = fd_bincode_bytes_decode_footprint( description_len, ctx );
12681 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12682 0 : err = !fd_utf8_verify( (char const *) ctx->data - description_len, description_len );
12683 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12684 0 : }
12685 0 : err = fd_bincode_uint64_decode_footprint( ctx );
12686 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12687 0 : return 0;
12688 0 : }
12689 0 : void * fd_feature_entry_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
12690 0 : fd_feature_entry_t * self = (fd_feature_entry_t *)mem;
12691 0 : fd_feature_entry_new( self );
12692 0 : void * alloc_region = (uchar *)mem + sizeof(fd_feature_entry_t);
12693 0 : void * * alloc_mem = &alloc_region;
12694 0 : fd_feature_entry_decode_inner( mem, alloc_mem, ctx );
12695 0 : return self;
12696 0 : }
12697 0 : void fd_feature_entry_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
12698 0 : fd_feature_entry_t * self = (fd_feature_entry_t *)struct_mem;
12699 0 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
12700 0 : fd_bincode_uint64_decode_unsafe( &self->description_len, ctx );
12701 0 : if( self->description_len ) {
12702 0 : self->description = *alloc_mem;
12703 0 : fd_bincode_bytes_decode_unsafe( self->description, self->description_len, ctx );
12704 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->description_len;
12705 0 : } else
12706 0 : self->description = NULL;
12707 0 : fd_bincode_uint64_decode_unsafe( &self->since_slot, ctx );
12708 0 : }
12709 0 : void * fd_feature_entry_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
12710 0 : fd_feature_entry_global_t * self = (fd_feature_entry_global_t *)mem;
12711 0 : fd_feature_entry_new( (fd_feature_entry_t *)self );
12712 0 : void * alloc_region = (uchar *)mem + sizeof(fd_feature_entry_global_t);
12713 0 : void * * alloc_mem = &alloc_region;
12714 0 : fd_feature_entry_decode_inner_global( mem, alloc_mem, ctx );
12715 0 : return self;
12716 0 : }
12717 0 : void fd_feature_entry_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
12718 0 : fd_feature_entry_global_t * self = (fd_feature_entry_global_t *)struct_mem;
12719 0 : fd_pubkey_decode_inner_global( &self->pubkey, alloc_mem, ctx );
12720 0 : fd_bincode_uint64_decode_unsafe( &self->description_len, ctx );
12721 0 : if( self->description_len ) {
12722 0 : self->description_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
12723 0 : fd_bincode_bytes_decode_unsafe( *alloc_mem, self->description_len, ctx );
12724 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->description_len;
12725 0 : } else
12726 0 : self->description_gaddr = 0UL;
12727 0 : fd_bincode_uint64_decode_unsafe( &self->since_slot, ctx );
12728 0 : }
12729 0 : int fd_feature_entry_convert_global_to_local( void const * global_self, fd_feature_entry_t * self, fd_bincode_decode_ctx_t * ctx ) {
12730 0 : int err = 0;
12731 0 : fd_feature_entry_global_t const * mem = (fd_feature_entry_global_t const *)global_self;
12732 0 : err = fd_pubkey_convert_global_to_local( &mem->pubkey, &self->pubkey, ctx );
12733 0 : if( FD_UNLIKELY( err ) ) return err;
12734 0 : self->description_len = mem->description_len;
12735 0 : self->description = fd_wksp_laddr_fast( ctx->wksp, mem->description_gaddr );
12736 0 : self->since_slot = mem->since_slot;
12737 0 : return FD_BINCODE_SUCCESS;
12738 0 : }
12739 0 : void fd_feature_entry_new(fd_feature_entry_t * self) {
12740 0 : fd_memset( self, 0, sizeof(fd_feature_entry_t) );
12741 0 : fd_pubkey_new( &self->pubkey );
12742 0 : }
12743 0 : void fd_feature_entry_destroy( fd_feature_entry_t * self ) {
12744 0 : fd_pubkey_destroy( &self->pubkey );
12745 0 : if( self->description ) {
12746 0 : self->description = NULL;
12747 0 : }
12748 0 : }
12749 :
12750 0 : ulong fd_feature_entry_footprint( void ){ return FD_FEATURE_ENTRY_FOOTPRINT; }
12751 0 : ulong fd_feature_entry_align( void ){ return FD_FEATURE_ENTRY_ALIGN; }
12752 :
12753 0 : void fd_feature_entry_walk( void * w, fd_feature_entry_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
12754 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_feature_entry", level++ );
12755 0 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level );
12756 0 : fun(w, self->description, "description", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
12757 0 : fun( w, &self->since_slot, "since_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
12758 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_feature_entry", level-- );
12759 0 : }
12760 0 : ulong fd_feature_entry_size( fd_feature_entry_t const * self ) {
12761 0 : ulong size = 0;
12762 0 : size += fd_pubkey_size( &self->pubkey );
12763 0 : do {
12764 0 : size += sizeof(ulong);
12765 0 : size += self->description_len;
12766 0 : } while(0);
12767 0 : size += sizeof(ulong);
12768 0 : return size;
12769 0 : }
12770 :
12771 0 : int fd_firedancer_bank_encode( fd_firedancer_bank_t const * self, fd_bincode_encode_ctx_t * ctx ) {
12772 0 : int err;
12773 0 : err = fd_stakes_encode( &self->stakes, ctx );
12774 0 : if( FD_UNLIKELY( err ) ) return err;
12775 0 : err = fd_recent_block_hashes_encode( &self->recent_block_hashes, ctx );
12776 0 : if( FD_UNLIKELY( err ) ) return err;
12777 0 : err = fd_clock_timestamp_votes_encode( &self->timestamp_votes, ctx );
12778 0 : if( FD_UNLIKELY( err ) ) return err;
12779 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
12780 0 : if( FD_UNLIKELY( err ) ) return err;
12781 0 : err = fd_bincode_uint64_encode( self->prev_slot, ctx );
12782 0 : if( FD_UNLIKELY( err ) ) return err;
12783 0 : err = fd_hash_encode( &self->poh, ctx );
12784 0 : if( FD_UNLIKELY( err ) ) return err;
12785 0 : err = fd_hash_encode( &self->banks_hash, ctx );
12786 0 : if( FD_UNLIKELY( err ) ) return err;
12787 0 : err = fd_fee_rate_governor_encode( &self->fee_rate_governor, ctx );
12788 0 : if( FD_UNLIKELY( err ) ) return err;
12789 0 : err = fd_bincode_uint64_encode( self->capitalization, ctx );
12790 0 : if( FD_UNLIKELY( err ) ) return err;
12791 0 : err = fd_bincode_uint64_encode( self->block_height, ctx );
12792 0 : if( FD_UNLIKELY( err ) ) return err;
12793 0 : err = fd_bincode_uint64_encode( self->lamports_per_signature, ctx );
12794 0 : if( FD_UNLIKELY( err ) ) return err;
12795 0 : err = fd_bincode_uint64_encode( self->hashes_per_tick, ctx );
12796 0 : if( FD_UNLIKELY( err ) ) return err;
12797 0 : err = fd_bincode_uint64_encode( self->ticks_per_slot, ctx );
12798 0 : if( FD_UNLIKELY( err ) ) return err;
12799 0 : err = fd_bincode_uint128_encode( self->ns_per_slot, ctx );
12800 0 : if( FD_UNLIKELY( err ) ) return err;
12801 0 : err = fd_bincode_uint64_encode( self->genesis_creation_time, ctx );
12802 0 : if( FD_UNLIKELY( err ) ) return err;
12803 0 : err = fd_bincode_double_encode( self->slots_per_year, ctx );
12804 0 : if( FD_UNLIKELY( err ) ) return err;
12805 0 : err = fd_bincode_uint64_encode( self->max_tick_height, ctx );
12806 0 : if( FD_UNLIKELY( err ) ) return err;
12807 0 : err = fd_inflation_encode( &self->inflation, ctx );
12808 0 : if( FD_UNLIKELY( err ) ) return err;
12809 0 : err = fd_epoch_schedule_encode( &self->epoch_schedule, ctx );
12810 0 : if( FD_UNLIKELY( err ) ) return err;
12811 0 : err = fd_rent_encode( &self->rent, ctx );
12812 0 : if( FD_UNLIKELY( err ) ) return err;
12813 0 : err = fd_bincode_uint64_encode( self->collected_fees, ctx );
12814 0 : if( FD_UNLIKELY( err ) ) return err;
12815 0 : err = fd_bincode_uint64_encode( self->collected_rent, ctx );
12816 0 : if( FD_UNLIKELY( err ) ) return err;
12817 0 : err = fd_vote_accounts_encode( &self->epoch_stakes, ctx );
12818 0 : if( FD_UNLIKELY( err ) ) return err;
12819 0 : err = fd_sol_sysvar_last_restart_slot_encode( &self->last_restart_slot, ctx );
12820 0 : if( FD_UNLIKELY( err ) ) return err;
12821 0 : return FD_BINCODE_SUCCESS;
12822 0 : }
12823 0 : int fd_firedancer_bank_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12824 0 : *total_sz += sizeof(fd_firedancer_bank_t);
12825 0 : void const * start_data = ctx->data;
12826 0 : int err = fd_firedancer_bank_decode_footprint_inner( ctx, total_sz );
12827 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12828 0 : ctx->data = start_data;
12829 0 : return err;
12830 0 : }
12831 0 : int fd_firedancer_bank_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12832 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12833 0 : int err = 0;
12834 0 : err = fd_stakes_decode_footprint_inner( ctx, total_sz );
12835 0 : if( FD_UNLIKELY( err ) ) return err;
12836 0 : err = fd_recent_block_hashes_decode_footprint_inner( ctx, total_sz );
12837 0 : if( FD_UNLIKELY( err ) ) return err;
12838 0 : err = fd_clock_timestamp_votes_decode_footprint_inner( ctx, total_sz );
12839 0 : if( FD_UNLIKELY( err ) ) return err;
12840 0 : err = fd_bincode_uint64_decode_footprint( ctx );
12841 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12842 0 : err = fd_bincode_uint64_decode_footprint( ctx );
12843 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12844 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
12845 0 : if( FD_UNLIKELY( err ) ) return err;
12846 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
12847 0 : if( FD_UNLIKELY( err ) ) return err;
12848 0 : err = fd_fee_rate_governor_decode_footprint_inner( ctx, total_sz );
12849 0 : if( FD_UNLIKELY( err ) ) return err;
12850 0 : err = fd_bincode_uint64_decode_footprint( ctx );
12851 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12852 0 : err = fd_bincode_uint64_decode_footprint( ctx );
12853 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12854 0 : err = fd_bincode_uint64_decode_footprint( ctx );
12855 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12856 0 : err = fd_bincode_uint64_decode_footprint( ctx );
12857 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12858 0 : err = fd_bincode_uint64_decode_footprint( ctx );
12859 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12860 0 : err = fd_bincode_uint128_decode_footprint( ctx );
12861 0 : if( FD_UNLIKELY( err ) ) return err;
12862 0 : err = fd_bincode_uint64_decode_footprint( ctx );
12863 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12864 0 : err = fd_bincode_double_decode_footprint( ctx );
12865 0 : if( FD_UNLIKELY( err ) ) return err;
12866 0 : err = fd_bincode_uint64_decode_footprint( ctx );
12867 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12868 0 : err = fd_inflation_decode_footprint_inner( ctx, total_sz );
12869 0 : if( FD_UNLIKELY( err ) ) return err;
12870 0 : err = fd_epoch_schedule_decode_footprint_inner( ctx, total_sz );
12871 0 : if( FD_UNLIKELY( err ) ) return err;
12872 0 : err = fd_rent_decode_footprint_inner( ctx, total_sz );
12873 0 : if( FD_UNLIKELY( err ) ) return err;
12874 0 : err = fd_bincode_uint64_decode_footprint( ctx );
12875 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12876 0 : err = fd_bincode_uint64_decode_footprint( ctx );
12877 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12878 0 : err = fd_vote_accounts_decode_footprint_inner( ctx, total_sz );
12879 0 : if( FD_UNLIKELY( err ) ) return err;
12880 0 : err = fd_sol_sysvar_last_restart_slot_decode_footprint_inner( ctx, total_sz );
12881 0 : if( FD_UNLIKELY( err ) ) return err;
12882 0 : return 0;
12883 0 : }
12884 0 : void * fd_firedancer_bank_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
12885 0 : fd_firedancer_bank_t * self = (fd_firedancer_bank_t *)mem;
12886 0 : fd_firedancer_bank_new( self );
12887 0 : void * alloc_region = (uchar *)mem + sizeof(fd_firedancer_bank_t);
12888 0 : void * * alloc_mem = &alloc_region;
12889 0 : fd_firedancer_bank_decode_inner( mem, alloc_mem, ctx );
12890 0 : return self;
12891 0 : }
12892 0 : void fd_firedancer_bank_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
12893 0 : fd_firedancer_bank_t * self = (fd_firedancer_bank_t *)struct_mem;
12894 0 : fd_stakes_decode_inner( &self->stakes, alloc_mem, ctx );
12895 0 : fd_recent_block_hashes_decode_inner( &self->recent_block_hashes, alloc_mem, ctx );
12896 0 : fd_clock_timestamp_votes_decode_inner( &self->timestamp_votes, alloc_mem, ctx );
12897 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
12898 0 : fd_bincode_uint64_decode_unsafe( &self->prev_slot, ctx );
12899 0 : fd_hash_decode_inner( &self->poh, alloc_mem, ctx );
12900 0 : fd_hash_decode_inner( &self->banks_hash, alloc_mem, ctx );
12901 0 : fd_fee_rate_governor_decode_inner( &self->fee_rate_governor, alloc_mem, ctx );
12902 0 : fd_bincode_uint64_decode_unsafe( &self->capitalization, ctx );
12903 0 : fd_bincode_uint64_decode_unsafe( &self->block_height, ctx );
12904 0 : fd_bincode_uint64_decode_unsafe( &self->lamports_per_signature, ctx );
12905 0 : fd_bincode_uint64_decode_unsafe( &self->hashes_per_tick, ctx );
12906 0 : fd_bincode_uint64_decode_unsafe( &self->ticks_per_slot, ctx );
12907 0 : fd_bincode_uint128_decode_unsafe( &self->ns_per_slot, ctx );
12908 0 : fd_bincode_uint64_decode_unsafe( &self->genesis_creation_time, ctx );
12909 0 : fd_bincode_double_decode_unsafe( &self->slots_per_year, ctx );
12910 0 : fd_bincode_uint64_decode_unsafe( &self->max_tick_height, ctx );
12911 0 : fd_inflation_decode_inner( &self->inflation, alloc_mem, ctx );
12912 0 : fd_epoch_schedule_decode_inner( &self->epoch_schedule, alloc_mem, ctx );
12913 0 : fd_rent_decode_inner( &self->rent, alloc_mem, ctx );
12914 0 : fd_bincode_uint64_decode_unsafe( &self->collected_fees, ctx );
12915 0 : fd_bincode_uint64_decode_unsafe( &self->collected_rent, ctx );
12916 0 : fd_vote_accounts_decode_inner( &self->epoch_stakes, alloc_mem, ctx );
12917 0 : fd_sol_sysvar_last_restart_slot_decode_inner( &self->last_restart_slot, alloc_mem, ctx );
12918 0 : }
12919 0 : void * fd_firedancer_bank_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
12920 0 : fd_firedancer_bank_global_t * self = (fd_firedancer_bank_global_t *)mem;
12921 0 : fd_firedancer_bank_new( (fd_firedancer_bank_t *)self );
12922 0 : void * alloc_region = (uchar *)mem + sizeof(fd_firedancer_bank_global_t);
12923 0 : void * * alloc_mem = &alloc_region;
12924 0 : fd_firedancer_bank_decode_inner_global( mem, alloc_mem, ctx );
12925 0 : return self;
12926 0 : }
12927 0 : void fd_firedancer_bank_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
12928 0 : fd_firedancer_bank_global_t * self = (fd_firedancer_bank_global_t *)struct_mem;
12929 0 : fd_stakes_decode_inner_global( &self->stakes, alloc_mem, ctx );
12930 0 : fd_recent_block_hashes_decode_inner_global( &self->recent_block_hashes, alloc_mem, ctx );
12931 0 : fd_clock_timestamp_votes_decode_inner_global( &self->timestamp_votes, alloc_mem, ctx );
12932 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
12933 0 : fd_bincode_uint64_decode_unsafe( &self->prev_slot, ctx );
12934 0 : fd_hash_decode_inner_global( &self->poh, alloc_mem, ctx );
12935 0 : fd_hash_decode_inner_global( &self->banks_hash, alloc_mem, ctx );
12936 0 : fd_fee_rate_governor_decode_inner_global( &self->fee_rate_governor, alloc_mem, ctx );
12937 0 : fd_bincode_uint64_decode_unsafe( &self->capitalization, ctx );
12938 0 : fd_bincode_uint64_decode_unsafe( &self->block_height, ctx );
12939 0 : fd_bincode_uint64_decode_unsafe( &self->lamports_per_signature, ctx );
12940 0 : fd_bincode_uint64_decode_unsafe( &self->hashes_per_tick, ctx );
12941 0 : fd_bincode_uint64_decode_unsafe( &self->ticks_per_slot, ctx );
12942 0 : fd_bincode_uint128_decode_unsafe( &self->ns_per_slot, ctx );
12943 0 : fd_bincode_uint64_decode_unsafe( &self->genesis_creation_time, ctx );
12944 0 : fd_bincode_double_decode_unsafe( &self->slots_per_year, ctx );
12945 0 : fd_bincode_uint64_decode_unsafe( &self->max_tick_height, ctx );
12946 0 : fd_inflation_decode_inner_global( &self->inflation, alloc_mem, ctx );
12947 0 : fd_epoch_schedule_decode_inner_global( &self->epoch_schedule, alloc_mem, ctx );
12948 0 : fd_rent_decode_inner_global( &self->rent, alloc_mem, ctx );
12949 0 : fd_bincode_uint64_decode_unsafe( &self->collected_fees, ctx );
12950 0 : fd_bincode_uint64_decode_unsafe( &self->collected_rent, ctx );
12951 0 : fd_vote_accounts_decode_inner_global( &self->epoch_stakes, alloc_mem, ctx );
12952 0 : fd_sol_sysvar_last_restart_slot_decode_inner_global( &self->last_restart_slot, alloc_mem, ctx );
12953 0 : }
12954 0 : int fd_firedancer_bank_convert_global_to_local( void const * global_self, fd_firedancer_bank_t * self, fd_bincode_decode_ctx_t * ctx ) {
12955 0 : int err = 0;
12956 0 : fd_firedancer_bank_global_t const * mem = (fd_firedancer_bank_global_t const *)global_self;
12957 0 : err = fd_stakes_convert_global_to_local( &mem->stakes, &self->stakes, ctx );
12958 0 : if( FD_UNLIKELY( err ) ) return err;
12959 0 : err = fd_recent_block_hashes_convert_global_to_local( &mem->recent_block_hashes, &self->recent_block_hashes, ctx );
12960 0 : if( FD_UNLIKELY( err ) ) return err;
12961 0 : err = fd_clock_timestamp_votes_convert_global_to_local( &mem->timestamp_votes, &self->timestamp_votes, ctx );
12962 0 : if( FD_UNLIKELY( err ) ) return err;
12963 0 : self->slot = mem->slot;
12964 0 : self->prev_slot = mem->prev_slot;
12965 0 : err = fd_hash_convert_global_to_local( &mem->poh, &self->poh, ctx );
12966 0 : if( FD_UNLIKELY( err ) ) return err;
12967 0 : err = fd_hash_convert_global_to_local( &mem->banks_hash, &self->banks_hash, ctx );
12968 0 : if( FD_UNLIKELY( err ) ) return err;
12969 0 : err = fd_fee_rate_governor_convert_global_to_local( &mem->fee_rate_governor, &self->fee_rate_governor, ctx );
12970 0 : if( FD_UNLIKELY( err ) ) return err;
12971 0 : self->capitalization = mem->capitalization;
12972 0 : self->block_height = mem->block_height;
12973 0 : self->lamports_per_signature = mem->lamports_per_signature;
12974 0 : self->hashes_per_tick = mem->hashes_per_tick;
12975 0 : self->ticks_per_slot = mem->ticks_per_slot;
12976 0 : self->ns_per_slot = mem->ns_per_slot;
12977 0 : self->genesis_creation_time = mem->genesis_creation_time;
12978 0 : self->slots_per_year = mem->slots_per_year;
12979 0 : self->max_tick_height = mem->max_tick_height;
12980 0 : err = fd_inflation_convert_global_to_local( &mem->inflation, &self->inflation, ctx );
12981 0 : if( FD_UNLIKELY( err ) ) return err;
12982 0 : err = fd_epoch_schedule_convert_global_to_local( &mem->epoch_schedule, &self->epoch_schedule, ctx );
12983 0 : if( FD_UNLIKELY( err ) ) return err;
12984 0 : err = fd_rent_convert_global_to_local( &mem->rent, &self->rent, ctx );
12985 0 : if( FD_UNLIKELY( err ) ) return err;
12986 0 : self->collected_fees = mem->collected_fees;
12987 0 : self->collected_rent = mem->collected_rent;
12988 0 : err = fd_vote_accounts_convert_global_to_local( &mem->epoch_stakes, &self->epoch_stakes, ctx );
12989 0 : if( FD_UNLIKELY( err ) ) return err;
12990 0 : err = fd_sol_sysvar_last_restart_slot_convert_global_to_local( &mem->last_restart_slot, &self->last_restart_slot, ctx );
12991 0 : if( FD_UNLIKELY( err ) ) return err;
12992 0 : return FD_BINCODE_SUCCESS;
12993 0 : }
12994 0 : void fd_firedancer_bank_new(fd_firedancer_bank_t * self) {
12995 0 : fd_memset( self, 0, sizeof(fd_firedancer_bank_t) );
12996 0 : fd_stakes_new( &self->stakes );
12997 0 : fd_recent_block_hashes_new( &self->recent_block_hashes );
12998 0 : fd_clock_timestamp_votes_new( &self->timestamp_votes );
12999 0 : fd_hash_new( &self->poh );
13000 0 : fd_hash_new( &self->banks_hash );
13001 0 : fd_fee_rate_governor_new( &self->fee_rate_governor );
13002 0 : fd_inflation_new( &self->inflation );
13003 0 : fd_epoch_schedule_new( &self->epoch_schedule );
13004 0 : fd_rent_new( &self->rent );
13005 0 : fd_vote_accounts_new( &self->epoch_stakes );
13006 0 : fd_sol_sysvar_last_restart_slot_new( &self->last_restart_slot );
13007 0 : }
13008 0 : void fd_firedancer_bank_destroy( fd_firedancer_bank_t * self ) {
13009 0 : fd_stakes_destroy( &self->stakes );
13010 0 : fd_recent_block_hashes_destroy( &self->recent_block_hashes );
13011 0 : fd_clock_timestamp_votes_destroy( &self->timestamp_votes );
13012 0 : fd_hash_destroy( &self->poh );
13013 0 : fd_hash_destroy( &self->banks_hash );
13014 0 : fd_fee_rate_governor_destroy( &self->fee_rate_governor );
13015 0 : fd_inflation_destroy( &self->inflation );
13016 0 : fd_epoch_schedule_destroy( &self->epoch_schedule );
13017 0 : fd_rent_destroy( &self->rent );
13018 0 : fd_vote_accounts_destroy( &self->epoch_stakes );
13019 0 : fd_sol_sysvar_last_restart_slot_destroy( &self->last_restart_slot );
13020 0 : }
13021 :
13022 0 : ulong fd_firedancer_bank_footprint( void ){ return FD_FIREDANCER_BANK_FOOTPRINT; }
13023 0 : ulong fd_firedancer_bank_align( void ){ return FD_FIREDANCER_BANK_ALIGN; }
13024 :
13025 0 : void fd_firedancer_bank_walk( void * w, fd_firedancer_bank_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
13026 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_firedancer_bank", level++ );
13027 0 : fd_stakes_walk( w, &self->stakes, fun, "stakes", level );
13028 0 : fd_recent_block_hashes_walk( w, &self->recent_block_hashes, fun, "recent_block_hashes", level );
13029 0 : fd_clock_timestamp_votes_walk( w, &self->timestamp_votes, fun, "timestamp_votes", level );
13030 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
13031 0 : fun( w, &self->prev_slot, "prev_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
13032 0 : fd_hash_walk( w, &self->poh, fun, "poh", level );
13033 0 : fd_hash_walk( w, &self->banks_hash, fun, "banks_hash", level );
13034 0 : fd_fee_rate_governor_walk( w, &self->fee_rate_governor, fun, "fee_rate_governor", level );
13035 0 : fun( w, &self->capitalization, "capitalization", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
13036 0 : fun( w, &self->block_height, "block_height", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
13037 0 : fun( w, &self->lamports_per_signature, "lamports_per_signature", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
13038 0 : fun( w, &self->hashes_per_tick, "hashes_per_tick", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
13039 0 : fun( w, &self->ticks_per_slot, "ticks_per_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
13040 0 : fun( w, &self->ns_per_slot, "ns_per_slot", FD_FLAMENCO_TYPE_UINT128, "uint128", level );
13041 0 : fun( w, &self->genesis_creation_time, "genesis_creation_time", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
13042 0 : fun( w, &self->slots_per_year, "slots_per_year", FD_FLAMENCO_TYPE_DOUBLE, "double", level );
13043 0 : fun( w, &self->max_tick_height, "max_tick_height", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
13044 0 : fd_inflation_walk( w, &self->inflation, fun, "inflation", level );
13045 0 : fd_epoch_schedule_walk( w, &self->epoch_schedule, fun, "epoch_schedule", level );
13046 0 : fd_rent_walk( w, &self->rent, fun, "rent", level );
13047 0 : fun( w, &self->collected_fees, "collected_fees", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
13048 0 : fun( w, &self->collected_rent, "collected_rent", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
13049 0 : fd_vote_accounts_walk( w, &self->epoch_stakes, fun, "epoch_stakes", level );
13050 0 : fd_sol_sysvar_last_restart_slot_walk( w, &self->last_restart_slot, fun, "last_restart_slot", level );
13051 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_firedancer_bank", level-- );
13052 0 : }
13053 0 : ulong fd_firedancer_bank_size( fd_firedancer_bank_t const * self ) {
13054 0 : ulong size = 0;
13055 0 : size += fd_stakes_size( &self->stakes );
13056 0 : size += fd_recent_block_hashes_size( &self->recent_block_hashes );
13057 0 : size += fd_clock_timestamp_votes_size( &self->timestamp_votes );
13058 0 : size += sizeof(ulong);
13059 0 : size += sizeof(ulong);
13060 0 : size += fd_hash_size( &self->poh );
13061 0 : size += fd_hash_size( &self->banks_hash );
13062 0 : size += fd_fee_rate_governor_size( &self->fee_rate_governor );
13063 0 : size += sizeof(ulong);
13064 0 : size += sizeof(ulong);
13065 0 : size += sizeof(ulong);
13066 0 : size += sizeof(ulong);
13067 0 : size += sizeof(ulong);
13068 0 : size += sizeof(uint128);
13069 0 : size += sizeof(ulong);
13070 0 : size += sizeof(double);
13071 0 : size += sizeof(ulong);
13072 0 : size += fd_inflation_size( &self->inflation );
13073 0 : size += fd_epoch_schedule_size( &self->epoch_schedule );
13074 0 : size += fd_rent_size( &self->rent );
13075 0 : size += sizeof(ulong);
13076 0 : size += sizeof(ulong);
13077 0 : size += fd_vote_accounts_size( &self->epoch_stakes );
13078 0 : size += fd_sol_sysvar_last_restart_slot_size( &self->last_restart_slot );
13079 0 : return size;
13080 0 : }
13081 :
13082 0 : FD_FN_PURE uchar fd_cluster_type_is_Testnet(fd_cluster_type_t const * self) {
13083 0 : return self->discriminant == 0;
13084 0 : }
13085 0 : FD_FN_PURE uchar fd_cluster_type_is_MainnetBeta(fd_cluster_type_t const * self) {
13086 0 : return self->discriminant == 1;
13087 0 : }
13088 0 : FD_FN_PURE uchar fd_cluster_type_is_Devnet(fd_cluster_type_t const * self) {
13089 0 : return self->discriminant == 2;
13090 0 : }
13091 0 : FD_FN_PURE uchar fd_cluster_type_is_Development(fd_cluster_type_t const * self) {
13092 0 : return self->discriminant == 3;
13093 0 : }
13094 : void fd_cluster_type_inner_new( fd_cluster_type_inner_t * self, uint discriminant );
13095 0 : int fd_cluster_type_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13096 0 : int err;
13097 0 : switch (discriminant) {
13098 0 : case 0: {
13099 0 : return FD_BINCODE_SUCCESS;
13100 0 : }
13101 0 : case 1: {
13102 0 : return FD_BINCODE_SUCCESS;
13103 0 : }
13104 0 : case 2: {
13105 0 : return FD_BINCODE_SUCCESS;
13106 0 : }
13107 0 : case 3: {
13108 0 : return FD_BINCODE_SUCCESS;
13109 0 : }
13110 0 : default: return FD_BINCODE_ERR_ENCODING;
13111 0 : }
13112 0 : }
13113 0 : int fd_cluster_type_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13114 0 : *total_sz += sizeof(fd_cluster_type_t);
13115 0 : void const * start_data = ctx->data;
13116 0 : int err = fd_cluster_type_decode_footprint_inner( ctx, total_sz );
13117 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
13118 0 : ctx->data = start_data;
13119 0 : return err;
13120 0 : }
13121 0 : int fd_cluster_type_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13122 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
13123 0 : uint discriminant = 0;
13124 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
13125 0 : if( FD_UNLIKELY( err ) ) return err;
13126 0 : return fd_cluster_type_inner_decode_footprint( discriminant, ctx, total_sz );
13127 0 : }
13128 0 : void fd_cluster_type_inner_decode_inner( fd_cluster_type_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
13129 0 : switch (discriminant) {
13130 0 : case 0: {
13131 0 : break;
13132 0 : }
13133 0 : case 1: {
13134 0 : break;
13135 0 : }
13136 0 : case 2: {
13137 0 : break;
13138 0 : }
13139 0 : case 3: {
13140 0 : break;
13141 0 : }
13142 0 : }
13143 0 : }
13144 0 : void fd_cluster_type_inner_decode_inner_global( fd_cluster_type_inner_global_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
13145 0 : switch (discriminant) {
13146 0 : case 0: {
13147 0 : break;
13148 0 : }
13149 0 : case 1: {
13150 0 : break;
13151 0 : }
13152 0 : case 2: {
13153 0 : break;
13154 0 : }
13155 0 : case 3: {
13156 0 : break;
13157 0 : }
13158 0 : }
13159 0 : }
13160 0 : int fd_cluster_type_convert_global_to_local_inner( fd_cluster_type_inner_global_t const * mem, fd_cluster_type_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
13161 0 : int err = 0;
13162 0 : switch( discriminant ) {
13163 0 : case 0: {
13164 0 : break;
13165 0 : }
13166 0 : case 1: {
13167 0 : break;
13168 0 : }
13169 0 : case 2: {
13170 0 : break;
13171 0 : }
13172 0 : case 3: {
13173 0 : break;
13174 0 : }
13175 0 : }
13176 0 : return FD_BINCODE_SUCCESS;
13177 0 : }
13178 0 : int fd_cluster_type_convert_global_to_local( void const * global_self, fd_cluster_type_t * self, fd_bincode_decode_ctx_t * ctx ) {
13179 0 : fd_cluster_type_global_t const * mem = (fd_cluster_type_global_t const *)global_self;
13180 0 : uint discriminant = mem->discriminant;
13181 0 : self->discriminant = mem->discriminant;
13182 0 : int err = fd_cluster_type_convert_global_to_local_inner( &mem->inner, &self->inner, discriminant, ctx );
13183 0 : return FD_BINCODE_SUCCESS;
13184 0 : }
13185 0 : void fd_cluster_type_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
13186 0 : fd_cluster_type_t * self = (fd_cluster_type_t *)struct_mem;
13187 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
13188 0 : fd_cluster_type_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
13189 0 : }
13190 0 : void * fd_cluster_type_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
13191 0 : fd_cluster_type_t * self = (fd_cluster_type_t *)mem;
13192 0 : fd_cluster_type_new( self );
13193 0 : void * alloc_region = (uchar *)mem + sizeof(fd_cluster_type_t);
13194 0 : void * * alloc_mem = &alloc_region;
13195 0 : fd_cluster_type_decode_inner( mem, alloc_mem, ctx );
13196 0 : return self;
13197 0 : }
13198 0 : void * fd_cluster_type_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
13199 0 : fd_cluster_type_t * self = (fd_cluster_type_t *)mem;
13200 0 : fd_cluster_type_new( self );
13201 0 : void * alloc_region = (uchar *)mem + sizeof(fd_cluster_type_t);
13202 0 : void * * alloc_mem = &alloc_region;
13203 0 : fd_cluster_type_decode_inner_global( mem, alloc_mem, ctx );
13204 0 : return self;
13205 0 : }
13206 0 : void fd_cluster_type_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
13207 0 : fd_cluster_type_global_t * self = (fd_cluster_type_global_t *)struct_mem;
13208 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
13209 0 : fd_cluster_type_inner_decode_inner_global( &self->inner, alloc_mem, self->discriminant, ctx );
13210 0 : }
13211 0 : void fd_cluster_type_inner_new( fd_cluster_type_inner_t * self, uint discriminant ) {
13212 0 : switch( discriminant ) {
13213 0 : case 0: {
13214 0 : break;
13215 0 : }
13216 0 : case 1: {
13217 0 : break;
13218 0 : }
13219 0 : case 2: {
13220 0 : break;
13221 0 : }
13222 0 : case 3: {
13223 0 : break;
13224 0 : }
13225 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
13226 0 : }
13227 0 : }
13228 0 : void fd_cluster_type_new_disc( fd_cluster_type_t * self, uint discriminant ) {
13229 0 : self->discriminant = discriminant;
13230 0 : fd_cluster_type_inner_new( &self->inner, self->discriminant );
13231 0 : }
13232 0 : void fd_cluster_type_new( fd_cluster_type_t * self ) {
13233 0 : fd_memset( self, 0, sizeof(fd_cluster_type_t) );
13234 0 : fd_cluster_type_new_disc( self, UINT_MAX );
13235 0 : }
13236 0 : void fd_cluster_type_inner_destroy( fd_cluster_type_inner_t * self, uint discriminant ) {
13237 0 : switch( discriminant ) {
13238 0 : default: break; // FD_LOG_ERR(( "unhandled type" ));
13239 0 : }
13240 0 : }
13241 0 : void fd_cluster_type_destroy( fd_cluster_type_t * self ) {
13242 0 : fd_cluster_type_inner_destroy( &self->inner, self->discriminant );
13243 0 : }
13244 :
13245 0 : ulong fd_cluster_type_footprint( void ){ return FD_CLUSTER_TYPE_FOOTPRINT; }
13246 0 : ulong fd_cluster_type_align( void ){ return FD_CLUSTER_TYPE_ALIGN; }
13247 :
13248 0 : void fd_cluster_type_walk( void * w, fd_cluster_type_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
13249 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_cluster_type", level++);
13250 0 : switch( self->discriminant ) {
13251 0 : case 0: {
13252 0 : fun( w, self, "Testnet", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
13253 0 : break;
13254 0 : }
13255 0 : case 1: {
13256 0 : fun( w, self, "MainnetBeta", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
13257 0 : break;
13258 0 : }
13259 0 : case 2: {
13260 0 : fun( w, self, "Devnet", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
13261 0 : break;
13262 0 : }
13263 0 : case 3: {
13264 0 : fun( w, self, "Development", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
13265 0 : break;
13266 0 : }
13267 0 : }
13268 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_cluster_type", level-- );
13269 0 : }
13270 0 : ulong fd_cluster_type_size( fd_cluster_type_t const * self ) {
13271 0 : ulong size = 0;
13272 0 : size += sizeof(uint);
13273 0 : switch (self->discriminant) {
13274 0 : }
13275 0 : return size;
13276 0 : }
13277 :
13278 0 : int fd_cluster_type_inner_encode( fd_cluster_type_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
13279 0 : return FD_BINCODE_SUCCESS;
13280 0 : }
13281 0 : int fd_cluster_type_encode( fd_cluster_type_t const * self, fd_bincode_encode_ctx_t * ctx ) {
13282 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
13283 0 : if( FD_UNLIKELY( err ) ) return err;
13284 0 : return fd_cluster_type_inner_encode( &self->inner, self->discriminant, ctx );
13285 0 : }
13286 :
13287 0 : int fd_epoch_bank_encode( fd_epoch_bank_t const * self, fd_bincode_encode_ctx_t * ctx ) {
13288 0 : int err;
13289 0 : err = fd_stakes_encode( &self->stakes, ctx );
13290 0 : if( FD_UNLIKELY( err ) ) return err;
13291 0 : err = fd_bincode_uint64_encode( self->hashes_per_tick, ctx );
13292 0 : if( FD_UNLIKELY( err ) ) return err;
13293 0 : err = fd_bincode_uint64_encode( self->ticks_per_slot, ctx );
13294 0 : if( FD_UNLIKELY( err ) ) return err;
13295 0 : err = fd_bincode_uint128_encode( self->ns_per_slot, ctx );
13296 0 : if( FD_UNLIKELY( err ) ) return err;
13297 0 : err = fd_bincode_uint64_encode( self->genesis_creation_time, ctx );
13298 0 : if( FD_UNLIKELY( err ) ) return err;
13299 0 : err = fd_bincode_double_encode( self->slots_per_year, ctx );
13300 0 : if( FD_UNLIKELY( err ) ) return err;
13301 0 : err = fd_bincode_uint64_encode( self->max_tick_height, ctx );
13302 0 : if( FD_UNLIKELY( err ) ) return err;
13303 0 : err = fd_inflation_encode( &self->inflation, ctx );
13304 0 : if( FD_UNLIKELY( err ) ) return err;
13305 0 : err = fd_epoch_schedule_encode( &self->epoch_schedule, ctx );
13306 0 : if( FD_UNLIKELY( err ) ) return err;
13307 0 : err = fd_rent_encode( &self->rent, ctx );
13308 0 : if( FD_UNLIKELY( err ) ) return err;
13309 0 : err = fd_bincode_uint64_encode( self->eah_start_slot, ctx );
13310 0 : if( FD_UNLIKELY( err ) ) return err;
13311 0 : err = fd_bincode_uint64_encode( self->eah_stop_slot, ctx );
13312 0 : if( FD_UNLIKELY( err ) ) return err;
13313 0 : err = fd_bincode_uint64_encode( self->eah_interval, ctx );
13314 0 : if( FD_UNLIKELY( err ) ) return err;
13315 0 : err = fd_hash_encode( &self->genesis_hash, ctx );
13316 0 : if( FD_UNLIKELY( err ) ) return err;
13317 0 : err = fd_bincode_uint32_encode( self->cluster_type, ctx );
13318 0 : if( FD_UNLIKELY( err ) ) return err;
13319 0 : for( ulong i=0; i<3; i++ ) {
13320 0 : err = fd_bincode_uint32_encode( self->cluster_version[i], ctx );
13321 0 : if( FD_UNLIKELY( err ) ) return err;
13322 0 : }
13323 0 : err = fd_vote_accounts_encode( &self->next_epoch_stakes, ctx );
13324 0 : if( FD_UNLIKELY( err ) ) return err;
13325 0 : err = fd_epoch_schedule_encode( &self->rent_epoch_schedule, ctx );
13326 0 : if( FD_UNLIKELY( err ) ) return err;
13327 0 : return FD_BINCODE_SUCCESS;
13328 0 : }
13329 0 : int fd_epoch_bank_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13330 0 : *total_sz += sizeof(fd_epoch_bank_t);
13331 0 : void const * start_data = ctx->data;
13332 0 : int err = fd_epoch_bank_decode_footprint_inner( ctx, total_sz );
13333 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
13334 0 : ctx->data = start_data;
13335 0 : return err;
13336 0 : }
13337 0 : int fd_epoch_bank_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13338 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
13339 0 : int err = 0;
13340 0 : err = fd_stakes_decode_footprint_inner( ctx, total_sz );
13341 0 : if( FD_UNLIKELY( err ) ) return err;
13342 0 : err = fd_bincode_uint64_decode_footprint( ctx );
13343 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13344 0 : err = fd_bincode_uint64_decode_footprint( ctx );
13345 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13346 0 : err = fd_bincode_uint128_decode_footprint( ctx );
13347 0 : if( FD_UNLIKELY( err ) ) return err;
13348 0 : err = fd_bincode_uint64_decode_footprint( ctx );
13349 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13350 0 : err = fd_bincode_double_decode_footprint( ctx );
13351 0 : if( FD_UNLIKELY( err ) ) return err;
13352 0 : err = fd_bincode_uint64_decode_footprint( ctx );
13353 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13354 0 : err = fd_inflation_decode_footprint_inner( ctx, total_sz );
13355 0 : if( FD_UNLIKELY( err ) ) return err;
13356 0 : err = fd_epoch_schedule_decode_footprint_inner( ctx, total_sz );
13357 0 : if( FD_UNLIKELY( err ) ) return err;
13358 0 : err = fd_rent_decode_footprint_inner( ctx, total_sz );
13359 0 : if( FD_UNLIKELY( err ) ) return err;
13360 0 : err = fd_bincode_uint64_decode_footprint( ctx );
13361 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13362 0 : err = fd_bincode_uint64_decode_footprint( ctx );
13363 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13364 0 : err = fd_bincode_uint64_decode_footprint( ctx );
13365 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13366 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
13367 0 : if( FD_UNLIKELY( err ) ) return err;
13368 0 : err = fd_bincode_uint32_decode_footprint( ctx );
13369 0 : if( FD_UNLIKELY( err ) ) return err;
13370 0 : for( ulong i=0; i<3; i++ ) {
13371 0 : err = fd_bincode_uint32_decode_footprint( ctx );
13372 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13373 0 : }
13374 0 : err = fd_vote_accounts_decode_footprint_inner( ctx, total_sz );
13375 0 : if( FD_UNLIKELY( err ) ) return err;
13376 0 : err = fd_epoch_schedule_decode_footprint_inner( ctx, total_sz );
13377 0 : if( FD_UNLIKELY( err ) ) return err;
13378 0 : return 0;
13379 0 : }
13380 0 : void * fd_epoch_bank_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
13381 0 : fd_epoch_bank_t * self = (fd_epoch_bank_t *)mem;
13382 0 : fd_epoch_bank_new( self );
13383 0 : void * alloc_region = (uchar *)mem + sizeof(fd_epoch_bank_t);
13384 0 : void * * alloc_mem = &alloc_region;
13385 0 : fd_epoch_bank_decode_inner( mem, alloc_mem, ctx );
13386 0 : return self;
13387 0 : }
13388 0 : void fd_epoch_bank_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
13389 0 : fd_epoch_bank_t * self = (fd_epoch_bank_t *)struct_mem;
13390 0 : fd_stakes_decode_inner( &self->stakes, alloc_mem, ctx );
13391 0 : fd_bincode_uint64_decode_unsafe( &self->hashes_per_tick, ctx );
13392 0 : fd_bincode_uint64_decode_unsafe( &self->ticks_per_slot, ctx );
13393 0 : fd_bincode_uint128_decode_unsafe( &self->ns_per_slot, ctx );
13394 0 : fd_bincode_uint64_decode_unsafe( &self->genesis_creation_time, ctx );
13395 0 : fd_bincode_double_decode_unsafe( &self->slots_per_year, ctx );
13396 0 : fd_bincode_uint64_decode_unsafe( &self->max_tick_height, ctx );
13397 0 : fd_inflation_decode_inner( &self->inflation, alloc_mem, ctx );
13398 0 : fd_epoch_schedule_decode_inner( &self->epoch_schedule, alloc_mem, ctx );
13399 0 : fd_rent_decode_inner( &self->rent, alloc_mem, ctx );
13400 0 : fd_bincode_uint64_decode_unsafe( &self->eah_start_slot, ctx );
13401 0 : fd_bincode_uint64_decode_unsafe( &self->eah_stop_slot, ctx );
13402 0 : fd_bincode_uint64_decode_unsafe( &self->eah_interval, ctx );
13403 0 : fd_hash_decode_inner( &self->genesis_hash, alloc_mem, ctx );
13404 0 : fd_bincode_uint32_decode_unsafe( &self->cluster_type, ctx );
13405 0 : for( ulong i=0; i<3; i++ ) {
13406 0 : fd_bincode_uint32_decode_unsafe( self->cluster_version + i, ctx );
13407 0 : }
13408 0 : fd_vote_accounts_decode_inner( &self->next_epoch_stakes, alloc_mem, ctx );
13409 0 : fd_epoch_schedule_decode_inner( &self->rent_epoch_schedule, alloc_mem, ctx );
13410 0 : }
13411 0 : void * fd_epoch_bank_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
13412 0 : fd_epoch_bank_global_t * self = (fd_epoch_bank_global_t *)mem;
13413 0 : fd_epoch_bank_new( (fd_epoch_bank_t *)self );
13414 0 : void * alloc_region = (uchar *)mem + sizeof(fd_epoch_bank_global_t);
13415 0 : void * * alloc_mem = &alloc_region;
13416 0 : fd_epoch_bank_decode_inner_global( mem, alloc_mem, ctx );
13417 0 : return self;
13418 0 : }
13419 0 : void fd_epoch_bank_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
13420 0 : fd_epoch_bank_global_t * self = (fd_epoch_bank_global_t *)struct_mem;
13421 0 : fd_stakes_decode_inner_global( &self->stakes, alloc_mem, ctx );
13422 0 : fd_bincode_uint64_decode_unsafe( &self->hashes_per_tick, ctx );
13423 0 : fd_bincode_uint64_decode_unsafe( &self->ticks_per_slot, ctx );
13424 0 : fd_bincode_uint128_decode_unsafe( &self->ns_per_slot, ctx );
13425 0 : fd_bincode_uint64_decode_unsafe( &self->genesis_creation_time, ctx );
13426 0 : fd_bincode_double_decode_unsafe( &self->slots_per_year, ctx );
13427 0 : fd_bincode_uint64_decode_unsafe( &self->max_tick_height, ctx );
13428 0 : fd_inflation_decode_inner_global( &self->inflation, alloc_mem, ctx );
13429 0 : fd_epoch_schedule_decode_inner_global( &self->epoch_schedule, alloc_mem, ctx );
13430 0 : fd_rent_decode_inner_global( &self->rent, alloc_mem, ctx );
13431 0 : fd_bincode_uint64_decode_unsafe( &self->eah_start_slot, ctx );
13432 0 : fd_bincode_uint64_decode_unsafe( &self->eah_stop_slot, ctx );
13433 0 : fd_bincode_uint64_decode_unsafe( &self->eah_interval, ctx );
13434 0 : fd_hash_decode_inner_global( &self->genesis_hash, alloc_mem, ctx );
13435 0 : fd_bincode_uint32_decode_unsafe( &self->cluster_type, ctx );
13436 0 : for( ulong i=0; i<3; i++ ) {
13437 0 : fd_bincode_uint32_decode_unsafe( self->cluster_version + i, ctx );
13438 0 : }
13439 0 : fd_vote_accounts_decode_inner_global( &self->next_epoch_stakes, alloc_mem, ctx );
13440 0 : fd_epoch_schedule_decode_inner_global( &self->rent_epoch_schedule, alloc_mem, ctx );
13441 0 : }
13442 0 : int fd_epoch_bank_convert_global_to_local( void const * global_self, fd_epoch_bank_t * self, fd_bincode_decode_ctx_t * ctx ) {
13443 0 : int err = 0;
13444 0 : fd_epoch_bank_global_t const * mem = (fd_epoch_bank_global_t const *)global_self;
13445 0 : err = fd_stakes_convert_global_to_local( &mem->stakes, &self->stakes, ctx );
13446 0 : if( FD_UNLIKELY( err ) ) return err;
13447 0 : self->hashes_per_tick = mem->hashes_per_tick;
13448 0 : self->ticks_per_slot = mem->ticks_per_slot;
13449 0 : self->ns_per_slot = mem->ns_per_slot;
13450 0 : self->genesis_creation_time = mem->genesis_creation_time;
13451 0 : self->slots_per_year = mem->slots_per_year;
13452 0 : self->max_tick_height = mem->max_tick_height;
13453 0 : err = fd_inflation_convert_global_to_local( &mem->inflation, &self->inflation, ctx );
13454 0 : if( FD_UNLIKELY( err ) ) return err;
13455 0 : err = fd_epoch_schedule_convert_global_to_local( &mem->epoch_schedule, &self->epoch_schedule, ctx );
13456 0 : if( FD_UNLIKELY( err ) ) return err;
13457 0 : err = fd_rent_convert_global_to_local( &mem->rent, &self->rent, ctx );
13458 0 : if( FD_UNLIKELY( err ) ) return err;
13459 0 : self->eah_start_slot = mem->eah_start_slot;
13460 0 : self->eah_stop_slot = mem->eah_stop_slot;
13461 0 : self->eah_interval = mem->eah_interval;
13462 0 : err = fd_hash_convert_global_to_local( &mem->genesis_hash, &self->genesis_hash, ctx );
13463 0 : if( FD_UNLIKELY( err ) ) return err;
13464 0 : self->cluster_type = mem->cluster_type;
13465 0 : fd_memcpy( self->cluster_version, mem->cluster_version, 3 * sizeof(uint) );
13466 0 : err = fd_vote_accounts_convert_global_to_local( &mem->next_epoch_stakes, &self->next_epoch_stakes, ctx );
13467 0 : if( FD_UNLIKELY( err ) ) return err;
13468 0 : err = fd_epoch_schedule_convert_global_to_local( &mem->rent_epoch_schedule, &self->rent_epoch_schedule, ctx );
13469 0 : if( FD_UNLIKELY( err ) ) return err;
13470 0 : return FD_BINCODE_SUCCESS;
13471 0 : }
13472 0 : void fd_epoch_bank_new(fd_epoch_bank_t * self) {
13473 0 : fd_memset( self, 0, sizeof(fd_epoch_bank_t) );
13474 0 : fd_stakes_new( &self->stakes );
13475 0 : fd_inflation_new( &self->inflation );
13476 0 : fd_epoch_schedule_new( &self->epoch_schedule );
13477 0 : fd_rent_new( &self->rent );
13478 0 : fd_hash_new( &self->genesis_hash );
13479 0 : fd_vote_accounts_new( &self->next_epoch_stakes );
13480 0 : fd_epoch_schedule_new( &self->rent_epoch_schedule );
13481 0 : }
13482 0 : void fd_epoch_bank_destroy( fd_epoch_bank_t * self ) {
13483 0 : fd_stakes_destroy( &self->stakes );
13484 0 : fd_inflation_destroy( &self->inflation );
13485 0 : fd_epoch_schedule_destroy( &self->epoch_schedule );
13486 0 : fd_rent_destroy( &self->rent );
13487 0 : fd_hash_destroy( &self->genesis_hash );
13488 0 : fd_vote_accounts_destroy( &self->next_epoch_stakes );
13489 0 : fd_epoch_schedule_destroy( &self->rent_epoch_schedule );
13490 0 : }
13491 :
13492 0 : ulong fd_epoch_bank_footprint( void ){ return FD_EPOCH_BANK_FOOTPRINT; }
13493 0 : ulong fd_epoch_bank_align( void ){ return FD_EPOCH_BANK_ALIGN; }
13494 :
13495 0 : void fd_epoch_bank_walk( void * w, fd_epoch_bank_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
13496 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_epoch_bank", level++ );
13497 0 : fd_stakes_walk( w, &self->stakes, fun, "stakes", level );
13498 0 : fun( w, &self->hashes_per_tick, "hashes_per_tick", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
13499 0 : fun( w, &self->ticks_per_slot, "ticks_per_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
13500 0 : fun( w, &self->ns_per_slot, "ns_per_slot", FD_FLAMENCO_TYPE_UINT128, "uint128", level );
13501 0 : fun( w, &self->genesis_creation_time, "genesis_creation_time", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
13502 0 : fun( w, &self->slots_per_year, "slots_per_year", FD_FLAMENCO_TYPE_DOUBLE, "double", level );
13503 0 : fun( w, &self->max_tick_height, "max_tick_height", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
13504 0 : fd_inflation_walk( w, &self->inflation, fun, "inflation", level );
13505 0 : fd_epoch_schedule_walk( w, &self->epoch_schedule, fun, "epoch_schedule", level );
13506 0 : fd_rent_walk( w, &self->rent, fun, "rent", level );
13507 0 : fun( w, &self->eah_start_slot, "eah_start_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
13508 0 : fun( w, &self->eah_stop_slot, "eah_stop_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
13509 0 : fun( w, &self->eah_interval, "eah_interval", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
13510 0 : fd_hash_walk( w, &self->genesis_hash, fun, "genesis_hash", level );
13511 0 : fun( w, &self->cluster_type, "cluster_type", FD_FLAMENCO_TYPE_UINT, "uint", level );
13512 0 : fun( w, NULL, "cluster_version", FD_FLAMENCO_TYPE_ARR, "uint[]", level++ );
13513 0 : for( ulong i=0; i<3; i++ )
13514 0 : fun( w, self->cluster_version + i, "cluster_version", FD_FLAMENCO_TYPE_UINT, "uint", level );
13515 0 : fun( w, NULL, "cluster_version", FD_FLAMENCO_TYPE_ARR_END, "uint[]", level-- );
13516 0 : fd_vote_accounts_walk( w, &self->next_epoch_stakes, fun, "next_epoch_stakes", level );
13517 0 : fd_epoch_schedule_walk( w, &self->rent_epoch_schedule, fun, "rent_epoch_schedule", level );
13518 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_epoch_bank", level-- );
13519 0 : }
13520 0 : ulong fd_epoch_bank_size( fd_epoch_bank_t const * self ) {
13521 0 : ulong size = 0;
13522 0 : size += fd_stakes_size( &self->stakes );
13523 0 : size += sizeof(ulong);
13524 0 : size += sizeof(ulong);
13525 0 : size += sizeof(uint128);
13526 0 : size += sizeof(ulong);
13527 0 : size += sizeof(double);
13528 0 : size += sizeof(ulong);
13529 0 : size += fd_inflation_size( &self->inflation );
13530 0 : size += fd_epoch_schedule_size( &self->epoch_schedule );
13531 0 : size += fd_rent_size( &self->rent );
13532 0 : size += sizeof(ulong);
13533 0 : size += sizeof(ulong);
13534 0 : size += sizeof(ulong);
13535 0 : size += fd_hash_size( &self->genesis_hash );
13536 0 : size += sizeof(uint);
13537 0 : size += 3 * sizeof(uint);
13538 0 : size += fd_vote_accounts_size( &self->next_epoch_stakes );
13539 0 : size += fd_epoch_schedule_size( &self->rent_epoch_schedule );
13540 0 : return size;
13541 0 : }
13542 :
13543 6 : int fd_slot_bank_encode( fd_slot_bank_t const * self, fd_bincode_encode_ctx_t * ctx ) {
13544 6 : int err;
13545 6 : err = fd_clock_timestamp_votes_encode( &self->timestamp_votes, ctx );
13546 6 : if( FD_UNLIKELY( err ) ) return err;
13547 6 : err = fd_bincode_uint64_encode( self->slot, ctx );
13548 6 : if( FD_UNLIKELY( err ) ) return err;
13549 6 : err = fd_bincode_uint64_encode( self->prev_slot, ctx );
13550 6 : if( FD_UNLIKELY( err ) ) return err;
13551 6 : err = fd_hash_encode( &self->poh, ctx );
13552 6 : if( FD_UNLIKELY( err ) ) return err;
13553 6 : err = fd_hash_encode( &self->banks_hash, ctx );
13554 6 : if( FD_UNLIKELY( err ) ) return err;
13555 6 : err = fd_hash_encode( &self->epoch_account_hash, ctx );
13556 6 : if( FD_UNLIKELY( err ) ) return err;
13557 6 : err = fd_fee_rate_governor_encode( &self->fee_rate_governor, ctx );
13558 6 : if( FD_UNLIKELY( err ) ) return err;
13559 6 : err = fd_bincode_uint64_encode( self->capitalization, ctx );
13560 6 : if( FD_UNLIKELY( err ) ) return err;
13561 6 : err = fd_bincode_uint64_encode( self->block_height, ctx );
13562 6 : if( FD_UNLIKELY( err ) ) return err;
13563 6 : err = fd_bincode_uint64_encode( self->max_tick_height, ctx );
13564 6 : if( FD_UNLIKELY( err ) ) return err;
13565 6 : err = fd_bincode_uint64_encode( self->collected_execution_fees, ctx );
13566 6 : if( FD_UNLIKELY( err ) ) return err;
13567 6 : err = fd_bincode_uint64_encode( self->collected_priority_fees, ctx );
13568 6 : if( FD_UNLIKELY( err ) ) return err;
13569 6 : err = fd_bincode_uint64_encode( self->collected_rent, ctx );
13570 6 : if( FD_UNLIKELY( err ) ) return err;
13571 6 : err = fd_vote_accounts_encode( &self->epoch_stakes, ctx );
13572 6 : if( FD_UNLIKELY( err ) ) return err;
13573 6 : err = fd_sol_sysvar_last_restart_slot_encode( &self->last_restart_slot, ctx );
13574 6 : if( FD_UNLIKELY( err ) ) return err;
13575 6 : err = fd_account_keys_encode( &self->stake_account_keys, ctx );
13576 6 : if( FD_UNLIKELY( err ) ) return err;
13577 6 : err = fd_account_keys_encode( &self->vote_account_keys, ctx );
13578 6 : if( FD_UNLIKELY( err ) ) return err;
13579 6 : err = fd_bincode_uint64_encode( self->lamports_per_signature, ctx );
13580 6 : if( FD_UNLIKELY( err ) ) return err;
13581 6 : err = fd_bincode_uint64_encode( self->transaction_count, ctx );
13582 6 : if( FD_UNLIKELY( err ) ) return err;
13583 6 : err = fd_slot_lthash_encode( &self->lthash, ctx );
13584 6 : if( FD_UNLIKELY( err ) ) return err;
13585 6 : err = fd_block_hash_queue_encode( &self->block_hash_queue, ctx );
13586 6 : if( FD_UNLIKELY( err ) ) return err;
13587 6 : err = fd_hash_encode( &self->prev_banks_hash, ctx );
13588 6 : if( FD_UNLIKELY( err ) ) return err;
13589 6 : err = fd_bincode_uint64_encode( self->parent_signature_cnt, ctx );
13590 6 : if( FD_UNLIKELY( err ) ) return err;
13591 6 : err = fd_bincode_uint64_encode( self->tick_height, ctx );
13592 6 : if( FD_UNLIKELY( err ) ) return err;
13593 6 : err = fd_bincode_bool_encode( self->has_use_preceeding_epoch_stakes, ctx );
13594 6 : if( FD_UNLIKELY( err ) ) return err;
13595 6 : if( self->has_use_preceeding_epoch_stakes ) {
13596 6 : err = fd_bincode_uint64_encode( self->use_preceeding_epoch_stakes, ctx );
13597 6 : if( FD_UNLIKELY( err ) ) return err;
13598 6 : }
13599 6 : err = fd_hard_forks_encode( &self->hard_forks, ctx );
13600 6 : if( FD_UNLIKELY( err ) ) return err;
13601 6 : return FD_BINCODE_SUCCESS;
13602 6 : }
13603 6 : int fd_slot_bank_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13604 6 : *total_sz += sizeof(fd_slot_bank_t);
13605 6 : void const * start_data = ctx->data;
13606 6 : int err = fd_slot_bank_decode_footprint_inner( ctx, total_sz );
13607 6 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
13608 6 : ctx->data = start_data;
13609 6 : return err;
13610 6 : }
13611 6 : int fd_slot_bank_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13612 6 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
13613 6 : int err = 0;
13614 6 : err = fd_clock_timestamp_votes_decode_footprint_inner( ctx, total_sz );
13615 6 : if( FD_UNLIKELY( err ) ) return err;
13616 6 : err = fd_bincode_uint64_decode_footprint( ctx );
13617 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13618 6 : err = fd_bincode_uint64_decode_footprint( ctx );
13619 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13620 6 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
13621 6 : if( FD_UNLIKELY( err ) ) return err;
13622 6 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
13623 6 : if( FD_UNLIKELY( err ) ) return err;
13624 6 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
13625 6 : if( FD_UNLIKELY( err ) ) return err;
13626 6 : err = fd_fee_rate_governor_decode_footprint_inner( ctx, total_sz );
13627 6 : if( FD_UNLIKELY( err ) ) return err;
13628 6 : err = fd_bincode_uint64_decode_footprint( ctx );
13629 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13630 6 : err = fd_bincode_uint64_decode_footprint( ctx );
13631 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13632 6 : err = fd_bincode_uint64_decode_footprint( ctx );
13633 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13634 6 : err = fd_bincode_uint64_decode_footprint( ctx );
13635 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13636 6 : err = fd_bincode_uint64_decode_footprint( ctx );
13637 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13638 6 : err = fd_bincode_uint64_decode_footprint( ctx );
13639 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13640 6 : err = fd_vote_accounts_decode_footprint_inner( ctx, total_sz );
13641 6 : if( FD_UNLIKELY( err ) ) return err;
13642 6 : err = fd_sol_sysvar_last_restart_slot_decode_footprint_inner( ctx, total_sz );
13643 6 : if( FD_UNLIKELY( err ) ) return err;
13644 6 : err = fd_account_keys_decode_footprint_inner( ctx, total_sz );
13645 6 : if( FD_UNLIKELY( err ) ) return err;
13646 6 : err = fd_account_keys_decode_footprint_inner( ctx, total_sz );
13647 6 : if( FD_UNLIKELY( err ) ) return err;
13648 6 : err = fd_bincode_uint64_decode_footprint( ctx );
13649 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13650 6 : err = fd_bincode_uint64_decode_footprint( ctx );
13651 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13652 6 : err = fd_slot_lthash_decode_footprint_inner( ctx, total_sz );
13653 6 : if( FD_UNLIKELY( err ) ) return err;
13654 6 : err = fd_block_hash_queue_decode_footprint_inner( ctx, total_sz );
13655 6 : if( FD_UNLIKELY( err ) ) return err;
13656 6 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
13657 6 : if( FD_UNLIKELY( err ) ) return err;
13658 6 : err = fd_bincode_uint64_decode_footprint( ctx );
13659 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13660 6 : err = fd_bincode_uint64_decode_footprint( ctx );
13661 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13662 6 : {
13663 6 : uchar o;
13664 6 : err = fd_bincode_bool_decode( &o, ctx );
13665 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13666 6 : if( o ) {
13667 6 : err = fd_bincode_uint64_decode_footprint( ctx );
13668 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13669 6 : }
13670 6 : }
13671 6 : err = fd_hard_forks_decode_footprint_inner( ctx, total_sz );
13672 6 : if( FD_UNLIKELY( err ) ) return err;
13673 6 : return 0;
13674 6 : }
13675 6 : void * fd_slot_bank_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
13676 6 : fd_slot_bank_t * self = (fd_slot_bank_t *)mem;
13677 6 : fd_slot_bank_new( self );
13678 6 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_bank_t);
13679 6 : void * * alloc_mem = &alloc_region;
13680 6 : fd_slot_bank_decode_inner( mem, alloc_mem, ctx );
13681 6 : return self;
13682 6 : }
13683 6 : void fd_slot_bank_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
13684 6 : fd_slot_bank_t * self = (fd_slot_bank_t *)struct_mem;
13685 6 : fd_clock_timestamp_votes_decode_inner( &self->timestamp_votes, alloc_mem, ctx );
13686 6 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
13687 6 : fd_bincode_uint64_decode_unsafe( &self->prev_slot, ctx );
13688 6 : fd_hash_decode_inner( &self->poh, alloc_mem, ctx );
13689 6 : fd_hash_decode_inner( &self->banks_hash, alloc_mem, ctx );
13690 6 : fd_hash_decode_inner( &self->epoch_account_hash, alloc_mem, ctx );
13691 6 : fd_fee_rate_governor_decode_inner( &self->fee_rate_governor, alloc_mem, ctx );
13692 6 : fd_bincode_uint64_decode_unsafe( &self->capitalization, ctx );
13693 6 : fd_bincode_uint64_decode_unsafe( &self->block_height, ctx );
13694 6 : fd_bincode_uint64_decode_unsafe( &self->max_tick_height, ctx );
13695 6 : fd_bincode_uint64_decode_unsafe( &self->collected_execution_fees, ctx );
13696 6 : fd_bincode_uint64_decode_unsafe( &self->collected_priority_fees, ctx );
13697 6 : fd_bincode_uint64_decode_unsafe( &self->collected_rent, ctx );
13698 6 : fd_vote_accounts_decode_inner( &self->epoch_stakes, alloc_mem, ctx );
13699 6 : fd_sol_sysvar_last_restart_slot_decode_inner( &self->last_restart_slot, alloc_mem, ctx );
13700 6 : fd_account_keys_decode_inner( &self->stake_account_keys, alloc_mem, ctx );
13701 6 : fd_account_keys_decode_inner( &self->vote_account_keys, alloc_mem, ctx );
13702 6 : fd_bincode_uint64_decode_unsafe( &self->lamports_per_signature, ctx );
13703 6 : fd_bincode_uint64_decode_unsafe( &self->transaction_count, ctx );
13704 6 : fd_slot_lthash_decode_inner( &self->lthash, alloc_mem, ctx );
13705 6 : fd_block_hash_queue_decode_inner( &self->block_hash_queue, alloc_mem, ctx );
13706 6 : fd_hash_decode_inner( &self->prev_banks_hash, alloc_mem, ctx );
13707 6 : fd_bincode_uint64_decode_unsafe( &self->parent_signature_cnt, ctx );
13708 6 : fd_bincode_uint64_decode_unsafe( &self->tick_height, ctx );
13709 6 : {
13710 6 : uchar o;
13711 6 : fd_bincode_bool_decode_unsafe( &o, ctx );
13712 6 : self->has_use_preceeding_epoch_stakes = !!o;
13713 6 : if( o ) {
13714 6 : fd_bincode_uint64_decode_unsafe( &self->use_preceeding_epoch_stakes, ctx );
13715 6 : }
13716 6 : }
13717 6 : fd_hard_forks_decode_inner( &self->hard_forks, alloc_mem, ctx );
13718 6 : }
13719 3 : void * fd_slot_bank_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
13720 3 : fd_slot_bank_global_t * self = (fd_slot_bank_global_t *)mem;
13721 3 : fd_slot_bank_new( (fd_slot_bank_t *)self );
13722 3 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_bank_global_t);
13723 3 : void * * alloc_mem = &alloc_region;
13724 3 : fd_slot_bank_decode_inner_global( mem, alloc_mem, ctx );
13725 3 : return self;
13726 3 : }
13727 3 : void fd_slot_bank_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
13728 3 : fd_slot_bank_global_t * self = (fd_slot_bank_global_t *)struct_mem;
13729 3 : fd_clock_timestamp_votes_decode_inner_global( &self->timestamp_votes, alloc_mem, ctx );
13730 3 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
13731 3 : fd_bincode_uint64_decode_unsafe( &self->prev_slot, ctx );
13732 3 : fd_hash_decode_inner_global( &self->poh, alloc_mem, ctx );
13733 3 : fd_hash_decode_inner_global( &self->banks_hash, alloc_mem, ctx );
13734 3 : fd_hash_decode_inner_global( &self->epoch_account_hash, alloc_mem, ctx );
13735 3 : fd_fee_rate_governor_decode_inner_global( &self->fee_rate_governor, alloc_mem, ctx );
13736 3 : fd_bincode_uint64_decode_unsafe( &self->capitalization, ctx );
13737 3 : fd_bincode_uint64_decode_unsafe( &self->block_height, ctx );
13738 3 : fd_bincode_uint64_decode_unsafe( &self->max_tick_height, ctx );
13739 3 : fd_bincode_uint64_decode_unsafe( &self->collected_execution_fees, ctx );
13740 3 : fd_bincode_uint64_decode_unsafe( &self->collected_priority_fees, ctx );
13741 3 : fd_bincode_uint64_decode_unsafe( &self->collected_rent, ctx );
13742 3 : fd_vote_accounts_decode_inner_global( &self->epoch_stakes, alloc_mem, ctx );
13743 3 : fd_sol_sysvar_last_restart_slot_decode_inner_global( &self->last_restart_slot, alloc_mem, ctx );
13744 3 : fd_account_keys_decode_inner_global( &self->stake_account_keys, alloc_mem, ctx );
13745 3 : fd_account_keys_decode_inner_global( &self->vote_account_keys, alloc_mem, ctx );
13746 3 : fd_bincode_uint64_decode_unsafe( &self->lamports_per_signature, ctx );
13747 3 : fd_bincode_uint64_decode_unsafe( &self->transaction_count, ctx );
13748 3 : fd_slot_lthash_decode_inner_global( &self->lthash, alloc_mem, ctx );
13749 3 : fd_block_hash_queue_decode_inner_global( &self->block_hash_queue, alloc_mem, ctx );
13750 3 : fd_hash_decode_inner_global( &self->prev_banks_hash, alloc_mem, ctx );
13751 3 : fd_bincode_uint64_decode_unsafe( &self->parent_signature_cnt, ctx );
13752 3 : fd_bincode_uint64_decode_unsafe( &self->tick_height, ctx );
13753 3 : {
13754 3 : uchar o;
13755 3 : fd_bincode_bool_decode_unsafe( &o, ctx );
13756 3 : self->has_use_preceeding_epoch_stakes = !!o;
13757 3 : if( o ) {
13758 3 : fd_bincode_uint64_decode_unsafe( &self->use_preceeding_epoch_stakes, ctx );
13759 3 : }
13760 3 : }
13761 3 : fd_hard_forks_decode_inner_global( &self->hard_forks, alloc_mem, ctx );
13762 3 : }
13763 3 : int fd_slot_bank_convert_global_to_local( void const * global_self, fd_slot_bank_t * self, fd_bincode_decode_ctx_t * ctx ) {
13764 3 : int err = 0;
13765 3 : fd_slot_bank_global_t const * mem = (fd_slot_bank_global_t const *)global_self;
13766 3 : err = fd_clock_timestamp_votes_convert_global_to_local( &mem->timestamp_votes, &self->timestamp_votes, ctx );
13767 3 : if( FD_UNLIKELY( err ) ) return err;
13768 3 : self->slot = mem->slot;
13769 3 : self->prev_slot = mem->prev_slot;
13770 3 : err = fd_hash_convert_global_to_local( &mem->poh, &self->poh, ctx );
13771 3 : if( FD_UNLIKELY( err ) ) return err;
13772 3 : err = fd_hash_convert_global_to_local( &mem->banks_hash, &self->banks_hash, ctx );
13773 3 : if( FD_UNLIKELY( err ) ) return err;
13774 3 : err = fd_hash_convert_global_to_local( &mem->epoch_account_hash, &self->epoch_account_hash, ctx );
13775 3 : if( FD_UNLIKELY( err ) ) return err;
13776 3 : err = fd_fee_rate_governor_convert_global_to_local( &mem->fee_rate_governor, &self->fee_rate_governor, ctx );
13777 3 : if( FD_UNLIKELY( err ) ) return err;
13778 3 : self->capitalization = mem->capitalization;
13779 3 : self->block_height = mem->block_height;
13780 3 : self->max_tick_height = mem->max_tick_height;
13781 3 : self->collected_execution_fees = mem->collected_execution_fees;
13782 3 : self->collected_priority_fees = mem->collected_priority_fees;
13783 3 : self->collected_rent = mem->collected_rent;
13784 3 : err = fd_vote_accounts_convert_global_to_local( &mem->epoch_stakes, &self->epoch_stakes, ctx );
13785 3 : if( FD_UNLIKELY( err ) ) return err;
13786 3 : err = fd_sol_sysvar_last_restart_slot_convert_global_to_local( &mem->last_restart_slot, &self->last_restart_slot, ctx );
13787 3 : if( FD_UNLIKELY( err ) ) return err;
13788 3 : err = fd_account_keys_convert_global_to_local( &mem->stake_account_keys, &self->stake_account_keys, ctx );
13789 3 : if( FD_UNLIKELY( err ) ) return err;
13790 3 : err = fd_account_keys_convert_global_to_local( &mem->vote_account_keys, &self->vote_account_keys, ctx );
13791 3 : if( FD_UNLIKELY( err ) ) return err;
13792 3 : self->lamports_per_signature = mem->lamports_per_signature;
13793 3 : self->transaction_count = mem->transaction_count;
13794 3 : err = fd_slot_lthash_convert_global_to_local( &mem->lthash, &self->lthash, ctx );
13795 3 : if( FD_UNLIKELY( err ) ) return err;
13796 3 : err = fd_block_hash_queue_convert_global_to_local( &mem->block_hash_queue, &self->block_hash_queue, ctx );
13797 3 : if( FD_UNLIKELY( err ) ) return err;
13798 3 : err = fd_hash_convert_global_to_local( &mem->prev_banks_hash, &self->prev_banks_hash, ctx );
13799 3 : if( FD_UNLIKELY( err ) ) return err;
13800 3 : self->parent_signature_cnt = mem->parent_signature_cnt;
13801 3 : self->tick_height = mem->tick_height;
13802 3 : self->use_preceeding_epoch_stakes = mem->use_preceeding_epoch_stakes;
13803 3 : self->has_use_preceeding_epoch_stakes = mem->has_use_preceeding_epoch_stakes;
13804 3 : err = fd_hard_forks_convert_global_to_local( &mem->hard_forks, &self->hard_forks, ctx );
13805 3 : if( FD_UNLIKELY( err ) ) return err;
13806 3 : return FD_BINCODE_SUCCESS;
13807 3 : }
13808 9 : void fd_slot_bank_new(fd_slot_bank_t * self) {
13809 9 : fd_memset( self, 0, sizeof(fd_slot_bank_t) );
13810 9 : fd_clock_timestamp_votes_new( &self->timestamp_votes );
13811 9 : fd_hash_new( &self->poh );
13812 9 : fd_hash_new( &self->banks_hash );
13813 9 : fd_hash_new( &self->epoch_account_hash );
13814 9 : fd_fee_rate_governor_new( &self->fee_rate_governor );
13815 9 : fd_vote_accounts_new( &self->epoch_stakes );
13816 9 : fd_sol_sysvar_last_restart_slot_new( &self->last_restart_slot );
13817 9 : fd_account_keys_new( &self->stake_account_keys );
13818 9 : fd_account_keys_new( &self->vote_account_keys );
13819 9 : fd_slot_lthash_new( &self->lthash );
13820 9 : fd_block_hash_queue_new( &self->block_hash_queue );
13821 9 : fd_hash_new( &self->prev_banks_hash );
13822 9 : fd_hard_forks_new( &self->hard_forks );
13823 9 : }
13824 0 : void fd_slot_bank_destroy( fd_slot_bank_t * self ) {
13825 0 : fd_clock_timestamp_votes_destroy( &self->timestamp_votes );
13826 0 : fd_hash_destroy( &self->poh );
13827 0 : fd_hash_destroy( &self->banks_hash );
13828 0 : fd_hash_destroy( &self->epoch_account_hash );
13829 0 : fd_fee_rate_governor_destroy( &self->fee_rate_governor );
13830 0 : fd_vote_accounts_destroy( &self->epoch_stakes );
13831 0 : fd_sol_sysvar_last_restart_slot_destroy( &self->last_restart_slot );
13832 0 : fd_account_keys_destroy( &self->stake_account_keys );
13833 0 : fd_account_keys_destroy( &self->vote_account_keys );
13834 0 : fd_slot_lthash_destroy( &self->lthash );
13835 0 : fd_block_hash_queue_destroy( &self->block_hash_queue );
13836 0 : fd_hash_destroy( &self->prev_banks_hash );
13837 0 : if( self->has_use_preceeding_epoch_stakes ) {
13838 0 : self->has_use_preceeding_epoch_stakes = 0;
13839 0 : }
13840 0 : fd_hard_forks_destroy( &self->hard_forks );
13841 0 : }
13842 :
13843 3 : ulong fd_slot_bank_footprint( void ){ return FD_SLOT_BANK_FOOTPRINT; }
13844 15 : ulong fd_slot_bank_align( void ){ return FD_SLOT_BANK_ALIGN; }
13845 :
13846 3 : void fd_slot_bank_walk( void * w, fd_slot_bank_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
13847 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_slot_bank", level++ );
13848 3 : fd_clock_timestamp_votes_walk( w, &self->timestamp_votes, fun, "timestamp_votes", level );
13849 3 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
13850 3 : fun( w, &self->prev_slot, "prev_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
13851 3 : fd_hash_walk( w, &self->poh, fun, "poh", level );
13852 3 : fd_hash_walk( w, &self->banks_hash, fun, "banks_hash", level );
13853 3 : fd_hash_walk( w, &self->epoch_account_hash, fun, "epoch_account_hash", level );
13854 3 : fd_fee_rate_governor_walk( w, &self->fee_rate_governor, fun, "fee_rate_governor", level );
13855 3 : fun( w, &self->capitalization, "capitalization", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
13856 3 : fun( w, &self->block_height, "block_height", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
13857 3 : fun( w, &self->max_tick_height, "max_tick_height", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
13858 3 : fun( w, &self->collected_execution_fees, "collected_execution_fees", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
13859 3 : fun( w, &self->collected_priority_fees, "collected_priority_fees", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
13860 3 : fun( w, &self->collected_rent, "collected_rent", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
13861 3 : fd_vote_accounts_walk( w, &self->epoch_stakes, fun, "epoch_stakes", level );
13862 3 : fd_sol_sysvar_last_restart_slot_walk( w, &self->last_restart_slot, fun, "last_restart_slot", level );
13863 3 : fd_account_keys_walk( w, &self->stake_account_keys, fun, "stake_account_keys", level );
13864 3 : fd_account_keys_walk( w, &self->vote_account_keys, fun, "vote_account_keys", level );
13865 3 : fun( w, &self->lamports_per_signature, "lamports_per_signature", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
13866 3 : fun( w, &self->transaction_count, "transaction_count", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
13867 3 : fd_slot_lthash_walk( w, &self->lthash, fun, "lthash", level );
13868 3 : fd_block_hash_queue_walk( w, &self->block_hash_queue, fun, "block_hash_queue", level );
13869 3 : fd_hash_walk( w, &self->prev_banks_hash, fun, "prev_banks_hash", level );
13870 3 : fun( w, &self->parent_signature_cnt, "parent_signature_cnt", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
13871 3 : fun( w, &self->tick_height, "tick_height", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
13872 3 : if( !self->has_use_preceeding_epoch_stakes ) {
13873 0 : fun( w, NULL, "use_preceeding_epoch_stakes", FD_FLAMENCO_TYPE_NULL, "ulong", level );
13874 3 : } else {
13875 3 : fun( w, &self->use_preceeding_epoch_stakes, "use_preceeding_epoch_stakes", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
13876 3 : }
13877 3 : fd_hard_forks_walk( w, &self->hard_forks, fun, "hard_forks", level );
13878 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_slot_bank", level-- );
13879 3 : }
13880 0 : ulong fd_slot_bank_size( fd_slot_bank_t const * self ) {
13881 0 : ulong size = 0;
13882 0 : size += fd_clock_timestamp_votes_size( &self->timestamp_votes );
13883 0 : size += sizeof(ulong);
13884 0 : size += sizeof(ulong);
13885 0 : size += fd_hash_size( &self->poh );
13886 0 : size += fd_hash_size( &self->banks_hash );
13887 0 : size += fd_hash_size( &self->epoch_account_hash );
13888 0 : size += fd_fee_rate_governor_size( &self->fee_rate_governor );
13889 0 : size += sizeof(ulong);
13890 0 : size += sizeof(ulong);
13891 0 : size += sizeof(ulong);
13892 0 : size += sizeof(ulong);
13893 0 : size += sizeof(ulong);
13894 0 : size += sizeof(ulong);
13895 0 : size += fd_vote_accounts_size( &self->epoch_stakes );
13896 0 : size += fd_sol_sysvar_last_restart_slot_size( &self->last_restart_slot );
13897 0 : size += fd_account_keys_size( &self->stake_account_keys );
13898 0 : size += fd_account_keys_size( &self->vote_account_keys );
13899 0 : size += sizeof(ulong);
13900 0 : size += sizeof(ulong);
13901 0 : size += fd_slot_lthash_size( &self->lthash );
13902 0 : size += fd_block_hash_queue_size( &self->block_hash_queue );
13903 0 : size += fd_hash_size( &self->prev_banks_hash );
13904 0 : size += sizeof(ulong);
13905 0 : size += sizeof(ulong);
13906 0 : size += sizeof(char);
13907 0 : if( self->has_use_preceeding_epoch_stakes ) {
13908 0 : size += sizeof(ulong);
13909 0 : }
13910 0 : size += fd_hard_forks_size( &self->hard_forks );
13911 0 : return size;
13912 0 : }
13913 :
13914 0 : int fd_prev_epoch_inflation_rewards_encode( fd_prev_epoch_inflation_rewards_t const * self, fd_bincode_encode_ctx_t * ctx ) {
13915 0 : int err;
13916 0 : err = fd_bincode_uint64_encode( self->validator_rewards, ctx );
13917 0 : if( FD_UNLIKELY( err ) ) return err;
13918 0 : err = fd_bincode_double_encode( self->prev_epoch_duration_in_years, ctx );
13919 0 : if( FD_UNLIKELY( err ) ) return err;
13920 0 : err = fd_bincode_double_encode( self->validator_rate, ctx );
13921 0 : if( FD_UNLIKELY( err ) ) return err;
13922 0 : err = fd_bincode_double_encode( self->foundation_rate, ctx );
13923 0 : if( FD_UNLIKELY( err ) ) return err;
13924 0 : return FD_BINCODE_SUCCESS;
13925 0 : }
13926 0 : int fd_prev_epoch_inflation_rewards_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13927 0 : *total_sz += sizeof(fd_prev_epoch_inflation_rewards_t);
13928 0 : void const * start_data = ctx->data;
13929 0 : int err = fd_prev_epoch_inflation_rewards_decode_footprint_inner( ctx, total_sz );
13930 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
13931 0 : ctx->data = start_data;
13932 0 : return err;
13933 0 : }
13934 0 : int fd_prev_epoch_inflation_rewards_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13935 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
13936 0 : int err = 0;
13937 0 : err = fd_bincode_uint64_decode_footprint( ctx );
13938 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13939 0 : err = fd_bincode_double_decode_footprint( ctx );
13940 0 : if( FD_UNLIKELY( err ) ) return err;
13941 0 : err = fd_bincode_double_decode_footprint( ctx );
13942 0 : if( FD_UNLIKELY( err ) ) return err;
13943 0 : err = fd_bincode_double_decode_footprint( ctx );
13944 0 : if( FD_UNLIKELY( err ) ) return err;
13945 0 : return 0;
13946 0 : }
13947 0 : void * fd_prev_epoch_inflation_rewards_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
13948 0 : fd_prev_epoch_inflation_rewards_t * self = (fd_prev_epoch_inflation_rewards_t *)mem;
13949 0 : fd_prev_epoch_inflation_rewards_new( self );
13950 0 : void * alloc_region = (uchar *)mem + sizeof(fd_prev_epoch_inflation_rewards_t);
13951 0 : void * * alloc_mem = &alloc_region;
13952 0 : fd_prev_epoch_inflation_rewards_decode_inner( mem, alloc_mem, ctx );
13953 0 : return self;
13954 0 : }
13955 0 : void fd_prev_epoch_inflation_rewards_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
13956 0 : fd_prev_epoch_inflation_rewards_t * self = (fd_prev_epoch_inflation_rewards_t *)struct_mem;
13957 0 : fd_bincode_uint64_decode_unsafe( &self->validator_rewards, ctx );
13958 0 : fd_bincode_double_decode_unsafe( &self->prev_epoch_duration_in_years, ctx );
13959 0 : fd_bincode_double_decode_unsafe( &self->validator_rate, ctx );
13960 0 : fd_bincode_double_decode_unsafe( &self->foundation_rate, ctx );
13961 0 : }
13962 0 : void * fd_prev_epoch_inflation_rewards_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
13963 0 : fd_prev_epoch_inflation_rewards_global_t * self = (fd_prev_epoch_inflation_rewards_global_t *)mem;
13964 0 : fd_prev_epoch_inflation_rewards_new( (fd_prev_epoch_inflation_rewards_t *)self );
13965 0 : void * alloc_region = (uchar *)mem + sizeof(fd_prev_epoch_inflation_rewards_global_t);
13966 0 : void * * alloc_mem = &alloc_region;
13967 0 : fd_prev_epoch_inflation_rewards_decode_inner_global( mem, alloc_mem, ctx );
13968 0 : return self;
13969 0 : }
13970 0 : void fd_prev_epoch_inflation_rewards_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
13971 0 : fd_prev_epoch_inflation_rewards_global_t * self = (fd_prev_epoch_inflation_rewards_global_t *)struct_mem;
13972 0 : fd_bincode_uint64_decode_unsafe( &self->validator_rewards, ctx );
13973 0 : fd_bincode_double_decode_unsafe( &self->prev_epoch_duration_in_years, ctx );
13974 0 : fd_bincode_double_decode_unsafe( &self->validator_rate, ctx );
13975 0 : fd_bincode_double_decode_unsafe( &self->foundation_rate, ctx );
13976 0 : }
13977 0 : int fd_prev_epoch_inflation_rewards_convert_global_to_local( void const * global_self, fd_prev_epoch_inflation_rewards_t * self, fd_bincode_decode_ctx_t * ctx ) {
13978 0 : int err = 0;
13979 0 : fd_prev_epoch_inflation_rewards_global_t const * mem = (fd_prev_epoch_inflation_rewards_global_t const *)global_self;
13980 0 : self->validator_rewards = mem->validator_rewards;
13981 0 : self->prev_epoch_duration_in_years = mem->prev_epoch_duration_in_years;
13982 0 : self->validator_rate = mem->validator_rate;
13983 0 : self->foundation_rate = mem->foundation_rate;
13984 0 : return FD_BINCODE_SUCCESS;
13985 0 : }
13986 0 : void fd_prev_epoch_inflation_rewards_new(fd_prev_epoch_inflation_rewards_t * self) {
13987 0 : fd_memset( self, 0, sizeof(fd_prev_epoch_inflation_rewards_t) );
13988 0 : }
13989 0 : void fd_prev_epoch_inflation_rewards_destroy( fd_prev_epoch_inflation_rewards_t * self ) {
13990 0 : }
13991 :
13992 0 : ulong fd_prev_epoch_inflation_rewards_footprint( void ){ return FD_PREV_EPOCH_INFLATION_REWARDS_FOOTPRINT; }
13993 0 : ulong fd_prev_epoch_inflation_rewards_align( void ){ return FD_PREV_EPOCH_INFLATION_REWARDS_ALIGN; }
13994 :
13995 0 : void fd_prev_epoch_inflation_rewards_walk( void * w, fd_prev_epoch_inflation_rewards_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
13996 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_prev_epoch_inflation_rewards", level++ );
13997 0 : fun( w, &self->validator_rewards, "validator_rewards", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
13998 0 : fun( w, &self->prev_epoch_duration_in_years, "prev_epoch_duration_in_years", FD_FLAMENCO_TYPE_DOUBLE, "double", level );
13999 0 : fun( w, &self->validator_rate, "validator_rate", FD_FLAMENCO_TYPE_DOUBLE, "double", level );
14000 0 : fun( w, &self->foundation_rate, "foundation_rate", FD_FLAMENCO_TYPE_DOUBLE, "double", level );
14001 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_prev_epoch_inflation_rewards", level-- );
14002 0 : }
14003 0 : ulong fd_prev_epoch_inflation_rewards_size( fd_prev_epoch_inflation_rewards_t const * self ) {
14004 0 : ulong size = 0;
14005 0 : size += sizeof(ulong);
14006 0 : size += sizeof(double);
14007 0 : size += sizeof(double);
14008 0 : size += sizeof(double);
14009 0 : return size;
14010 0 : }
14011 :
14012 0 : int fd_vote_encode( fd_vote_t const * self, fd_bincode_encode_ctx_t * ctx ) {
14013 0 : int err;
14014 0 : if( self->slots ) {
14015 0 : ulong slots_len = deq_ulong_cnt( self->slots );
14016 0 : err = fd_bincode_uint64_encode( slots_len, ctx );
14017 0 : if( FD_UNLIKELY( err ) ) return err;
14018 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 ) ) {
14019 0 : ulong const * ele = deq_ulong_iter_ele_const( self->slots, iter );
14020 0 : err = fd_bincode_uint64_encode( ele[0], ctx );
14021 0 : }
14022 0 : } else {
14023 0 : ulong slots_len = 0;
14024 0 : err = fd_bincode_uint64_encode( slots_len, ctx );
14025 0 : if( FD_UNLIKELY( err ) ) return err;
14026 0 : }
14027 0 : err = fd_hash_encode( &self->hash, ctx );
14028 0 : if( FD_UNLIKELY( err ) ) return err;
14029 0 : if( self->timestamp != NULL ) {
14030 0 : err = fd_bincode_bool_encode( 1, ctx );
14031 0 : if( FD_UNLIKELY( err ) ) return err;
14032 0 : err = fd_bincode_int64_encode( self->timestamp[0], ctx );
14033 0 : if( FD_UNLIKELY( err ) ) return err;
14034 0 : } else {
14035 0 : err = fd_bincode_bool_encode( 0, ctx );
14036 0 : if( FD_UNLIKELY( err ) ) return err;
14037 0 : }
14038 0 : return FD_BINCODE_SUCCESS;
14039 0 : }
14040 0 : int fd_vote_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
14041 0 : *total_sz += sizeof(fd_vote_t);
14042 0 : void const * start_data = ctx->data;
14043 0 : int err = fd_vote_decode_footprint_inner( ctx, total_sz );
14044 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
14045 0 : ctx->data = start_data;
14046 0 : return err;
14047 0 : }
14048 0 : int fd_vote_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
14049 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
14050 0 : int err = 0;
14051 0 : ulong slots_len;
14052 0 : err = fd_bincode_uint64_decode( &slots_len, ctx );
14053 0 : if( FD_UNLIKELY( err ) ) return err;
14054 0 : ulong slots_max = slots_len == 0 ? 1 : slots_len;
14055 0 : *total_sz += deq_ulong_align() + deq_ulong_footprint( slots_max ) ;
14056 0 : ulong slots_sz;
14057 0 : if( FD_UNLIKELY( __builtin_umull_overflow( slots_len, 8, &slots_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
14058 0 : err = fd_bincode_bytes_decode_footprint( slots_sz, ctx );
14059 0 : if( FD_UNLIKELY( err ) ) return err;
14060 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
14061 0 : if( FD_UNLIKELY( err ) ) return err;
14062 0 : {
14063 0 : uchar o;
14064 0 : err = fd_bincode_bool_decode( &o, ctx );
14065 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14066 0 : if( o ) {
14067 0 : *total_sz += 8UL + sizeof(long);
14068 0 : err = fd_bincode_int64_decode_footprint( ctx );
14069 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14070 0 : }
14071 0 : }
14072 0 : return 0;
14073 0 : }
14074 0 : void * fd_vote_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
14075 0 : fd_vote_t * self = (fd_vote_t *)mem;
14076 0 : fd_vote_new( self );
14077 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_t);
14078 0 : void * * alloc_mem = &alloc_region;
14079 0 : fd_vote_decode_inner( mem, alloc_mem, ctx );
14080 0 : return self;
14081 0 : }
14082 0 : void fd_vote_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
14083 0 : fd_vote_t * self = (fd_vote_t *)struct_mem;
14084 0 : ulong slots_len;
14085 0 : fd_bincode_uint64_decode_unsafe( &slots_len, ctx );
14086 0 : self->slots = deq_ulong_join_new( alloc_mem, slots_len );
14087 0 : for( ulong i=0; i < slots_len; i++ ) {
14088 0 : ulong * elem = deq_ulong_push_tail_nocopy( self->slots );
14089 0 : fd_bincode_uint64_decode_unsafe( elem, ctx );
14090 0 : }
14091 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
14092 0 : {
14093 0 : uchar o;
14094 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
14095 0 : if( o ) {
14096 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, 8UL );
14097 0 : self->timestamp = *alloc_mem;
14098 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(long);
14099 0 : fd_bincode_int64_decode_unsafe( self->timestamp, ctx );
14100 0 : } else {
14101 0 : self->timestamp = NULL;
14102 0 : }
14103 0 : }
14104 0 : }
14105 0 : void * fd_vote_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
14106 0 : fd_vote_global_t * self = (fd_vote_global_t *)mem;
14107 0 : fd_vote_new( (fd_vote_t *)self );
14108 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_global_t);
14109 0 : void * * alloc_mem = &alloc_region;
14110 0 : fd_vote_decode_inner_global( mem, alloc_mem, ctx );
14111 0 : return self;
14112 0 : }
14113 0 : void fd_vote_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
14114 0 : fd_vote_global_t * self = (fd_vote_global_t *)struct_mem;
14115 0 : ulong slots_len;
14116 0 : fd_bincode_uint64_decode_unsafe( &slots_len, ctx );
14117 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, deq_ulong_align() );
14118 0 : self->slots_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
14119 0 : ulong * slots = deq_ulong_join_new( alloc_mem, slots_len );
14120 0 : for( ulong i=0; i < slots_len; i++ ) {
14121 0 : ulong * elem = deq_ulong_push_tail_nocopy( slots );
14122 0 : fd_bincode_uint64_decode_unsafe( elem, ctx );
14123 0 : }
14124 0 : fd_hash_decode_inner_global( &self->hash, alloc_mem, ctx );
14125 0 : {
14126 0 : uchar o;
14127 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
14128 0 : if( o ) {
14129 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, 8UL );
14130 0 : self->timestamp_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
14131 0 : fd_bincode_int64_decode_unsafe( *alloc_mem, ctx );
14132 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(long);
14133 0 : } else {
14134 0 : self->timestamp_gaddr = 0UL;
14135 0 : }
14136 0 : }
14137 0 : }
14138 0 : int fd_vote_convert_global_to_local( void const * global_self, fd_vote_t * self, fd_bincode_decode_ctx_t * ctx ) {
14139 0 : int err = 0;
14140 0 : fd_vote_global_t const * mem = (fd_vote_global_t const *)global_self;
14141 0 : self->slots = deq_ulong_join( fd_wksp_laddr_fast( ctx->wksp, mem->slots_gaddr ) );
14142 0 : err = fd_hash_convert_global_to_local( &mem->hash, &self->hash, ctx );
14143 0 : if( FD_UNLIKELY( err ) ) return err;
14144 0 : self->timestamp = fd_wksp_laddr_fast( ctx->wksp, mem->timestamp_gaddr );
14145 0 : return FD_BINCODE_SUCCESS;
14146 0 : }
14147 0 : void fd_vote_new(fd_vote_t * self) {
14148 0 : fd_memset( self, 0, sizeof(fd_vote_t) );
14149 0 : fd_hash_new( &self->hash );
14150 0 : }
14151 0 : void fd_vote_destroy( fd_vote_t * self ) {
14152 0 : if( self->slots ) {
14153 0 : self->slots = NULL;
14154 0 : }
14155 0 : fd_hash_destroy( &self->hash );
14156 0 : if( self->timestamp ) {
14157 0 : self->timestamp = NULL;
14158 0 : }
14159 0 : }
14160 :
14161 0 : ulong fd_vote_footprint( void ){ return FD_VOTE_FOOTPRINT; }
14162 0 : ulong fd_vote_align( void ){ return FD_VOTE_ALIGN; }
14163 :
14164 0 : void fd_vote_walk( void * w, fd_vote_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
14165 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote", level++ );
14166 :
14167 : /* Walk deque */
14168 0 : fun( w, self->slots, "slots", FD_FLAMENCO_TYPE_ARR, "slots", level++ );
14169 0 : if( self->slots ) {
14170 0 : for( deq_ulong_iter_t iter = deq_ulong_iter_init( self->slots );
14171 0 : !deq_ulong_iter_done( self->slots, iter );
14172 0 : iter = deq_ulong_iter_next( self->slots, iter ) ) {
14173 0 : ulong * ele = deq_ulong_iter_ele( self->slots, iter );
14174 0 : fun(w, ele, "ele", FD_FLAMENCO_TYPE_ULONG, "long", level );
14175 0 : }
14176 0 : }
14177 0 : fun( w, self->slots, "slots", FD_FLAMENCO_TYPE_ARR_END, "slots", level-- );
14178 : /* Done walking deque */
14179 :
14180 0 : fd_hash_walk( w, &self->hash, fun, "hash", level );
14181 0 : if( !self->timestamp ) {
14182 0 : fun( w, NULL, "timestamp", FD_FLAMENCO_TYPE_NULL, "long", level );
14183 0 : } else {
14184 0 : fun( w, self->timestamp, "timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level );
14185 0 : }
14186 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote", level-- );
14187 0 : }
14188 0 : ulong fd_vote_size( fd_vote_t const * self ) {
14189 0 : ulong size = 0;
14190 0 : if( self->slots ) {
14191 0 : size += sizeof(ulong);
14192 0 : ulong slots_len = deq_ulong_cnt(self->slots);
14193 0 : size += slots_len * sizeof(ulong);
14194 0 : } else {
14195 0 : size += sizeof(ulong);
14196 0 : }
14197 0 : size += fd_hash_size( &self->hash );
14198 0 : size += sizeof(char);
14199 0 : if( NULL != self->timestamp ) {
14200 0 : size += sizeof(long);
14201 0 : }
14202 0 : return size;
14203 0 : }
14204 :
14205 0 : int fd_vote_init_encode( fd_vote_init_t const * self, fd_bincode_encode_ctx_t * ctx ) {
14206 0 : int err;
14207 0 : err = fd_pubkey_encode( &self->node_pubkey, ctx );
14208 0 : if( FD_UNLIKELY( err ) ) return err;
14209 0 : err = fd_pubkey_encode( &self->authorized_voter, ctx );
14210 0 : if( FD_UNLIKELY( err ) ) return err;
14211 0 : err = fd_pubkey_encode( &self->authorized_withdrawer, ctx );
14212 0 : if( FD_UNLIKELY( err ) ) return err;
14213 0 : err = fd_bincode_uint8_encode( (uchar)(self->commission), ctx );
14214 0 : if( FD_UNLIKELY( err ) ) return err;
14215 0 : return FD_BINCODE_SUCCESS;
14216 0 : }
14217 0 : int fd_vote_init_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
14218 0 : *total_sz += sizeof(fd_vote_init_t);
14219 0 : void const * start_data = ctx->data;
14220 0 : int err = fd_vote_init_decode_footprint_inner( ctx, total_sz );
14221 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
14222 0 : ctx->data = start_data;
14223 0 : return err;
14224 0 : }
14225 0 : int fd_vote_init_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
14226 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
14227 0 : int err = 0;
14228 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
14229 0 : if( FD_UNLIKELY( err ) ) return err;
14230 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
14231 0 : if( FD_UNLIKELY( err ) ) return err;
14232 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
14233 0 : if( FD_UNLIKELY( err ) ) return err;
14234 0 : err = fd_bincode_uint8_decode_footprint( ctx );
14235 0 : if( FD_UNLIKELY( err ) ) return err;
14236 0 : return 0;
14237 0 : }
14238 0 : void * fd_vote_init_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
14239 0 : fd_vote_init_t * self = (fd_vote_init_t *)mem;
14240 0 : fd_vote_init_new( self );
14241 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_init_t);
14242 0 : void * * alloc_mem = &alloc_region;
14243 0 : fd_vote_init_decode_inner( mem, alloc_mem, ctx );
14244 0 : return self;
14245 0 : }
14246 0 : void fd_vote_init_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
14247 0 : fd_vote_init_t * self = (fd_vote_init_t *)struct_mem;
14248 0 : fd_pubkey_decode_inner( &self->node_pubkey, alloc_mem, ctx );
14249 0 : fd_pubkey_decode_inner( &self->authorized_voter, alloc_mem, ctx );
14250 0 : fd_pubkey_decode_inner( &self->authorized_withdrawer, alloc_mem, ctx );
14251 0 : fd_bincode_uint8_decode_unsafe( &self->commission, ctx );
14252 0 : }
14253 0 : void * fd_vote_init_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
14254 0 : fd_vote_init_global_t * self = (fd_vote_init_global_t *)mem;
14255 0 : fd_vote_init_new( (fd_vote_init_t *)self );
14256 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_init_global_t);
14257 0 : void * * alloc_mem = &alloc_region;
14258 0 : fd_vote_init_decode_inner_global( mem, alloc_mem, ctx );
14259 0 : return self;
14260 0 : }
14261 0 : void fd_vote_init_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
14262 0 : fd_vote_init_global_t * self = (fd_vote_init_global_t *)struct_mem;
14263 0 : fd_pubkey_decode_inner_global( &self->node_pubkey, alloc_mem, ctx );
14264 0 : fd_pubkey_decode_inner_global( &self->authorized_voter, alloc_mem, ctx );
14265 0 : fd_pubkey_decode_inner_global( &self->authorized_withdrawer, alloc_mem, ctx );
14266 0 : fd_bincode_uint8_decode_unsafe( &self->commission, ctx );
14267 0 : }
14268 0 : int fd_vote_init_convert_global_to_local( void const * global_self, fd_vote_init_t * self, fd_bincode_decode_ctx_t * ctx ) {
14269 0 : int err = 0;
14270 0 : fd_vote_init_global_t const * mem = (fd_vote_init_global_t const *)global_self;
14271 0 : err = fd_pubkey_convert_global_to_local( &mem->node_pubkey, &self->node_pubkey, ctx );
14272 0 : if( FD_UNLIKELY( err ) ) return err;
14273 0 : err = fd_pubkey_convert_global_to_local( &mem->authorized_voter, &self->authorized_voter, ctx );
14274 0 : if( FD_UNLIKELY( err ) ) return err;
14275 0 : err = fd_pubkey_convert_global_to_local( &mem->authorized_withdrawer, &self->authorized_withdrawer, ctx );
14276 0 : if( FD_UNLIKELY( err ) ) return err;
14277 0 : self->commission = mem->commission;
14278 0 : return FD_BINCODE_SUCCESS;
14279 0 : }
14280 0 : void fd_vote_init_new(fd_vote_init_t * self) {
14281 0 : fd_memset( self, 0, sizeof(fd_vote_init_t) );
14282 0 : fd_pubkey_new( &self->node_pubkey );
14283 0 : fd_pubkey_new( &self->authorized_voter );
14284 0 : fd_pubkey_new( &self->authorized_withdrawer );
14285 0 : }
14286 0 : void fd_vote_init_destroy( fd_vote_init_t * self ) {
14287 0 : fd_pubkey_destroy( &self->node_pubkey );
14288 0 : fd_pubkey_destroy( &self->authorized_voter );
14289 0 : fd_pubkey_destroy( &self->authorized_withdrawer );
14290 0 : }
14291 :
14292 0 : ulong fd_vote_init_footprint( void ){ return FD_VOTE_INIT_FOOTPRINT; }
14293 0 : ulong fd_vote_init_align( void ){ return FD_VOTE_INIT_ALIGN; }
14294 :
14295 0 : void fd_vote_init_walk( void * w, fd_vote_init_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
14296 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_init", level++ );
14297 0 : fd_pubkey_walk( w, &self->node_pubkey, fun, "node_pubkey", level );
14298 0 : fd_pubkey_walk( w, &self->authorized_voter, fun, "authorized_voter", level );
14299 0 : fd_pubkey_walk( w, &self->authorized_withdrawer, fun, "authorized_withdrawer", level );
14300 0 : fun( w, &self->commission, "commission", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
14301 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_init", level-- );
14302 0 : }
14303 0 : ulong fd_vote_init_size( fd_vote_init_t const * self ) {
14304 0 : ulong size = 0;
14305 0 : size += fd_pubkey_size( &self->node_pubkey );
14306 0 : size += fd_pubkey_size( &self->authorized_voter );
14307 0 : size += fd_pubkey_size( &self->authorized_withdrawer );
14308 0 : size += sizeof(char);
14309 0 : return size;
14310 0 : }
14311 :
14312 0 : FD_FN_PURE uchar fd_vote_authorize_is_voter(fd_vote_authorize_t const * self) {
14313 0 : return self->discriminant == 0;
14314 0 : }
14315 0 : FD_FN_PURE uchar fd_vote_authorize_is_withdrawer(fd_vote_authorize_t const * self) {
14316 0 : return self->discriminant == 1;
14317 0 : }
14318 : void fd_vote_authorize_inner_new( fd_vote_authorize_inner_t * self, uint discriminant );
14319 0 : int fd_vote_authorize_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
14320 0 : int err;
14321 0 : switch (discriminant) {
14322 0 : case 0: {
14323 0 : return FD_BINCODE_SUCCESS;
14324 0 : }
14325 0 : case 1: {
14326 0 : return FD_BINCODE_SUCCESS;
14327 0 : }
14328 0 : default: return FD_BINCODE_ERR_ENCODING;
14329 0 : }
14330 0 : }
14331 0 : int fd_vote_authorize_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
14332 0 : *total_sz += sizeof(fd_vote_authorize_t);
14333 0 : void const * start_data = ctx->data;
14334 0 : int err = fd_vote_authorize_decode_footprint_inner( ctx, total_sz );
14335 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
14336 0 : ctx->data = start_data;
14337 0 : return err;
14338 0 : }
14339 0 : int fd_vote_authorize_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
14340 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
14341 0 : uint discriminant = 0;
14342 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
14343 0 : if( FD_UNLIKELY( err ) ) return err;
14344 0 : return fd_vote_authorize_inner_decode_footprint( discriminant, ctx, total_sz );
14345 0 : }
14346 0 : void fd_vote_authorize_inner_decode_inner( fd_vote_authorize_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
14347 0 : switch (discriminant) {
14348 0 : case 0: {
14349 0 : break;
14350 0 : }
14351 0 : case 1: {
14352 0 : break;
14353 0 : }
14354 0 : }
14355 0 : }
14356 0 : void fd_vote_authorize_inner_decode_inner_global( fd_vote_authorize_inner_global_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
14357 0 : switch (discriminant) {
14358 0 : case 0: {
14359 0 : break;
14360 0 : }
14361 0 : case 1: {
14362 0 : break;
14363 0 : }
14364 0 : }
14365 0 : }
14366 0 : int fd_vote_authorize_convert_global_to_local_inner( fd_vote_authorize_inner_global_t const * mem, fd_vote_authorize_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
14367 0 : int err = 0;
14368 0 : switch( discriminant ) {
14369 0 : case 0: {
14370 0 : break;
14371 0 : }
14372 0 : case 1: {
14373 0 : break;
14374 0 : }
14375 0 : }
14376 0 : return FD_BINCODE_SUCCESS;
14377 0 : }
14378 0 : int fd_vote_authorize_convert_global_to_local( void const * global_self, fd_vote_authorize_t * self, fd_bincode_decode_ctx_t * ctx ) {
14379 0 : fd_vote_authorize_global_t const * mem = (fd_vote_authorize_global_t const *)global_self;
14380 0 : uint discriminant = mem->discriminant;
14381 0 : self->discriminant = mem->discriminant;
14382 0 : int err = fd_vote_authorize_convert_global_to_local_inner( &mem->inner, &self->inner, discriminant, ctx );
14383 0 : return FD_BINCODE_SUCCESS;
14384 0 : }
14385 0 : void fd_vote_authorize_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
14386 0 : fd_vote_authorize_t * self = (fd_vote_authorize_t *)struct_mem;
14387 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
14388 0 : fd_vote_authorize_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
14389 0 : }
14390 0 : void * fd_vote_authorize_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
14391 0 : fd_vote_authorize_t * self = (fd_vote_authorize_t *)mem;
14392 0 : fd_vote_authorize_new( self );
14393 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_authorize_t);
14394 0 : void * * alloc_mem = &alloc_region;
14395 0 : fd_vote_authorize_decode_inner( mem, alloc_mem, ctx );
14396 0 : return self;
14397 0 : }
14398 0 : void * fd_vote_authorize_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
14399 0 : fd_vote_authorize_t * self = (fd_vote_authorize_t *)mem;
14400 0 : fd_vote_authorize_new( self );
14401 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_authorize_t);
14402 0 : void * * alloc_mem = &alloc_region;
14403 0 : fd_vote_authorize_decode_inner_global( mem, alloc_mem, ctx );
14404 0 : return self;
14405 0 : }
14406 0 : void fd_vote_authorize_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
14407 0 : fd_vote_authorize_global_t * self = (fd_vote_authorize_global_t *)struct_mem;
14408 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
14409 0 : fd_vote_authorize_inner_decode_inner_global( &self->inner, alloc_mem, self->discriminant, ctx );
14410 0 : }
14411 0 : void fd_vote_authorize_inner_new( fd_vote_authorize_inner_t * self, uint discriminant ) {
14412 0 : switch( discriminant ) {
14413 0 : case 0: {
14414 0 : break;
14415 0 : }
14416 0 : case 1: {
14417 0 : break;
14418 0 : }
14419 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
14420 0 : }
14421 0 : }
14422 0 : void fd_vote_authorize_new_disc( fd_vote_authorize_t * self, uint discriminant ) {
14423 0 : self->discriminant = discriminant;
14424 0 : fd_vote_authorize_inner_new( &self->inner, self->discriminant );
14425 0 : }
14426 0 : void fd_vote_authorize_new( fd_vote_authorize_t * self ) {
14427 0 : fd_memset( self, 0, sizeof(fd_vote_authorize_t) );
14428 0 : fd_vote_authorize_new_disc( self, UINT_MAX );
14429 0 : }
14430 0 : void fd_vote_authorize_inner_destroy( fd_vote_authorize_inner_t * self, uint discriminant ) {
14431 0 : switch( discriminant ) {
14432 0 : default: break; // FD_LOG_ERR(( "unhandled type" ));
14433 0 : }
14434 0 : }
14435 0 : void fd_vote_authorize_destroy( fd_vote_authorize_t * self ) {
14436 0 : fd_vote_authorize_inner_destroy( &self->inner, self->discriminant );
14437 0 : }
14438 :
14439 0 : ulong fd_vote_authorize_footprint( void ){ return FD_VOTE_AUTHORIZE_FOOTPRINT; }
14440 0 : ulong fd_vote_authorize_align( void ){ return FD_VOTE_AUTHORIZE_ALIGN; }
14441 :
14442 0 : void fd_vote_authorize_walk( void * w, fd_vote_authorize_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
14443 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_vote_authorize", level++);
14444 0 : switch( self->discriminant ) {
14445 0 : case 0: {
14446 0 : fun( w, self, "voter", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
14447 0 : break;
14448 0 : }
14449 0 : case 1: {
14450 0 : fun( w, self, "withdrawer", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
14451 0 : break;
14452 0 : }
14453 0 : }
14454 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_vote_authorize", level-- );
14455 0 : }
14456 0 : ulong fd_vote_authorize_size( fd_vote_authorize_t const * self ) {
14457 0 : ulong size = 0;
14458 0 : size += sizeof(uint);
14459 0 : switch (self->discriminant) {
14460 0 : }
14461 0 : return size;
14462 0 : }
14463 :
14464 0 : int fd_vote_authorize_inner_encode( fd_vote_authorize_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
14465 0 : return FD_BINCODE_SUCCESS;
14466 0 : }
14467 0 : int fd_vote_authorize_encode( fd_vote_authorize_t const * self, fd_bincode_encode_ctx_t * ctx ) {
14468 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
14469 0 : if( FD_UNLIKELY( err ) ) return err;
14470 0 : return fd_vote_authorize_inner_encode( &self->inner, self->discriminant, ctx );
14471 0 : }
14472 :
14473 0 : int fd_vote_authorize_pubkey_encode( fd_vote_authorize_pubkey_t const * self, fd_bincode_encode_ctx_t * ctx ) {
14474 0 : int err;
14475 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
14476 0 : if( FD_UNLIKELY( err ) ) return err;
14477 0 : err = fd_vote_authorize_encode( &self->vote_authorize, ctx );
14478 0 : if( FD_UNLIKELY( err ) ) return err;
14479 0 : return FD_BINCODE_SUCCESS;
14480 0 : }
14481 0 : int fd_vote_authorize_pubkey_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
14482 0 : *total_sz += sizeof(fd_vote_authorize_pubkey_t);
14483 0 : void const * start_data = ctx->data;
14484 0 : int err = fd_vote_authorize_pubkey_decode_footprint_inner( ctx, total_sz );
14485 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
14486 0 : ctx->data = start_data;
14487 0 : return err;
14488 0 : }
14489 0 : int fd_vote_authorize_pubkey_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
14490 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
14491 0 : int err = 0;
14492 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
14493 0 : if( FD_UNLIKELY( err ) ) return err;
14494 0 : err = fd_vote_authorize_decode_footprint_inner( ctx, total_sz );
14495 0 : if( FD_UNLIKELY( err ) ) return err;
14496 0 : return 0;
14497 0 : }
14498 0 : void * fd_vote_authorize_pubkey_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
14499 0 : fd_vote_authorize_pubkey_t * self = (fd_vote_authorize_pubkey_t *)mem;
14500 0 : fd_vote_authorize_pubkey_new( self );
14501 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_authorize_pubkey_t);
14502 0 : void * * alloc_mem = &alloc_region;
14503 0 : fd_vote_authorize_pubkey_decode_inner( mem, alloc_mem, ctx );
14504 0 : return self;
14505 0 : }
14506 0 : void fd_vote_authorize_pubkey_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
14507 0 : fd_vote_authorize_pubkey_t * self = (fd_vote_authorize_pubkey_t *)struct_mem;
14508 0 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
14509 0 : fd_vote_authorize_decode_inner( &self->vote_authorize, alloc_mem, ctx );
14510 0 : }
14511 0 : void * fd_vote_authorize_pubkey_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
14512 0 : fd_vote_authorize_pubkey_global_t * self = (fd_vote_authorize_pubkey_global_t *)mem;
14513 0 : fd_vote_authorize_pubkey_new( (fd_vote_authorize_pubkey_t *)self );
14514 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_authorize_pubkey_global_t);
14515 0 : void * * alloc_mem = &alloc_region;
14516 0 : fd_vote_authorize_pubkey_decode_inner_global( mem, alloc_mem, ctx );
14517 0 : return self;
14518 0 : }
14519 0 : void fd_vote_authorize_pubkey_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
14520 0 : fd_vote_authorize_pubkey_global_t * self = (fd_vote_authorize_pubkey_global_t *)struct_mem;
14521 0 : fd_pubkey_decode_inner_global( &self->pubkey, alloc_mem, ctx );
14522 0 : fd_vote_authorize_decode_inner_global( &self->vote_authorize, alloc_mem, ctx );
14523 0 : }
14524 0 : int fd_vote_authorize_pubkey_convert_global_to_local( void const * global_self, fd_vote_authorize_pubkey_t * self, fd_bincode_decode_ctx_t * ctx ) {
14525 0 : int err = 0;
14526 0 : fd_vote_authorize_pubkey_global_t const * mem = (fd_vote_authorize_pubkey_global_t const *)global_self;
14527 0 : err = fd_pubkey_convert_global_to_local( &mem->pubkey, &self->pubkey, ctx );
14528 0 : if( FD_UNLIKELY( err ) ) return err;
14529 0 : err = fd_vote_authorize_convert_global_to_local( &mem->vote_authorize, &self->vote_authorize, ctx );
14530 0 : if( FD_UNLIKELY( err ) ) return err;
14531 0 : return FD_BINCODE_SUCCESS;
14532 0 : }
14533 0 : void fd_vote_authorize_pubkey_new(fd_vote_authorize_pubkey_t * self) {
14534 0 : fd_memset( self, 0, sizeof(fd_vote_authorize_pubkey_t) );
14535 0 : fd_pubkey_new( &self->pubkey );
14536 0 : fd_vote_authorize_new( &self->vote_authorize );
14537 0 : }
14538 0 : void fd_vote_authorize_pubkey_destroy( fd_vote_authorize_pubkey_t * self ) {
14539 0 : fd_pubkey_destroy( &self->pubkey );
14540 0 : fd_vote_authorize_destroy( &self->vote_authorize );
14541 0 : }
14542 :
14543 0 : ulong fd_vote_authorize_pubkey_footprint( void ){ return FD_VOTE_AUTHORIZE_PUBKEY_FOOTPRINT; }
14544 0 : ulong fd_vote_authorize_pubkey_align( void ){ return FD_VOTE_AUTHORIZE_PUBKEY_ALIGN; }
14545 :
14546 0 : void fd_vote_authorize_pubkey_walk( void * w, fd_vote_authorize_pubkey_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
14547 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_authorize_pubkey", level++ );
14548 0 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level );
14549 0 : fd_vote_authorize_walk( w, &self->vote_authorize, fun, "vote_authorize", level );
14550 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_authorize_pubkey", level-- );
14551 0 : }
14552 0 : ulong fd_vote_authorize_pubkey_size( fd_vote_authorize_pubkey_t const * self ) {
14553 0 : ulong size = 0;
14554 0 : size += fd_pubkey_size( &self->pubkey );
14555 0 : size += fd_vote_authorize_size( &self->vote_authorize );
14556 0 : return size;
14557 0 : }
14558 :
14559 0 : int fd_vote_switch_encode( fd_vote_switch_t const * self, fd_bincode_encode_ctx_t * ctx ) {
14560 0 : int err;
14561 0 : err = fd_vote_encode( &self->vote, ctx );
14562 0 : if( FD_UNLIKELY( err ) ) return err;
14563 0 : err = fd_hash_encode( &self->hash, ctx );
14564 0 : if( FD_UNLIKELY( err ) ) return err;
14565 0 : return FD_BINCODE_SUCCESS;
14566 0 : }
14567 0 : int fd_vote_switch_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
14568 0 : *total_sz += sizeof(fd_vote_switch_t);
14569 0 : void const * start_data = ctx->data;
14570 0 : int err = fd_vote_switch_decode_footprint_inner( ctx, total_sz );
14571 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
14572 0 : ctx->data = start_data;
14573 0 : return err;
14574 0 : }
14575 0 : int fd_vote_switch_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
14576 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
14577 0 : int err = 0;
14578 0 : err = fd_vote_decode_footprint_inner( ctx, total_sz );
14579 0 : if( FD_UNLIKELY( err ) ) return err;
14580 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
14581 0 : if( FD_UNLIKELY( err ) ) return err;
14582 0 : return 0;
14583 0 : }
14584 0 : void * fd_vote_switch_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
14585 0 : fd_vote_switch_t * self = (fd_vote_switch_t *)mem;
14586 0 : fd_vote_switch_new( self );
14587 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_switch_t);
14588 0 : void * * alloc_mem = &alloc_region;
14589 0 : fd_vote_switch_decode_inner( mem, alloc_mem, ctx );
14590 0 : return self;
14591 0 : }
14592 0 : void fd_vote_switch_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
14593 0 : fd_vote_switch_t * self = (fd_vote_switch_t *)struct_mem;
14594 0 : fd_vote_decode_inner( &self->vote, alloc_mem, ctx );
14595 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
14596 0 : }
14597 0 : void * fd_vote_switch_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
14598 0 : fd_vote_switch_global_t * self = (fd_vote_switch_global_t *)mem;
14599 0 : fd_vote_switch_new( (fd_vote_switch_t *)self );
14600 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_switch_global_t);
14601 0 : void * * alloc_mem = &alloc_region;
14602 0 : fd_vote_switch_decode_inner_global( mem, alloc_mem, ctx );
14603 0 : return self;
14604 0 : }
14605 0 : void fd_vote_switch_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
14606 0 : fd_vote_switch_global_t * self = (fd_vote_switch_global_t *)struct_mem;
14607 0 : fd_vote_decode_inner_global( &self->vote, alloc_mem, ctx );
14608 0 : fd_hash_decode_inner_global( &self->hash, alloc_mem, ctx );
14609 0 : }
14610 0 : int fd_vote_switch_convert_global_to_local( void const * global_self, fd_vote_switch_t * self, fd_bincode_decode_ctx_t * ctx ) {
14611 0 : int err = 0;
14612 0 : fd_vote_switch_global_t const * mem = (fd_vote_switch_global_t const *)global_self;
14613 0 : err = fd_vote_convert_global_to_local( &mem->vote, &self->vote, ctx );
14614 0 : if( FD_UNLIKELY( err ) ) return err;
14615 0 : err = fd_hash_convert_global_to_local( &mem->hash, &self->hash, ctx );
14616 0 : if( FD_UNLIKELY( err ) ) return err;
14617 0 : return FD_BINCODE_SUCCESS;
14618 0 : }
14619 0 : void fd_vote_switch_new(fd_vote_switch_t * self) {
14620 0 : fd_memset( self, 0, sizeof(fd_vote_switch_t) );
14621 0 : fd_vote_new( &self->vote );
14622 0 : fd_hash_new( &self->hash );
14623 0 : }
14624 0 : void fd_vote_switch_destroy( fd_vote_switch_t * self ) {
14625 0 : fd_vote_destroy( &self->vote );
14626 0 : fd_hash_destroy( &self->hash );
14627 0 : }
14628 :
14629 0 : ulong fd_vote_switch_footprint( void ){ return FD_VOTE_SWITCH_FOOTPRINT; }
14630 0 : ulong fd_vote_switch_align( void ){ return FD_VOTE_SWITCH_ALIGN; }
14631 :
14632 0 : void fd_vote_switch_walk( void * w, fd_vote_switch_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
14633 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_switch", level++ );
14634 0 : fd_vote_walk( w, &self->vote, fun, "vote", level );
14635 0 : fd_hash_walk( w, &self->hash, fun, "hash", level );
14636 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_switch", level-- );
14637 0 : }
14638 0 : ulong fd_vote_switch_size( fd_vote_switch_t const * self ) {
14639 0 : ulong size = 0;
14640 0 : size += fd_vote_size( &self->vote );
14641 0 : size += fd_hash_size( &self->hash );
14642 0 : return size;
14643 0 : }
14644 :
14645 0 : int fd_update_vote_state_switch_encode( fd_update_vote_state_switch_t const * self, fd_bincode_encode_ctx_t * ctx ) {
14646 0 : int err;
14647 0 : err = fd_vote_state_update_encode( &self->vote_state_update, ctx );
14648 0 : if( FD_UNLIKELY( err ) ) return err;
14649 0 : err = fd_hash_encode( &self->hash, ctx );
14650 0 : if( FD_UNLIKELY( err ) ) return err;
14651 0 : return FD_BINCODE_SUCCESS;
14652 0 : }
14653 0 : int fd_update_vote_state_switch_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
14654 0 : *total_sz += sizeof(fd_update_vote_state_switch_t);
14655 0 : void const * start_data = ctx->data;
14656 0 : int err = fd_update_vote_state_switch_decode_footprint_inner( ctx, total_sz );
14657 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
14658 0 : ctx->data = start_data;
14659 0 : return err;
14660 0 : }
14661 0 : int fd_update_vote_state_switch_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
14662 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
14663 0 : int err = 0;
14664 0 : err = fd_vote_state_update_decode_footprint_inner( ctx, total_sz );
14665 0 : if( FD_UNLIKELY( err ) ) return err;
14666 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
14667 0 : if( FD_UNLIKELY( err ) ) return err;
14668 0 : return 0;
14669 0 : }
14670 0 : void * fd_update_vote_state_switch_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
14671 0 : fd_update_vote_state_switch_t * self = (fd_update_vote_state_switch_t *)mem;
14672 0 : fd_update_vote_state_switch_new( self );
14673 0 : void * alloc_region = (uchar *)mem + sizeof(fd_update_vote_state_switch_t);
14674 0 : void * * alloc_mem = &alloc_region;
14675 0 : fd_update_vote_state_switch_decode_inner( mem, alloc_mem, ctx );
14676 0 : return self;
14677 0 : }
14678 0 : void fd_update_vote_state_switch_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
14679 0 : fd_update_vote_state_switch_t * self = (fd_update_vote_state_switch_t *)struct_mem;
14680 0 : fd_vote_state_update_decode_inner( &self->vote_state_update, alloc_mem, ctx );
14681 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
14682 0 : }
14683 0 : void * fd_update_vote_state_switch_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
14684 0 : fd_update_vote_state_switch_global_t * self = (fd_update_vote_state_switch_global_t *)mem;
14685 0 : fd_update_vote_state_switch_new( (fd_update_vote_state_switch_t *)self );
14686 0 : void * alloc_region = (uchar *)mem + sizeof(fd_update_vote_state_switch_global_t);
14687 0 : void * * alloc_mem = &alloc_region;
14688 0 : fd_update_vote_state_switch_decode_inner_global( mem, alloc_mem, ctx );
14689 0 : return self;
14690 0 : }
14691 0 : void fd_update_vote_state_switch_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
14692 0 : fd_update_vote_state_switch_global_t * self = (fd_update_vote_state_switch_global_t *)struct_mem;
14693 0 : fd_vote_state_update_decode_inner_global( &self->vote_state_update, alloc_mem, ctx );
14694 0 : fd_hash_decode_inner_global( &self->hash, alloc_mem, ctx );
14695 0 : }
14696 0 : int fd_update_vote_state_switch_convert_global_to_local( void const * global_self, fd_update_vote_state_switch_t * self, fd_bincode_decode_ctx_t * ctx ) {
14697 0 : int err = 0;
14698 0 : fd_update_vote_state_switch_global_t const * mem = (fd_update_vote_state_switch_global_t const *)global_self;
14699 0 : err = fd_vote_state_update_convert_global_to_local( &mem->vote_state_update, &self->vote_state_update, ctx );
14700 0 : if( FD_UNLIKELY( err ) ) return err;
14701 0 : err = fd_hash_convert_global_to_local( &mem->hash, &self->hash, ctx );
14702 0 : if( FD_UNLIKELY( err ) ) return err;
14703 0 : return FD_BINCODE_SUCCESS;
14704 0 : }
14705 0 : void fd_update_vote_state_switch_new(fd_update_vote_state_switch_t * self) {
14706 0 : fd_memset( self, 0, sizeof(fd_update_vote_state_switch_t) );
14707 0 : fd_vote_state_update_new( &self->vote_state_update );
14708 0 : fd_hash_new( &self->hash );
14709 0 : }
14710 0 : void fd_update_vote_state_switch_destroy( fd_update_vote_state_switch_t * self ) {
14711 0 : fd_vote_state_update_destroy( &self->vote_state_update );
14712 0 : fd_hash_destroy( &self->hash );
14713 0 : }
14714 :
14715 0 : ulong fd_update_vote_state_switch_footprint( void ){ return FD_UPDATE_VOTE_STATE_SWITCH_FOOTPRINT; }
14716 0 : ulong fd_update_vote_state_switch_align( void ){ return FD_UPDATE_VOTE_STATE_SWITCH_ALIGN; }
14717 :
14718 0 : void fd_update_vote_state_switch_walk( void * w, fd_update_vote_state_switch_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
14719 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_update_vote_state_switch", level++ );
14720 0 : fd_vote_state_update_walk( w, &self->vote_state_update, fun, "vote_state_update", level );
14721 0 : fd_hash_walk( w, &self->hash, fun, "hash", level );
14722 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_update_vote_state_switch", level-- );
14723 0 : }
14724 0 : ulong fd_update_vote_state_switch_size( fd_update_vote_state_switch_t const * self ) {
14725 0 : ulong size = 0;
14726 0 : size += fd_vote_state_update_size( &self->vote_state_update );
14727 0 : size += fd_hash_size( &self->hash );
14728 0 : return size;
14729 0 : }
14730 :
14731 0 : int fd_vote_authorize_with_seed_args_encode( fd_vote_authorize_with_seed_args_t const * self, fd_bincode_encode_ctx_t * ctx ) {
14732 0 : int err;
14733 0 : err = fd_vote_authorize_encode( &self->authorization_type, ctx );
14734 0 : if( FD_UNLIKELY( err ) ) return err;
14735 0 : err = fd_pubkey_encode( &self->current_authority_derived_key_owner, ctx );
14736 0 : if( FD_UNLIKELY( err ) ) return err;
14737 0 : err = fd_bincode_uint64_encode( self->current_authority_derived_key_seed_len, ctx );
14738 0 : if( FD_UNLIKELY(err) ) return err;
14739 0 : if( self->current_authority_derived_key_seed_len ) {
14740 0 : err = fd_bincode_bytes_encode( self->current_authority_derived_key_seed, self->current_authority_derived_key_seed_len, ctx );
14741 0 : if( FD_UNLIKELY( err ) ) return err;
14742 0 : }
14743 0 : err = fd_pubkey_encode( &self->new_authority, ctx );
14744 0 : if( FD_UNLIKELY( err ) ) return err;
14745 0 : return FD_BINCODE_SUCCESS;
14746 0 : }
14747 0 : int fd_vote_authorize_with_seed_args_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
14748 0 : *total_sz += sizeof(fd_vote_authorize_with_seed_args_t);
14749 0 : void const * start_data = ctx->data;
14750 0 : int err = fd_vote_authorize_with_seed_args_decode_footprint_inner( ctx, total_sz );
14751 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
14752 0 : ctx->data = start_data;
14753 0 : return err;
14754 0 : }
14755 0 : int fd_vote_authorize_with_seed_args_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
14756 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
14757 0 : int err = 0;
14758 0 : err = fd_vote_authorize_decode_footprint_inner( ctx, total_sz );
14759 0 : if( FD_UNLIKELY( err ) ) return err;
14760 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
14761 0 : if( FD_UNLIKELY( err ) ) return err;
14762 0 : ulong current_authority_derived_key_seed_len;
14763 0 : err = fd_bincode_uint64_decode( ¤t_authority_derived_key_seed_len, ctx );
14764 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14765 0 : *total_sz += current_authority_derived_key_seed_len;
14766 0 : if( current_authority_derived_key_seed_len ) {
14767 0 : err = fd_bincode_bytes_decode_footprint( current_authority_derived_key_seed_len, ctx );
14768 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14769 0 : err = !fd_utf8_verify( (char const *) ctx->data - current_authority_derived_key_seed_len, current_authority_derived_key_seed_len );
14770 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14771 0 : }
14772 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
14773 0 : if( FD_UNLIKELY( err ) ) return err;
14774 0 : return 0;
14775 0 : }
14776 0 : void * fd_vote_authorize_with_seed_args_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
14777 0 : fd_vote_authorize_with_seed_args_t * self = (fd_vote_authorize_with_seed_args_t *)mem;
14778 0 : fd_vote_authorize_with_seed_args_new( self );
14779 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_authorize_with_seed_args_t);
14780 0 : void * * alloc_mem = &alloc_region;
14781 0 : fd_vote_authorize_with_seed_args_decode_inner( mem, alloc_mem, ctx );
14782 0 : return self;
14783 0 : }
14784 0 : void fd_vote_authorize_with_seed_args_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
14785 0 : fd_vote_authorize_with_seed_args_t * self = (fd_vote_authorize_with_seed_args_t *)struct_mem;
14786 0 : fd_vote_authorize_decode_inner( &self->authorization_type, alloc_mem, ctx );
14787 0 : fd_pubkey_decode_inner( &self->current_authority_derived_key_owner, alloc_mem, ctx );
14788 0 : fd_bincode_uint64_decode_unsafe( &self->current_authority_derived_key_seed_len, ctx );
14789 0 : if( self->current_authority_derived_key_seed_len ) {
14790 0 : self->current_authority_derived_key_seed = *alloc_mem;
14791 0 : fd_bincode_bytes_decode_unsafe( self->current_authority_derived_key_seed, self->current_authority_derived_key_seed_len, ctx );
14792 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->current_authority_derived_key_seed_len;
14793 0 : } else
14794 0 : self->current_authority_derived_key_seed = NULL;
14795 0 : fd_pubkey_decode_inner( &self->new_authority, alloc_mem, ctx );
14796 0 : }
14797 0 : void * fd_vote_authorize_with_seed_args_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
14798 0 : fd_vote_authorize_with_seed_args_global_t * self = (fd_vote_authorize_with_seed_args_global_t *)mem;
14799 0 : fd_vote_authorize_with_seed_args_new( (fd_vote_authorize_with_seed_args_t *)self );
14800 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_authorize_with_seed_args_global_t);
14801 0 : void * * alloc_mem = &alloc_region;
14802 0 : fd_vote_authorize_with_seed_args_decode_inner_global( mem, alloc_mem, ctx );
14803 0 : return self;
14804 0 : }
14805 0 : void fd_vote_authorize_with_seed_args_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
14806 0 : fd_vote_authorize_with_seed_args_global_t * self = (fd_vote_authorize_with_seed_args_global_t *)struct_mem;
14807 0 : fd_vote_authorize_decode_inner_global( &self->authorization_type, alloc_mem, ctx );
14808 0 : fd_pubkey_decode_inner_global( &self->current_authority_derived_key_owner, alloc_mem, ctx );
14809 0 : fd_bincode_uint64_decode_unsafe( &self->current_authority_derived_key_seed_len, ctx );
14810 0 : if( self->current_authority_derived_key_seed_len ) {
14811 0 : self->current_authority_derived_key_seed_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
14812 0 : fd_bincode_bytes_decode_unsafe( *alloc_mem, self->current_authority_derived_key_seed_len, ctx );
14813 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->current_authority_derived_key_seed_len;
14814 0 : } else
14815 0 : self->current_authority_derived_key_seed_gaddr = 0UL;
14816 0 : fd_pubkey_decode_inner_global( &self->new_authority, alloc_mem, ctx );
14817 0 : }
14818 0 : int fd_vote_authorize_with_seed_args_convert_global_to_local( void const * global_self, fd_vote_authorize_with_seed_args_t * self, fd_bincode_decode_ctx_t * ctx ) {
14819 0 : int err = 0;
14820 0 : fd_vote_authorize_with_seed_args_global_t const * mem = (fd_vote_authorize_with_seed_args_global_t const *)global_self;
14821 0 : err = fd_vote_authorize_convert_global_to_local( &mem->authorization_type, &self->authorization_type, ctx );
14822 0 : if( FD_UNLIKELY( err ) ) return err;
14823 0 : err = fd_pubkey_convert_global_to_local( &mem->current_authority_derived_key_owner, &self->current_authority_derived_key_owner, ctx );
14824 0 : if( FD_UNLIKELY( err ) ) return err;
14825 0 : self->current_authority_derived_key_seed_len = mem->current_authority_derived_key_seed_len;
14826 0 : self->current_authority_derived_key_seed = fd_wksp_laddr_fast( ctx->wksp, mem->current_authority_derived_key_seed_gaddr );
14827 0 : err = fd_pubkey_convert_global_to_local( &mem->new_authority, &self->new_authority, ctx );
14828 0 : if( FD_UNLIKELY( err ) ) return err;
14829 0 : return FD_BINCODE_SUCCESS;
14830 0 : }
14831 0 : void fd_vote_authorize_with_seed_args_new(fd_vote_authorize_with_seed_args_t * self) {
14832 0 : fd_memset( self, 0, sizeof(fd_vote_authorize_with_seed_args_t) );
14833 0 : fd_vote_authorize_new( &self->authorization_type );
14834 0 : fd_pubkey_new( &self->current_authority_derived_key_owner );
14835 0 : fd_pubkey_new( &self->new_authority );
14836 0 : }
14837 0 : void fd_vote_authorize_with_seed_args_destroy( fd_vote_authorize_with_seed_args_t * self ) {
14838 0 : fd_vote_authorize_destroy( &self->authorization_type );
14839 0 : fd_pubkey_destroy( &self->current_authority_derived_key_owner );
14840 0 : if( self->current_authority_derived_key_seed ) {
14841 0 : self->current_authority_derived_key_seed = NULL;
14842 0 : }
14843 0 : fd_pubkey_destroy( &self->new_authority );
14844 0 : }
14845 :
14846 0 : ulong fd_vote_authorize_with_seed_args_footprint( void ){ return FD_VOTE_AUTHORIZE_WITH_SEED_ARGS_FOOTPRINT; }
14847 0 : ulong fd_vote_authorize_with_seed_args_align( void ){ return FD_VOTE_AUTHORIZE_WITH_SEED_ARGS_ALIGN; }
14848 :
14849 0 : void fd_vote_authorize_with_seed_args_walk( void * w, fd_vote_authorize_with_seed_args_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
14850 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_authorize_with_seed_args", level++ );
14851 0 : fd_vote_authorize_walk( w, &self->authorization_type, fun, "authorization_type", level );
14852 0 : fd_pubkey_walk( w, &self->current_authority_derived_key_owner, fun, "current_authority_derived_key_owner", level );
14853 0 : fun(w, self->current_authority_derived_key_seed, "current_authority_derived_key_seed", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
14854 0 : fd_pubkey_walk( w, &self->new_authority, fun, "new_authority", level );
14855 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_authorize_with_seed_args", level-- );
14856 0 : }
14857 0 : ulong fd_vote_authorize_with_seed_args_size( fd_vote_authorize_with_seed_args_t const * self ) {
14858 0 : ulong size = 0;
14859 0 : size += fd_vote_authorize_size( &self->authorization_type );
14860 0 : size += fd_pubkey_size( &self->current_authority_derived_key_owner );
14861 0 : do {
14862 0 : size += sizeof(ulong);
14863 0 : size += self->current_authority_derived_key_seed_len;
14864 0 : } while(0);
14865 0 : size += fd_pubkey_size( &self->new_authority );
14866 0 : return size;
14867 0 : }
14868 :
14869 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 ) {
14870 0 : int err;
14871 0 : err = fd_vote_authorize_encode( &self->authorization_type, ctx );
14872 0 : if( FD_UNLIKELY( err ) ) return err;
14873 0 : err = fd_pubkey_encode( &self->current_authority_derived_key_owner, ctx );
14874 0 : if( FD_UNLIKELY( err ) ) return err;
14875 0 : err = fd_bincode_uint64_encode( self->current_authority_derived_key_seed_len, ctx );
14876 0 : if( FD_UNLIKELY(err) ) return err;
14877 0 : if( self->current_authority_derived_key_seed_len ) {
14878 0 : err = fd_bincode_bytes_encode( self->current_authority_derived_key_seed, self->current_authority_derived_key_seed_len, ctx );
14879 0 : if( FD_UNLIKELY( err ) ) return err;
14880 0 : }
14881 0 : return FD_BINCODE_SUCCESS;
14882 0 : }
14883 0 : int fd_vote_authorize_checked_with_seed_args_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
14884 0 : *total_sz += sizeof(fd_vote_authorize_checked_with_seed_args_t);
14885 0 : void const * start_data = ctx->data;
14886 0 : int err = fd_vote_authorize_checked_with_seed_args_decode_footprint_inner( ctx, total_sz );
14887 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
14888 0 : ctx->data = start_data;
14889 0 : return err;
14890 0 : }
14891 0 : int fd_vote_authorize_checked_with_seed_args_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
14892 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
14893 0 : int err = 0;
14894 0 : err = fd_vote_authorize_decode_footprint_inner( ctx, total_sz );
14895 0 : if( FD_UNLIKELY( err ) ) return err;
14896 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
14897 0 : if( FD_UNLIKELY( err ) ) return err;
14898 0 : ulong current_authority_derived_key_seed_len;
14899 0 : err = fd_bincode_uint64_decode( ¤t_authority_derived_key_seed_len, ctx );
14900 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14901 0 : *total_sz += current_authority_derived_key_seed_len;
14902 0 : if( current_authority_derived_key_seed_len ) {
14903 0 : err = fd_bincode_bytes_decode_footprint( current_authority_derived_key_seed_len, ctx );
14904 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14905 0 : err = !fd_utf8_verify( (char const *) ctx->data - current_authority_derived_key_seed_len, current_authority_derived_key_seed_len );
14906 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14907 0 : }
14908 0 : return 0;
14909 0 : }
14910 0 : void * fd_vote_authorize_checked_with_seed_args_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
14911 0 : fd_vote_authorize_checked_with_seed_args_t * self = (fd_vote_authorize_checked_with_seed_args_t *)mem;
14912 0 : fd_vote_authorize_checked_with_seed_args_new( self );
14913 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_authorize_checked_with_seed_args_t);
14914 0 : void * * alloc_mem = &alloc_region;
14915 0 : fd_vote_authorize_checked_with_seed_args_decode_inner( mem, alloc_mem, ctx );
14916 0 : return self;
14917 0 : }
14918 0 : void fd_vote_authorize_checked_with_seed_args_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
14919 0 : fd_vote_authorize_checked_with_seed_args_t * self = (fd_vote_authorize_checked_with_seed_args_t *)struct_mem;
14920 0 : fd_vote_authorize_decode_inner( &self->authorization_type, alloc_mem, ctx );
14921 0 : fd_pubkey_decode_inner( &self->current_authority_derived_key_owner, alloc_mem, ctx );
14922 0 : fd_bincode_uint64_decode_unsafe( &self->current_authority_derived_key_seed_len, ctx );
14923 0 : if( self->current_authority_derived_key_seed_len ) {
14924 0 : self->current_authority_derived_key_seed = *alloc_mem;
14925 0 : fd_bincode_bytes_decode_unsafe( self->current_authority_derived_key_seed, self->current_authority_derived_key_seed_len, ctx );
14926 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->current_authority_derived_key_seed_len;
14927 0 : } else
14928 0 : self->current_authority_derived_key_seed = NULL;
14929 0 : }
14930 0 : void * fd_vote_authorize_checked_with_seed_args_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
14931 0 : fd_vote_authorize_checked_with_seed_args_global_t * self = (fd_vote_authorize_checked_with_seed_args_global_t *)mem;
14932 0 : fd_vote_authorize_checked_with_seed_args_new( (fd_vote_authorize_checked_with_seed_args_t *)self );
14933 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_authorize_checked_with_seed_args_global_t);
14934 0 : void * * alloc_mem = &alloc_region;
14935 0 : fd_vote_authorize_checked_with_seed_args_decode_inner_global( mem, alloc_mem, ctx );
14936 0 : return self;
14937 0 : }
14938 0 : void fd_vote_authorize_checked_with_seed_args_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
14939 0 : fd_vote_authorize_checked_with_seed_args_global_t * self = (fd_vote_authorize_checked_with_seed_args_global_t *)struct_mem;
14940 0 : fd_vote_authorize_decode_inner_global( &self->authorization_type, alloc_mem, ctx );
14941 0 : fd_pubkey_decode_inner_global( &self->current_authority_derived_key_owner, alloc_mem, ctx );
14942 0 : fd_bincode_uint64_decode_unsafe( &self->current_authority_derived_key_seed_len, ctx );
14943 0 : if( self->current_authority_derived_key_seed_len ) {
14944 0 : self->current_authority_derived_key_seed_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
14945 0 : fd_bincode_bytes_decode_unsafe( *alloc_mem, self->current_authority_derived_key_seed_len, ctx );
14946 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->current_authority_derived_key_seed_len;
14947 0 : } else
14948 0 : self->current_authority_derived_key_seed_gaddr = 0UL;
14949 0 : }
14950 0 : int fd_vote_authorize_checked_with_seed_args_convert_global_to_local( void const * global_self, fd_vote_authorize_checked_with_seed_args_t * self, fd_bincode_decode_ctx_t * ctx ) {
14951 0 : int err = 0;
14952 0 : fd_vote_authorize_checked_with_seed_args_global_t const * mem = (fd_vote_authorize_checked_with_seed_args_global_t const *)global_self;
14953 0 : err = fd_vote_authorize_convert_global_to_local( &mem->authorization_type, &self->authorization_type, ctx );
14954 0 : if( FD_UNLIKELY( err ) ) return err;
14955 0 : err = fd_pubkey_convert_global_to_local( &mem->current_authority_derived_key_owner, &self->current_authority_derived_key_owner, ctx );
14956 0 : if( FD_UNLIKELY( err ) ) return err;
14957 0 : self->current_authority_derived_key_seed_len = mem->current_authority_derived_key_seed_len;
14958 0 : self->current_authority_derived_key_seed = fd_wksp_laddr_fast( ctx->wksp, mem->current_authority_derived_key_seed_gaddr );
14959 0 : return FD_BINCODE_SUCCESS;
14960 0 : }
14961 0 : void fd_vote_authorize_checked_with_seed_args_new(fd_vote_authorize_checked_with_seed_args_t * self) {
14962 0 : fd_memset( self, 0, sizeof(fd_vote_authorize_checked_with_seed_args_t) );
14963 0 : fd_vote_authorize_new( &self->authorization_type );
14964 0 : fd_pubkey_new( &self->current_authority_derived_key_owner );
14965 0 : }
14966 0 : void fd_vote_authorize_checked_with_seed_args_destroy( fd_vote_authorize_checked_with_seed_args_t * self ) {
14967 0 : fd_vote_authorize_destroy( &self->authorization_type );
14968 0 : fd_pubkey_destroy( &self->current_authority_derived_key_owner );
14969 0 : if( self->current_authority_derived_key_seed ) {
14970 0 : self->current_authority_derived_key_seed = NULL;
14971 0 : }
14972 0 : }
14973 :
14974 0 : ulong fd_vote_authorize_checked_with_seed_args_footprint( void ){ return FD_VOTE_AUTHORIZE_CHECKED_WITH_SEED_ARGS_FOOTPRINT; }
14975 0 : ulong fd_vote_authorize_checked_with_seed_args_align( void ){ return FD_VOTE_AUTHORIZE_CHECKED_WITH_SEED_ARGS_ALIGN; }
14976 :
14977 0 : void fd_vote_authorize_checked_with_seed_args_walk( void * w, fd_vote_authorize_checked_with_seed_args_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
14978 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_authorize_checked_with_seed_args", level++ );
14979 0 : fd_vote_authorize_walk( w, &self->authorization_type, fun, "authorization_type", level );
14980 0 : fd_pubkey_walk( w, &self->current_authority_derived_key_owner, fun, "current_authority_derived_key_owner", level );
14981 0 : fun(w, self->current_authority_derived_key_seed, "current_authority_derived_key_seed", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
14982 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_authorize_checked_with_seed_args", level-- );
14983 0 : }
14984 0 : ulong fd_vote_authorize_checked_with_seed_args_size( fd_vote_authorize_checked_with_seed_args_t const * self ) {
14985 0 : ulong size = 0;
14986 0 : size += fd_vote_authorize_size( &self->authorization_type );
14987 0 : size += fd_pubkey_size( &self->current_authority_derived_key_owner );
14988 0 : do {
14989 0 : size += sizeof(ulong);
14990 0 : size += self->current_authority_derived_key_seed_len;
14991 0 : } while(0);
14992 0 : return size;
14993 0 : }
14994 :
14995 0 : FD_FN_PURE uchar fd_vote_instruction_is_initialize_account(fd_vote_instruction_t const * self) {
14996 0 : return self->discriminant == 0;
14997 0 : }
14998 0 : FD_FN_PURE uchar fd_vote_instruction_is_authorize(fd_vote_instruction_t const * self) {
14999 0 : return self->discriminant == 1;
15000 0 : }
15001 0 : FD_FN_PURE uchar fd_vote_instruction_is_vote(fd_vote_instruction_t const * self) {
15002 0 : return self->discriminant == 2;
15003 0 : }
15004 0 : FD_FN_PURE uchar fd_vote_instruction_is_withdraw(fd_vote_instruction_t const * self) {
15005 0 : return self->discriminant == 3;
15006 0 : }
15007 0 : FD_FN_PURE uchar fd_vote_instruction_is_update_validator_identity(fd_vote_instruction_t const * self) {
15008 0 : return self->discriminant == 4;
15009 0 : }
15010 0 : FD_FN_PURE uchar fd_vote_instruction_is_update_commission(fd_vote_instruction_t const * self) {
15011 0 : return self->discriminant == 5;
15012 0 : }
15013 0 : FD_FN_PURE uchar fd_vote_instruction_is_vote_switch(fd_vote_instruction_t const * self) {
15014 0 : return self->discriminant == 6;
15015 0 : }
15016 0 : FD_FN_PURE uchar fd_vote_instruction_is_authorize_checked(fd_vote_instruction_t const * self) {
15017 0 : return self->discriminant == 7;
15018 0 : }
15019 0 : FD_FN_PURE uchar fd_vote_instruction_is_update_vote_state(fd_vote_instruction_t const * self) {
15020 0 : return self->discriminant == 8;
15021 0 : }
15022 0 : FD_FN_PURE uchar fd_vote_instruction_is_update_vote_state_switch(fd_vote_instruction_t const * self) {
15023 0 : return self->discriminant == 9;
15024 0 : }
15025 0 : FD_FN_PURE uchar fd_vote_instruction_is_authorize_with_seed(fd_vote_instruction_t const * self) {
15026 0 : return self->discriminant == 10;
15027 0 : }
15028 0 : FD_FN_PURE uchar fd_vote_instruction_is_authorize_checked_with_seed(fd_vote_instruction_t const * self) {
15029 0 : return self->discriminant == 11;
15030 0 : }
15031 0 : FD_FN_PURE uchar fd_vote_instruction_is_compact_update_vote_state(fd_vote_instruction_t const * self) {
15032 0 : return self->discriminant == 12;
15033 0 : }
15034 0 : FD_FN_PURE uchar fd_vote_instruction_is_compact_update_vote_state_switch(fd_vote_instruction_t const * self) {
15035 0 : return self->discriminant == 13;
15036 0 : }
15037 0 : FD_FN_PURE uchar fd_vote_instruction_is_tower_sync(fd_vote_instruction_t const * self) {
15038 0 : return self->discriminant == 14;
15039 0 : }
15040 0 : FD_FN_PURE uchar fd_vote_instruction_is_tower_sync_switch(fd_vote_instruction_t const * self) {
15041 0 : return self->discriminant == 15;
15042 0 : }
15043 : void fd_vote_instruction_inner_new( fd_vote_instruction_inner_t * self, uint discriminant );
15044 0 : int fd_vote_instruction_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
15045 0 : int err;
15046 0 : switch (discriminant) {
15047 0 : case 0: {
15048 0 : err = fd_vote_init_decode_footprint_inner( ctx, total_sz );
15049 0 : if( FD_UNLIKELY( err ) ) return err;
15050 0 : return FD_BINCODE_SUCCESS;
15051 0 : }
15052 0 : case 1: {
15053 0 : err = fd_vote_authorize_pubkey_decode_footprint_inner( ctx, total_sz );
15054 0 : if( FD_UNLIKELY( err ) ) return err;
15055 0 : return FD_BINCODE_SUCCESS;
15056 0 : }
15057 0 : case 2: {
15058 0 : err = fd_vote_decode_footprint_inner( ctx, total_sz );
15059 0 : if( FD_UNLIKELY( err ) ) return err;
15060 0 : return FD_BINCODE_SUCCESS;
15061 0 : }
15062 0 : case 3: {
15063 0 : err = fd_bincode_uint64_decode_footprint( ctx );
15064 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15065 0 : return FD_BINCODE_SUCCESS;
15066 0 : }
15067 0 : case 4: {
15068 0 : return FD_BINCODE_SUCCESS;
15069 0 : }
15070 0 : case 5: {
15071 0 : err = fd_bincode_uint8_decode_footprint( ctx );
15072 0 : if( FD_UNLIKELY( err ) ) return err;
15073 0 : return FD_BINCODE_SUCCESS;
15074 0 : }
15075 0 : case 6: {
15076 0 : err = fd_vote_switch_decode_footprint_inner( ctx, total_sz );
15077 0 : if( FD_UNLIKELY( err ) ) return err;
15078 0 : return FD_BINCODE_SUCCESS;
15079 0 : }
15080 0 : case 7: {
15081 0 : err = fd_vote_authorize_decode_footprint_inner( ctx, total_sz );
15082 0 : if( FD_UNLIKELY( err ) ) return err;
15083 0 : return FD_BINCODE_SUCCESS;
15084 0 : }
15085 0 : case 8: {
15086 0 : err = fd_vote_state_update_decode_footprint_inner( ctx, total_sz );
15087 0 : if( FD_UNLIKELY( err ) ) return err;
15088 0 : return FD_BINCODE_SUCCESS;
15089 0 : }
15090 0 : case 9: {
15091 0 : err = fd_update_vote_state_switch_decode_footprint_inner( ctx, total_sz );
15092 0 : if( FD_UNLIKELY( err ) ) return err;
15093 0 : return FD_BINCODE_SUCCESS;
15094 0 : }
15095 0 : case 10: {
15096 0 : err = fd_vote_authorize_with_seed_args_decode_footprint_inner( ctx, total_sz );
15097 0 : if( FD_UNLIKELY( err ) ) return err;
15098 0 : return FD_BINCODE_SUCCESS;
15099 0 : }
15100 0 : case 11: {
15101 0 : err = fd_vote_authorize_checked_with_seed_args_decode_footprint_inner( ctx, total_sz );
15102 0 : if( FD_UNLIKELY( err ) ) return err;
15103 0 : return FD_BINCODE_SUCCESS;
15104 0 : }
15105 0 : case 12: {
15106 0 : err = fd_compact_vote_state_update_decode_footprint_inner( ctx, total_sz );
15107 0 : if( FD_UNLIKELY( err ) ) return err;
15108 0 : return FD_BINCODE_SUCCESS;
15109 0 : }
15110 0 : case 13: {
15111 0 : err = fd_compact_vote_state_update_switch_decode_footprint_inner( ctx, total_sz );
15112 0 : if( FD_UNLIKELY( err ) ) return err;
15113 0 : return FD_BINCODE_SUCCESS;
15114 0 : }
15115 0 : case 14: {
15116 0 : err = fd_tower_sync_decode_footprint_inner( ctx, total_sz );
15117 0 : if( FD_UNLIKELY( err ) ) return err;
15118 0 : return FD_BINCODE_SUCCESS;
15119 0 : }
15120 0 : case 15: {
15121 0 : err = fd_tower_sync_switch_decode_footprint_inner( ctx, total_sz );
15122 0 : if( FD_UNLIKELY( err ) ) return err;
15123 0 : return FD_BINCODE_SUCCESS;
15124 0 : }
15125 0 : default: return FD_BINCODE_ERR_ENCODING;
15126 0 : }
15127 0 : }
15128 0 : int fd_vote_instruction_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
15129 0 : *total_sz += sizeof(fd_vote_instruction_t);
15130 0 : void const * start_data = ctx->data;
15131 0 : int err = fd_vote_instruction_decode_footprint_inner( ctx, total_sz );
15132 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
15133 0 : ctx->data = start_data;
15134 0 : return err;
15135 0 : }
15136 0 : int fd_vote_instruction_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
15137 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
15138 0 : uint discriminant = 0;
15139 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
15140 0 : if( FD_UNLIKELY( err ) ) return err;
15141 0 : return fd_vote_instruction_inner_decode_footprint( discriminant, ctx, total_sz );
15142 0 : }
15143 0 : void fd_vote_instruction_inner_decode_inner( fd_vote_instruction_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
15144 0 : switch (discriminant) {
15145 0 : case 0: {
15146 0 : fd_vote_init_decode_inner( &self->initialize_account, alloc_mem, ctx );
15147 0 : break;
15148 0 : }
15149 0 : case 1: {
15150 0 : fd_vote_authorize_pubkey_decode_inner( &self->authorize, alloc_mem, ctx );
15151 0 : break;
15152 0 : }
15153 0 : case 2: {
15154 0 : fd_vote_decode_inner( &self->vote, alloc_mem, ctx );
15155 0 : break;
15156 0 : }
15157 0 : case 3: {
15158 0 : fd_bincode_uint64_decode_unsafe( &self->withdraw, ctx );
15159 0 : break;
15160 0 : }
15161 0 : case 4: {
15162 0 : break;
15163 0 : }
15164 0 : case 5: {
15165 0 : fd_bincode_uint8_decode_unsafe( &self->update_commission, ctx );
15166 0 : break;
15167 0 : }
15168 0 : case 6: {
15169 0 : fd_vote_switch_decode_inner( &self->vote_switch, alloc_mem, ctx );
15170 0 : break;
15171 0 : }
15172 0 : case 7: {
15173 0 : fd_vote_authorize_decode_inner( &self->authorize_checked, alloc_mem, ctx );
15174 0 : break;
15175 0 : }
15176 0 : case 8: {
15177 0 : fd_vote_state_update_decode_inner( &self->update_vote_state, alloc_mem, ctx );
15178 0 : break;
15179 0 : }
15180 0 : case 9: {
15181 0 : fd_update_vote_state_switch_decode_inner( &self->update_vote_state_switch, alloc_mem, ctx );
15182 0 : break;
15183 0 : }
15184 0 : case 10: {
15185 0 : fd_vote_authorize_with_seed_args_decode_inner( &self->authorize_with_seed, alloc_mem, ctx );
15186 0 : break;
15187 0 : }
15188 0 : case 11: {
15189 0 : fd_vote_authorize_checked_with_seed_args_decode_inner( &self->authorize_checked_with_seed, alloc_mem, ctx );
15190 0 : break;
15191 0 : }
15192 0 : case 12: {
15193 0 : fd_compact_vote_state_update_decode_inner( &self->compact_update_vote_state, alloc_mem, ctx );
15194 0 : break;
15195 0 : }
15196 0 : case 13: {
15197 0 : fd_compact_vote_state_update_switch_decode_inner( &self->compact_update_vote_state_switch, alloc_mem, ctx );
15198 0 : break;
15199 0 : }
15200 0 : case 14: {
15201 0 : fd_tower_sync_decode_inner( &self->tower_sync, alloc_mem, ctx );
15202 0 : break;
15203 0 : }
15204 0 : case 15: {
15205 0 : fd_tower_sync_switch_decode_inner( &self->tower_sync_switch, alloc_mem, ctx );
15206 0 : break;
15207 0 : }
15208 0 : }
15209 0 : }
15210 0 : void fd_vote_instruction_inner_decode_inner_global( fd_vote_instruction_inner_global_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
15211 0 : switch (discriminant) {
15212 0 : case 0: {
15213 0 : fd_vote_init_decode_inner_global( &self->initialize_account, alloc_mem, ctx );
15214 0 : break;
15215 0 : }
15216 0 : case 1: {
15217 0 : fd_vote_authorize_pubkey_decode_inner_global( &self->authorize, alloc_mem, ctx );
15218 0 : break;
15219 0 : }
15220 0 : case 2: {
15221 0 : fd_vote_decode_inner_global( &self->vote, alloc_mem, ctx );
15222 0 : break;
15223 0 : }
15224 0 : case 3: {
15225 0 : fd_bincode_uint64_decode_unsafe( &self->withdraw, ctx );
15226 0 : break;
15227 0 : }
15228 0 : case 4: {
15229 0 : break;
15230 0 : }
15231 0 : case 5: {
15232 0 : fd_bincode_uint8_decode_unsafe( &self->update_commission, ctx );
15233 0 : break;
15234 0 : }
15235 0 : case 6: {
15236 0 : fd_vote_switch_decode_inner_global( &self->vote_switch, alloc_mem, ctx );
15237 0 : break;
15238 0 : }
15239 0 : case 7: {
15240 0 : fd_vote_authorize_decode_inner_global( &self->authorize_checked, alloc_mem, ctx );
15241 0 : break;
15242 0 : }
15243 0 : case 8: {
15244 0 : fd_vote_state_update_decode_inner_global( &self->update_vote_state, alloc_mem, ctx );
15245 0 : break;
15246 0 : }
15247 0 : case 9: {
15248 0 : fd_update_vote_state_switch_decode_inner_global( &self->update_vote_state_switch, alloc_mem, ctx );
15249 0 : break;
15250 0 : }
15251 0 : case 10: {
15252 0 : fd_vote_authorize_with_seed_args_decode_inner_global( &self->authorize_with_seed, alloc_mem, ctx );
15253 0 : break;
15254 0 : }
15255 0 : case 11: {
15256 0 : fd_vote_authorize_checked_with_seed_args_decode_inner_global( &self->authorize_checked_with_seed, alloc_mem, ctx );
15257 0 : break;
15258 0 : }
15259 0 : case 12: {
15260 0 : fd_compact_vote_state_update_decode_inner_global( &self->compact_update_vote_state, alloc_mem, ctx );
15261 0 : break;
15262 0 : }
15263 0 : case 13: {
15264 0 : fd_compact_vote_state_update_switch_decode_inner_global( &self->compact_update_vote_state_switch, alloc_mem, ctx );
15265 0 : break;
15266 0 : }
15267 0 : case 14: {
15268 0 : fd_tower_sync_decode_inner_global( &self->tower_sync, alloc_mem, ctx );
15269 0 : break;
15270 0 : }
15271 0 : case 15: {
15272 0 : fd_tower_sync_switch_decode_inner_global( &self->tower_sync_switch, alloc_mem, ctx );
15273 0 : break;
15274 0 : }
15275 0 : }
15276 0 : }
15277 0 : int fd_vote_instruction_convert_global_to_local_inner( fd_vote_instruction_inner_global_t const * mem, fd_vote_instruction_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
15278 0 : int err = 0;
15279 0 : switch( discriminant ) {
15280 0 : case 0: {
15281 0 : err = fd_vote_init_convert_global_to_local( &mem->initialize_account, &self->initialize_account, ctx );
15282 0 : if( FD_UNLIKELY( err ) ) return err;
15283 0 : break;
15284 0 : }
15285 0 : case 1: {
15286 0 : err = fd_vote_authorize_pubkey_convert_global_to_local( &mem->authorize, &self->authorize, ctx );
15287 0 : if( FD_UNLIKELY( err ) ) return err;
15288 0 : break;
15289 0 : }
15290 0 : case 2: {
15291 0 : err = fd_vote_convert_global_to_local( &mem->vote, &self->vote, ctx );
15292 0 : if( FD_UNLIKELY( err ) ) return err;
15293 0 : break;
15294 0 : }
15295 0 : case 3: {
15296 0 : self->withdraw = mem->withdraw;
15297 0 : break;
15298 0 : }
15299 0 : case 4: {
15300 0 : break;
15301 0 : }
15302 0 : case 5: {
15303 0 : self->update_commission = mem->update_commission;
15304 0 : break;
15305 0 : }
15306 0 : case 6: {
15307 0 : err = fd_vote_switch_convert_global_to_local( &mem->vote_switch, &self->vote_switch, ctx );
15308 0 : if( FD_UNLIKELY( err ) ) return err;
15309 0 : break;
15310 0 : }
15311 0 : case 7: {
15312 0 : err = fd_vote_authorize_convert_global_to_local( &mem->authorize_checked, &self->authorize_checked, ctx );
15313 0 : if( FD_UNLIKELY( err ) ) return err;
15314 0 : break;
15315 0 : }
15316 0 : case 8: {
15317 0 : err = fd_vote_state_update_convert_global_to_local( &mem->update_vote_state, &self->update_vote_state, ctx );
15318 0 : if( FD_UNLIKELY( err ) ) return err;
15319 0 : break;
15320 0 : }
15321 0 : case 9: {
15322 0 : err = fd_update_vote_state_switch_convert_global_to_local( &mem->update_vote_state_switch, &self->update_vote_state_switch, ctx );
15323 0 : if( FD_UNLIKELY( err ) ) return err;
15324 0 : break;
15325 0 : }
15326 0 : case 10: {
15327 0 : err = fd_vote_authorize_with_seed_args_convert_global_to_local( &mem->authorize_with_seed, &self->authorize_with_seed, ctx );
15328 0 : if( FD_UNLIKELY( err ) ) return err;
15329 0 : break;
15330 0 : }
15331 0 : case 11: {
15332 0 : err = fd_vote_authorize_checked_with_seed_args_convert_global_to_local( &mem->authorize_checked_with_seed, &self->authorize_checked_with_seed, ctx );
15333 0 : if( FD_UNLIKELY( err ) ) return err;
15334 0 : break;
15335 0 : }
15336 0 : case 12: {
15337 0 : err = fd_compact_vote_state_update_convert_global_to_local( &mem->compact_update_vote_state, &self->compact_update_vote_state, ctx );
15338 0 : if( FD_UNLIKELY( err ) ) return err;
15339 0 : break;
15340 0 : }
15341 0 : case 13: {
15342 0 : err = fd_compact_vote_state_update_switch_convert_global_to_local( &mem->compact_update_vote_state_switch, &self->compact_update_vote_state_switch, ctx );
15343 0 : if( FD_UNLIKELY( err ) ) return err;
15344 0 : break;
15345 0 : }
15346 0 : case 14: {
15347 0 : err = fd_tower_sync_convert_global_to_local( &mem->tower_sync, &self->tower_sync, ctx );
15348 0 : if( FD_UNLIKELY( err ) ) return err;
15349 0 : break;
15350 0 : }
15351 0 : case 15: {
15352 0 : err = fd_tower_sync_switch_convert_global_to_local( &mem->tower_sync_switch, &self->tower_sync_switch, ctx );
15353 0 : if( FD_UNLIKELY( err ) ) return err;
15354 0 : break;
15355 0 : }
15356 0 : }
15357 0 : return FD_BINCODE_SUCCESS;
15358 0 : }
15359 0 : int fd_vote_instruction_convert_global_to_local( void const * global_self, fd_vote_instruction_t * self, fd_bincode_decode_ctx_t * ctx ) {
15360 0 : fd_vote_instruction_global_t const * mem = (fd_vote_instruction_global_t const *)global_self;
15361 0 : uint discriminant = mem->discriminant;
15362 0 : self->discriminant = mem->discriminant;
15363 0 : int err = fd_vote_instruction_convert_global_to_local_inner( &mem->inner, &self->inner, discriminant, ctx );
15364 0 : return FD_BINCODE_SUCCESS;
15365 0 : }
15366 0 : void fd_vote_instruction_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
15367 0 : fd_vote_instruction_t * self = (fd_vote_instruction_t *)struct_mem;
15368 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
15369 0 : fd_vote_instruction_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
15370 0 : }
15371 0 : void * fd_vote_instruction_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
15372 0 : fd_vote_instruction_t * self = (fd_vote_instruction_t *)mem;
15373 0 : fd_vote_instruction_new( self );
15374 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_instruction_t);
15375 0 : void * * alloc_mem = &alloc_region;
15376 0 : fd_vote_instruction_decode_inner( mem, alloc_mem, ctx );
15377 0 : return self;
15378 0 : }
15379 0 : void * fd_vote_instruction_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
15380 0 : fd_vote_instruction_t * self = (fd_vote_instruction_t *)mem;
15381 0 : fd_vote_instruction_new( self );
15382 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_instruction_t);
15383 0 : void * * alloc_mem = &alloc_region;
15384 0 : fd_vote_instruction_decode_inner_global( mem, alloc_mem, ctx );
15385 0 : return self;
15386 0 : }
15387 0 : void fd_vote_instruction_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
15388 0 : fd_vote_instruction_global_t * self = (fd_vote_instruction_global_t *)struct_mem;
15389 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
15390 0 : fd_vote_instruction_inner_decode_inner_global( &self->inner, alloc_mem, self->discriminant, ctx );
15391 0 : }
15392 0 : void fd_vote_instruction_inner_new( fd_vote_instruction_inner_t * self, uint discriminant ) {
15393 0 : switch( discriminant ) {
15394 0 : case 0: {
15395 0 : fd_vote_init_new( &self->initialize_account );
15396 0 : break;
15397 0 : }
15398 0 : case 1: {
15399 0 : fd_vote_authorize_pubkey_new( &self->authorize );
15400 0 : break;
15401 0 : }
15402 0 : case 2: {
15403 0 : fd_vote_new( &self->vote );
15404 0 : break;
15405 0 : }
15406 0 : case 3: {
15407 0 : break;
15408 0 : }
15409 0 : case 4: {
15410 0 : break;
15411 0 : }
15412 0 : case 5: {
15413 0 : break;
15414 0 : }
15415 0 : case 6: {
15416 0 : fd_vote_switch_new( &self->vote_switch );
15417 0 : break;
15418 0 : }
15419 0 : case 7: {
15420 0 : fd_vote_authorize_new( &self->authorize_checked );
15421 0 : break;
15422 0 : }
15423 0 : case 8: {
15424 0 : fd_vote_state_update_new( &self->update_vote_state );
15425 0 : break;
15426 0 : }
15427 0 : case 9: {
15428 0 : fd_update_vote_state_switch_new( &self->update_vote_state_switch );
15429 0 : break;
15430 0 : }
15431 0 : case 10: {
15432 0 : fd_vote_authorize_with_seed_args_new( &self->authorize_with_seed );
15433 0 : break;
15434 0 : }
15435 0 : case 11: {
15436 0 : fd_vote_authorize_checked_with_seed_args_new( &self->authorize_checked_with_seed );
15437 0 : break;
15438 0 : }
15439 0 : case 12: {
15440 0 : fd_compact_vote_state_update_new( &self->compact_update_vote_state );
15441 0 : break;
15442 0 : }
15443 0 : case 13: {
15444 0 : fd_compact_vote_state_update_switch_new( &self->compact_update_vote_state_switch );
15445 0 : break;
15446 0 : }
15447 0 : case 14: {
15448 0 : fd_tower_sync_new( &self->tower_sync );
15449 0 : break;
15450 0 : }
15451 0 : case 15: {
15452 0 : fd_tower_sync_switch_new( &self->tower_sync_switch );
15453 0 : break;
15454 0 : }
15455 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
15456 0 : }
15457 0 : }
15458 0 : void fd_vote_instruction_new_disc( fd_vote_instruction_t * self, uint discriminant ) {
15459 0 : self->discriminant = discriminant;
15460 0 : fd_vote_instruction_inner_new( &self->inner, self->discriminant );
15461 0 : }
15462 0 : void fd_vote_instruction_new( fd_vote_instruction_t * self ) {
15463 0 : fd_memset( self, 0, sizeof(fd_vote_instruction_t) );
15464 0 : fd_vote_instruction_new_disc( self, UINT_MAX );
15465 0 : }
15466 0 : void fd_vote_instruction_inner_destroy( fd_vote_instruction_inner_t * self, uint discriminant ) {
15467 0 : switch( discriminant ) {
15468 0 : case 0: {
15469 0 : fd_vote_init_destroy( &self->initialize_account );
15470 0 : break;
15471 0 : }
15472 0 : case 1: {
15473 0 : fd_vote_authorize_pubkey_destroy( &self->authorize );
15474 0 : break;
15475 0 : }
15476 0 : case 2: {
15477 0 : fd_vote_destroy( &self->vote );
15478 0 : break;
15479 0 : }
15480 0 : case 3: {
15481 0 : break;
15482 0 : }
15483 0 : case 5: {
15484 0 : break;
15485 0 : }
15486 0 : case 6: {
15487 0 : fd_vote_switch_destroy( &self->vote_switch );
15488 0 : break;
15489 0 : }
15490 0 : case 7: {
15491 0 : fd_vote_authorize_destroy( &self->authorize_checked );
15492 0 : break;
15493 0 : }
15494 0 : case 8: {
15495 0 : fd_vote_state_update_destroy( &self->update_vote_state );
15496 0 : break;
15497 0 : }
15498 0 : case 9: {
15499 0 : fd_update_vote_state_switch_destroy( &self->update_vote_state_switch );
15500 0 : break;
15501 0 : }
15502 0 : case 10: {
15503 0 : fd_vote_authorize_with_seed_args_destroy( &self->authorize_with_seed );
15504 0 : break;
15505 0 : }
15506 0 : case 11: {
15507 0 : fd_vote_authorize_checked_with_seed_args_destroy( &self->authorize_checked_with_seed );
15508 0 : break;
15509 0 : }
15510 0 : case 12: {
15511 0 : fd_compact_vote_state_update_destroy( &self->compact_update_vote_state );
15512 0 : break;
15513 0 : }
15514 0 : case 13: {
15515 0 : fd_compact_vote_state_update_switch_destroy( &self->compact_update_vote_state_switch );
15516 0 : break;
15517 0 : }
15518 0 : case 14: {
15519 0 : fd_tower_sync_destroy( &self->tower_sync );
15520 0 : break;
15521 0 : }
15522 0 : case 15: {
15523 0 : fd_tower_sync_switch_destroy( &self->tower_sync_switch );
15524 0 : break;
15525 0 : }
15526 0 : default: break; // FD_LOG_ERR(( "unhandled type" ));
15527 0 : }
15528 0 : }
15529 0 : void fd_vote_instruction_destroy( fd_vote_instruction_t * self ) {
15530 0 : fd_vote_instruction_inner_destroy( &self->inner, self->discriminant );
15531 0 : }
15532 :
15533 0 : ulong fd_vote_instruction_footprint( void ){ return FD_VOTE_INSTRUCTION_FOOTPRINT; }
15534 0 : ulong fd_vote_instruction_align( void ){ return FD_VOTE_INSTRUCTION_ALIGN; }
15535 :
15536 0 : void fd_vote_instruction_walk( void * w, fd_vote_instruction_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
15537 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_vote_instruction", level++);
15538 0 : switch( self->discriminant ) {
15539 0 : case 0: {
15540 0 : fun( w, self, "initialize_account", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
15541 0 : fd_vote_init_walk( w, &self->inner.initialize_account, fun, "initialize_account", level );
15542 0 : break;
15543 0 : }
15544 0 : case 1: {
15545 0 : fun( w, self, "authorize", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
15546 0 : fd_vote_authorize_pubkey_walk( w, &self->inner.authorize, fun, "authorize", level );
15547 0 : break;
15548 0 : }
15549 0 : case 2: {
15550 0 : fun( w, self, "vote", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
15551 0 : fd_vote_walk( w, &self->inner.vote, fun, "vote", level );
15552 0 : break;
15553 0 : }
15554 0 : case 3: {
15555 0 : fun( w, self, "withdraw", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
15556 0 : fun( w, &self->inner.withdraw, "withdraw", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
15557 0 : break;
15558 0 : }
15559 0 : case 4: {
15560 0 : fun( w, self, "update_validator_identity", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
15561 0 : break;
15562 0 : }
15563 0 : case 5: {
15564 0 : fun( w, self, "update_commission", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
15565 0 : fun( w, &self->inner.update_commission, "update_commission", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
15566 0 : break;
15567 0 : }
15568 0 : case 6: {
15569 0 : fun( w, self, "vote_switch", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
15570 0 : fd_vote_switch_walk( w, &self->inner.vote_switch, fun, "vote_switch", level );
15571 0 : break;
15572 0 : }
15573 0 : case 7: {
15574 0 : fun( w, self, "authorize_checked", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
15575 0 : fd_vote_authorize_walk( w, &self->inner.authorize_checked, fun, "authorize_checked", level );
15576 0 : break;
15577 0 : }
15578 0 : case 8: {
15579 0 : fun( w, self, "update_vote_state", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
15580 0 : fd_vote_state_update_walk( w, &self->inner.update_vote_state, fun, "update_vote_state", level );
15581 0 : break;
15582 0 : }
15583 0 : case 9: {
15584 0 : fun( w, self, "update_vote_state_switch", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
15585 0 : fd_update_vote_state_switch_walk( w, &self->inner.update_vote_state_switch, fun, "update_vote_state_switch", level );
15586 0 : break;
15587 0 : }
15588 0 : case 10: {
15589 0 : fun( w, self, "authorize_with_seed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
15590 0 : fd_vote_authorize_with_seed_args_walk( w, &self->inner.authorize_with_seed, fun, "authorize_with_seed", level );
15591 0 : break;
15592 0 : }
15593 0 : case 11: {
15594 0 : fun( w, self, "authorize_checked_with_seed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
15595 0 : fd_vote_authorize_checked_with_seed_args_walk( w, &self->inner.authorize_checked_with_seed, fun, "authorize_checked_with_seed", level );
15596 0 : break;
15597 0 : }
15598 0 : case 12: {
15599 0 : fun( w, self, "compact_update_vote_state", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
15600 0 : fd_compact_vote_state_update_walk( w, &self->inner.compact_update_vote_state, fun, "compact_update_vote_state", level );
15601 0 : break;
15602 0 : }
15603 0 : case 13: {
15604 0 : fun( w, self, "compact_update_vote_state_switch", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
15605 0 : fd_compact_vote_state_update_switch_walk( w, &self->inner.compact_update_vote_state_switch, fun, "compact_update_vote_state_switch", level );
15606 0 : break;
15607 0 : }
15608 0 : case 14: {
15609 0 : fun( w, self, "tower_sync", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
15610 0 : fd_tower_sync_walk( w, &self->inner.tower_sync, fun, "tower_sync", level );
15611 0 : break;
15612 0 : }
15613 0 : case 15: {
15614 0 : fun( w, self, "tower_sync_switch", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
15615 0 : fd_tower_sync_switch_walk( w, &self->inner.tower_sync_switch, fun, "tower_sync_switch", level );
15616 0 : break;
15617 0 : }
15618 0 : }
15619 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_vote_instruction", level-- );
15620 0 : }
15621 0 : ulong fd_vote_instruction_size( fd_vote_instruction_t const * self ) {
15622 0 : ulong size = 0;
15623 0 : size += sizeof(uint);
15624 0 : switch (self->discriminant) {
15625 0 : case 0: {
15626 0 : size += fd_vote_init_size( &self->inner.initialize_account );
15627 0 : break;
15628 0 : }
15629 0 : case 1: {
15630 0 : size += fd_vote_authorize_pubkey_size( &self->inner.authorize );
15631 0 : break;
15632 0 : }
15633 0 : case 2: {
15634 0 : size += fd_vote_size( &self->inner.vote );
15635 0 : break;
15636 0 : }
15637 0 : case 3: {
15638 0 : size += sizeof(ulong);
15639 0 : break;
15640 0 : }
15641 0 : case 5: {
15642 0 : size += sizeof(char);
15643 0 : break;
15644 0 : }
15645 0 : case 6: {
15646 0 : size += fd_vote_switch_size( &self->inner.vote_switch );
15647 0 : break;
15648 0 : }
15649 0 : case 7: {
15650 0 : size += fd_vote_authorize_size( &self->inner.authorize_checked );
15651 0 : break;
15652 0 : }
15653 0 : case 8: {
15654 0 : size += fd_vote_state_update_size( &self->inner.update_vote_state );
15655 0 : break;
15656 0 : }
15657 0 : case 9: {
15658 0 : size += fd_update_vote_state_switch_size( &self->inner.update_vote_state_switch );
15659 0 : break;
15660 0 : }
15661 0 : case 10: {
15662 0 : size += fd_vote_authorize_with_seed_args_size( &self->inner.authorize_with_seed );
15663 0 : break;
15664 0 : }
15665 0 : case 11: {
15666 0 : size += fd_vote_authorize_checked_with_seed_args_size( &self->inner.authorize_checked_with_seed );
15667 0 : break;
15668 0 : }
15669 0 : case 12: {
15670 0 : size += fd_compact_vote_state_update_size( &self->inner.compact_update_vote_state );
15671 0 : break;
15672 0 : }
15673 0 : case 13: {
15674 0 : size += fd_compact_vote_state_update_switch_size( &self->inner.compact_update_vote_state_switch );
15675 0 : break;
15676 0 : }
15677 0 : case 14: {
15678 0 : size += fd_tower_sync_size( &self->inner.tower_sync );
15679 0 : break;
15680 0 : }
15681 0 : case 15: {
15682 0 : size += fd_tower_sync_switch_size( &self->inner.tower_sync_switch );
15683 0 : break;
15684 0 : }
15685 0 : }
15686 0 : return size;
15687 0 : }
15688 :
15689 0 : int fd_vote_instruction_inner_encode( fd_vote_instruction_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
15690 0 : int err;
15691 0 : switch (discriminant) {
15692 0 : case 0: {
15693 0 : err = fd_vote_init_encode( &self->initialize_account, ctx );
15694 0 : if( FD_UNLIKELY( err ) ) return err;
15695 0 : break;
15696 0 : }
15697 0 : case 1: {
15698 0 : err = fd_vote_authorize_pubkey_encode( &self->authorize, ctx );
15699 0 : if( FD_UNLIKELY( err ) ) return err;
15700 0 : break;
15701 0 : }
15702 0 : case 2: {
15703 0 : err = fd_vote_encode( &self->vote, ctx );
15704 0 : if( FD_UNLIKELY( err ) ) return err;
15705 0 : break;
15706 0 : }
15707 0 : case 3: {
15708 0 : err = fd_bincode_uint64_encode( self->withdraw, ctx );
15709 0 : if( FD_UNLIKELY( err ) ) return err;
15710 0 : break;
15711 0 : }
15712 0 : case 5: {
15713 0 : err = fd_bincode_uint8_encode( (uchar)(self->update_commission), ctx );
15714 0 : if( FD_UNLIKELY( err ) ) return err;
15715 0 : break;
15716 0 : }
15717 0 : case 6: {
15718 0 : err = fd_vote_switch_encode( &self->vote_switch, ctx );
15719 0 : if( FD_UNLIKELY( err ) ) return err;
15720 0 : break;
15721 0 : }
15722 0 : case 7: {
15723 0 : err = fd_vote_authorize_encode( &self->authorize_checked, ctx );
15724 0 : if( FD_UNLIKELY( err ) ) return err;
15725 0 : break;
15726 0 : }
15727 0 : case 8: {
15728 0 : err = fd_vote_state_update_encode( &self->update_vote_state, ctx );
15729 0 : if( FD_UNLIKELY( err ) ) return err;
15730 0 : break;
15731 0 : }
15732 0 : case 9: {
15733 0 : err = fd_update_vote_state_switch_encode( &self->update_vote_state_switch, ctx );
15734 0 : if( FD_UNLIKELY( err ) ) return err;
15735 0 : break;
15736 0 : }
15737 0 : case 10: {
15738 0 : err = fd_vote_authorize_with_seed_args_encode( &self->authorize_with_seed, ctx );
15739 0 : if( FD_UNLIKELY( err ) ) return err;
15740 0 : break;
15741 0 : }
15742 0 : case 11: {
15743 0 : err = fd_vote_authorize_checked_with_seed_args_encode( &self->authorize_checked_with_seed, ctx );
15744 0 : if( FD_UNLIKELY( err ) ) return err;
15745 0 : break;
15746 0 : }
15747 0 : case 12: {
15748 0 : err = fd_compact_vote_state_update_encode( &self->compact_update_vote_state, ctx );
15749 0 : if( FD_UNLIKELY( err ) ) return err;
15750 0 : break;
15751 0 : }
15752 0 : case 13: {
15753 0 : err = fd_compact_vote_state_update_switch_encode( &self->compact_update_vote_state_switch, ctx );
15754 0 : if( FD_UNLIKELY( err ) ) return err;
15755 0 : break;
15756 0 : }
15757 0 : case 14: {
15758 0 : err = fd_tower_sync_encode( &self->tower_sync, ctx );
15759 0 : if( FD_UNLIKELY( err ) ) return err;
15760 0 : break;
15761 0 : }
15762 0 : case 15: {
15763 0 : err = fd_tower_sync_switch_encode( &self->tower_sync_switch, ctx );
15764 0 : if( FD_UNLIKELY( err ) ) return err;
15765 0 : break;
15766 0 : }
15767 0 : }
15768 0 : return FD_BINCODE_SUCCESS;
15769 0 : }
15770 0 : int fd_vote_instruction_encode( fd_vote_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
15771 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
15772 0 : if( FD_UNLIKELY( err ) ) return err;
15773 0 : return fd_vote_instruction_inner_encode( &self->inner, self->discriminant, ctx );
15774 0 : }
15775 :
15776 0 : int fd_system_program_instruction_create_account_encode( fd_system_program_instruction_create_account_t const * self, fd_bincode_encode_ctx_t * ctx ) {
15777 0 : int err;
15778 0 : err = fd_bincode_uint64_encode( self->lamports, ctx );
15779 0 : if( FD_UNLIKELY( err ) ) return err;
15780 0 : err = fd_bincode_uint64_encode( self->space, ctx );
15781 0 : if( FD_UNLIKELY( err ) ) return err;
15782 0 : err = fd_pubkey_encode( &self->owner, ctx );
15783 0 : if( FD_UNLIKELY( err ) ) return err;
15784 0 : return FD_BINCODE_SUCCESS;
15785 0 : }
15786 0 : int fd_system_program_instruction_create_account_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
15787 0 : *total_sz += sizeof(fd_system_program_instruction_create_account_t);
15788 0 : void const * start_data = ctx->data;
15789 0 : int err = fd_system_program_instruction_create_account_decode_footprint_inner( ctx, total_sz );
15790 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
15791 0 : ctx->data = start_data;
15792 0 : return err;
15793 0 : }
15794 0 : int fd_system_program_instruction_create_account_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
15795 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
15796 0 : int err = 0;
15797 0 : err = fd_bincode_uint64_decode_footprint( ctx );
15798 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15799 0 : err = fd_bincode_uint64_decode_footprint( ctx );
15800 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15801 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
15802 0 : if( FD_UNLIKELY( err ) ) return err;
15803 0 : return 0;
15804 0 : }
15805 0 : void * fd_system_program_instruction_create_account_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
15806 0 : fd_system_program_instruction_create_account_t * self = (fd_system_program_instruction_create_account_t *)mem;
15807 0 : fd_system_program_instruction_create_account_new( self );
15808 0 : void * alloc_region = (uchar *)mem + sizeof(fd_system_program_instruction_create_account_t);
15809 0 : void * * alloc_mem = &alloc_region;
15810 0 : fd_system_program_instruction_create_account_decode_inner( mem, alloc_mem, ctx );
15811 0 : return self;
15812 0 : }
15813 0 : void fd_system_program_instruction_create_account_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
15814 0 : fd_system_program_instruction_create_account_t * self = (fd_system_program_instruction_create_account_t *)struct_mem;
15815 0 : fd_bincode_uint64_decode_unsafe( &self->lamports, ctx );
15816 0 : fd_bincode_uint64_decode_unsafe( &self->space, ctx );
15817 0 : fd_pubkey_decode_inner( &self->owner, alloc_mem, ctx );
15818 0 : }
15819 0 : void * fd_system_program_instruction_create_account_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
15820 0 : fd_system_program_instruction_create_account_global_t * self = (fd_system_program_instruction_create_account_global_t *)mem;
15821 0 : fd_system_program_instruction_create_account_new( (fd_system_program_instruction_create_account_t *)self );
15822 0 : void * alloc_region = (uchar *)mem + sizeof(fd_system_program_instruction_create_account_global_t);
15823 0 : void * * alloc_mem = &alloc_region;
15824 0 : fd_system_program_instruction_create_account_decode_inner_global( mem, alloc_mem, ctx );
15825 0 : return self;
15826 0 : }
15827 0 : void fd_system_program_instruction_create_account_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
15828 0 : fd_system_program_instruction_create_account_global_t * self = (fd_system_program_instruction_create_account_global_t *)struct_mem;
15829 0 : fd_bincode_uint64_decode_unsafe( &self->lamports, ctx );
15830 0 : fd_bincode_uint64_decode_unsafe( &self->space, ctx );
15831 0 : fd_pubkey_decode_inner_global( &self->owner, alloc_mem, ctx );
15832 0 : }
15833 0 : int fd_system_program_instruction_create_account_convert_global_to_local( void const * global_self, fd_system_program_instruction_create_account_t * self, fd_bincode_decode_ctx_t * ctx ) {
15834 0 : int err = 0;
15835 0 : fd_system_program_instruction_create_account_global_t const * mem = (fd_system_program_instruction_create_account_global_t const *)global_self;
15836 0 : self->lamports = mem->lamports;
15837 0 : self->space = mem->space;
15838 0 : err = fd_pubkey_convert_global_to_local( &mem->owner, &self->owner, ctx );
15839 0 : if( FD_UNLIKELY( err ) ) return err;
15840 0 : return FD_BINCODE_SUCCESS;
15841 0 : }
15842 0 : void fd_system_program_instruction_create_account_new(fd_system_program_instruction_create_account_t * self) {
15843 0 : fd_memset( self, 0, sizeof(fd_system_program_instruction_create_account_t) );
15844 0 : fd_pubkey_new( &self->owner );
15845 0 : }
15846 0 : void fd_system_program_instruction_create_account_destroy( fd_system_program_instruction_create_account_t * self ) {
15847 0 : fd_pubkey_destroy( &self->owner );
15848 0 : }
15849 :
15850 0 : ulong fd_system_program_instruction_create_account_footprint( void ){ return FD_SYSTEM_PROGRAM_INSTRUCTION_CREATE_ACCOUNT_FOOTPRINT; }
15851 0 : ulong fd_system_program_instruction_create_account_align( void ){ return FD_SYSTEM_PROGRAM_INSTRUCTION_CREATE_ACCOUNT_ALIGN; }
15852 :
15853 0 : void fd_system_program_instruction_create_account_walk( void * w, fd_system_program_instruction_create_account_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
15854 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_system_program_instruction_create_account", level++ );
15855 0 : fun( w, &self->lamports, "lamports", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
15856 0 : fun( w, &self->space, "space", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
15857 0 : fd_pubkey_walk( w, &self->owner, fun, "owner", level );
15858 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_system_program_instruction_create_account", level-- );
15859 0 : }
15860 0 : ulong fd_system_program_instruction_create_account_size( fd_system_program_instruction_create_account_t const * self ) {
15861 0 : ulong size = 0;
15862 0 : size += sizeof(ulong);
15863 0 : size += sizeof(ulong);
15864 0 : size += fd_pubkey_size( &self->owner );
15865 0 : return size;
15866 0 : }
15867 :
15868 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 ) {
15869 0 : int err;
15870 0 : err = fd_pubkey_encode( &self->base, ctx );
15871 0 : if( FD_UNLIKELY( err ) ) return err;
15872 0 : err = fd_bincode_uint64_encode( self->seed_len, ctx );
15873 0 : if( FD_UNLIKELY(err) ) return err;
15874 0 : if( self->seed_len ) {
15875 0 : err = fd_bincode_bytes_encode( self->seed, self->seed_len, ctx );
15876 0 : if( FD_UNLIKELY( err ) ) return err;
15877 0 : }
15878 0 : err = fd_bincode_uint64_encode( self->lamports, ctx );
15879 0 : if( FD_UNLIKELY( err ) ) return err;
15880 0 : err = fd_bincode_uint64_encode( self->space, ctx );
15881 0 : if( FD_UNLIKELY( err ) ) return err;
15882 0 : err = fd_pubkey_encode( &self->owner, ctx );
15883 0 : if( FD_UNLIKELY( err ) ) return err;
15884 0 : return FD_BINCODE_SUCCESS;
15885 0 : }
15886 0 : int fd_system_program_instruction_create_account_with_seed_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
15887 0 : *total_sz += sizeof(fd_system_program_instruction_create_account_with_seed_t);
15888 0 : void const * start_data = ctx->data;
15889 0 : int err = fd_system_program_instruction_create_account_with_seed_decode_footprint_inner( ctx, total_sz );
15890 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
15891 0 : ctx->data = start_data;
15892 0 : return err;
15893 0 : }
15894 0 : int fd_system_program_instruction_create_account_with_seed_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
15895 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
15896 0 : int err = 0;
15897 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
15898 0 : if( FD_UNLIKELY( err ) ) return err;
15899 0 : ulong seed_len;
15900 0 : err = fd_bincode_uint64_decode( &seed_len, ctx );
15901 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15902 0 : *total_sz += seed_len;
15903 0 : if( seed_len ) {
15904 0 : err = fd_bincode_bytes_decode_footprint( seed_len, ctx );
15905 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15906 0 : err = !fd_utf8_verify( (char const *) ctx->data - seed_len, seed_len );
15907 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15908 0 : }
15909 0 : err = fd_bincode_uint64_decode_footprint( ctx );
15910 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15911 0 : err = fd_bincode_uint64_decode_footprint( ctx );
15912 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15913 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
15914 0 : if( FD_UNLIKELY( err ) ) return err;
15915 0 : return 0;
15916 0 : }
15917 0 : void * fd_system_program_instruction_create_account_with_seed_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
15918 0 : fd_system_program_instruction_create_account_with_seed_t * self = (fd_system_program_instruction_create_account_with_seed_t *)mem;
15919 0 : fd_system_program_instruction_create_account_with_seed_new( self );
15920 0 : void * alloc_region = (uchar *)mem + sizeof(fd_system_program_instruction_create_account_with_seed_t);
15921 0 : void * * alloc_mem = &alloc_region;
15922 0 : fd_system_program_instruction_create_account_with_seed_decode_inner( mem, alloc_mem, ctx );
15923 0 : return self;
15924 0 : }
15925 0 : void fd_system_program_instruction_create_account_with_seed_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
15926 0 : fd_system_program_instruction_create_account_with_seed_t * self = (fd_system_program_instruction_create_account_with_seed_t *)struct_mem;
15927 0 : fd_pubkey_decode_inner( &self->base, alloc_mem, ctx );
15928 0 : fd_bincode_uint64_decode_unsafe( &self->seed_len, ctx );
15929 0 : if( self->seed_len ) {
15930 0 : self->seed = *alloc_mem;
15931 0 : fd_bincode_bytes_decode_unsafe( self->seed, self->seed_len, ctx );
15932 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->seed_len;
15933 0 : } else
15934 0 : self->seed = NULL;
15935 0 : fd_bincode_uint64_decode_unsafe( &self->lamports, ctx );
15936 0 : fd_bincode_uint64_decode_unsafe( &self->space, ctx );
15937 0 : fd_pubkey_decode_inner( &self->owner, alloc_mem, ctx );
15938 0 : }
15939 0 : void * fd_system_program_instruction_create_account_with_seed_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
15940 0 : fd_system_program_instruction_create_account_with_seed_global_t * self = (fd_system_program_instruction_create_account_with_seed_global_t *)mem;
15941 0 : fd_system_program_instruction_create_account_with_seed_new( (fd_system_program_instruction_create_account_with_seed_t *)self );
15942 0 : void * alloc_region = (uchar *)mem + sizeof(fd_system_program_instruction_create_account_with_seed_global_t);
15943 0 : void * * alloc_mem = &alloc_region;
15944 0 : fd_system_program_instruction_create_account_with_seed_decode_inner_global( mem, alloc_mem, ctx );
15945 0 : return self;
15946 0 : }
15947 0 : void fd_system_program_instruction_create_account_with_seed_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
15948 0 : fd_system_program_instruction_create_account_with_seed_global_t * self = (fd_system_program_instruction_create_account_with_seed_global_t *)struct_mem;
15949 0 : fd_pubkey_decode_inner_global( &self->base, alloc_mem, ctx );
15950 0 : fd_bincode_uint64_decode_unsafe( &self->seed_len, ctx );
15951 0 : if( self->seed_len ) {
15952 0 : self->seed_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
15953 0 : fd_bincode_bytes_decode_unsafe( *alloc_mem, self->seed_len, ctx );
15954 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->seed_len;
15955 0 : } else
15956 0 : self->seed_gaddr = 0UL;
15957 0 : fd_bincode_uint64_decode_unsafe( &self->lamports, ctx );
15958 0 : fd_bincode_uint64_decode_unsafe( &self->space, ctx );
15959 0 : fd_pubkey_decode_inner_global( &self->owner, alloc_mem, ctx );
15960 0 : }
15961 0 : int fd_system_program_instruction_create_account_with_seed_convert_global_to_local( void const * global_self, fd_system_program_instruction_create_account_with_seed_t * self, fd_bincode_decode_ctx_t * ctx ) {
15962 0 : int err = 0;
15963 0 : fd_system_program_instruction_create_account_with_seed_global_t const * mem = (fd_system_program_instruction_create_account_with_seed_global_t const *)global_self;
15964 0 : err = fd_pubkey_convert_global_to_local( &mem->base, &self->base, ctx );
15965 0 : if( FD_UNLIKELY( err ) ) return err;
15966 0 : self->seed_len = mem->seed_len;
15967 0 : self->seed = fd_wksp_laddr_fast( ctx->wksp, mem->seed_gaddr );
15968 0 : self->lamports = mem->lamports;
15969 0 : self->space = mem->space;
15970 0 : err = fd_pubkey_convert_global_to_local( &mem->owner, &self->owner, ctx );
15971 0 : if( FD_UNLIKELY( err ) ) return err;
15972 0 : return FD_BINCODE_SUCCESS;
15973 0 : }
15974 0 : void fd_system_program_instruction_create_account_with_seed_new(fd_system_program_instruction_create_account_with_seed_t * self) {
15975 0 : fd_memset( self, 0, sizeof(fd_system_program_instruction_create_account_with_seed_t) );
15976 0 : fd_pubkey_new( &self->base );
15977 0 : fd_pubkey_new( &self->owner );
15978 0 : }
15979 0 : void fd_system_program_instruction_create_account_with_seed_destroy( fd_system_program_instruction_create_account_with_seed_t * self ) {
15980 0 : fd_pubkey_destroy( &self->base );
15981 0 : if( self->seed ) {
15982 0 : self->seed = NULL;
15983 0 : }
15984 0 : fd_pubkey_destroy( &self->owner );
15985 0 : }
15986 :
15987 0 : ulong fd_system_program_instruction_create_account_with_seed_footprint( void ){ return FD_SYSTEM_PROGRAM_INSTRUCTION_CREATE_ACCOUNT_WITH_SEED_FOOTPRINT; }
15988 0 : ulong fd_system_program_instruction_create_account_with_seed_align( void ){ return FD_SYSTEM_PROGRAM_INSTRUCTION_CREATE_ACCOUNT_WITH_SEED_ALIGN; }
15989 :
15990 0 : void fd_system_program_instruction_create_account_with_seed_walk( void * w, fd_system_program_instruction_create_account_with_seed_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
15991 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_system_program_instruction_create_account_with_seed", level++ );
15992 0 : fd_pubkey_walk( w, &self->base, fun, "base", level );
15993 0 : fun(w, self->seed, "seed", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
15994 0 : fun( w, &self->lamports, "lamports", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
15995 0 : fun( w, &self->space, "space", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
15996 0 : fd_pubkey_walk( w, &self->owner, fun, "owner", level );
15997 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_system_program_instruction_create_account_with_seed", level-- );
15998 0 : }
15999 0 : ulong fd_system_program_instruction_create_account_with_seed_size( fd_system_program_instruction_create_account_with_seed_t const * self ) {
16000 0 : ulong size = 0;
16001 0 : size += fd_pubkey_size( &self->base );
16002 0 : do {
16003 0 : size += sizeof(ulong);
16004 0 : size += self->seed_len;
16005 0 : } while(0);
16006 0 : size += sizeof(ulong);
16007 0 : size += sizeof(ulong);
16008 0 : size += fd_pubkey_size( &self->owner );
16009 0 : return size;
16010 0 : }
16011 :
16012 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 ) {
16013 0 : int err;
16014 0 : err = fd_pubkey_encode( &self->base, ctx );
16015 0 : if( FD_UNLIKELY( err ) ) return err;
16016 0 : err = fd_bincode_uint64_encode( self->seed_len, ctx );
16017 0 : if( FD_UNLIKELY(err) ) return err;
16018 0 : if( self->seed_len ) {
16019 0 : err = fd_bincode_bytes_encode( self->seed, self->seed_len, ctx );
16020 0 : if( FD_UNLIKELY( err ) ) return err;
16021 0 : }
16022 0 : err = fd_bincode_uint64_encode( self->space, ctx );
16023 0 : if( FD_UNLIKELY( err ) ) return err;
16024 0 : err = fd_pubkey_encode( &self->owner, ctx );
16025 0 : if( FD_UNLIKELY( err ) ) return err;
16026 0 : return FD_BINCODE_SUCCESS;
16027 0 : }
16028 0 : int fd_system_program_instruction_allocate_with_seed_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
16029 0 : *total_sz += sizeof(fd_system_program_instruction_allocate_with_seed_t);
16030 0 : void const * start_data = ctx->data;
16031 0 : int err = fd_system_program_instruction_allocate_with_seed_decode_footprint_inner( ctx, total_sz );
16032 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
16033 0 : ctx->data = start_data;
16034 0 : return err;
16035 0 : }
16036 0 : int fd_system_program_instruction_allocate_with_seed_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
16037 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
16038 0 : int err = 0;
16039 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
16040 0 : if( FD_UNLIKELY( err ) ) return err;
16041 0 : ulong seed_len;
16042 0 : err = fd_bincode_uint64_decode( &seed_len, ctx );
16043 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
16044 0 : *total_sz += seed_len;
16045 0 : if( seed_len ) {
16046 0 : err = fd_bincode_bytes_decode_footprint( seed_len, ctx );
16047 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
16048 0 : err = !fd_utf8_verify( (char const *) ctx->data - seed_len, seed_len );
16049 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
16050 0 : }
16051 0 : err = fd_bincode_uint64_decode_footprint( ctx );
16052 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
16053 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
16054 0 : if( FD_UNLIKELY( err ) ) return err;
16055 0 : return 0;
16056 0 : }
16057 0 : void * fd_system_program_instruction_allocate_with_seed_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
16058 0 : fd_system_program_instruction_allocate_with_seed_t * self = (fd_system_program_instruction_allocate_with_seed_t *)mem;
16059 0 : fd_system_program_instruction_allocate_with_seed_new( self );
16060 0 : void * alloc_region = (uchar *)mem + sizeof(fd_system_program_instruction_allocate_with_seed_t);
16061 0 : void * * alloc_mem = &alloc_region;
16062 0 : fd_system_program_instruction_allocate_with_seed_decode_inner( mem, alloc_mem, ctx );
16063 0 : return self;
16064 0 : }
16065 0 : void fd_system_program_instruction_allocate_with_seed_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
16066 0 : fd_system_program_instruction_allocate_with_seed_t * self = (fd_system_program_instruction_allocate_with_seed_t *)struct_mem;
16067 0 : fd_pubkey_decode_inner( &self->base, alloc_mem, ctx );
16068 0 : fd_bincode_uint64_decode_unsafe( &self->seed_len, ctx );
16069 0 : if( self->seed_len ) {
16070 0 : self->seed = *alloc_mem;
16071 0 : fd_bincode_bytes_decode_unsafe( self->seed, self->seed_len, ctx );
16072 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->seed_len;
16073 0 : } else
16074 0 : self->seed = NULL;
16075 0 : fd_bincode_uint64_decode_unsafe( &self->space, ctx );
16076 0 : fd_pubkey_decode_inner( &self->owner, alloc_mem, ctx );
16077 0 : }
16078 0 : void * fd_system_program_instruction_allocate_with_seed_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
16079 0 : fd_system_program_instruction_allocate_with_seed_global_t * self = (fd_system_program_instruction_allocate_with_seed_global_t *)mem;
16080 0 : fd_system_program_instruction_allocate_with_seed_new( (fd_system_program_instruction_allocate_with_seed_t *)self );
16081 0 : void * alloc_region = (uchar *)mem + sizeof(fd_system_program_instruction_allocate_with_seed_global_t);
16082 0 : void * * alloc_mem = &alloc_region;
16083 0 : fd_system_program_instruction_allocate_with_seed_decode_inner_global( mem, alloc_mem, ctx );
16084 0 : return self;
16085 0 : }
16086 0 : void fd_system_program_instruction_allocate_with_seed_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
16087 0 : fd_system_program_instruction_allocate_with_seed_global_t * self = (fd_system_program_instruction_allocate_with_seed_global_t *)struct_mem;
16088 0 : fd_pubkey_decode_inner_global( &self->base, alloc_mem, ctx );
16089 0 : fd_bincode_uint64_decode_unsafe( &self->seed_len, ctx );
16090 0 : if( self->seed_len ) {
16091 0 : self->seed_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
16092 0 : fd_bincode_bytes_decode_unsafe( *alloc_mem, self->seed_len, ctx );
16093 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->seed_len;
16094 0 : } else
16095 0 : self->seed_gaddr = 0UL;
16096 0 : fd_bincode_uint64_decode_unsafe( &self->space, ctx );
16097 0 : fd_pubkey_decode_inner_global( &self->owner, alloc_mem, ctx );
16098 0 : }
16099 0 : int fd_system_program_instruction_allocate_with_seed_convert_global_to_local( void const * global_self, fd_system_program_instruction_allocate_with_seed_t * self, fd_bincode_decode_ctx_t * ctx ) {
16100 0 : int err = 0;
16101 0 : fd_system_program_instruction_allocate_with_seed_global_t const * mem = (fd_system_program_instruction_allocate_with_seed_global_t const *)global_self;
16102 0 : err = fd_pubkey_convert_global_to_local( &mem->base, &self->base, ctx );
16103 0 : if( FD_UNLIKELY( err ) ) return err;
16104 0 : self->seed_len = mem->seed_len;
16105 0 : self->seed = fd_wksp_laddr_fast( ctx->wksp, mem->seed_gaddr );
16106 0 : self->space = mem->space;
16107 0 : err = fd_pubkey_convert_global_to_local( &mem->owner, &self->owner, ctx );
16108 0 : if( FD_UNLIKELY( err ) ) return err;
16109 0 : return FD_BINCODE_SUCCESS;
16110 0 : }
16111 0 : void fd_system_program_instruction_allocate_with_seed_new(fd_system_program_instruction_allocate_with_seed_t * self) {
16112 0 : fd_memset( self, 0, sizeof(fd_system_program_instruction_allocate_with_seed_t) );
16113 0 : fd_pubkey_new( &self->base );
16114 0 : fd_pubkey_new( &self->owner );
16115 0 : }
16116 0 : void fd_system_program_instruction_allocate_with_seed_destroy( fd_system_program_instruction_allocate_with_seed_t * self ) {
16117 0 : fd_pubkey_destroy( &self->base );
16118 0 : if( self->seed ) {
16119 0 : self->seed = NULL;
16120 0 : }
16121 0 : fd_pubkey_destroy( &self->owner );
16122 0 : }
16123 :
16124 0 : ulong fd_system_program_instruction_allocate_with_seed_footprint( void ){ return FD_SYSTEM_PROGRAM_INSTRUCTION_ALLOCATE_WITH_SEED_FOOTPRINT; }
16125 0 : ulong fd_system_program_instruction_allocate_with_seed_align( void ){ return FD_SYSTEM_PROGRAM_INSTRUCTION_ALLOCATE_WITH_SEED_ALIGN; }
16126 :
16127 0 : void fd_system_program_instruction_allocate_with_seed_walk( void * w, fd_system_program_instruction_allocate_with_seed_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
16128 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_system_program_instruction_allocate_with_seed", level++ );
16129 0 : fd_pubkey_walk( w, &self->base, fun, "base", level );
16130 0 : fun(w, self->seed, "seed", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
16131 0 : fun( w, &self->space, "space", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
16132 0 : fd_pubkey_walk( w, &self->owner, fun, "owner", level );
16133 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_system_program_instruction_allocate_with_seed", level-- );
16134 0 : }
16135 0 : ulong fd_system_program_instruction_allocate_with_seed_size( fd_system_program_instruction_allocate_with_seed_t const * self ) {
16136 0 : ulong size = 0;
16137 0 : size += fd_pubkey_size( &self->base );
16138 0 : do {
16139 0 : size += sizeof(ulong);
16140 0 : size += self->seed_len;
16141 0 : } while(0);
16142 0 : size += sizeof(ulong);
16143 0 : size += fd_pubkey_size( &self->owner );
16144 0 : return size;
16145 0 : }
16146 :
16147 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 ) {
16148 0 : int err;
16149 0 : err = fd_pubkey_encode( &self->base, ctx );
16150 0 : if( FD_UNLIKELY( err ) ) return err;
16151 0 : err = fd_bincode_uint64_encode( self->seed_len, ctx );
16152 0 : if( FD_UNLIKELY(err) ) return err;
16153 0 : if( self->seed_len ) {
16154 0 : err = fd_bincode_bytes_encode( self->seed, self->seed_len, ctx );
16155 0 : if( FD_UNLIKELY( err ) ) return err;
16156 0 : }
16157 0 : err = fd_pubkey_encode( &self->owner, ctx );
16158 0 : if( FD_UNLIKELY( err ) ) return err;
16159 0 : return FD_BINCODE_SUCCESS;
16160 0 : }
16161 0 : int fd_system_program_instruction_assign_with_seed_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
16162 0 : *total_sz += sizeof(fd_system_program_instruction_assign_with_seed_t);
16163 0 : void const * start_data = ctx->data;
16164 0 : int err = fd_system_program_instruction_assign_with_seed_decode_footprint_inner( ctx, total_sz );
16165 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
16166 0 : ctx->data = start_data;
16167 0 : return err;
16168 0 : }
16169 0 : int fd_system_program_instruction_assign_with_seed_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
16170 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
16171 0 : int err = 0;
16172 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
16173 0 : if( FD_UNLIKELY( err ) ) return err;
16174 0 : ulong seed_len;
16175 0 : err = fd_bincode_uint64_decode( &seed_len, ctx );
16176 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
16177 0 : *total_sz += seed_len;
16178 0 : if( seed_len ) {
16179 0 : err = fd_bincode_bytes_decode_footprint( seed_len, ctx );
16180 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
16181 0 : err = !fd_utf8_verify( (char const *) ctx->data - seed_len, seed_len );
16182 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
16183 0 : }
16184 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
16185 0 : if( FD_UNLIKELY( err ) ) return err;
16186 0 : return 0;
16187 0 : }
16188 0 : void * fd_system_program_instruction_assign_with_seed_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
16189 0 : fd_system_program_instruction_assign_with_seed_t * self = (fd_system_program_instruction_assign_with_seed_t *)mem;
16190 0 : fd_system_program_instruction_assign_with_seed_new( self );
16191 0 : void * alloc_region = (uchar *)mem + sizeof(fd_system_program_instruction_assign_with_seed_t);
16192 0 : void * * alloc_mem = &alloc_region;
16193 0 : fd_system_program_instruction_assign_with_seed_decode_inner( mem, alloc_mem, ctx );
16194 0 : return self;
16195 0 : }
16196 0 : void fd_system_program_instruction_assign_with_seed_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
16197 0 : fd_system_program_instruction_assign_with_seed_t * self = (fd_system_program_instruction_assign_with_seed_t *)struct_mem;
16198 0 : fd_pubkey_decode_inner( &self->base, alloc_mem, ctx );
16199 0 : fd_bincode_uint64_decode_unsafe( &self->seed_len, ctx );
16200 0 : if( self->seed_len ) {
16201 0 : self->seed = *alloc_mem;
16202 0 : fd_bincode_bytes_decode_unsafe( self->seed, self->seed_len, ctx );
16203 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->seed_len;
16204 0 : } else
16205 0 : self->seed = NULL;
16206 0 : fd_pubkey_decode_inner( &self->owner, alloc_mem, ctx );
16207 0 : }
16208 0 : void * fd_system_program_instruction_assign_with_seed_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
16209 0 : fd_system_program_instruction_assign_with_seed_global_t * self = (fd_system_program_instruction_assign_with_seed_global_t *)mem;
16210 0 : fd_system_program_instruction_assign_with_seed_new( (fd_system_program_instruction_assign_with_seed_t *)self );
16211 0 : void * alloc_region = (uchar *)mem + sizeof(fd_system_program_instruction_assign_with_seed_global_t);
16212 0 : void * * alloc_mem = &alloc_region;
16213 0 : fd_system_program_instruction_assign_with_seed_decode_inner_global( mem, alloc_mem, ctx );
16214 0 : return self;
16215 0 : }
16216 0 : void fd_system_program_instruction_assign_with_seed_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
16217 0 : fd_system_program_instruction_assign_with_seed_global_t * self = (fd_system_program_instruction_assign_with_seed_global_t *)struct_mem;
16218 0 : fd_pubkey_decode_inner_global( &self->base, alloc_mem, ctx );
16219 0 : fd_bincode_uint64_decode_unsafe( &self->seed_len, ctx );
16220 0 : if( self->seed_len ) {
16221 0 : self->seed_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
16222 0 : fd_bincode_bytes_decode_unsafe( *alloc_mem, self->seed_len, ctx );
16223 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->seed_len;
16224 0 : } else
16225 0 : self->seed_gaddr = 0UL;
16226 0 : fd_pubkey_decode_inner_global( &self->owner, alloc_mem, ctx );
16227 0 : }
16228 0 : int fd_system_program_instruction_assign_with_seed_convert_global_to_local( void const * global_self, fd_system_program_instruction_assign_with_seed_t * self, fd_bincode_decode_ctx_t * ctx ) {
16229 0 : int err = 0;
16230 0 : fd_system_program_instruction_assign_with_seed_global_t const * mem = (fd_system_program_instruction_assign_with_seed_global_t const *)global_self;
16231 0 : err = fd_pubkey_convert_global_to_local( &mem->base, &self->base, ctx );
16232 0 : if( FD_UNLIKELY( err ) ) return err;
16233 0 : self->seed_len = mem->seed_len;
16234 0 : self->seed = fd_wksp_laddr_fast( ctx->wksp, mem->seed_gaddr );
16235 0 : err = fd_pubkey_convert_global_to_local( &mem->owner, &self->owner, ctx );
16236 0 : if( FD_UNLIKELY( err ) ) return err;
16237 0 : return FD_BINCODE_SUCCESS;
16238 0 : }
16239 0 : void fd_system_program_instruction_assign_with_seed_new(fd_system_program_instruction_assign_with_seed_t * self) {
16240 0 : fd_memset( self, 0, sizeof(fd_system_program_instruction_assign_with_seed_t) );
16241 0 : fd_pubkey_new( &self->base );
16242 0 : fd_pubkey_new( &self->owner );
16243 0 : }
16244 0 : void fd_system_program_instruction_assign_with_seed_destroy( fd_system_program_instruction_assign_with_seed_t * self ) {
16245 0 : fd_pubkey_destroy( &self->base );
16246 0 : if( self->seed ) {
16247 0 : self->seed = NULL;
16248 0 : }
16249 0 : fd_pubkey_destroy( &self->owner );
16250 0 : }
16251 :
16252 0 : ulong fd_system_program_instruction_assign_with_seed_footprint( void ){ return FD_SYSTEM_PROGRAM_INSTRUCTION_ASSIGN_WITH_SEED_FOOTPRINT; }
16253 0 : ulong fd_system_program_instruction_assign_with_seed_align( void ){ return FD_SYSTEM_PROGRAM_INSTRUCTION_ASSIGN_WITH_SEED_ALIGN; }
16254 :
16255 0 : void fd_system_program_instruction_assign_with_seed_walk( void * w, fd_system_program_instruction_assign_with_seed_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
16256 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_system_program_instruction_assign_with_seed", level++ );
16257 0 : fd_pubkey_walk( w, &self->base, fun, "base", level );
16258 0 : fun(w, self->seed, "seed", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
16259 0 : fd_pubkey_walk( w, &self->owner, fun, "owner", level );
16260 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_system_program_instruction_assign_with_seed", level-- );
16261 0 : }
16262 0 : ulong fd_system_program_instruction_assign_with_seed_size( fd_system_program_instruction_assign_with_seed_t const * self ) {
16263 0 : ulong size = 0;
16264 0 : size += fd_pubkey_size( &self->base );
16265 0 : do {
16266 0 : size += sizeof(ulong);
16267 0 : size += self->seed_len;
16268 0 : } while(0);
16269 0 : size += fd_pubkey_size( &self->owner );
16270 0 : return size;
16271 0 : }
16272 :
16273 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 ) {
16274 0 : int err;
16275 0 : err = fd_bincode_uint64_encode( self->lamports, ctx );
16276 0 : if( FD_UNLIKELY( err ) ) return err;
16277 0 : err = fd_bincode_uint64_encode( self->from_seed_len, ctx );
16278 0 : if( FD_UNLIKELY(err) ) return err;
16279 0 : if( self->from_seed_len ) {
16280 0 : err = fd_bincode_bytes_encode( self->from_seed, self->from_seed_len, ctx );
16281 0 : if( FD_UNLIKELY( err ) ) return err;
16282 0 : }
16283 0 : err = fd_pubkey_encode( &self->from_owner, ctx );
16284 0 : if( FD_UNLIKELY( err ) ) return err;
16285 0 : return FD_BINCODE_SUCCESS;
16286 0 : }
16287 0 : int fd_system_program_instruction_transfer_with_seed_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
16288 0 : *total_sz += sizeof(fd_system_program_instruction_transfer_with_seed_t);
16289 0 : void const * start_data = ctx->data;
16290 0 : int err = fd_system_program_instruction_transfer_with_seed_decode_footprint_inner( ctx, total_sz );
16291 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
16292 0 : ctx->data = start_data;
16293 0 : return err;
16294 0 : }
16295 0 : int fd_system_program_instruction_transfer_with_seed_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
16296 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
16297 0 : int err = 0;
16298 0 : err = fd_bincode_uint64_decode_footprint( ctx );
16299 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
16300 0 : ulong from_seed_len;
16301 0 : err = fd_bincode_uint64_decode( &from_seed_len, ctx );
16302 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
16303 0 : *total_sz += from_seed_len;
16304 0 : if( from_seed_len ) {
16305 0 : err = fd_bincode_bytes_decode_footprint( from_seed_len, ctx );
16306 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
16307 0 : err = !fd_utf8_verify( (char const *) ctx->data - from_seed_len, from_seed_len );
16308 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
16309 0 : }
16310 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
16311 0 : if( FD_UNLIKELY( err ) ) return err;
16312 0 : return 0;
16313 0 : }
16314 0 : void * fd_system_program_instruction_transfer_with_seed_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
16315 0 : fd_system_program_instruction_transfer_with_seed_t * self = (fd_system_program_instruction_transfer_with_seed_t *)mem;
16316 0 : fd_system_program_instruction_transfer_with_seed_new( self );
16317 0 : void * alloc_region = (uchar *)mem + sizeof(fd_system_program_instruction_transfer_with_seed_t);
16318 0 : void * * alloc_mem = &alloc_region;
16319 0 : fd_system_program_instruction_transfer_with_seed_decode_inner( mem, alloc_mem, ctx );
16320 0 : return self;
16321 0 : }
16322 0 : void fd_system_program_instruction_transfer_with_seed_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
16323 0 : fd_system_program_instruction_transfer_with_seed_t * self = (fd_system_program_instruction_transfer_with_seed_t *)struct_mem;
16324 0 : fd_bincode_uint64_decode_unsafe( &self->lamports, ctx );
16325 0 : fd_bincode_uint64_decode_unsafe( &self->from_seed_len, ctx );
16326 0 : if( self->from_seed_len ) {
16327 0 : self->from_seed = *alloc_mem;
16328 0 : fd_bincode_bytes_decode_unsafe( self->from_seed, self->from_seed_len, ctx );
16329 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->from_seed_len;
16330 0 : } else
16331 0 : self->from_seed = NULL;
16332 0 : fd_pubkey_decode_inner( &self->from_owner, alloc_mem, ctx );
16333 0 : }
16334 0 : void * fd_system_program_instruction_transfer_with_seed_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
16335 0 : fd_system_program_instruction_transfer_with_seed_global_t * self = (fd_system_program_instruction_transfer_with_seed_global_t *)mem;
16336 0 : fd_system_program_instruction_transfer_with_seed_new( (fd_system_program_instruction_transfer_with_seed_t *)self );
16337 0 : void * alloc_region = (uchar *)mem + sizeof(fd_system_program_instruction_transfer_with_seed_global_t);
16338 0 : void * * alloc_mem = &alloc_region;
16339 0 : fd_system_program_instruction_transfer_with_seed_decode_inner_global( mem, alloc_mem, ctx );
16340 0 : return self;
16341 0 : }
16342 0 : void fd_system_program_instruction_transfer_with_seed_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
16343 0 : fd_system_program_instruction_transfer_with_seed_global_t * self = (fd_system_program_instruction_transfer_with_seed_global_t *)struct_mem;
16344 0 : fd_bincode_uint64_decode_unsafe( &self->lamports, ctx );
16345 0 : fd_bincode_uint64_decode_unsafe( &self->from_seed_len, ctx );
16346 0 : if( self->from_seed_len ) {
16347 0 : self->from_seed_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
16348 0 : fd_bincode_bytes_decode_unsafe( *alloc_mem, self->from_seed_len, ctx );
16349 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->from_seed_len;
16350 0 : } else
16351 0 : self->from_seed_gaddr = 0UL;
16352 0 : fd_pubkey_decode_inner_global( &self->from_owner, alloc_mem, ctx );
16353 0 : }
16354 0 : int fd_system_program_instruction_transfer_with_seed_convert_global_to_local( void const * global_self, fd_system_program_instruction_transfer_with_seed_t * self, fd_bincode_decode_ctx_t * ctx ) {
16355 0 : int err = 0;
16356 0 : fd_system_program_instruction_transfer_with_seed_global_t const * mem = (fd_system_program_instruction_transfer_with_seed_global_t const *)global_self;
16357 0 : self->lamports = mem->lamports;
16358 0 : self->from_seed_len = mem->from_seed_len;
16359 0 : self->from_seed = fd_wksp_laddr_fast( ctx->wksp, mem->from_seed_gaddr );
16360 0 : err = fd_pubkey_convert_global_to_local( &mem->from_owner, &self->from_owner, ctx );
16361 0 : if( FD_UNLIKELY( err ) ) return err;
16362 0 : return FD_BINCODE_SUCCESS;
16363 0 : }
16364 0 : void fd_system_program_instruction_transfer_with_seed_new(fd_system_program_instruction_transfer_with_seed_t * self) {
16365 0 : fd_memset( self, 0, sizeof(fd_system_program_instruction_transfer_with_seed_t) );
16366 0 : fd_pubkey_new( &self->from_owner );
16367 0 : }
16368 0 : void fd_system_program_instruction_transfer_with_seed_destroy( fd_system_program_instruction_transfer_with_seed_t * self ) {
16369 0 : if( self->from_seed ) {
16370 0 : self->from_seed = NULL;
16371 0 : }
16372 0 : fd_pubkey_destroy( &self->from_owner );
16373 0 : }
16374 :
16375 0 : ulong fd_system_program_instruction_transfer_with_seed_footprint( void ){ return FD_SYSTEM_PROGRAM_INSTRUCTION_TRANSFER_WITH_SEED_FOOTPRINT; }
16376 0 : ulong fd_system_program_instruction_transfer_with_seed_align( void ){ return FD_SYSTEM_PROGRAM_INSTRUCTION_TRANSFER_WITH_SEED_ALIGN; }
16377 :
16378 0 : void fd_system_program_instruction_transfer_with_seed_walk( void * w, fd_system_program_instruction_transfer_with_seed_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
16379 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_system_program_instruction_transfer_with_seed", level++ );
16380 0 : fun( w, &self->lamports, "lamports", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
16381 0 : fun(w, self->from_seed, "from_seed", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
16382 0 : fd_pubkey_walk( w, &self->from_owner, fun, "from_owner", level );
16383 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_system_program_instruction_transfer_with_seed", level-- );
16384 0 : }
16385 0 : ulong fd_system_program_instruction_transfer_with_seed_size( fd_system_program_instruction_transfer_with_seed_t const * self ) {
16386 0 : ulong size = 0;
16387 0 : size += sizeof(ulong);
16388 0 : do {
16389 0 : size += sizeof(ulong);
16390 0 : size += self->from_seed_len;
16391 0 : } while(0);
16392 0 : size += fd_pubkey_size( &self->from_owner );
16393 0 : return size;
16394 0 : }
16395 :
16396 0 : FD_FN_PURE uchar fd_system_program_instruction_is_create_account(fd_system_program_instruction_t const * self) {
16397 0 : return self->discriminant == 0;
16398 0 : }
16399 0 : FD_FN_PURE uchar fd_system_program_instruction_is_assign(fd_system_program_instruction_t const * self) {
16400 0 : return self->discriminant == 1;
16401 0 : }
16402 0 : FD_FN_PURE uchar fd_system_program_instruction_is_transfer(fd_system_program_instruction_t const * self) {
16403 0 : return self->discriminant == 2;
16404 0 : }
16405 0 : FD_FN_PURE uchar fd_system_program_instruction_is_create_account_with_seed(fd_system_program_instruction_t const * self) {
16406 0 : return self->discriminant == 3;
16407 0 : }
16408 0 : FD_FN_PURE uchar fd_system_program_instruction_is_advance_nonce_account(fd_system_program_instruction_t const * self) {
16409 0 : return self->discriminant == 4;
16410 0 : }
16411 0 : FD_FN_PURE uchar fd_system_program_instruction_is_withdraw_nonce_account(fd_system_program_instruction_t const * self) {
16412 0 : return self->discriminant == 5;
16413 0 : }
16414 0 : FD_FN_PURE uchar fd_system_program_instruction_is_initialize_nonce_account(fd_system_program_instruction_t const * self) {
16415 0 : return self->discriminant == 6;
16416 0 : }
16417 0 : FD_FN_PURE uchar fd_system_program_instruction_is_authorize_nonce_account(fd_system_program_instruction_t const * self) {
16418 0 : return self->discriminant == 7;
16419 0 : }
16420 0 : FD_FN_PURE uchar fd_system_program_instruction_is_allocate(fd_system_program_instruction_t const * self) {
16421 0 : return self->discriminant == 8;
16422 0 : }
16423 0 : FD_FN_PURE uchar fd_system_program_instruction_is_allocate_with_seed(fd_system_program_instruction_t const * self) {
16424 0 : return self->discriminant == 9;
16425 0 : }
16426 0 : FD_FN_PURE uchar fd_system_program_instruction_is_assign_with_seed(fd_system_program_instruction_t const * self) {
16427 0 : return self->discriminant == 10;
16428 0 : }
16429 0 : FD_FN_PURE uchar fd_system_program_instruction_is_transfer_with_seed(fd_system_program_instruction_t const * self) {
16430 0 : return self->discriminant == 11;
16431 0 : }
16432 0 : FD_FN_PURE uchar fd_system_program_instruction_is_upgrade_nonce_account(fd_system_program_instruction_t const * self) {
16433 0 : return self->discriminant == 12;
16434 0 : }
16435 : void fd_system_program_instruction_inner_new( fd_system_program_instruction_inner_t * self, uint discriminant );
16436 0 : int fd_system_program_instruction_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
16437 0 : int err;
16438 0 : switch (discriminant) {
16439 0 : case 0: {
16440 0 : err = fd_system_program_instruction_create_account_decode_footprint_inner( ctx, total_sz );
16441 0 : if( FD_UNLIKELY( err ) ) return err;
16442 0 : return FD_BINCODE_SUCCESS;
16443 0 : }
16444 0 : case 1: {
16445 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
16446 0 : if( FD_UNLIKELY( err ) ) return err;
16447 0 : return FD_BINCODE_SUCCESS;
16448 0 : }
16449 0 : case 2: {
16450 0 : err = fd_bincode_uint64_decode_footprint( ctx );
16451 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
16452 0 : return FD_BINCODE_SUCCESS;
16453 0 : }
16454 0 : case 3: {
16455 0 : err = fd_system_program_instruction_create_account_with_seed_decode_footprint_inner( ctx, total_sz );
16456 0 : if( FD_UNLIKELY( err ) ) return err;
16457 0 : return FD_BINCODE_SUCCESS;
16458 0 : }
16459 0 : case 4: {
16460 0 : return FD_BINCODE_SUCCESS;
16461 0 : }
16462 0 : case 5: {
16463 0 : err = fd_bincode_uint64_decode_footprint( ctx );
16464 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
16465 0 : return FD_BINCODE_SUCCESS;
16466 0 : }
16467 0 : case 6: {
16468 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
16469 0 : if( FD_UNLIKELY( err ) ) return err;
16470 0 : return FD_BINCODE_SUCCESS;
16471 0 : }
16472 0 : case 7: {
16473 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
16474 0 : if( FD_UNLIKELY( err ) ) return err;
16475 0 : return FD_BINCODE_SUCCESS;
16476 0 : }
16477 0 : case 8: {
16478 0 : err = fd_bincode_uint64_decode_footprint( ctx );
16479 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
16480 0 : return FD_BINCODE_SUCCESS;
16481 0 : }
16482 0 : case 9: {
16483 0 : err = fd_system_program_instruction_allocate_with_seed_decode_footprint_inner( ctx, total_sz );
16484 0 : if( FD_UNLIKELY( err ) ) return err;
16485 0 : return FD_BINCODE_SUCCESS;
16486 0 : }
16487 0 : case 10: {
16488 0 : err = fd_system_program_instruction_assign_with_seed_decode_footprint_inner( ctx, total_sz );
16489 0 : if( FD_UNLIKELY( err ) ) return err;
16490 0 : return FD_BINCODE_SUCCESS;
16491 0 : }
16492 0 : case 11: {
16493 0 : err = fd_system_program_instruction_transfer_with_seed_decode_footprint_inner( ctx, total_sz );
16494 0 : if( FD_UNLIKELY( err ) ) return err;
16495 0 : return FD_BINCODE_SUCCESS;
16496 0 : }
16497 0 : case 12: {
16498 0 : return FD_BINCODE_SUCCESS;
16499 0 : }
16500 0 : default: return FD_BINCODE_ERR_ENCODING;
16501 0 : }
16502 0 : }
16503 0 : int fd_system_program_instruction_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
16504 0 : *total_sz += sizeof(fd_system_program_instruction_t);
16505 0 : void const * start_data = ctx->data;
16506 0 : int err = fd_system_program_instruction_decode_footprint_inner( ctx, total_sz );
16507 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
16508 0 : ctx->data = start_data;
16509 0 : return err;
16510 0 : }
16511 0 : int fd_system_program_instruction_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
16512 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
16513 0 : uint discriminant = 0;
16514 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
16515 0 : if( FD_UNLIKELY( err ) ) return err;
16516 0 : return fd_system_program_instruction_inner_decode_footprint( discriminant, ctx, total_sz );
16517 0 : }
16518 0 : 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 ) {
16519 0 : switch (discriminant) {
16520 0 : case 0: {
16521 0 : fd_system_program_instruction_create_account_decode_inner( &self->create_account, alloc_mem, ctx );
16522 0 : break;
16523 0 : }
16524 0 : case 1: {
16525 0 : fd_pubkey_decode_inner( &self->assign, alloc_mem, ctx );
16526 0 : break;
16527 0 : }
16528 0 : case 2: {
16529 0 : fd_bincode_uint64_decode_unsafe( &self->transfer, ctx );
16530 0 : break;
16531 0 : }
16532 0 : case 3: {
16533 0 : fd_system_program_instruction_create_account_with_seed_decode_inner( &self->create_account_with_seed, alloc_mem, ctx );
16534 0 : break;
16535 0 : }
16536 0 : case 4: {
16537 0 : break;
16538 0 : }
16539 0 : case 5: {
16540 0 : fd_bincode_uint64_decode_unsafe( &self->withdraw_nonce_account, ctx );
16541 0 : break;
16542 0 : }
16543 0 : case 6: {
16544 0 : fd_pubkey_decode_inner( &self->initialize_nonce_account, alloc_mem, ctx );
16545 0 : break;
16546 0 : }
16547 0 : case 7: {
16548 0 : fd_pubkey_decode_inner( &self->authorize_nonce_account, alloc_mem, ctx );
16549 0 : break;
16550 0 : }
16551 0 : case 8: {
16552 0 : fd_bincode_uint64_decode_unsafe( &self->allocate, ctx );
16553 0 : break;
16554 0 : }
16555 0 : case 9: {
16556 0 : fd_system_program_instruction_allocate_with_seed_decode_inner( &self->allocate_with_seed, alloc_mem, ctx );
16557 0 : break;
16558 0 : }
16559 0 : case 10: {
16560 0 : fd_system_program_instruction_assign_with_seed_decode_inner( &self->assign_with_seed, alloc_mem, ctx );
16561 0 : break;
16562 0 : }
16563 0 : case 11: {
16564 0 : fd_system_program_instruction_transfer_with_seed_decode_inner( &self->transfer_with_seed, alloc_mem, ctx );
16565 0 : break;
16566 0 : }
16567 0 : case 12: {
16568 0 : break;
16569 0 : }
16570 0 : }
16571 0 : }
16572 0 : void fd_system_program_instruction_inner_decode_inner_global( fd_system_program_instruction_inner_global_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
16573 0 : switch (discriminant) {
16574 0 : case 0: {
16575 0 : fd_system_program_instruction_create_account_decode_inner_global( &self->create_account, alloc_mem, ctx );
16576 0 : break;
16577 0 : }
16578 0 : case 1: {
16579 0 : fd_pubkey_decode_inner_global( &self->assign, alloc_mem, ctx );
16580 0 : break;
16581 0 : }
16582 0 : case 2: {
16583 0 : fd_bincode_uint64_decode_unsafe( &self->transfer, ctx );
16584 0 : break;
16585 0 : }
16586 0 : case 3: {
16587 0 : fd_system_program_instruction_create_account_with_seed_decode_inner_global( &self->create_account_with_seed, alloc_mem, ctx );
16588 0 : break;
16589 0 : }
16590 0 : case 4: {
16591 0 : break;
16592 0 : }
16593 0 : case 5: {
16594 0 : fd_bincode_uint64_decode_unsafe( &self->withdraw_nonce_account, ctx );
16595 0 : break;
16596 0 : }
16597 0 : case 6: {
16598 0 : fd_pubkey_decode_inner_global( &self->initialize_nonce_account, alloc_mem, ctx );
16599 0 : break;
16600 0 : }
16601 0 : case 7: {
16602 0 : fd_pubkey_decode_inner_global( &self->authorize_nonce_account, alloc_mem, ctx );
16603 0 : break;
16604 0 : }
16605 0 : case 8: {
16606 0 : fd_bincode_uint64_decode_unsafe( &self->allocate, ctx );
16607 0 : break;
16608 0 : }
16609 0 : case 9: {
16610 0 : fd_system_program_instruction_allocate_with_seed_decode_inner_global( &self->allocate_with_seed, alloc_mem, ctx );
16611 0 : break;
16612 0 : }
16613 0 : case 10: {
16614 0 : fd_system_program_instruction_assign_with_seed_decode_inner_global( &self->assign_with_seed, alloc_mem, ctx );
16615 0 : break;
16616 0 : }
16617 0 : case 11: {
16618 0 : fd_system_program_instruction_transfer_with_seed_decode_inner_global( &self->transfer_with_seed, alloc_mem, ctx );
16619 0 : break;
16620 0 : }
16621 0 : case 12: {
16622 0 : break;
16623 0 : }
16624 0 : }
16625 0 : }
16626 0 : int fd_system_program_instruction_convert_global_to_local_inner( fd_system_program_instruction_inner_global_t const * mem, fd_system_program_instruction_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
16627 0 : int err = 0;
16628 0 : switch( discriminant ) {
16629 0 : case 0: {
16630 0 : err = fd_system_program_instruction_create_account_convert_global_to_local( &mem->create_account, &self->create_account, ctx );
16631 0 : if( FD_UNLIKELY( err ) ) return err;
16632 0 : break;
16633 0 : }
16634 0 : case 1: {
16635 0 : err = fd_pubkey_convert_global_to_local( &mem->assign, &self->assign, ctx );
16636 0 : if( FD_UNLIKELY( err ) ) return err;
16637 0 : break;
16638 0 : }
16639 0 : case 2: {
16640 0 : self->transfer = mem->transfer;
16641 0 : break;
16642 0 : }
16643 0 : case 3: {
16644 0 : err = fd_system_program_instruction_create_account_with_seed_convert_global_to_local( &mem->create_account_with_seed, &self->create_account_with_seed, ctx );
16645 0 : if( FD_UNLIKELY( err ) ) return err;
16646 0 : break;
16647 0 : }
16648 0 : case 4: {
16649 0 : break;
16650 0 : }
16651 0 : case 5: {
16652 0 : self->withdraw_nonce_account = mem->withdraw_nonce_account;
16653 0 : break;
16654 0 : }
16655 0 : case 6: {
16656 0 : err = fd_pubkey_convert_global_to_local( &mem->initialize_nonce_account, &self->initialize_nonce_account, ctx );
16657 0 : if( FD_UNLIKELY( err ) ) return err;
16658 0 : break;
16659 0 : }
16660 0 : case 7: {
16661 0 : err = fd_pubkey_convert_global_to_local( &mem->authorize_nonce_account, &self->authorize_nonce_account, ctx );
16662 0 : if( FD_UNLIKELY( err ) ) return err;
16663 0 : break;
16664 0 : }
16665 0 : case 8: {
16666 0 : self->allocate = mem->allocate;
16667 0 : break;
16668 0 : }
16669 0 : case 9: {
16670 0 : err = fd_system_program_instruction_allocate_with_seed_convert_global_to_local( &mem->allocate_with_seed, &self->allocate_with_seed, ctx );
16671 0 : if( FD_UNLIKELY( err ) ) return err;
16672 0 : break;
16673 0 : }
16674 0 : case 10: {
16675 0 : err = fd_system_program_instruction_assign_with_seed_convert_global_to_local( &mem->assign_with_seed, &self->assign_with_seed, ctx );
16676 0 : if( FD_UNLIKELY( err ) ) return err;
16677 0 : break;
16678 0 : }
16679 0 : case 11: {
16680 0 : err = fd_system_program_instruction_transfer_with_seed_convert_global_to_local( &mem->transfer_with_seed, &self->transfer_with_seed, ctx );
16681 0 : if( FD_UNLIKELY( err ) ) return err;
16682 0 : break;
16683 0 : }
16684 0 : case 12: {
16685 0 : break;
16686 0 : }
16687 0 : }
16688 0 : return FD_BINCODE_SUCCESS;
16689 0 : }
16690 0 : int fd_system_program_instruction_convert_global_to_local( void const * global_self, fd_system_program_instruction_t * self, fd_bincode_decode_ctx_t * ctx ) {
16691 0 : fd_system_program_instruction_global_t const * mem = (fd_system_program_instruction_global_t const *)global_self;
16692 0 : uint discriminant = mem->discriminant;
16693 0 : self->discriminant = mem->discriminant;
16694 0 : int err = fd_system_program_instruction_convert_global_to_local_inner( &mem->inner, &self->inner, discriminant, ctx );
16695 0 : return FD_BINCODE_SUCCESS;
16696 0 : }
16697 0 : void fd_system_program_instruction_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
16698 0 : fd_system_program_instruction_t * self = (fd_system_program_instruction_t *)struct_mem;
16699 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
16700 0 : fd_system_program_instruction_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
16701 0 : }
16702 0 : void * fd_system_program_instruction_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
16703 0 : fd_system_program_instruction_t * self = (fd_system_program_instruction_t *)mem;
16704 0 : fd_system_program_instruction_new( self );
16705 0 : void * alloc_region = (uchar *)mem + sizeof(fd_system_program_instruction_t);
16706 0 : void * * alloc_mem = &alloc_region;
16707 0 : fd_system_program_instruction_decode_inner( mem, alloc_mem, ctx );
16708 0 : return self;
16709 0 : }
16710 0 : void * fd_system_program_instruction_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
16711 0 : fd_system_program_instruction_t * self = (fd_system_program_instruction_t *)mem;
16712 0 : fd_system_program_instruction_new( self );
16713 0 : void * alloc_region = (uchar *)mem + sizeof(fd_system_program_instruction_t);
16714 0 : void * * alloc_mem = &alloc_region;
16715 0 : fd_system_program_instruction_decode_inner_global( mem, alloc_mem, ctx );
16716 0 : return self;
16717 0 : }
16718 0 : void fd_system_program_instruction_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
16719 0 : fd_system_program_instruction_global_t * self = (fd_system_program_instruction_global_t *)struct_mem;
16720 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
16721 0 : fd_system_program_instruction_inner_decode_inner_global( &self->inner, alloc_mem, self->discriminant, ctx );
16722 0 : }
16723 0 : void fd_system_program_instruction_inner_new( fd_system_program_instruction_inner_t * self, uint discriminant ) {
16724 0 : switch( discriminant ) {
16725 0 : case 0: {
16726 0 : fd_system_program_instruction_create_account_new( &self->create_account );
16727 0 : break;
16728 0 : }
16729 0 : case 1: {
16730 0 : fd_pubkey_new( &self->assign );
16731 0 : break;
16732 0 : }
16733 0 : case 2: {
16734 0 : break;
16735 0 : }
16736 0 : case 3: {
16737 0 : fd_system_program_instruction_create_account_with_seed_new( &self->create_account_with_seed );
16738 0 : break;
16739 0 : }
16740 0 : case 4: {
16741 0 : break;
16742 0 : }
16743 0 : case 5: {
16744 0 : break;
16745 0 : }
16746 0 : case 6: {
16747 0 : fd_pubkey_new( &self->initialize_nonce_account );
16748 0 : break;
16749 0 : }
16750 0 : case 7: {
16751 0 : fd_pubkey_new( &self->authorize_nonce_account );
16752 0 : break;
16753 0 : }
16754 0 : case 8: {
16755 0 : break;
16756 0 : }
16757 0 : case 9: {
16758 0 : fd_system_program_instruction_allocate_with_seed_new( &self->allocate_with_seed );
16759 0 : break;
16760 0 : }
16761 0 : case 10: {
16762 0 : fd_system_program_instruction_assign_with_seed_new( &self->assign_with_seed );
16763 0 : break;
16764 0 : }
16765 0 : case 11: {
16766 0 : fd_system_program_instruction_transfer_with_seed_new( &self->transfer_with_seed );
16767 0 : break;
16768 0 : }
16769 0 : case 12: {
16770 0 : break;
16771 0 : }
16772 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
16773 0 : }
16774 0 : }
16775 0 : void fd_system_program_instruction_new_disc( fd_system_program_instruction_t * self, uint discriminant ) {
16776 0 : self->discriminant = discriminant;
16777 0 : fd_system_program_instruction_inner_new( &self->inner, self->discriminant );
16778 0 : }
16779 0 : void fd_system_program_instruction_new( fd_system_program_instruction_t * self ) {
16780 0 : fd_memset( self, 0, sizeof(fd_system_program_instruction_t) );
16781 0 : fd_system_program_instruction_new_disc( self, UINT_MAX );
16782 0 : }
16783 0 : void fd_system_program_instruction_inner_destroy( fd_system_program_instruction_inner_t * self, uint discriminant ) {
16784 0 : switch( discriminant ) {
16785 0 : case 0: {
16786 0 : fd_system_program_instruction_create_account_destroy( &self->create_account );
16787 0 : break;
16788 0 : }
16789 0 : case 1: {
16790 0 : fd_pubkey_destroy( &self->assign );
16791 0 : break;
16792 0 : }
16793 0 : case 2: {
16794 0 : break;
16795 0 : }
16796 0 : case 3: {
16797 0 : fd_system_program_instruction_create_account_with_seed_destroy( &self->create_account_with_seed );
16798 0 : break;
16799 0 : }
16800 0 : case 5: {
16801 0 : break;
16802 0 : }
16803 0 : case 6: {
16804 0 : fd_pubkey_destroy( &self->initialize_nonce_account );
16805 0 : break;
16806 0 : }
16807 0 : case 7: {
16808 0 : fd_pubkey_destroy( &self->authorize_nonce_account );
16809 0 : break;
16810 0 : }
16811 0 : case 8: {
16812 0 : break;
16813 0 : }
16814 0 : case 9: {
16815 0 : fd_system_program_instruction_allocate_with_seed_destroy( &self->allocate_with_seed );
16816 0 : break;
16817 0 : }
16818 0 : case 10: {
16819 0 : fd_system_program_instruction_assign_with_seed_destroy( &self->assign_with_seed );
16820 0 : break;
16821 0 : }
16822 0 : case 11: {
16823 0 : fd_system_program_instruction_transfer_with_seed_destroy( &self->transfer_with_seed );
16824 0 : break;
16825 0 : }
16826 0 : default: break; // FD_LOG_ERR(( "unhandled type" ));
16827 0 : }
16828 0 : }
16829 0 : void fd_system_program_instruction_destroy( fd_system_program_instruction_t * self ) {
16830 0 : fd_system_program_instruction_inner_destroy( &self->inner, self->discriminant );
16831 0 : }
16832 :
16833 0 : ulong fd_system_program_instruction_footprint( void ){ return FD_SYSTEM_PROGRAM_INSTRUCTION_FOOTPRINT; }
16834 0 : ulong fd_system_program_instruction_align( void ){ return FD_SYSTEM_PROGRAM_INSTRUCTION_ALIGN; }
16835 :
16836 0 : void fd_system_program_instruction_walk( void * w, fd_system_program_instruction_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
16837 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_system_program_instruction", level++);
16838 0 : switch( self->discriminant ) {
16839 0 : case 0: {
16840 0 : fun( w, self, "create_account", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
16841 0 : fd_system_program_instruction_create_account_walk( w, &self->inner.create_account, fun, "create_account", level );
16842 0 : break;
16843 0 : }
16844 0 : case 1: {
16845 0 : fun( w, self, "assign", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
16846 0 : fd_pubkey_walk( w, &self->inner.assign, fun, "assign", level );
16847 0 : break;
16848 0 : }
16849 0 : case 2: {
16850 0 : fun( w, self, "transfer", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
16851 0 : fun( w, &self->inner.transfer, "transfer", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
16852 0 : break;
16853 0 : }
16854 0 : case 3: {
16855 0 : fun( w, self, "create_account_with_seed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
16856 0 : fd_system_program_instruction_create_account_with_seed_walk( w, &self->inner.create_account_with_seed, fun, "create_account_with_seed", level );
16857 0 : break;
16858 0 : }
16859 0 : case 4: {
16860 0 : fun( w, self, "advance_nonce_account", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
16861 0 : break;
16862 0 : }
16863 0 : case 5: {
16864 0 : fun( w, self, "withdraw_nonce_account", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
16865 0 : fun( w, &self->inner.withdraw_nonce_account, "withdraw_nonce_account", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
16866 0 : break;
16867 0 : }
16868 0 : case 6: {
16869 0 : fun( w, self, "initialize_nonce_account", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
16870 0 : fd_pubkey_walk( w, &self->inner.initialize_nonce_account, fun, "initialize_nonce_account", level );
16871 0 : break;
16872 0 : }
16873 0 : case 7: {
16874 0 : fun( w, self, "authorize_nonce_account", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
16875 0 : fd_pubkey_walk( w, &self->inner.authorize_nonce_account, fun, "authorize_nonce_account", level );
16876 0 : break;
16877 0 : }
16878 0 : case 8: {
16879 0 : fun( w, self, "allocate", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
16880 0 : fun( w, &self->inner.allocate, "allocate", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
16881 0 : break;
16882 0 : }
16883 0 : case 9: {
16884 0 : fun( w, self, "allocate_with_seed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
16885 0 : fd_system_program_instruction_allocate_with_seed_walk( w, &self->inner.allocate_with_seed, fun, "allocate_with_seed", level );
16886 0 : break;
16887 0 : }
16888 0 : case 10: {
16889 0 : fun( w, self, "assign_with_seed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
16890 0 : fd_system_program_instruction_assign_with_seed_walk( w, &self->inner.assign_with_seed, fun, "assign_with_seed", level );
16891 0 : break;
16892 0 : }
16893 0 : case 11: {
16894 0 : fun( w, self, "transfer_with_seed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
16895 0 : fd_system_program_instruction_transfer_with_seed_walk( w, &self->inner.transfer_with_seed, fun, "transfer_with_seed", level );
16896 0 : break;
16897 0 : }
16898 0 : case 12: {
16899 0 : fun( w, self, "upgrade_nonce_account", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
16900 0 : break;
16901 0 : }
16902 0 : }
16903 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_system_program_instruction", level-- );
16904 0 : }
16905 0 : ulong fd_system_program_instruction_size( fd_system_program_instruction_t const * self ) {
16906 0 : ulong size = 0;
16907 0 : size += sizeof(uint);
16908 0 : switch (self->discriminant) {
16909 0 : case 0: {
16910 0 : size += fd_system_program_instruction_create_account_size( &self->inner.create_account );
16911 0 : break;
16912 0 : }
16913 0 : case 1: {
16914 0 : size += fd_pubkey_size( &self->inner.assign );
16915 0 : break;
16916 0 : }
16917 0 : case 2: {
16918 0 : size += sizeof(ulong);
16919 0 : break;
16920 0 : }
16921 0 : case 3: {
16922 0 : size += fd_system_program_instruction_create_account_with_seed_size( &self->inner.create_account_with_seed );
16923 0 : break;
16924 0 : }
16925 0 : case 5: {
16926 0 : size += sizeof(ulong);
16927 0 : break;
16928 0 : }
16929 0 : case 6: {
16930 0 : size += fd_pubkey_size( &self->inner.initialize_nonce_account );
16931 0 : break;
16932 0 : }
16933 0 : case 7: {
16934 0 : size += fd_pubkey_size( &self->inner.authorize_nonce_account );
16935 0 : break;
16936 0 : }
16937 0 : case 8: {
16938 0 : size += sizeof(ulong);
16939 0 : break;
16940 0 : }
16941 0 : case 9: {
16942 0 : size += fd_system_program_instruction_allocate_with_seed_size( &self->inner.allocate_with_seed );
16943 0 : break;
16944 0 : }
16945 0 : case 10: {
16946 0 : size += fd_system_program_instruction_assign_with_seed_size( &self->inner.assign_with_seed );
16947 0 : break;
16948 0 : }
16949 0 : case 11: {
16950 0 : size += fd_system_program_instruction_transfer_with_seed_size( &self->inner.transfer_with_seed );
16951 0 : break;
16952 0 : }
16953 0 : }
16954 0 : return size;
16955 0 : }
16956 :
16957 0 : int fd_system_program_instruction_inner_encode( fd_system_program_instruction_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
16958 0 : int err;
16959 0 : switch (discriminant) {
16960 0 : case 0: {
16961 0 : err = fd_system_program_instruction_create_account_encode( &self->create_account, ctx );
16962 0 : if( FD_UNLIKELY( err ) ) return err;
16963 0 : break;
16964 0 : }
16965 0 : case 1: {
16966 0 : err = fd_pubkey_encode( &self->assign, ctx );
16967 0 : if( FD_UNLIKELY( err ) ) return err;
16968 0 : break;
16969 0 : }
16970 0 : case 2: {
16971 0 : err = fd_bincode_uint64_encode( self->transfer, ctx );
16972 0 : if( FD_UNLIKELY( err ) ) return err;
16973 0 : break;
16974 0 : }
16975 0 : case 3: {
16976 0 : err = fd_system_program_instruction_create_account_with_seed_encode( &self->create_account_with_seed, ctx );
16977 0 : if( FD_UNLIKELY( err ) ) return err;
16978 0 : break;
16979 0 : }
16980 0 : case 5: {
16981 0 : err = fd_bincode_uint64_encode( self->withdraw_nonce_account, ctx );
16982 0 : if( FD_UNLIKELY( err ) ) return err;
16983 0 : break;
16984 0 : }
16985 0 : case 6: {
16986 0 : err = fd_pubkey_encode( &self->initialize_nonce_account, ctx );
16987 0 : if( FD_UNLIKELY( err ) ) return err;
16988 0 : break;
16989 0 : }
16990 0 : case 7: {
16991 0 : err = fd_pubkey_encode( &self->authorize_nonce_account, ctx );
16992 0 : if( FD_UNLIKELY( err ) ) return err;
16993 0 : break;
16994 0 : }
16995 0 : case 8: {
16996 0 : err = fd_bincode_uint64_encode( self->allocate, ctx );
16997 0 : if( FD_UNLIKELY( err ) ) return err;
16998 0 : break;
16999 0 : }
17000 0 : case 9: {
17001 0 : err = fd_system_program_instruction_allocate_with_seed_encode( &self->allocate_with_seed, ctx );
17002 0 : if( FD_UNLIKELY( err ) ) return err;
17003 0 : break;
17004 0 : }
17005 0 : case 10: {
17006 0 : err = fd_system_program_instruction_assign_with_seed_encode( &self->assign_with_seed, ctx );
17007 0 : if( FD_UNLIKELY( err ) ) return err;
17008 0 : break;
17009 0 : }
17010 0 : case 11: {
17011 0 : err = fd_system_program_instruction_transfer_with_seed_encode( &self->transfer_with_seed, ctx );
17012 0 : if( FD_UNLIKELY( err ) ) return err;
17013 0 : break;
17014 0 : }
17015 0 : }
17016 0 : return FD_BINCODE_SUCCESS;
17017 0 : }
17018 0 : int fd_system_program_instruction_encode( fd_system_program_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
17019 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
17020 0 : if( FD_UNLIKELY( err ) ) return err;
17021 0 : return fd_system_program_instruction_inner_encode( &self->inner, self->discriminant, ctx );
17022 0 : }
17023 :
17024 0 : FD_FN_PURE uchar fd_system_error_is_account_already_in_use(fd_system_error_t const * self) {
17025 0 : return self->discriminant == 0;
17026 0 : }
17027 0 : FD_FN_PURE uchar fd_system_error_is_result_with_negative_lamports(fd_system_error_t const * self) {
17028 0 : return self->discriminant == 1;
17029 0 : }
17030 0 : FD_FN_PURE uchar fd_system_error_is_invalid_program_id(fd_system_error_t const * self) {
17031 0 : return self->discriminant == 2;
17032 0 : }
17033 0 : FD_FN_PURE uchar fd_system_error_is_invalid_account_data_length(fd_system_error_t const * self) {
17034 0 : return self->discriminant == 3;
17035 0 : }
17036 0 : FD_FN_PURE uchar fd_system_error_is_max_seed_length_exceeded(fd_system_error_t const * self) {
17037 0 : return self->discriminant == 4;
17038 0 : }
17039 0 : FD_FN_PURE uchar fd_system_error_is_address_with_seed_mismatch(fd_system_error_t const * self) {
17040 0 : return self->discriminant == 5;
17041 0 : }
17042 0 : FD_FN_PURE uchar fd_system_error_is_nonce_no_recent_blockhashes(fd_system_error_t const * self) {
17043 0 : return self->discriminant == 6;
17044 0 : }
17045 0 : FD_FN_PURE uchar fd_system_error_is_nonce_blockhash_not_expired(fd_system_error_t const * self) {
17046 0 : return self->discriminant == 7;
17047 0 : }
17048 0 : FD_FN_PURE uchar fd_system_error_is_nonce_unexpected_blockhash_value(fd_system_error_t const * self) {
17049 0 : return self->discriminant == 8;
17050 0 : }
17051 : void fd_system_error_inner_new( fd_system_error_inner_t * self, uint discriminant );
17052 0 : int fd_system_error_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
17053 0 : int err;
17054 0 : switch (discriminant) {
17055 0 : case 0: {
17056 0 : return FD_BINCODE_SUCCESS;
17057 0 : }
17058 0 : case 1: {
17059 0 : return FD_BINCODE_SUCCESS;
17060 0 : }
17061 0 : case 2: {
17062 0 : return FD_BINCODE_SUCCESS;
17063 0 : }
17064 0 : case 3: {
17065 0 : return FD_BINCODE_SUCCESS;
17066 0 : }
17067 0 : case 4: {
17068 0 : return FD_BINCODE_SUCCESS;
17069 0 : }
17070 0 : case 5: {
17071 0 : return FD_BINCODE_SUCCESS;
17072 0 : }
17073 0 : case 6: {
17074 0 : return FD_BINCODE_SUCCESS;
17075 0 : }
17076 0 : case 7: {
17077 0 : return FD_BINCODE_SUCCESS;
17078 0 : }
17079 0 : case 8: {
17080 0 : return FD_BINCODE_SUCCESS;
17081 0 : }
17082 0 : default: return FD_BINCODE_ERR_ENCODING;
17083 0 : }
17084 0 : }
17085 0 : int fd_system_error_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
17086 0 : *total_sz += sizeof(fd_system_error_t);
17087 0 : void const * start_data = ctx->data;
17088 0 : int err = fd_system_error_decode_footprint_inner( ctx, total_sz );
17089 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
17090 0 : ctx->data = start_data;
17091 0 : return err;
17092 0 : }
17093 0 : int fd_system_error_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
17094 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
17095 0 : uint discriminant = 0;
17096 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
17097 0 : if( FD_UNLIKELY( err ) ) return err;
17098 0 : return fd_system_error_inner_decode_footprint( discriminant, ctx, total_sz );
17099 0 : }
17100 0 : void fd_system_error_inner_decode_inner( fd_system_error_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
17101 0 : switch (discriminant) {
17102 0 : case 0: {
17103 0 : break;
17104 0 : }
17105 0 : case 1: {
17106 0 : break;
17107 0 : }
17108 0 : case 2: {
17109 0 : break;
17110 0 : }
17111 0 : case 3: {
17112 0 : break;
17113 0 : }
17114 0 : case 4: {
17115 0 : break;
17116 0 : }
17117 0 : case 5: {
17118 0 : break;
17119 0 : }
17120 0 : case 6: {
17121 0 : break;
17122 0 : }
17123 0 : case 7: {
17124 0 : break;
17125 0 : }
17126 0 : case 8: {
17127 0 : break;
17128 0 : }
17129 0 : }
17130 0 : }
17131 0 : void fd_system_error_inner_decode_inner_global( fd_system_error_inner_global_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
17132 0 : switch (discriminant) {
17133 0 : case 0: {
17134 0 : break;
17135 0 : }
17136 0 : case 1: {
17137 0 : break;
17138 0 : }
17139 0 : case 2: {
17140 0 : break;
17141 0 : }
17142 0 : case 3: {
17143 0 : break;
17144 0 : }
17145 0 : case 4: {
17146 0 : break;
17147 0 : }
17148 0 : case 5: {
17149 0 : break;
17150 0 : }
17151 0 : case 6: {
17152 0 : break;
17153 0 : }
17154 0 : case 7: {
17155 0 : break;
17156 0 : }
17157 0 : case 8: {
17158 0 : break;
17159 0 : }
17160 0 : }
17161 0 : }
17162 0 : int fd_system_error_convert_global_to_local_inner( fd_system_error_inner_global_t const * mem, fd_system_error_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
17163 0 : int err = 0;
17164 0 : switch( discriminant ) {
17165 0 : case 0: {
17166 0 : break;
17167 0 : }
17168 0 : case 1: {
17169 0 : break;
17170 0 : }
17171 0 : case 2: {
17172 0 : break;
17173 0 : }
17174 0 : case 3: {
17175 0 : break;
17176 0 : }
17177 0 : case 4: {
17178 0 : break;
17179 0 : }
17180 0 : case 5: {
17181 0 : break;
17182 0 : }
17183 0 : case 6: {
17184 0 : break;
17185 0 : }
17186 0 : case 7: {
17187 0 : break;
17188 0 : }
17189 0 : case 8: {
17190 0 : break;
17191 0 : }
17192 0 : }
17193 0 : return FD_BINCODE_SUCCESS;
17194 0 : }
17195 0 : int fd_system_error_convert_global_to_local( void const * global_self, fd_system_error_t * self, fd_bincode_decode_ctx_t * ctx ) {
17196 0 : fd_system_error_global_t const * mem = (fd_system_error_global_t const *)global_self;
17197 0 : uint discriminant = mem->discriminant;
17198 0 : self->discriminant = mem->discriminant;
17199 0 : int err = fd_system_error_convert_global_to_local_inner( &mem->inner, &self->inner, discriminant, ctx );
17200 0 : return FD_BINCODE_SUCCESS;
17201 0 : }
17202 0 : void fd_system_error_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
17203 0 : fd_system_error_t * self = (fd_system_error_t *)struct_mem;
17204 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
17205 0 : fd_system_error_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
17206 0 : }
17207 0 : void * fd_system_error_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
17208 0 : fd_system_error_t * self = (fd_system_error_t *)mem;
17209 0 : fd_system_error_new( self );
17210 0 : void * alloc_region = (uchar *)mem + sizeof(fd_system_error_t);
17211 0 : void * * alloc_mem = &alloc_region;
17212 0 : fd_system_error_decode_inner( mem, alloc_mem, ctx );
17213 0 : return self;
17214 0 : }
17215 0 : void * fd_system_error_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
17216 0 : fd_system_error_t * self = (fd_system_error_t *)mem;
17217 0 : fd_system_error_new( self );
17218 0 : void * alloc_region = (uchar *)mem + sizeof(fd_system_error_t);
17219 0 : void * * alloc_mem = &alloc_region;
17220 0 : fd_system_error_decode_inner_global( mem, alloc_mem, ctx );
17221 0 : return self;
17222 0 : }
17223 0 : void fd_system_error_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
17224 0 : fd_system_error_global_t * self = (fd_system_error_global_t *)struct_mem;
17225 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
17226 0 : fd_system_error_inner_decode_inner_global( &self->inner, alloc_mem, self->discriminant, ctx );
17227 0 : }
17228 0 : void fd_system_error_inner_new( fd_system_error_inner_t * self, uint discriminant ) {
17229 0 : switch( discriminant ) {
17230 0 : case 0: {
17231 0 : break;
17232 0 : }
17233 0 : case 1: {
17234 0 : break;
17235 0 : }
17236 0 : case 2: {
17237 0 : break;
17238 0 : }
17239 0 : case 3: {
17240 0 : break;
17241 0 : }
17242 0 : case 4: {
17243 0 : break;
17244 0 : }
17245 0 : case 5: {
17246 0 : break;
17247 0 : }
17248 0 : case 6: {
17249 0 : break;
17250 0 : }
17251 0 : case 7: {
17252 0 : break;
17253 0 : }
17254 0 : case 8: {
17255 0 : break;
17256 0 : }
17257 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
17258 0 : }
17259 0 : }
17260 0 : void fd_system_error_new_disc( fd_system_error_t * self, uint discriminant ) {
17261 0 : self->discriminant = discriminant;
17262 0 : fd_system_error_inner_new( &self->inner, self->discriminant );
17263 0 : }
17264 0 : void fd_system_error_new( fd_system_error_t * self ) {
17265 0 : fd_memset( self, 0, sizeof(fd_system_error_t) );
17266 0 : fd_system_error_new_disc( self, UINT_MAX );
17267 0 : }
17268 0 : void fd_system_error_inner_destroy( fd_system_error_inner_t * self, uint discriminant ) {
17269 0 : switch( discriminant ) {
17270 0 : default: break; // FD_LOG_ERR(( "unhandled type" ));
17271 0 : }
17272 0 : }
17273 0 : void fd_system_error_destroy( fd_system_error_t * self ) {
17274 0 : fd_system_error_inner_destroy( &self->inner, self->discriminant );
17275 0 : }
17276 :
17277 0 : ulong fd_system_error_footprint( void ){ return FD_SYSTEM_ERROR_FOOTPRINT; }
17278 0 : ulong fd_system_error_align( void ){ return FD_SYSTEM_ERROR_ALIGN; }
17279 :
17280 0 : void fd_system_error_walk( void * w, fd_system_error_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
17281 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_system_error", level++);
17282 0 : switch( self->discriminant ) {
17283 0 : case 0: {
17284 0 : fun( w, self, "account_already_in_use", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
17285 0 : break;
17286 0 : }
17287 0 : case 1: {
17288 0 : fun( w, self, "result_with_negative_lamports", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
17289 0 : break;
17290 0 : }
17291 0 : case 2: {
17292 0 : fun( w, self, "invalid_program_id", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
17293 0 : break;
17294 0 : }
17295 0 : case 3: {
17296 0 : fun( w, self, "invalid_account_data_length", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
17297 0 : break;
17298 0 : }
17299 0 : case 4: {
17300 0 : fun( w, self, "max_seed_length_exceeded", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
17301 0 : break;
17302 0 : }
17303 0 : case 5: {
17304 0 : fun( w, self, "address_with_seed_mismatch", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
17305 0 : break;
17306 0 : }
17307 0 : case 6: {
17308 0 : fun( w, self, "nonce_no_recent_blockhashes", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
17309 0 : break;
17310 0 : }
17311 0 : case 7: {
17312 0 : fun( w, self, "nonce_blockhash_not_expired", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
17313 0 : break;
17314 0 : }
17315 0 : case 8: {
17316 0 : fun( w, self, "nonce_unexpected_blockhash_value", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
17317 0 : break;
17318 0 : }
17319 0 : }
17320 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_system_error", level-- );
17321 0 : }
17322 0 : ulong fd_system_error_size( fd_system_error_t const * self ) {
17323 0 : ulong size = 0;
17324 0 : size += sizeof(uint);
17325 0 : switch (self->discriminant) {
17326 0 : }
17327 0 : return size;
17328 0 : }
17329 :
17330 0 : int fd_system_error_inner_encode( fd_system_error_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
17331 0 : return FD_BINCODE_SUCCESS;
17332 0 : }
17333 0 : int fd_system_error_encode( fd_system_error_t const * self, fd_bincode_encode_ctx_t * ctx ) {
17334 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
17335 0 : if( FD_UNLIKELY( err ) ) return err;
17336 0 : return fd_system_error_inner_encode( &self->inner, self->discriminant, ctx );
17337 0 : }
17338 :
17339 12 : int fd_stake_authorized_encode( fd_stake_authorized_t const * self, fd_bincode_encode_ctx_t * ctx ) {
17340 12 : int err;
17341 12 : err = fd_pubkey_encode( &self->staker, ctx );
17342 12 : if( FD_UNLIKELY( err ) ) return err;
17343 12 : err = fd_pubkey_encode( &self->withdrawer, ctx );
17344 12 : if( FD_UNLIKELY( err ) ) return err;
17345 12 : return FD_BINCODE_SUCCESS;
17346 12 : }
17347 0 : int fd_stake_authorized_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
17348 0 : *total_sz += sizeof(fd_stake_authorized_t);
17349 0 : void const * start_data = ctx->data;
17350 0 : int err = fd_stake_authorized_decode_footprint_inner( ctx, total_sz );
17351 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
17352 0 : ctx->data = start_data;
17353 0 : return err;
17354 0 : }
17355 0 : int fd_stake_authorized_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
17356 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
17357 0 : int err = 0;
17358 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
17359 0 : if( FD_UNLIKELY( err ) ) return err;
17360 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
17361 0 : if( FD_UNLIKELY( err ) ) return err;
17362 0 : return 0;
17363 0 : }
17364 0 : void * fd_stake_authorized_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
17365 0 : fd_stake_authorized_t * self = (fd_stake_authorized_t *)mem;
17366 0 : fd_stake_authorized_new( self );
17367 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_authorized_t);
17368 0 : void * * alloc_mem = &alloc_region;
17369 0 : fd_stake_authorized_decode_inner( mem, alloc_mem, ctx );
17370 0 : return self;
17371 0 : }
17372 0 : void fd_stake_authorized_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
17373 0 : fd_stake_authorized_t * self = (fd_stake_authorized_t *)struct_mem;
17374 0 : fd_pubkey_decode_inner( &self->staker, alloc_mem, ctx );
17375 0 : fd_pubkey_decode_inner( &self->withdrawer, alloc_mem, ctx );
17376 0 : }
17377 0 : void * fd_stake_authorized_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
17378 0 : fd_stake_authorized_global_t * self = (fd_stake_authorized_global_t *)mem;
17379 0 : fd_stake_authorized_new( (fd_stake_authorized_t *)self );
17380 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_authorized_global_t);
17381 0 : void * * alloc_mem = &alloc_region;
17382 0 : fd_stake_authorized_decode_inner_global( mem, alloc_mem, ctx );
17383 0 : return self;
17384 0 : }
17385 0 : void fd_stake_authorized_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
17386 0 : fd_stake_authorized_global_t * self = (fd_stake_authorized_global_t *)struct_mem;
17387 0 : fd_pubkey_decode_inner_global( &self->staker, alloc_mem, ctx );
17388 0 : fd_pubkey_decode_inner_global( &self->withdrawer, alloc_mem, ctx );
17389 0 : }
17390 0 : int fd_stake_authorized_convert_global_to_local( void const * global_self, fd_stake_authorized_t * self, fd_bincode_decode_ctx_t * ctx ) {
17391 0 : int err = 0;
17392 0 : fd_stake_authorized_global_t const * mem = (fd_stake_authorized_global_t const *)global_self;
17393 0 : err = fd_pubkey_convert_global_to_local( &mem->staker, &self->staker, ctx );
17394 0 : if( FD_UNLIKELY( err ) ) return err;
17395 0 : err = fd_pubkey_convert_global_to_local( &mem->withdrawer, &self->withdrawer, ctx );
17396 0 : if( FD_UNLIKELY( err ) ) return err;
17397 0 : return FD_BINCODE_SUCCESS;
17398 0 : }
17399 12 : void fd_stake_authorized_new(fd_stake_authorized_t * self) {
17400 12 : fd_memset( self, 0, sizeof(fd_stake_authorized_t) );
17401 12 : fd_pubkey_new( &self->staker );
17402 12 : fd_pubkey_new( &self->withdrawer );
17403 12 : }
17404 0 : void fd_stake_authorized_destroy( fd_stake_authorized_t * self ) {
17405 0 : fd_pubkey_destroy( &self->staker );
17406 0 : fd_pubkey_destroy( &self->withdrawer );
17407 0 : }
17408 :
17409 0 : ulong fd_stake_authorized_footprint( void ){ return FD_STAKE_AUTHORIZED_FOOTPRINT; }
17410 0 : ulong fd_stake_authorized_align( void ){ return FD_STAKE_AUTHORIZED_ALIGN; }
17411 :
17412 0 : void fd_stake_authorized_walk( void * w, fd_stake_authorized_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
17413 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_authorized", level++ );
17414 0 : fd_pubkey_walk( w, &self->staker, fun, "staker", level );
17415 0 : fd_pubkey_walk( w, &self->withdrawer, fun, "withdrawer", level );
17416 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_authorized", level-- );
17417 0 : }
17418 0 : ulong fd_stake_authorized_size( fd_stake_authorized_t const * self ) {
17419 0 : ulong size = 0;
17420 0 : size += fd_pubkey_size( &self->staker );
17421 0 : size += fd_pubkey_size( &self->withdrawer );
17422 0 : return size;
17423 0 : }
17424 :
17425 12 : int fd_stake_lockup_encode( fd_stake_lockup_t const * self, fd_bincode_encode_ctx_t * ctx ) {
17426 12 : int err;
17427 12 : err = fd_bincode_uint64_encode( (ulong)self->unix_timestamp, ctx );
17428 12 : if( FD_UNLIKELY( err ) ) return err;
17429 12 : err = fd_bincode_uint64_encode( self->epoch, ctx );
17430 12 : if( FD_UNLIKELY( err ) ) return err;
17431 12 : err = fd_pubkey_encode( &self->custodian, ctx );
17432 12 : if( FD_UNLIKELY( err ) ) return err;
17433 12 : return FD_BINCODE_SUCCESS;
17434 12 : }
17435 0 : int fd_stake_lockup_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
17436 0 : *total_sz += sizeof(fd_stake_lockup_t);
17437 0 : void const * start_data = ctx->data;
17438 0 : int err = fd_stake_lockup_decode_footprint_inner( ctx, total_sz );
17439 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
17440 0 : ctx->data = start_data;
17441 0 : return err;
17442 0 : }
17443 0 : int fd_stake_lockup_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
17444 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
17445 0 : int err = 0;
17446 0 : err = fd_bincode_uint64_decode_footprint( ctx );
17447 0 : if( FD_UNLIKELY( err ) ) return err;
17448 0 : err = fd_bincode_uint64_decode_footprint( ctx );
17449 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
17450 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
17451 0 : if( FD_UNLIKELY( err ) ) return err;
17452 0 : return 0;
17453 0 : }
17454 0 : void * fd_stake_lockup_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
17455 0 : fd_stake_lockup_t * self = (fd_stake_lockup_t *)mem;
17456 0 : fd_stake_lockup_new( self );
17457 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_lockup_t);
17458 0 : void * * alloc_mem = &alloc_region;
17459 0 : fd_stake_lockup_decode_inner( mem, alloc_mem, ctx );
17460 0 : return self;
17461 0 : }
17462 0 : void fd_stake_lockup_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
17463 0 : fd_stake_lockup_t * self = (fd_stake_lockup_t *)struct_mem;
17464 0 : fd_bincode_uint64_decode_unsafe( (ulong *) &self->unix_timestamp, ctx );
17465 0 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
17466 0 : fd_pubkey_decode_inner( &self->custodian, alloc_mem, ctx );
17467 0 : }
17468 0 : void * fd_stake_lockup_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
17469 0 : fd_stake_lockup_global_t * self = (fd_stake_lockup_global_t *)mem;
17470 0 : fd_stake_lockup_new( (fd_stake_lockup_t *)self );
17471 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_lockup_global_t);
17472 0 : void * * alloc_mem = &alloc_region;
17473 0 : fd_stake_lockup_decode_inner_global( mem, alloc_mem, ctx );
17474 0 : return self;
17475 0 : }
17476 0 : void fd_stake_lockup_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
17477 0 : fd_stake_lockup_global_t * self = (fd_stake_lockup_global_t *)struct_mem;
17478 0 : fd_bincode_uint64_decode_unsafe( (ulong *) &self->unix_timestamp, ctx );
17479 0 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
17480 0 : fd_pubkey_decode_inner_global( &self->custodian, alloc_mem, ctx );
17481 0 : }
17482 0 : int fd_stake_lockup_convert_global_to_local( void const * global_self, fd_stake_lockup_t * self, fd_bincode_decode_ctx_t * ctx ) {
17483 0 : int err = 0;
17484 0 : fd_stake_lockup_global_t const * mem = (fd_stake_lockup_global_t const *)global_self;
17485 0 : self->unix_timestamp = mem->unix_timestamp;
17486 0 : self->epoch = mem->epoch;
17487 0 : err = fd_pubkey_convert_global_to_local( &mem->custodian, &self->custodian, ctx );
17488 0 : if( FD_UNLIKELY( err ) ) return err;
17489 0 : return FD_BINCODE_SUCCESS;
17490 0 : }
17491 12 : void fd_stake_lockup_new(fd_stake_lockup_t * self) {
17492 12 : fd_memset( self, 0, sizeof(fd_stake_lockup_t) );
17493 12 : fd_pubkey_new( &self->custodian );
17494 12 : }
17495 0 : void fd_stake_lockup_destroy( fd_stake_lockup_t * self ) {
17496 0 : fd_pubkey_destroy( &self->custodian );
17497 0 : }
17498 :
17499 0 : ulong fd_stake_lockup_footprint( void ){ return FD_STAKE_LOCKUP_FOOTPRINT; }
17500 0 : ulong fd_stake_lockup_align( void ){ return FD_STAKE_LOCKUP_ALIGN; }
17501 :
17502 0 : void fd_stake_lockup_walk( void * w, fd_stake_lockup_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
17503 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_lockup", level++ );
17504 0 : fun( w, &self->unix_timestamp, "unix_timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level );
17505 0 : fun( w, &self->epoch, "epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
17506 0 : fd_pubkey_walk( w, &self->custodian, fun, "custodian", level );
17507 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_lockup", level-- );
17508 0 : }
17509 0 : ulong fd_stake_lockup_size( fd_stake_lockup_t const * self ) {
17510 0 : ulong size = 0;
17511 0 : size += sizeof(long);
17512 0 : size += sizeof(ulong);
17513 0 : size += fd_pubkey_size( &self->custodian );
17514 0 : return size;
17515 0 : }
17516 :
17517 0 : int fd_stake_instruction_initialize_encode( fd_stake_instruction_initialize_t const * self, fd_bincode_encode_ctx_t * ctx ) {
17518 0 : int err;
17519 0 : err = fd_stake_authorized_encode( &self->authorized, ctx );
17520 0 : if( FD_UNLIKELY( err ) ) return err;
17521 0 : err = fd_stake_lockup_encode( &self->lockup, ctx );
17522 0 : if( FD_UNLIKELY( err ) ) return err;
17523 0 : return FD_BINCODE_SUCCESS;
17524 0 : }
17525 0 : int fd_stake_instruction_initialize_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
17526 0 : *total_sz += sizeof(fd_stake_instruction_initialize_t);
17527 0 : void const * start_data = ctx->data;
17528 0 : int err = fd_stake_instruction_initialize_decode_footprint_inner( ctx, total_sz );
17529 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
17530 0 : ctx->data = start_data;
17531 0 : return err;
17532 0 : }
17533 0 : int fd_stake_instruction_initialize_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
17534 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
17535 0 : int err = 0;
17536 0 : err = fd_stake_authorized_decode_footprint_inner( ctx, total_sz );
17537 0 : if( FD_UNLIKELY( err ) ) return err;
17538 0 : err = fd_stake_lockup_decode_footprint_inner( ctx, total_sz );
17539 0 : if( FD_UNLIKELY( err ) ) return err;
17540 0 : return 0;
17541 0 : }
17542 0 : void * fd_stake_instruction_initialize_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
17543 0 : fd_stake_instruction_initialize_t * self = (fd_stake_instruction_initialize_t *)mem;
17544 0 : fd_stake_instruction_initialize_new( self );
17545 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_instruction_initialize_t);
17546 0 : void * * alloc_mem = &alloc_region;
17547 0 : fd_stake_instruction_initialize_decode_inner( mem, alloc_mem, ctx );
17548 0 : return self;
17549 0 : }
17550 0 : void fd_stake_instruction_initialize_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
17551 0 : fd_stake_instruction_initialize_t * self = (fd_stake_instruction_initialize_t *)struct_mem;
17552 0 : fd_stake_authorized_decode_inner( &self->authorized, alloc_mem, ctx );
17553 0 : fd_stake_lockup_decode_inner( &self->lockup, alloc_mem, ctx );
17554 0 : }
17555 0 : void * fd_stake_instruction_initialize_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
17556 0 : fd_stake_instruction_initialize_global_t * self = (fd_stake_instruction_initialize_global_t *)mem;
17557 0 : fd_stake_instruction_initialize_new( (fd_stake_instruction_initialize_t *)self );
17558 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_instruction_initialize_global_t);
17559 0 : void * * alloc_mem = &alloc_region;
17560 0 : fd_stake_instruction_initialize_decode_inner_global( mem, alloc_mem, ctx );
17561 0 : return self;
17562 0 : }
17563 0 : void fd_stake_instruction_initialize_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
17564 0 : fd_stake_instruction_initialize_global_t * self = (fd_stake_instruction_initialize_global_t *)struct_mem;
17565 0 : fd_stake_authorized_decode_inner_global( &self->authorized, alloc_mem, ctx );
17566 0 : fd_stake_lockup_decode_inner_global( &self->lockup, alloc_mem, ctx );
17567 0 : }
17568 0 : int fd_stake_instruction_initialize_convert_global_to_local( void const * global_self, fd_stake_instruction_initialize_t * self, fd_bincode_decode_ctx_t * ctx ) {
17569 0 : int err = 0;
17570 0 : fd_stake_instruction_initialize_global_t const * mem = (fd_stake_instruction_initialize_global_t const *)global_self;
17571 0 : err = fd_stake_authorized_convert_global_to_local( &mem->authorized, &self->authorized, ctx );
17572 0 : if( FD_UNLIKELY( err ) ) return err;
17573 0 : err = fd_stake_lockup_convert_global_to_local( &mem->lockup, &self->lockup, ctx );
17574 0 : if( FD_UNLIKELY( err ) ) return err;
17575 0 : return FD_BINCODE_SUCCESS;
17576 0 : }
17577 0 : void fd_stake_instruction_initialize_new(fd_stake_instruction_initialize_t * self) {
17578 0 : fd_memset( self, 0, sizeof(fd_stake_instruction_initialize_t) );
17579 0 : fd_stake_authorized_new( &self->authorized );
17580 0 : fd_stake_lockup_new( &self->lockup );
17581 0 : }
17582 0 : void fd_stake_instruction_initialize_destroy( fd_stake_instruction_initialize_t * self ) {
17583 0 : fd_stake_authorized_destroy( &self->authorized );
17584 0 : fd_stake_lockup_destroy( &self->lockup );
17585 0 : }
17586 :
17587 0 : ulong fd_stake_instruction_initialize_footprint( void ){ return FD_STAKE_INSTRUCTION_INITIALIZE_FOOTPRINT; }
17588 0 : ulong fd_stake_instruction_initialize_align( void ){ return FD_STAKE_INSTRUCTION_INITIALIZE_ALIGN; }
17589 :
17590 0 : void fd_stake_instruction_initialize_walk( void * w, fd_stake_instruction_initialize_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
17591 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_instruction_initialize", level++ );
17592 0 : fd_stake_authorized_walk( w, &self->authorized, fun, "authorized", level );
17593 0 : fd_stake_lockup_walk( w, &self->lockup, fun, "lockup", level );
17594 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_instruction_initialize", level-- );
17595 0 : }
17596 0 : ulong fd_stake_instruction_initialize_size( fd_stake_instruction_initialize_t const * self ) {
17597 0 : ulong size = 0;
17598 0 : size += fd_stake_authorized_size( &self->authorized );
17599 0 : size += fd_stake_lockup_size( &self->lockup );
17600 0 : return size;
17601 0 : }
17602 :
17603 0 : int fd_stake_lockup_custodian_args_encode( fd_stake_lockup_custodian_args_t const * self, fd_bincode_encode_ctx_t * ctx ) {
17604 0 : int err;
17605 0 : err = fd_stake_lockup_encode( &self->lockup, ctx );
17606 0 : if( FD_UNLIKELY( err ) ) return err;
17607 0 : err = fd_sol_sysvar_clock_encode( &self->clock, ctx );
17608 0 : if( FD_UNLIKELY( err ) ) return err;
17609 0 : if( self->custodian != NULL ) {
17610 0 : err = fd_bincode_bool_encode( 1, ctx );
17611 0 : if( FD_UNLIKELY( err ) ) return err;
17612 0 : err = fd_pubkey_encode( self->custodian, ctx );
17613 0 : if( FD_UNLIKELY( err ) ) return err;
17614 0 : } else {
17615 0 : err = fd_bincode_bool_encode( 0, ctx );
17616 0 : if( FD_UNLIKELY( err ) ) return err;
17617 0 : }
17618 0 : return FD_BINCODE_SUCCESS;
17619 0 : }
17620 0 : int fd_stake_lockup_custodian_args_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
17621 0 : *total_sz += sizeof(fd_stake_lockup_custodian_args_t);
17622 0 : void const * start_data = ctx->data;
17623 0 : int err = fd_stake_lockup_custodian_args_decode_footprint_inner( ctx, total_sz );
17624 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
17625 0 : ctx->data = start_data;
17626 0 : return err;
17627 0 : }
17628 0 : int fd_stake_lockup_custodian_args_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
17629 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
17630 0 : int err = 0;
17631 0 : err = fd_stake_lockup_decode_footprint_inner( ctx, total_sz );
17632 0 : if( FD_UNLIKELY( err ) ) return err;
17633 0 : err = fd_sol_sysvar_clock_decode_footprint_inner( ctx, total_sz );
17634 0 : if( FD_UNLIKELY( err ) ) return err;
17635 0 : {
17636 0 : uchar o;
17637 0 : err = fd_bincode_bool_decode( &o, ctx );
17638 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
17639 0 : if( o ) {
17640 0 : *total_sz += FD_PUBKEY_ALIGN + FD_PUBKEY_FOOTPRINT;
17641 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
17642 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
17643 0 : }
17644 0 : }
17645 0 : return 0;
17646 0 : }
17647 0 : void * fd_stake_lockup_custodian_args_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
17648 0 : fd_stake_lockup_custodian_args_t * self = (fd_stake_lockup_custodian_args_t *)mem;
17649 0 : fd_stake_lockup_custodian_args_new( self );
17650 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_lockup_custodian_args_t);
17651 0 : void * * alloc_mem = &alloc_region;
17652 0 : fd_stake_lockup_custodian_args_decode_inner( mem, alloc_mem, ctx );
17653 0 : return self;
17654 0 : }
17655 0 : void fd_stake_lockup_custodian_args_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
17656 0 : fd_stake_lockup_custodian_args_t * self = (fd_stake_lockup_custodian_args_t *)struct_mem;
17657 0 : fd_stake_lockup_decode_inner( &self->lockup, alloc_mem, ctx );
17658 0 : fd_sol_sysvar_clock_decode_inner( &self->clock, alloc_mem, ctx );
17659 0 : {
17660 0 : uchar o;
17661 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
17662 0 : if( o ) {
17663 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, FD_PUBKEY_ALIGN );
17664 0 : self->custodian = *alloc_mem;
17665 0 : *alloc_mem = (uchar *)*alloc_mem + FD_PUBKEY_FOOTPRINT;
17666 0 : fd_pubkey_new( self->custodian );
17667 0 : fd_pubkey_decode_inner( self->custodian, alloc_mem, ctx );
17668 0 : } else {
17669 0 : self->custodian = NULL;
17670 0 : }
17671 0 : }
17672 0 : }
17673 0 : void * fd_stake_lockup_custodian_args_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
17674 0 : fd_stake_lockup_custodian_args_global_t * self = (fd_stake_lockup_custodian_args_global_t *)mem;
17675 0 : fd_stake_lockup_custodian_args_new( (fd_stake_lockup_custodian_args_t *)self );
17676 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_lockup_custodian_args_global_t);
17677 0 : void * * alloc_mem = &alloc_region;
17678 0 : fd_stake_lockup_custodian_args_decode_inner_global( mem, alloc_mem, ctx );
17679 0 : return self;
17680 0 : }
17681 0 : void fd_stake_lockup_custodian_args_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
17682 0 : fd_stake_lockup_custodian_args_global_t * self = (fd_stake_lockup_custodian_args_global_t *)struct_mem;
17683 0 : fd_stake_lockup_decode_inner_global( &self->lockup, alloc_mem, ctx );
17684 0 : fd_sol_sysvar_clock_decode_inner_global( &self->clock, alloc_mem, ctx );
17685 0 : {
17686 0 : uchar o;
17687 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
17688 0 : if( o ) {
17689 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, FD_PUBKEY_ALIGN );
17690 0 : self->custodian_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
17691 0 : fd_pubkey_new( *alloc_mem );
17692 0 : *alloc_mem = (uchar *)*alloc_mem + FD_PUBKEY_FOOTPRINT;
17693 0 : fd_pubkey_decode_inner_global( fd_wksp_laddr_fast( ctx->wksp, self->custodian_gaddr ), alloc_mem, ctx );
17694 0 : } else {
17695 0 : self->custodian_gaddr = 0UL;
17696 0 : }
17697 0 : }
17698 0 : }
17699 0 : int fd_stake_lockup_custodian_args_convert_global_to_local( void const * global_self, fd_stake_lockup_custodian_args_t * self, fd_bincode_decode_ctx_t * ctx ) {
17700 0 : int err = 0;
17701 0 : fd_stake_lockup_custodian_args_global_t const * mem = (fd_stake_lockup_custodian_args_global_t const *)global_self;
17702 0 : err = fd_stake_lockup_convert_global_to_local( &mem->lockup, &self->lockup, ctx );
17703 0 : if( FD_UNLIKELY( err ) ) return err;
17704 0 : err = fd_sol_sysvar_clock_convert_global_to_local( &mem->clock, &self->clock, ctx );
17705 0 : if( FD_UNLIKELY( err ) ) return err;
17706 0 : self->custodian = fd_wksp_laddr_fast( ctx->wksp, mem->custodian_gaddr );
17707 0 : return FD_BINCODE_SUCCESS;
17708 0 : }
17709 0 : void fd_stake_lockup_custodian_args_new(fd_stake_lockup_custodian_args_t * self) {
17710 0 : fd_memset( self, 0, sizeof(fd_stake_lockup_custodian_args_t) );
17711 0 : fd_stake_lockup_new( &self->lockup );
17712 0 : fd_sol_sysvar_clock_new( &self->clock );
17713 0 : }
17714 0 : void fd_stake_lockup_custodian_args_destroy( fd_stake_lockup_custodian_args_t * self ) {
17715 0 : fd_stake_lockup_destroy( &self->lockup );
17716 0 : fd_sol_sysvar_clock_destroy( &self->clock );
17717 0 : if( self->custodian ) {
17718 0 : fd_pubkey_destroy( self->custodian );
17719 0 : self->custodian = NULL;
17720 0 : }
17721 0 : }
17722 :
17723 0 : ulong fd_stake_lockup_custodian_args_footprint( void ){ return FD_STAKE_LOCKUP_CUSTODIAN_ARGS_FOOTPRINT; }
17724 0 : ulong fd_stake_lockup_custodian_args_align( void ){ return FD_STAKE_LOCKUP_CUSTODIAN_ARGS_ALIGN; }
17725 :
17726 0 : void fd_stake_lockup_custodian_args_walk( void * w, fd_stake_lockup_custodian_args_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
17727 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_lockup_custodian_args", level++ );
17728 0 : fd_stake_lockup_walk( w, &self->lockup, fun, "lockup", level );
17729 0 : fd_sol_sysvar_clock_walk( w, &self->clock, fun, "clock", level );
17730 0 : if( !self->custodian ) {
17731 0 : fun( w, NULL, "custodian", FD_FLAMENCO_TYPE_NULL, "pubkey", level );
17732 0 : } else {
17733 0 : fd_pubkey_walk( w, self->custodian, fun, "custodian", level );
17734 0 : }
17735 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_lockup_custodian_args", level-- );
17736 0 : }
17737 0 : ulong fd_stake_lockup_custodian_args_size( fd_stake_lockup_custodian_args_t const * self ) {
17738 0 : ulong size = 0;
17739 0 : size += fd_stake_lockup_size( &self->lockup );
17740 0 : size += fd_sol_sysvar_clock_size( &self->clock );
17741 0 : size += sizeof(char);
17742 0 : if( NULL != self->custodian ) {
17743 0 : size += fd_pubkey_size( self->custodian );
17744 0 : }
17745 0 : return size;
17746 0 : }
17747 :
17748 0 : FD_FN_PURE uchar fd_stake_authorize_is_staker(fd_stake_authorize_t const * self) {
17749 0 : return self->discriminant == 0;
17750 0 : }
17751 0 : FD_FN_PURE uchar fd_stake_authorize_is_withdrawer(fd_stake_authorize_t const * self) {
17752 0 : return self->discriminant == 1;
17753 0 : }
17754 : void fd_stake_authorize_inner_new( fd_stake_authorize_inner_t * self, uint discriminant );
17755 0 : int fd_stake_authorize_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
17756 0 : int err;
17757 0 : switch (discriminant) {
17758 0 : case 0: {
17759 0 : return FD_BINCODE_SUCCESS;
17760 0 : }
17761 0 : case 1: {
17762 0 : return FD_BINCODE_SUCCESS;
17763 0 : }
17764 0 : default: return FD_BINCODE_ERR_ENCODING;
17765 0 : }
17766 0 : }
17767 0 : int fd_stake_authorize_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
17768 0 : *total_sz += sizeof(fd_stake_authorize_t);
17769 0 : void const * start_data = ctx->data;
17770 0 : int err = fd_stake_authorize_decode_footprint_inner( ctx, total_sz );
17771 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
17772 0 : ctx->data = start_data;
17773 0 : return err;
17774 0 : }
17775 0 : int fd_stake_authorize_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
17776 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
17777 0 : uint discriminant = 0;
17778 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
17779 0 : if( FD_UNLIKELY( err ) ) return err;
17780 0 : return fd_stake_authorize_inner_decode_footprint( discriminant, ctx, total_sz );
17781 0 : }
17782 0 : void fd_stake_authorize_inner_decode_inner( fd_stake_authorize_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
17783 0 : switch (discriminant) {
17784 0 : case 0: {
17785 0 : break;
17786 0 : }
17787 0 : case 1: {
17788 0 : break;
17789 0 : }
17790 0 : }
17791 0 : }
17792 0 : void fd_stake_authorize_inner_decode_inner_global( fd_stake_authorize_inner_global_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
17793 0 : switch (discriminant) {
17794 0 : case 0: {
17795 0 : break;
17796 0 : }
17797 0 : case 1: {
17798 0 : break;
17799 0 : }
17800 0 : }
17801 0 : }
17802 0 : int fd_stake_authorize_convert_global_to_local_inner( fd_stake_authorize_inner_global_t const * mem, fd_stake_authorize_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
17803 0 : int err = 0;
17804 0 : switch( discriminant ) {
17805 0 : case 0: {
17806 0 : break;
17807 0 : }
17808 0 : case 1: {
17809 0 : break;
17810 0 : }
17811 0 : }
17812 0 : return FD_BINCODE_SUCCESS;
17813 0 : }
17814 0 : int fd_stake_authorize_convert_global_to_local( void const * global_self, fd_stake_authorize_t * self, fd_bincode_decode_ctx_t * ctx ) {
17815 0 : fd_stake_authorize_global_t const * mem = (fd_stake_authorize_global_t const *)global_self;
17816 0 : uint discriminant = mem->discriminant;
17817 0 : self->discriminant = mem->discriminant;
17818 0 : int err = fd_stake_authorize_convert_global_to_local_inner( &mem->inner, &self->inner, discriminant, ctx );
17819 0 : return FD_BINCODE_SUCCESS;
17820 0 : }
17821 0 : void fd_stake_authorize_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
17822 0 : fd_stake_authorize_t * self = (fd_stake_authorize_t *)struct_mem;
17823 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
17824 0 : fd_stake_authorize_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
17825 0 : }
17826 0 : void * fd_stake_authorize_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
17827 0 : fd_stake_authorize_t * self = (fd_stake_authorize_t *)mem;
17828 0 : fd_stake_authorize_new( self );
17829 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_authorize_t);
17830 0 : void * * alloc_mem = &alloc_region;
17831 0 : fd_stake_authorize_decode_inner( mem, alloc_mem, ctx );
17832 0 : return self;
17833 0 : }
17834 0 : void * fd_stake_authorize_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
17835 0 : fd_stake_authorize_t * self = (fd_stake_authorize_t *)mem;
17836 0 : fd_stake_authorize_new( self );
17837 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_authorize_t);
17838 0 : void * * alloc_mem = &alloc_region;
17839 0 : fd_stake_authorize_decode_inner_global( mem, alloc_mem, ctx );
17840 0 : return self;
17841 0 : }
17842 0 : void fd_stake_authorize_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
17843 0 : fd_stake_authorize_global_t * self = (fd_stake_authorize_global_t *)struct_mem;
17844 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
17845 0 : fd_stake_authorize_inner_decode_inner_global( &self->inner, alloc_mem, self->discriminant, ctx );
17846 0 : }
17847 0 : void fd_stake_authorize_inner_new( fd_stake_authorize_inner_t * self, uint discriminant ) {
17848 0 : switch( discriminant ) {
17849 0 : case 0: {
17850 0 : break;
17851 0 : }
17852 0 : case 1: {
17853 0 : break;
17854 0 : }
17855 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
17856 0 : }
17857 0 : }
17858 0 : void fd_stake_authorize_new_disc( fd_stake_authorize_t * self, uint discriminant ) {
17859 0 : self->discriminant = discriminant;
17860 0 : fd_stake_authorize_inner_new( &self->inner, self->discriminant );
17861 0 : }
17862 0 : void fd_stake_authorize_new( fd_stake_authorize_t * self ) {
17863 0 : fd_memset( self, 0, sizeof(fd_stake_authorize_t) );
17864 0 : fd_stake_authorize_new_disc( self, UINT_MAX );
17865 0 : }
17866 0 : void fd_stake_authorize_inner_destroy( fd_stake_authorize_inner_t * self, uint discriminant ) {
17867 0 : switch( discriminant ) {
17868 0 : default: break; // FD_LOG_ERR(( "unhandled type" ));
17869 0 : }
17870 0 : }
17871 0 : void fd_stake_authorize_destroy( fd_stake_authorize_t * self ) {
17872 0 : fd_stake_authorize_inner_destroy( &self->inner, self->discriminant );
17873 0 : }
17874 :
17875 0 : ulong fd_stake_authorize_footprint( void ){ return FD_STAKE_AUTHORIZE_FOOTPRINT; }
17876 0 : ulong fd_stake_authorize_align( void ){ return FD_STAKE_AUTHORIZE_ALIGN; }
17877 :
17878 0 : void fd_stake_authorize_walk( void * w, fd_stake_authorize_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
17879 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_stake_authorize", level++);
17880 0 : switch( self->discriminant ) {
17881 0 : case 0: {
17882 0 : fun( w, self, "staker", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
17883 0 : break;
17884 0 : }
17885 0 : case 1: {
17886 0 : fun( w, self, "withdrawer", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
17887 0 : break;
17888 0 : }
17889 0 : }
17890 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_stake_authorize", level-- );
17891 0 : }
17892 0 : ulong fd_stake_authorize_size( fd_stake_authorize_t const * self ) {
17893 0 : ulong size = 0;
17894 0 : size += sizeof(uint);
17895 0 : switch (self->discriminant) {
17896 0 : }
17897 0 : return size;
17898 0 : }
17899 :
17900 0 : int fd_stake_authorize_inner_encode( fd_stake_authorize_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
17901 0 : return FD_BINCODE_SUCCESS;
17902 0 : }
17903 0 : int fd_stake_authorize_encode( fd_stake_authorize_t const * self, fd_bincode_encode_ctx_t * ctx ) {
17904 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
17905 0 : if( FD_UNLIKELY( err ) ) return err;
17906 0 : return fd_stake_authorize_inner_encode( &self->inner, self->discriminant, ctx );
17907 0 : }
17908 :
17909 0 : int fd_stake_instruction_authorize_encode( fd_stake_instruction_authorize_t const * self, fd_bincode_encode_ctx_t * ctx ) {
17910 0 : int err;
17911 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
17912 0 : if( FD_UNLIKELY( err ) ) return err;
17913 0 : err = fd_stake_authorize_encode( &self->stake_authorize, ctx );
17914 0 : if( FD_UNLIKELY( err ) ) return err;
17915 0 : return FD_BINCODE_SUCCESS;
17916 0 : }
17917 0 : int fd_stake_instruction_authorize_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
17918 0 : *total_sz += sizeof(fd_stake_instruction_authorize_t);
17919 0 : void const * start_data = ctx->data;
17920 0 : int err = fd_stake_instruction_authorize_decode_footprint_inner( ctx, total_sz );
17921 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
17922 0 : ctx->data = start_data;
17923 0 : return err;
17924 0 : }
17925 0 : int fd_stake_instruction_authorize_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
17926 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
17927 0 : int err = 0;
17928 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
17929 0 : if( FD_UNLIKELY( err ) ) return err;
17930 0 : err = fd_stake_authorize_decode_footprint_inner( ctx, total_sz );
17931 0 : if( FD_UNLIKELY( err ) ) return err;
17932 0 : return 0;
17933 0 : }
17934 0 : void * fd_stake_instruction_authorize_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
17935 0 : fd_stake_instruction_authorize_t * self = (fd_stake_instruction_authorize_t *)mem;
17936 0 : fd_stake_instruction_authorize_new( self );
17937 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_instruction_authorize_t);
17938 0 : void * * alloc_mem = &alloc_region;
17939 0 : fd_stake_instruction_authorize_decode_inner( mem, alloc_mem, ctx );
17940 0 : return self;
17941 0 : }
17942 0 : void fd_stake_instruction_authorize_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
17943 0 : fd_stake_instruction_authorize_t * self = (fd_stake_instruction_authorize_t *)struct_mem;
17944 0 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
17945 0 : fd_stake_authorize_decode_inner( &self->stake_authorize, alloc_mem, ctx );
17946 0 : }
17947 0 : void * fd_stake_instruction_authorize_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
17948 0 : fd_stake_instruction_authorize_global_t * self = (fd_stake_instruction_authorize_global_t *)mem;
17949 0 : fd_stake_instruction_authorize_new( (fd_stake_instruction_authorize_t *)self );
17950 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_instruction_authorize_global_t);
17951 0 : void * * alloc_mem = &alloc_region;
17952 0 : fd_stake_instruction_authorize_decode_inner_global( mem, alloc_mem, ctx );
17953 0 : return self;
17954 0 : }
17955 0 : void fd_stake_instruction_authorize_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
17956 0 : fd_stake_instruction_authorize_global_t * self = (fd_stake_instruction_authorize_global_t *)struct_mem;
17957 0 : fd_pubkey_decode_inner_global( &self->pubkey, alloc_mem, ctx );
17958 0 : fd_stake_authorize_decode_inner_global( &self->stake_authorize, alloc_mem, ctx );
17959 0 : }
17960 0 : int fd_stake_instruction_authorize_convert_global_to_local( void const * global_self, fd_stake_instruction_authorize_t * self, fd_bincode_decode_ctx_t * ctx ) {
17961 0 : int err = 0;
17962 0 : fd_stake_instruction_authorize_global_t const * mem = (fd_stake_instruction_authorize_global_t const *)global_self;
17963 0 : err = fd_pubkey_convert_global_to_local( &mem->pubkey, &self->pubkey, ctx );
17964 0 : if( FD_UNLIKELY( err ) ) return err;
17965 0 : err = fd_stake_authorize_convert_global_to_local( &mem->stake_authorize, &self->stake_authorize, ctx );
17966 0 : if( FD_UNLIKELY( err ) ) return err;
17967 0 : return FD_BINCODE_SUCCESS;
17968 0 : }
17969 0 : void fd_stake_instruction_authorize_new(fd_stake_instruction_authorize_t * self) {
17970 0 : fd_memset( self, 0, sizeof(fd_stake_instruction_authorize_t) );
17971 0 : fd_pubkey_new( &self->pubkey );
17972 0 : fd_stake_authorize_new( &self->stake_authorize );
17973 0 : }
17974 0 : void fd_stake_instruction_authorize_destroy( fd_stake_instruction_authorize_t * self ) {
17975 0 : fd_pubkey_destroy( &self->pubkey );
17976 0 : fd_stake_authorize_destroy( &self->stake_authorize );
17977 0 : }
17978 :
17979 0 : ulong fd_stake_instruction_authorize_footprint( void ){ return FD_STAKE_INSTRUCTION_AUTHORIZE_FOOTPRINT; }
17980 0 : ulong fd_stake_instruction_authorize_align( void ){ return FD_STAKE_INSTRUCTION_AUTHORIZE_ALIGN; }
17981 :
17982 0 : void fd_stake_instruction_authorize_walk( void * w, fd_stake_instruction_authorize_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
17983 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_instruction_authorize", level++ );
17984 0 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level );
17985 0 : fd_stake_authorize_walk( w, &self->stake_authorize, fun, "stake_authorize", level );
17986 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_instruction_authorize", level-- );
17987 0 : }
17988 0 : ulong fd_stake_instruction_authorize_size( fd_stake_instruction_authorize_t const * self ) {
17989 0 : ulong size = 0;
17990 0 : size += fd_pubkey_size( &self->pubkey );
17991 0 : size += fd_stake_authorize_size( &self->stake_authorize );
17992 0 : return size;
17993 0 : }
17994 :
17995 0 : int fd_authorize_with_seed_args_encode( fd_authorize_with_seed_args_t const * self, fd_bincode_encode_ctx_t * ctx ) {
17996 0 : int err;
17997 0 : err = fd_pubkey_encode( &self->new_authorized_pubkey, ctx );
17998 0 : if( FD_UNLIKELY( err ) ) return err;
17999 0 : err = fd_stake_authorize_encode( &self->stake_authorize, ctx );
18000 0 : if( FD_UNLIKELY( err ) ) return err;
18001 0 : err = fd_bincode_uint64_encode( self->authority_seed_len, ctx );
18002 0 : if( FD_UNLIKELY(err) ) return err;
18003 0 : if( self->authority_seed_len ) {
18004 0 : err = fd_bincode_bytes_encode( self->authority_seed, self->authority_seed_len, ctx );
18005 0 : if( FD_UNLIKELY( err ) ) return err;
18006 0 : }
18007 0 : err = fd_pubkey_encode( &self->authority_owner, ctx );
18008 0 : if( FD_UNLIKELY( err ) ) return err;
18009 0 : return FD_BINCODE_SUCCESS;
18010 0 : }
18011 0 : int fd_authorize_with_seed_args_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
18012 0 : *total_sz += sizeof(fd_authorize_with_seed_args_t);
18013 0 : void const * start_data = ctx->data;
18014 0 : int err = fd_authorize_with_seed_args_decode_footprint_inner( ctx, total_sz );
18015 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
18016 0 : ctx->data = start_data;
18017 0 : return err;
18018 0 : }
18019 0 : int fd_authorize_with_seed_args_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
18020 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
18021 0 : int err = 0;
18022 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
18023 0 : if( FD_UNLIKELY( err ) ) return err;
18024 0 : err = fd_stake_authorize_decode_footprint_inner( ctx, total_sz );
18025 0 : if( FD_UNLIKELY( err ) ) return err;
18026 0 : ulong authority_seed_len;
18027 0 : err = fd_bincode_uint64_decode( &authority_seed_len, ctx );
18028 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18029 0 : *total_sz += authority_seed_len;
18030 0 : if( authority_seed_len ) {
18031 0 : err = fd_bincode_bytes_decode_footprint( authority_seed_len, ctx );
18032 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18033 0 : err = !fd_utf8_verify( (char const *) ctx->data - authority_seed_len, authority_seed_len );
18034 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18035 0 : }
18036 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
18037 0 : if( FD_UNLIKELY( err ) ) return err;
18038 0 : return 0;
18039 0 : }
18040 0 : void * fd_authorize_with_seed_args_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
18041 0 : fd_authorize_with_seed_args_t * self = (fd_authorize_with_seed_args_t *)mem;
18042 0 : fd_authorize_with_seed_args_new( self );
18043 0 : void * alloc_region = (uchar *)mem + sizeof(fd_authorize_with_seed_args_t);
18044 0 : void * * alloc_mem = &alloc_region;
18045 0 : fd_authorize_with_seed_args_decode_inner( mem, alloc_mem, ctx );
18046 0 : return self;
18047 0 : }
18048 0 : void fd_authorize_with_seed_args_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
18049 0 : fd_authorize_with_seed_args_t * self = (fd_authorize_with_seed_args_t *)struct_mem;
18050 0 : fd_pubkey_decode_inner( &self->new_authorized_pubkey, alloc_mem, ctx );
18051 0 : fd_stake_authorize_decode_inner( &self->stake_authorize, alloc_mem, ctx );
18052 0 : fd_bincode_uint64_decode_unsafe( &self->authority_seed_len, ctx );
18053 0 : if( self->authority_seed_len ) {
18054 0 : self->authority_seed = *alloc_mem;
18055 0 : fd_bincode_bytes_decode_unsafe( self->authority_seed, self->authority_seed_len, ctx );
18056 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->authority_seed_len;
18057 0 : } else
18058 0 : self->authority_seed = NULL;
18059 0 : fd_pubkey_decode_inner( &self->authority_owner, alloc_mem, ctx );
18060 0 : }
18061 0 : void * fd_authorize_with_seed_args_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
18062 0 : fd_authorize_with_seed_args_global_t * self = (fd_authorize_with_seed_args_global_t *)mem;
18063 0 : fd_authorize_with_seed_args_new( (fd_authorize_with_seed_args_t *)self );
18064 0 : void * alloc_region = (uchar *)mem + sizeof(fd_authorize_with_seed_args_global_t);
18065 0 : void * * alloc_mem = &alloc_region;
18066 0 : fd_authorize_with_seed_args_decode_inner_global( mem, alloc_mem, ctx );
18067 0 : return self;
18068 0 : }
18069 0 : void fd_authorize_with_seed_args_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
18070 0 : fd_authorize_with_seed_args_global_t * self = (fd_authorize_with_seed_args_global_t *)struct_mem;
18071 0 : fd_pubkey_decode_inner_global( &self->new_authorized_pubkey, alloc_mem, ctx );
18072 0 : fd_stake_authorize_decode_inner_global( &self->stake_authorize, alloc_mem, ctx );
18073 0 : fd_bincode_uint64_decode_unsafe( &self->authority_seed_len, ctx );
18074 0 : if( self->authority_seed_len ) {
18075 0 : self->authority_seed_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
18076 0 : fd_bincode_bytes_decode_unsafe( *alloc_mem, self->authority_seed_len, ctx );
18077 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->authority_seed_len;
18078 0 : } else
18079 0 : self->authority_seed_gaddr = 0UL;
18080 0 : fd_pubkey_decode_inner_global( &self->authority_owner, alloc_mem, ctx );
18081 0 : }
18082 0 : int fd_authorize_with_seed_args_convert_global_to_local( void const * global_self, fd_authorize_with_seed_args_t * self, fd_bincode_decode_ctx_t * ctx ) {
18083 0 : int err = 0;
18084 0 : fd_authorize_with_seed_args_global_t const * mem = (fd_authorize_with_seed_args_global_t const *)global_self;
18085 0 : err = fd_pubkey_convert_global_to_local( &mem->new_authorized_pubkey, &self->new_authorized_pubkey, ctx );
18086 0 : if( FD_UNLIKELY( err ) ) return err;
18087 0 : err = fd_stake_authorize_convert_global_to_local( &mem->stake_authorize, &self->stake_authorize, ctx );
18088 0 : if( FD_UNLIKELY( err ) ) return err;
18089 0 : self->authority_seed_len = mem->authority_seed_len;
18090 0 : self->authority_seed = fd_wksp_laddr_fast( ctx->wksp, mem->authority_seed_gaddr );
18091 0 : err = fd_pubkey_convert_global_to_local( &mem->authority_owner, &self->authority_owner, ctx );
18092 0 : if( FD_UNLIKELY( err ) ) return err;
18093 0 : return FD_BINCODE_SUCCESS;
18094 0 : }
18095 0 : void fd_authorize_with_seed_args_new(fd_authorize_with_seed_args_t * self) {
18096 0 : fd_memset( self, 0, sizeof(fd_authorize_with_seed_args_t) );
18097 0 : fd_pubkey_new( &self->new_authorized_pubkey );
18098 0 : fd_stake_authorize_new( &self->stake_authorize );
18099 0 : fd_pubkey_new( &self->authority_owner );
18100 0 : }
18101 0 : void fd_authorize_with_seed_args_destroy( fd_authorize_with_seed_args_t * self ) {
18102 0 : fd_pubkey_destroy( &self->new_authorized_pubkey );
18103 0 : fd_stake_authorize_destroy( &self->stake_authorize );
18104 0 : if( self->authority_seed ) {
18105 0 : self->authority_seed = NULL;
18106 0 : }
18107 0 : fd_pubkey_destroy( &self->authority_owner );
18108 0 : }
18109 :
18110 0 : ulong fd_authorize_with_seed_args_footprint( void ){ return FD_AUTHORIZE_WITH_SEED_ARGS_FOOTPRINT; }
18111 0 : ulong fd_authorize_with_seed_args_align( void ){ return FD_AUTHORIZE_WITH_SEED_ARGS_ALIGN; }
18112 :
18113 0 : void fd_authorize_with_seed_args_walk( void * w, fd_authorize_with_seed_args_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
18114 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_authorize_with_seed_args", level++ );
18115 0 : fd_pubkey_walk( w, &self->new_authorized_pubkey, fun, "new_authorized_pubkey", level );
18116 0 : fd_stake_authorize_walk( w, &self->stake_authorize, fun, "stake_authorize", level );
18117 0 : fun(w, self->authority_seed, "authority_seed", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
18118 0 : fd_pubkey_walk( w, &self->authority_owner, fun, "authority_owner", level );
18119 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_authorize_with_seed_args", level-- );
18120 0 : }
18121 0 : ulong fd_authorize_with_seed_args_size( fd_authorize_with_seed_args_t const * self ) {
18122 0 : ulong size = 0;
18123 0 : size += fd_pubkey_size( &self->new_authorized_pubkey );
18124 0 : size += fd_stake_authorize_size( &self->stake_authorize );
18125 0 : do {
18126 0 : size += sizeof(ulong);
18127 0 : size += self->authority_seed_len;
18128 0 : } while(0);
18129 0 : size += fd_pubkey_size( &self->authority_owner );
18130 0 : return size;
18131 0 : }
18132 :
18133 0 : int fd_authorize_checked_with_seed_args_encode( fd_authorize_checked_with_seed_args_t const * self, fd_bincode_encode_ctx_t * ctx ) {
18134 0 : int err;
18135 0 : err = fd_stake_authorize_encode( &self->stake_authorize, ctx );
18136 0 : if( FD_UNLIKELY( err ) ) return err;
18137 0 : err = fd_bincode_uint64_encode( self->authority_seed_len, ctx );
18138 0 : if( FD_UNLIKELY(err) ) return err;
18139 0 : if( self->authority_seed_len ) {
18140 0 : err = fd_bincode_bytes_encode( self->authority_seed, self->authority_seed_len, ctx );
18141 0 : if( FD_UNLIKELY( err ) ) return err;
18142 0 : }
18143 0 : err = fd_pubkey_encode( &self->authority_owner, ctx );
18144 0 : if( FD_UNLIKELY( err ) ) return err;
18145 0 : return FD_BINCODE_SUCCESS;
18146 0 : }
18147 0 : int fd_authorize_checked_with_seed_args_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
18148 0 : *total_sz += sizeof(fd_authorize_checked_with_seed_args_t);
18149 0 : void const * start_data = ctx->data;
18150 0 : int err = fd_authorize_checked_with_seed_args_decode_footprint_inner( ctx, total_sz );
18151 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
18152 0 : ctx->data = start_data;
18153 0 : return err;
18154 0 : }
18155 0 : int fd_authorize_checked_with_seed_args_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
18156 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
18157 0 : int err = 0;
18158 0 : err = fd_stake_authorize_decode_footprint_inner( ctx, total_sz );
18159 0 : if( FD_UNLIKELY( err ) ) return err;
18160 0 : ulong authority_seed_len;
18161 0 : err = fd_bincode_uint64_decode( &authority_seed_len, ctx );
18162 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18163 0 : *total_sz += authority_seed_len;
18164 0 : if( authority_seed_len ) {
18165 0 : err = fd_bincode_bytes_decode_footprint( authority_seed_len, ctx );
18166 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18167 0 : err = !fd_utf8_verify( (char const *) ctx->data - authority_seed_len, authority_seed_len );
18168 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18169 0 : }
18170 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
18171 0 : if( FD_UNLIKELY( err ) ) return err;
18172 0 : return 0;
18173 0 : }
18174 0 : void * fd_authorize_checked_with_seed_args_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
18175 0 : fd_authorize_checked_with_seed_args_t * self = (fd_authorize_checked_with_seed_args_t *)mem;
18176 0 : fd_authorize_checked_with_seed_args_new( self );
18177 0 : void * alloc_region = (uchar *)mem + sizeof(fd_authorize_checked_with_seed_args_t);
18178 0 : void * * alloc_mem = &alloc_region;
18179 0 : fd_authorize_checked_with_seed_args_decode_inner( mem, alloc_mem, ctx );
18180 0 : return self;
18181 0 : }
18182 0 : void fd_authorize_checked_with_seed_args_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
18183 0 : fd_authorize_checked_with_seed_args_t * self = (fd_authorize_checked_with_seed_args_t *)struct_mem;
18184 0 : fd_stake_authorize_decode_inner( &self->stake_authorize, alloc_mem, ctx );
18185 0 : fd_bincode_uint64_decode_unsafe( &self->authority_seed_len, ctx );
18186 0 : if( self->authority_seed_len ) {
18187 0 : self->authority_seed = *alloc_mem;
18188 0 : fd_bincode_bytes_decode_unsafe( self->authority_seed, self->authority_seed_len, ctx );
18189 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->authority_seed_len;
18190 0 : } else
18191 0 : self->authority_seed = NULL;
18192 0 : fd_pubkey_decode_inner( &self->authority_owner, alloc_mem, ctx );
18193 0 : }
18194 0 : void * fd_authorize_checked_with_seed_args_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
18195 0 : fd_authorize_checked_with_seed_args_global_t * self = (fd_authorize_checked_with_seed_args_global_t *)mem;
18196 0 : fd_authorize_checked_with_seed_args_new( (fd_authorize_checked_with_seed_args_t *)self );
18197 0 : void * alloc_region = (uchar *)mem + sizeof(fd_authorize_checked_with_seed_args_global_t);
18198 0 : void * * alloc_mem = &alloc_region;
18199 0 : fd_authorize_checked_with_seed_args_decode_inner_global( mem, alloc_mem, ctx );
18200 0 : return self;
18201 0 : }
18202 0 : void fd_authorize_checked_with_seed_args_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
18203 0 : fd_authorize_checked_with_seed_args_global_t * self = (fd_authorize_checked_with_seed_args_global_t *)struct_mem;
18204 0 : fd_stake_authorize_decode_inner_global( &self->stake_authorize, alloc_mem, ctx );
18205 0 : fd_bincode_uint64_decode_unsafe( &self->authority_seed_len, ctx );
18206 0 : if( self->authority_seed_len ) {
18207 0 : self->authority_seed_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
18208 0 : fd_bincode_bytes_decode_unsafe( *alloc_mem, self->authority_seed_len, ctx );
18209 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->authority_seed_len;
18210 0 : } else
18211 0 : self->authority_seed_gaddr = 0UL;
18212 0 : fd_pubkey_decode_inner_global( &self->authority_owner, alloc_mem, ctx );
18213 0 : }
18214 0 : int fd_authorize_checked_with_seed_args_convert_global_to_local( void const * global_self, fd_authorize_checked_with_seed_args_t * self, fd_bincode_decode_ctx_t * ctx ) {
18215 0 : int err = 0;
18216 0 : fd_authorize_checked_with_seed_args_global_t const * mem = (fd_authorize_checked_with_seed_args_global_t const *)global_self;
18217 0 : err = fd_stake_authorize_convert_global_to_local( &mem->stake_authorize, &self->stake_authorize, ctx );
18218 0 : if( FD_UNLIKELY( err ) ) return err;
18219 0 : self->authority_seed_len = mem->authority_seed_len;
18220 0 : self->authority_seed = fd_wksp_laddr_fast( ctx->wksp, mem->authority_seed_gaddr );
18221 0 : err = fd_pubkey_convert_global_to_local( &mem->authority_owner, &self->authority_owner, ctx );
18222 0 : if( FD_UNLIKELY( err ) ) return err;
18223 0 : return FD_BINCODE_SUCCESS;
18224 0 : }
18225 0 : void fd_authorize_checked_with_seed_args_new(fd_authorize_checked_with_seed_args_t * self) {
18226 0 : fd_memset( self, 0, sizeof(fd_authorize_checked_with_seed_args_t) );
18227 0 : fd_stake_authorize_new( &self->stake_authorize );
18228 0 : fd_pubkey_new( &self->authority_owner );
18229 0 : }
18230 0 : void fd_authorize_checked_with_seed_args_destroy( fd_authorize_checked_with_seed_args_t * self ) {
18231 0 : fd_stake_authorize_destroy( &self->stake_authorize );
18232 0 : if( self->authority_seed ) {
18233 0 : self->authority_seed = NULL;
18234 0 : }
18235 0 : fd_pubkey_destroy( &self->authority_owner );
18236 0 : }
18237 :
18238 0 : ulong fd_authorize_checked_with_seed_args_footprint( void ){ return FD_AUTHORIZE_CHECKED_WITH_SEED_ARGS_FOOTPRINT; }
18239 0 : ulong fd_authorize_checked_with_seed_args_align( void ){ return FD_AUTHORIZE_CHECKED_WITH_SEED_ARGS_ALIGN; }
18240 :
18241 0 : void fd_authorize_checked_with_seed_args_walk( void * w, fd_authorize_checked_with_seed_args_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
18242 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_authorize_checked_with_seed_args", level++ );
18243 0 : fd_stake_authorize_walk( w, &self->stake_authorize, fun, "stake_authorize", level );
18244 0 : fun(w, self->authority_seed, "authority_seed", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
18245 0 : fd_pubkey_walk( w, &self->authority_owner, fun, "authority_owner", level );
18246 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_authorize_checked_with_seed_args", level-- );
18247 0 : }
18248 0 : ulong fd_authorize_checked_with_seed_args_size( fd_authorize_checked_with_seed_args_t const * self ) {
18249 0 : ulong size = 0;
18250 0 : size += fd_stake_authorize_size( &self->stake_authorize );
18251 0 : do {
18252 0 : size += sizeof(ulong);
18253 0 : size += self->authority_seed_len;
18254 0 : } while(0);
18255 0 : size += fd_pubkey_size( &self->authority_owner );
18256 0 : return size;
18257 0 : }
18258 :
18259 0 : int fd_lockup_checked_args_encode( fd_lockup_checked_args_t const * self, fd_bincode_encode_ctx_t * ctx ) {
18260 0 : int err;
18261 0 : if( self->unix_timestamp != NULL ) {
18262 0 : err = fd_bincode_bool_encode( 1, ctx );
18263 0 : if( FD_UNLIKELY( err ) ) return err;
18264 0 : err = fd_bincode_int64_encode( self->unix_timestamp[0], ctx );
18265 0 : if( FD_UNLIKELY( err ) ) return err;
18266 0 : } else {
18267 0 : err = fd_bincode_bool_encode( 0, ctx );
18268 0 : if( FD_UNLIKELY( err ) ) return err;
18269 0 : }
18270 0 : if( self->epoch != NULL ) {
18271 0 : err = fd_bincode_bool_encode( 1, ctx );
18272 0 : if( FD_UNLIKELY( err ) ) return err;
18273 0 : err = fd_bincode_uint64_encode( self->epoch[0], ctx );
18274 0 : if( FD_UNLIKELY( err ) ) return err;
18275 0 : } else {
18276 0 : err = fd_bincode_bool_encode( 0, ctx );
18277 0 : if( FD_UNLIKELY( err ) ) return err;
18278 0 : }
18279 0 : return FD_BINCODE_SUCCESS;
18280 0 : }
18281 0 : int fd_lockup_checked_args_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
18282 0 : *total_sz += sizeof(fd_lockup_checked_args_t);
18283 0 : void const * start_data = ctx->data;
18284 0 : int err = fd_lockup_checked_args_decode_footprint_inner( ctx, total_sz );
18285 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
18286 0 : ctx->data = start_data;
18287 0 : return err;
18288 0 : }
18289 0 : int fd_lockup_checked_args_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
18290 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
18291 0 : int err = 0;
18292 0 : {
18293 0 : uchar o;
18294 0 : err = fd_bincode_bool_decode( &o, ctx );
18295 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18296 0 : if( o ) {
18297 0 : *total_sz += 8UL + sizeof(long);
18298 0 : err = fd_bincode_int64_decode_footprint( ctx );
18299 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18300 0 : }
18301 0 : }
18302 0 : {
18303 0 : uchar o;
18304 0 : err = fd_bincode_bool_decode( &o, ctx );
18305 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18306 0 : if( o ) {
18307 0 : *total_sz += 8UL + sizeof(ulong);
18308 0 : err = fd_bincode_uint64_decode_footprint( ctx );
18309 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18310 0 : }
18311 0 : }
18312 0 : return 0;
18313 0 : }
18314 0 : void * fd_lockup_checked_args_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
18315 0 : fd_lockup_checked_args_t * self = (fd_lockup_checked_args_t *)mem;
18316 0 : fd_lockup_checked_args_new( self );
18317 0 : void * alloc_region = (uchar *)mem + sizeof(fd_lockup_checked_args_t);
18318 0 : void * * alloc_mem = &alloc_region;
18319 0 : fd_lockup_checked_args_decode_inner( mem, alloc_mem, ctx );
18320 0 : return self;
18321 0 : }
18322 0 : void fd_lockup_checked_args_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
18323 0 : fd_lockup_checked_args_t * self = (fd_lockup_checked_args_t *)struct_mem;
18324 0 : {
18325 0 : uchar o;
18326 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
18327 0 : if( o ) {
18328 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, 8UL );
18329 0 : self->unix_timestamp = *alloc_mem;
18330 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(long);
18331 0 : fd_bincode_int64_decode_unsafe( self->unix_timestamp, ctx );
18332 0 : } else {
18333 0 : self->unix_timestamp = NULL;
18334 0 : }
18335 0 : }
18336 0 : {
18337 0 : uchar o;
18338 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
18339 0 : if( o ) {
18340 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, 8UL );
18341 0 : self->epoch = *alloc_mem;
18342 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(ulong);
18343 0 : fd_bincode_uint64_decode_unsafe( self->epoch, ctx );
18344 0 : } else {
18345 0 : self->epoch = NULL;
18346 0 : }
18347 0 : }
18348 0 : }
18349 0 : void * fd_lockup_checked_args_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
18350 0 : fd_lockup_checked_args_global_t * self = (fd_lockup_checked_args_global_t *)mem;
18351 0 : fd_lockup_checked_args_new( (fd_lockup_checked_args_t *)self );
18352 0 : void * alloc_region = (uchar *)mem + sizeof(fd_lockup_checked_args_global_t);
18353 0 : void * * alloc_mem = &alloc_region;
18354 0 : fd_lockup_checked_args_decode_inner_global( mem, alloc_mem, ctx );
18355 0 : return self;
18356 0 : }
18357 0 : void fd_lockup_checked_args_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
18358 0 : fd_lockup_checked_args_global_t * self = (fd_lockup_checked_args_global_t *)struct_mem;
18359 0 : {
18360 0 : uchar o;
18361 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
18362 0 : if( o ) {
18363 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, 8UL );
18364 0 : self->unix_timestamp_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
18365 0 : fd_bincode_int64_decode_unsafe( *alloc_mem, ctx );
18366 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(long);
18367 0 : } else {
18368 0 : self->unix_timestamp_gaddr = 0UL;
18369 0 : }
18370 0 : }
18371 0 : {
18372 0 : uchar o;
18373 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
18374 0 : if( o ) {
18375 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, 8UL );
18376 0 : self->epoch_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
18377 0 : fd_bincode_uint64_decode_unsafe( *alloc_mem, ctx );
18378 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(ulong);
18379 0 : } else {
18380 0 : self->epoch_gaddr = 0UL;
18381 0 : }
18382 0 : }
18383 0 : }
18384 0 : int fd_lockup_checked_args_convert_global_to_local( void const * global_self, fd_lockup_checked_args_t * self, fd_bincode_decode_ctx_t * ctx ) {
18385 0 : int err = 0;
18386 0 : fd_lockup_checked_args_global_t const * mem = (fd_lockup_checked_args_global_t const *)global_self;
18387 0 : self->unix_timestamp = fd_wksp_laddr_fast( ctx->wksp, mem->unix_timestamp_gaddr );
18388 0 : self->epoch = fd_wksp_laddr_fast( ctx->wksp, mem->epoch_gaddr );
18389 0 : return FD_BINCODE_SUCCESS;
18390 0 : }
18391 0 : void fd_lockup_checked_args_new(fd_lockup_checked_args_t * self) {
18392 0 : fd_memset( self, 0, sizeof(fd_lockup_checked_args_t) );
18393 0 : }
18394 0 : void fd_lockup_checked_args_destroy( fd_lockup_checked_args_t * self ) {
18395 0 : if( self->unix_timestamp ) {
18396 0 : self->unix_timestamp = NULL;
18397 0 : }
18398 0 : if( self->epoch ) {
18399 0 : self->epoch = NULL;
18400 0 : }
18401 0 : }
18402 :
18403 0 : ulong fd_lockup_checked_args_footprint( void ){ return FD_LOCKUP_CHECKED_ARGS_FOOTPRINT; }
18404 0 : ulong fd_lockup_checked_args_align( void ){ return FD_LOCKUP_CHECKED_ARGS_ALIGN; }
18405 :
18406 0 : void fd_lockup_checked_args_walk( void * w, fd_lockup_checked_args_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
18407 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_lockup_checked_args", level++ );
18408 0 : if( !self->unix_timestamp ) {
18409 0 : fun( w, NULL, "unix_timestamp", FD_FLAMENCO_TYPE_NULL, "long", level );
18410 0 : } else {
18411 0 : fun( w, self->unix_timestamp, "unix_timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level );
18412 0 : }
18413 0 : if( !self->epoch ) {
18414 0 : fun( w, NULL, "epoch", FD_FLAMENCO_TYPE_NULL, "ulong", level );
18415 0 : } else {
18416 0 : fun( w, self->epoch, "epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
18417 0 : }
18418 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_lockup_checked_args", level-- );
18419 0 : }
18420 0 : ulong fd_lockup_checked_args_size( fd_lockup_checked_args_t const * self ) {
18421 0 : ulong size = 0;
18422 0 : size += sizeof(char);
18423 0 : if( NULL != self->unix_timestamp ) {
18424 0 : size += sizeof(long);
18425 0 : }
18426 0 : size += sizeof(char);
18427 0 : if( NULL != self->epoch ) {
18428 0 : size += sizeof(ulong);
18429 0 : }
18430 0 : return size;
18431 0 : }
18432 :
18433 0 : int fd_lockup_args_encode( fd_lockup_args_t const * self, fd_bincode_encode_ctx_t * ctx ) {
18434 0 : int err;
18435 0 : if( self->unix_timestamp != NULL ) {
18436 0 : err = fd_bincode_bool_encode( 1, ctx );
18437 0 : if( FD_UNLIKELY( err ) ) return err;
18438 0 : err = fd_bincode_int64_encode( self->unix_timestamp[0], ctx );
18439 0 : if( FD_UNLIKELY( err ) ) return err;
18440 0 : } else {
18441 0 : err = fd_bincode_bool_encode( 0, ctx );
18442 0 : if( FD_UNLIKELY( err ) ) return err;
18443 0 : }
18444 0 : if( self->epoch != NULL ) {
18445 0 : err = fd_bincode_bool_encode( 1, ctx );
18446 0 : if( FD_UNLIKELY( err ) ) return err;
18447 0 : err = fd_bincode_uint64_encode( self->epoch[0], ctx );
18448 0 : if( FD_UNLIKELY( err ) ) return err;
18449 0 : } else {
18450 0 : err = fd_bincode_bool_encode( 0, ctx );
18451 0 : if( FD_UNLIKELY( err ) ) return err;
18452 0 : }
18453 0 : if( self->custodian != NULL ) {
18454 0 : err = fd_bincode_bool_encode( 1, ctx );
18455 0 : if( FD_UNLIKELY( err ) ) return err;
18456 0 : err = fd_pubkey_encode( self->custodian, ctx );
18457 0 : if( FD_UNLIKELY( err ) ) return err;
18458 0 : } else {
18459 0 : err = fd_bincode_bool_encode( 0, ctx );
18460 0 : if( FD_UNLIKELY( err ) ) return err;
18461 0 : }
18462 0 : return FD_BINCODE_SUCCESS;
18463 0 : }
18464 0 : int fd_lockup_args_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
18465 0 : *total_sz += sizeof(fd_lockup_args_t);
18466 0 : void const * start_data = ctx->data;
18467 0 : int err = fd_lockup_args_decode_footprint_inner( ctx, total_sz );
18468 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
18469 0 : ctx->data = start_data;
18470 0 : return err;
18471 0 : }
18472 0 : int fd_lockup_args_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
18473 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
18474 0 : int err = 0;
18475 0 : {
18476 0 : uchar o;
18477 0 : err = fd_bincode_bool_decode( &o, ctx );
18478 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18479 0 : if( o ) {
18480 0 : *total_sz += 8UL + sizeof(long);
18481 0 : err = fd_bincode_int64_decode_footprint( ctx );
18482 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18483 0 : }
18484 0 : }
18485 0 : {
18486 0 : uchar o;
18487 0 : err = fd_bincode_bool_decode( &o, ctx );
18488 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18489 0 : if( o ) {
18490 0 : *total_sz += 8UL + sizeof(ulong);
18491 0 : err = fd_bincode_uint64_decode_footprint( ctx );
18492 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18493 0 : }
18494 0 : }
18495 0 : {
18496 0 : uchar o;
18497 0 : err = fd_bincode_bool_decode( &o, ctx );
18498 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18499 0 : if( o ) {
18500 0 : *total_sz += FD_PUBKEY_ALIGN + FD_PUBKEY_FOOTPRINT;
18501 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
18502 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18503 0 : }
18504 0 : }
18505 0 : return 0;
18506 0 : }
18507 0 : void * fd_lockup_args_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
18508 0 : fd_lockup_args_t * self = (fd_lockup_args_t *)mem;
18509 0 : fd_lockup_args_new( self );
18510 0 : void * alloc_region = (uchar *)mem + sizeof(fd_lockup_args_t);
18511 0 : void * * alloc_mem = &alloc_region;
18512 0 : fd_lockup_args_decode_inner( mem, alloc_mem, ctx );
18513 0 : return self;
18514 0 : }
18515 0 : void fd_lockup_args_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
18516 0 : fd_lockup_args_t * self = (fd_lockup_args_t *)struct_mem;
18517 0 : {
18518 0 : uchar o;
18519 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
18520 0 : if( o ) {
18521 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, 8UL );
18522 0 : self->unix_timestamp = *alloc_mem;
18523 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(long);
18524 0 : fd_bincode_int64_decode_unsafe( self->unix_timestamp, ctx );
18525 0 : } else {
18526 0 : self->unix_timestamp = NULL;
18527 0 : }
18528 0 : }
18529 0 : {
18530 0 : uchar o;
18531 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
18532 0 : if( o ) {
18533 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, 8UL );
18534 0 : self->epoch = *alloc_mem;
18535 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(ulong);
18536 0 : fd_bincode_uint64_decode_unsafe( self->epoch, ctx );
18537 0 : } else {
18538 0 : self->epoch = NULL;
18539 0 : }
18540 0 : }
18541 0 : {
18542 0 : uchar o;
18543 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
18544 0 : if( o ) {
18545 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, FD_PUBKEY_ALIGN );
18546 0 : self->custodian = *alloc_mem;
18547 0 : *alloc_mem = (uchar *)*alloc_mem + FD_PUBKEY_FOOTPRINT;
18548 0 : fd_pubkey_new( self->custodian );
18549 0 : fd_pubkey_decode_inner( self->custodian, alloc_mem, ctx );
18550 0 : } else {
18551 0 : self->custodian = NULL;
18552 0 : }
18553 0 : }
18554 0 : }
18555 0 : void * fd_lockup_args_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
18556 0 : fd_lockup_args_global_t * self = (fd_lockup_args_global_t *)mem;
18557 0 : fd_lockup_args_new( (fd_lockup_args_t *)self );
18558 0 : void * alloc_region = (uchar *)mem + sizeof(fd_lockup_args_global_t);
18559 0 : void * * alloc_mem = &alloc_region;
18560 0 : fd_lockup_args_decode_inner_global( mem, alloc_mem, ctx );
18561 0 : return self;
18562 0 : }
18563 0 : void fd_lockup_args_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
18564 0 : fd_lockup_args_global_t * self = (fd_lockup_args_global_t *)struct_mem;
18565 0 : {
18566 0 : uchar o;
18567 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
18568 0 : if( o ) {
18569 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, 8UL );
18570 0 : self->unix_timestamp_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
18571 0 : fd_bincode_int64_decode_unsafe( *alloc_mem, ctx );
18572 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(long);
18573 0 : } else {
18574 0 : self->unix_timestamp_gaddr = 0UL;
18575 0 : }
18576 0 : }
18577 0 : {
18578 0 : uchar o;
18579 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
18580 0 : if( o ) {
18581 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, 8UL );
18582 0 : self->epoch_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
18583 0 : fd_bincode_uint64_decode_unsafe( *alloc_mem, ctx );
18584 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(ulong);
18585 0 : } else {
18586 0 : self->epoch_gaddr = 0UL;
18587 0 : }
18588 0 : }
18589 0 : {
18590 0 : uchar o;
18591 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
18592 0 : if( o ) {
18593 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, FD_PUBKEY_ALIGN );
18594 0 : self->custodian_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
18595 0 : fd_pubkey_new( *alloc_mem );
18596 0 : *alloc_mem = (uchar *)*alloc_mem + FD_PUBKEY_FOOTPRINT;
18597 0 : fd_pubkey_decode_inner_global( fd_wksp_laddr_fast( ctx->wksp, self->custodian_gaddr ), alloc_mem, ctx );
18598 0 : } else {
18599 0 : self->custodian_gaddr = 0UL;
18600 0 : }
18601 0 : }
18602 0 : }
18603 0 : int fd_lockup_args_convert_global_to_local( void const * global_self, fd_lockup_args_t * self, fd_bincode_decode_ctx_t * ctx ) {
18604 0 : int err = 0;
18605 0 : fd_lockup_args_global_t const * mem = (fd_lockup_args_global_t const *)global_self;
18606 0 : self->unix_timestamp = fd_wksp_laddr_fast( ctx->wksp, mem->unix_timestamp_gaddr );
18607 0 : self->epoch = fd_wksp_laddr_fast( ctx->wksp, mem->epoch_gaddr );
18608 0 : self->custodian = fd_wksp_laddr_fast( ctx->wksp, mem->custodian_gaddr );
18609 0 : return FD_BINCODE_SUCCESS;
18610 0 : }
18611 0 : void fd_lockup_args_new(fd_lockup_args_t * self) {
18612 0 : fd_memset( self, 0, sizeof(fd_lockup_args_t) );
18613 0 : }
18614 0 : void fd_lockup_args_destroy( fd_lockup_args_t * self ) {
18615 0 : if( self->unix_timestamp ) {
18616 0 : self->unix_timestamp = NULL;
18617 0 : }
18618 0 : if( self->epoch ) {
18619 0 : self->epoch = NULL;
18620 0 : }
18621 0 : if( self->custodian ) {
18622 0 : fd_pubkey_destroy( self->custodian );
18623 0 : self->custodian = NULL;
18624 0 : }
18625 0 : }
18626 :
18627 0 : ulong fd_lockup_args_footprint( void ){ return FD_LOCKUP_ARGS_FOOTPRINT; }
18628 0 : ulong fd_lockup_args_align( void ){ return FD_LOCKUP_ARGS_ALIGN; }
18629 :
18630 0 : void fd_lockup_args_walk( void * w, fd_lockup_args_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
18631 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_lockup_args", level++ );
18632 0 : if( !self->unix_timestamp ) {
18633 0 : fun( w, NULL, "unix_timestamp", FD_FLAMENCO_TYPE_NULL, "long", level );
18634 0 : } else {
18635 0 : fun( w, self->unix_timestamp, "unix_timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level );
18636 0 : }
18637 0 : if( !self->epoch ) {
18638 0 : fun( w, NULL, "epoch", FD_FLAMENCO_TYPE_NULL, "ulong", level );
18639 0 : } else {
18640 0 : fun( w, self->epoch, "epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
18641 0 : }
18642 0 : if( !self->custodian ) {
18643 0 : fun( w, NULL, "custodian", FD_FLAMENCO_TYPE_NULL, "pubkey", level );
18644 0 : } else {
18645 0 : fd_pubkey_walk( w, self->custodian, fun, "custodian", level );
18646 0 : }
18647 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_lockup_args", level-- );
18648 0 : }
18649 0 : ulong fd_lockup_args_size( fd_lockup_args_t const * self ) {
18650 0 : ulong size = 0;
18651 0 : size += sizeof(char);
18652 0 : if( NULL != self->unix_timestamp ) {
18653 0 : size += sizeof(long);
18654 0 : }
18655 0 : size += sizeof(char);
18656 0 : if( NULL != self->epoch ) {
18657 0 : size += sizeof(ulong);
18658 0 : }
18659 0 : size += sizeof(char);
18660 0 : if( NULL != self->custodian ) {
18661 0 : size += fd_pubkey_size( self->custodian );
18662 0 : }
18663 0 : return size;
18664 0 : }
18665 :
18666 0 : FD_FN_PURE uchar fd_stake_instruction_is_initialize(fd_stake_instruction_t const * self) {
18667 0 : return self->discriminant == 0;
18668 0 : }
18669 0 : FD_FN_PURE uchar fd_stake_instruction_is_authorize(fd_stake_instruction_t const * self) {
18670 0 : return self->discriminant == 1;
18671 0 : }
18672 0 : FD_FN_PURE uchar fd_stake_instruction_is_delegate_stake(fd_stake_instruction_t const * self) {
18673 0 : return self->discriminant == 2;
18674 0 : }
18675 0 : FD_FN_PURE uchar fd_stake_instruction_is_split(fd_stake_instruction_t const * self) {
18676 0 : return self->discriminant == 3;
18677 0 : }
18678 0 : FD_FN_PURE uchar fd_stake_instruction_is_withdraw(fd_stake_instruction_t const * self) {
18679 0 : return self->discriminant == 4;
18680 0 : }
18681 0 : FD_FN_PURE uchar fd_stake_instruction_is_deactivate(fd_stake_instruction_t const * self) {
18682 0 : return self->discriminant == 5;
18683 0 : }
18684 0 : FD_FN_PURE uchar fd_stake_instruction_is_set_lockup(fd_stake_instruction_t const * self) {
18685 0 : return self->discriminant == 6;
18686 0 : }
18687 0 : FD_FN_PURE uchar fd_stake_instruction_is_merge(fd_stake_instruction_t const * self) {
18688 0 : return self->discriminant == 7;
18689 0 : }
18690 0 : FD_FN_PURE uchar fd_stake_instruction_is_authorize_with_seed(fd_stake_instruction_t const * self) {
18691 0 : return self->discriminant == 8;
18692 0 : }
18693 0 : FD_FN_PURE uchar fd_stake_instruction_is_initialize_checked(fd_stake_instruction_t const * self) {
18694 0 : return self->discriminant == 9;
18695 0 : }
18696 0 : FD_FN_PURE uchar fd_stake_instruction_is_authorize_checked(fd_stake_instruction_t const * self) {
18697 0 : return self->discriminant == 10;
18698 0 : }
18699 0 : FD_FN_PURE uchar fd_stake_instruction_is_authorize_checked_with_seed(fd_stake_instruction_t const * self) {
18700 0 : return self->discriminant == 11;
18701 0 : }
18702 0 : FD_FN_PURE uchar fd_stake_instruction_is_set_lockup_checked(fd_stake_instruction_t const * self) {
18703 0 : return self->discriminant == 12;
18704 0 : }
18705 0 : FD_FN_PURE uchar fd_stake_instruction_is_get_minimum_delegation(fd_stake_instruction_t const * self) {
18706 0 : return self->discriminant == 13;
18707 0 : }
18708 0 : FD_FN_PURE uchar fd_stake_instruction_is_deactivate_delinquent(fd_stake_instruction_t const * self) {
18709 0 : return self->discriminant == 14;
18710 0 : }
18711 0 : FD_FN_PURE uchar fd_stake_instruction_is_redelegate(fd_stake_instruction_t const * self) {
18712 0 : return self->discriminant == 15;
18713 0 : }
18714 0 : FD_FN_PURE uchar fd_stake_instruction_is_move_stake(fd_stake_instruction_t const * self) {
18715 0 : return self->discriminant == 16;
18716 0 : }
18717 0 : FD_FN_PURE uchar fd_stake_instruction_is_move_lamports(fd_stake_instruction_t const * self) {
18718 0 : return self->discriminant == 17;
18719 0 : }
18720 : void fd_stake_instruction_inner_new( fd_stake_instruction_inner_t * self, uint discriminant );
18721 0 : int fd_stake_instruction_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
18722 0 : int err;
18723 0 : switch (discriminant) {
18724 0 : case 0: {
18725 0 : err = fd_stake_instruction_initialize_decode_footprint_inner( ctx, total_sz );
18726 0 : if( FD_UNLIKELY( err ) ) return err;
18727 0 : return FD_BINCODE_SUCCESS;
18728 0 : }
18729 0 : case 1: {
18730 0 : err = fd_stake_instruction_authorize_decode_footprint_inner( ctx, total_sz );
18731 0 : if( FD_UNLIKELY( err ) ) return err;
18732 0 : return FD_BINCODE_SUCCESS;
18733 0 : }
18734 0 : case 2: {
18735 0 : return FD_BINCODE_SUCCESS;
18736 0 : }
18737 0 : case 3: {
18738 0 : err = fd_bincode_uint64_decode_footprint( ctx );
18739 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18740 0 : return FD_BINCODE_SUCCESS;
18741 0 : }
18742 0 : case 4: {
18743 0 : err = fd_bincode_uint64_decode_footprint( ctx );
18744 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18745 0 : return FD_BINCODE_SUCCESS;
18746 0 : }
18747 0 : case 5: {
18748 0 : return FD_BINCODE_SUCCESS;
18749 0 : }
18750 0 : case 6: {
18751 0 : err = fd_lockup_args_decode_footprint_inner( ctx, total_sz );
18752 0 : if( FD_UNLIKELY( err ) ) return err;
18753 0 : return FD_BINCODE_SUCCESS;
18754 0 : }
18755 0 : case 7: {
18756 0 : return FD_BINCODE_SUCCESS;
18757 0 : }
18758 0 : case 8: {
18759 0 : err = fd_authorize_with_seed_args_decode_footprint_inner( ctx, total_sz );
18760 0 : if( FD_UNLIKELY( err ) ) return err;
18761 0 : return FD_BINCODE_SUCCESS;
18762 0 : }
18763 0 : case 9: {
18764 0 : return FD_BINCODE_SUCCESS;
18765 0 : }
18766 0 : case 10: {
18767 0 : err = fd_stake_authorize_decode_footprint_inner( ctx, total_sz );
18768 0 : if( FD_UNLIKELY( err ) ) return err;
18769 0 : return FD_BINCODE_SUCCESS;
18770 0 : }
18771 0 : case 11: {
18772 0 : err = fd_authorize_checked_with_seed_args_decode_footprint_inner( ctx, total_sz );
18773 0 : if( FD_UNLIKELY( err ) ) return err;
18774 0 : return FD_BINCODE_SUCCESS;
18775 0 : }
18776 0 : case 12: {
18777 0 : err = fd_lockup_checked_args_decode_footprint_inner( ctx, total_sz );
18778 0 : if( FD_UNLIKELY( err ) ) return err;
18779 0 : return FD_BINCODE_SUCCESS;
18780 0 : }
18781 0 : case 13: {
18782 0 : return FD_BINCODE_SUCCESS;
18783 0 : }
18784 0 : case 14: {
18785 0 : return FD_BINCODE_SUCCESS;
18786 0 : }
18787 0 : case 15: {
18788 0 : return FD_BINCODE_SUCCESS;
18789 0 : }
18790 0 : case 16: {
18791 0 : err = fd_bincode_uint64_decode_footprint( ctx );
18792 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18793 0 : return FD_BINCODE_SUCCESS;
18794 0 : }
18795 0 : case 17: {
18796 0 : err = fd_bincode_uint64_decode_footprint( ctx );
18797 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18798 0 : return FD_BINCODE_SUCCESS;
18799 0 : }
18800 0 : default: return FD_BINCODE_ERR_ENCODING;
18801 0 : }
18802 0 : }
18803 0 : int fd_stake_instruction_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
18804 0 : *total_sz += sizeof(fd_stake_instruction_t);
18805 0 : void const * start_data = ctx->data;
18806 0 : int err = fd_stake_instruction_decode_footprint_inner( ctx, total_sz );
18807 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
18808 0 : ctx->data = start_data;
18809 0 : return err;
18810 0 : }
18811 0 : int fd_stake_instruction_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
18812 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
18813 0 : uint discriminant = 0;
18814 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
18815 0 : if( FD_UNLIKELY( err ) ) return err;
18816 0 : return fd_stake_instruction_inner_decode_footprint( discriminant, ctx, total_sz );
18817 0 : }
18818 0 : void fd_stake_instruction_inner_decode_inner( fd_stake_instruction_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
18819 0 : switch (discriminant) {
18820 0 : case 0: {
18821 0 : fd_stake_instruction_initialize_decode_inner( &self->initialize, alloc_mem, ctx );
18822 0 : break;
18823 0 : }
18824 0 : case 1: {
18825 0 : fd_stake_instruction_authorize_decode_inner( &self->authorize, alloc_mem, ctx );
18826 0 : break;
18827 0 : }
18828 0 : case 2: {
18829 0 : break;
18830 0 : }
18831 0 : case 3: {
18832 0 : fd_bincode_uint64_decode_unsafe( &self->split, ctx );
18833 0 : break;
18834 0 : }
18835 0 : case 4: {
18836 0 : fd_bincode_uint64_decode_unsafe( &self->withdraw, ctx );
18837 0 : break;
18838 0 : }
18839 0 : case 5: {
18840 0 : break;
18841 0 : }
18842 0 : case 6: {
18843 0 : fd_lockup_args_decode_inner( &self->set_lockup, alloc_mem, ctx );
18844 0 : break;
18845 0 : }
18846 0 : case 7: {
18847 0 : break;
18848 0 : }
18849 0 : case 8: {
18850 0 : fd_authorize_with_seed_args_decode_inner( &self->authorize_with_seed, alloc_mem, ctx );
18851 0 : break;
18852 0 : }
18853 0 : case 9: {
18854 0 : break;
18855 0 : }
18856 0 : case 10: {
18857 0 : fd_stake_authorize_decode_inner( &self->authorize_checked, alloc_mem, ctx );
18858 0 : break;
18859 0 : }
18860 0 : case 11: {
18861 0 : fd_authorize_checked_with_seed_args_decode_inner( &self->authorize_checked_with_seed, alloc_mem, ctx );
18862 0 : break;
18863 0 : }
18864 0 : case 12: {
18865 0 : fd_lockup_checked_args_decode_inner( &self->set_lockup_checked, alloc_mem, ctx );
18866 0 : break;
18867 0 : }
18868 0 : case 13: {
18869 0 : break;
18870 0 : }
18871 0 : case 14: {
18872 0 : break;
18873 0 : }
18874 0 : case 15: {
18875 0 : break;
18876 0 : }
18877 0 : case 16: {
18878 0 : fd_bincode_uint64_decode_unsafe( &self->move_stake, ctx );
18879 0 : break;
18880 0 : }
18881 0 : case 17: {
18882 0 : fd_bincode_uint64_decode_unsafe( &self->move_lamports, ctx );
18883 0 : break;
18884 0 : }
18885 0 : }
18886 0 : }
18887 0 : void fd_stake_instruction_inner_decode_inner_global( fd_stake_instruction_inner_global_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
18888 0 : switch (discriminant) {
18889 0 : case 0: {
18890 0 : fd_stake_instruction_initialize_decode_inner_global( &self->initialize, alloc_mem, ctx );
18891 0 : break;
18892 0 : }
18893 0 : case 1: {
18894 0 : fd_stake_instruction_authorize_decode_inner_global( &self->authorize, alloc_mem, ctx );
18895 0 : break;
18896 0 : }
18897 0 : case 2: {
18898 0 : break;
18899 0 : }
18900 0 : case 3: {
18901 0 : fd_bincode_uint64_decode_unsafe( &self->split, ctx );
18902 0 : break;
18903 0 : }
18904 0 : case 4: {
18905 0 : fd_bincode_uint64_decode_unsafe( &self->withdraw, ctx );
18906 0 : break;
18907 0 : }
18908 0 : case 5: {
18909 0 : break;
18910 0 : }
18911 0 : case 6: {
18912 0 : fd_lockup_args_decode_inner_global( &self->set_lockup, alloc_mem, ctx );
18913 0 : break;
18914 0 : }
18915 0 : case 7: {
18916 0 : break;
18917 0 : }
18918 0 : case 8: {
18919 0 : fd_authorize_with_seed_args_decode_inner_global( &self->authorize_with_seed, alloc_mem, ctx );
18920 0 : break;
18921 0 : }
18922 0 : case 9: {
18923 0 : break;
18924 0 : }
18925 0 : case 10: {
18926 0 : fd_stake_authorize_decode_inner_global( &self->authorize_checked, alloc_mem, ctx );
18927 0 : break;
18928 0 : }
18929 0 : case 11: {
18930 0 : fd_authorize_checked_with_seed_args_decode_inner_global( &self->authorize_checked_with_seed, alloc_mem, ctx );
18931 0 : break;
18932 0 : }
18933 0 : case 12: {
18934 0 : fd_lockup_checked_args_decode_inner_global( &self->set_lockup_checked, alloc_mem, ctx );
18935 0 : break;
18936 0 : }
18937 0 : case 13: {
18938 0 : break;
18939 0 : }
18940 0 : case 14: {
18941 0 : break;
18942 0 : }
18943 0 : case 15: {
18944 0 : break;
18945 0 : }
18946 0 : case 16: {
18947 0 : fd_bincode_uint64_decode_unsafe( &self->move_stake, ctx );
18948 0 : break;
18949 0 : }
18950 0 : case 17: {
18951 0 : fd_bincode_uint64_decode_unsafe( &self->move_lamports, ctx );
18952 0 : break;
18953 0 : }
18954 0 : }
18955 0 : }
18956 0 : int fd_stake_instruction_convert_global_to_local_inner( fd_stake_instruction_inner_global_t const * mem, fd_stake_instruction_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
18957 0 : int err = 0;
18958 0 : switch( discriminant ) {
18959 0 : case 0: {
18960 0 : err = fd_stake_instruction_initialize_convert_global_to_local( &mem->initialize, &self->initialize, ctx );
18961 0 : if( FD_UNLIKELY( err ) ) return err;
18962 0 : break;
18963 0 : }
18964 0 : case 1: {
18965 0 : err = fd_stake_instruction_authorize_convert_global_to_local( &mem->authorize, &self->authorize, ctx );
18966 0 : if( FD_UNLIKELY( err ) ) return err;
18967 0 : break;
18968 0 : }
18969 0 : case 2: {
18970 0 : break;
18971 0 : }
18972 0 : case 3: {
18973 0 : self->split = mem->split;
18974 0 : break;
18975 0 : }
18976 0 : case 4: {
18977 0 : self->withdraw = mem->withdraw;
18978 0 : break;
18979 0 : }
18980 0 : case 5: {
18981 0 : break;
18982 0 : }
18983 0 : case 6: {
18984 0 : err = fd_lockup_args_convert_global_to_local( &mem->set_lockup, &self->set_lockup, ctx );
18985 0 : if( FD_UNLIKELY( err ) ) return err;
18986 0 : break;
18987 0 : }
18988 0 : case 7: {
18989 0 : break;
18990 0 : }
18991 0 : case 8: {
18992 0 : err = fd_authorize_with_seed_args_convert_global_to_local( &mem->authorize_with_seed, &self->authorize_with_seed, ctx );
18993 0 : if( FD_UNLIKELY( err ) ) return err;
18994 0 : break;
18995 0 : }
18996 0 : case 9: {
18997 0 : break;
18998 0 : }
18999 0 : case 10: {
19000 0 : err = fd_stake_authorize_convert_global_to_local( &mem->authorize_checked, &self->authorize_checked, ctx );
19001 0 : if( FD_UNLIKELY( err ) ) return err;
19002 0 : break;
19003 0 : }
19004 0 : case 11: {
19005 0 : err = fd_authorize_checked_with_seed_args_convert_global_to_local( &mem->authorize_checked_with_seed, &self->authorize_checked_with_seed, ctx );
19006 0 : if( FD_UNLIKELY( err ) ) return err;
19007 0 : break;
19008 0 : }
19009 0 : case 12: {
19010 0 : err = fd_lockup_checked_args_convert_global_to_local( &mem->set_lockup_checked, &self->set_lockup_checked, ctx );
19011 0 : if( FD_UNLIKELY( err ) ) return err;
19012 0 : break;
19013 0 : }
19014 0 : case 13: {
19015 0 : break;
19016 0 : }
19017 0 : case 14: {
19018 0 : break;
19019 0 : }
19020 0 : case 15: {
19021 0 : break;
19022 0 : }
19023 0 : case 16: {
19024 0 : self->move_stake = mem->move_stake;
19025 0 : break;
19026 0 : }
19027 0 : case 17: {
19028 0 : self->move_lamports = mem->move_lamports;
19029 0 : break;
19030 0 : }
19031 0 : }
19032 0 : return FD_BINCODE_SUCCESS;
19033 0 : }
19034 0 : int fd_stake_instruction_convert_global_to_local( void const * global_self, fd_stake_instruction_t * self, fd_bincode_decode_ctx_t * ctx ) {
19035 0 : fd_stake_instruction_global_t const * mem = (fd_stake_instruction_global_t const *)global_self;
19036 0 : uint discriminant = mem->discriminant;
19037 0 : self->discriminant = mem->discriminant;
19038 0 : int err = fd_stake_instruction_convert_global_to_local_inner( &mem->inner, &self->inner, discriminant, ctx );
19039 0 : return FD_BINCODE_SUCCESS;
19040 0 : }
19041 0 : void fd_stake_instruction_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
19042 0 : fd_stake_instruction_t * self = (fd_stake_instruction_t *)struct_mem;
19043 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
19044 0 : fd_stake_instruction_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
19045 0 : }
19046 0 : void * fd_stake_instruction_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
19047 0 : fd_stake_instruction_t * self = (fd_stake_instruction_t *)mem;
19048 0 : fd_stake_instruction_new( self );
19049 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_instruction_t);
19050 0 : void * * alloc_mem = &alloc_region;
19051 0 : fd_stake_instruction_decode_inner( mem, alloc_mem, ctx );
19052 0 : return self;
19053 0 : }
19054 0 : void * fd_stake_instruction_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
19055 0 : fd_stake_instruction_t * self = (fd_stake_instruction_t *)mem;
19056 0 : fd_stake_instruction_new( self );
19057 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_instruction_t);
19058 0 : void * * alloc_mem = &alloc_region;
19059 0 : fd_stake_instruction_decode_inner_global( mem, alloc_mem, ctx );
19060 0 : return self;
19061 0 : }
19062 0 : void fd_stake_instruction_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
19063 0 : fd_stake_instruction_global_t * self = (fd_stake_instruction_global_t *)struct_mem;
19064 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
19065 0 : fd_stake_instruction_inner_decode_inner_global( &self->inner, alloc_mem, self->discriminant, ctx );
19066 0 : }
19067 0 : void fd_stake_instruction_inner_new( fd_stake_instruction_inner_t * self, uint discriminant ) {
19068 0 : switch( discriminant ) {
19069 0 : case 0: {
19070 0 : fd_stake_instruction_initialize_new( &self->initialize );
19071 0 : break;
19072 0 : }
19073 0 : case 1: {
19074 0 : fd_stake_instruction_authorize_new( &self->authorize );
19075 0 : break;
19076 0 : }
19077 0 : case 2: {
19078 0 : break;
19079 0 : }
19080 0 : case 3: {
19081 0 : break;
19082 0 : }
19083 0 : case 4: {
19084 0 : break;
19085 0 : }
19086 0 : case 5: {
19087 0 : break;
19088 0 : }
19089 0 : case 6: {
19090 0 : fd_lockup_args_new( &self->set_lockup );
19091 0 : break;
19092 0 : }
19093 0 : case 7: {
19094 0 : break;
19095 0 : }
19096 0 : case 8: {
19097 0 : fd_authorize_with_seed_args_new( &self->authorize_with_seed );
19098 0 : break;
19099 0 : }
19100 0 : case 9: {
19101 0 : break;
19102 0 : }
19103 0 : case 10: {
19104 0 : fd_stake_authorize_new( &self->authorize_checked );
19105 0 : break;
19106 0 : }
19107 0 : case 11: {
19108 0 : fd_authorize_checked_with_seed_args_new( &self->authorize_checked_with_seed );
19109 0 : break;
19110 0 : }
19111 0 : case 12: {
19112 0 : fd_lockup_checked_args_new( &self->set_lockup_checked );
19113 0 : break;
19114 0 : }
19115 0 : case 13: {
19116 0 : break;
19117 0 : }
19118 0 : case 14: {
19119 0 : break;
19120 0 : }
19121 0 : case 15: {
19122 0 : break;
19123 0 : }
19124 0 : case 16: {
19125 0 : break;
19126 0 : }
19127 0 : case 17: {
19128 0 : break;
19129 0 : }
19130 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
19131 0 : }
19132 0 : }
19133 0 : void fd_stake_instruction_new_disc( fd_stake_instruction_t * self, uint discriminant ) {
19134 0 : self->discriminant = discriminant;
19135 0 : fd_stake_instruction_inner_new( &self->inner, self->discriminant );
19136 0 : }
19137 0 : void fd_stake_instruction_new( fd_stake_instruction_t * self ) {
19138 0 : fd_memset( self, 0, sizeof(fd_stake_instruction_t) );
19139 0 : fd_stake_instruction_new_disc( self, UINT_MAX );
19140 0 : }
19141 0 : void fd_stake_instruction_inner_destroy( fd_stake_instruction_inner_t * self, uint discriminant ) {
19142 0 : switch( discriminant ) {
19143 0 : case 0: {
19144 0 : fd_stake_instruction_initialize_destroy( &self->initialize );
19145 0 : break;
19146 0 : }
19147 0 : case 1: {
19148 0 : fd_stake_instruction_authorize_destroy( &self->authorize );
19149 0 : break;
19150 0 : }
19151 0 : case 3: {
19152 0 : break;
19153 0 : }
19154 0 : case 4: {
19155 0 : break;
19156 0 : }
19157 0 : case 6: {
19158 0 : fd_lockup_args_destroy( &self->set_lockup );
19159 0 : break;
19160 0 : }
19161 0 : case 8: {
19162 0 : fd_authorize_with_seed_args_destroy( &self->authorize_with_seed );
19163 0 : break;
19164 0 : }
19165 0 : case 10: {
19166 0 : fd_stake_authorize_destroy( &self->authorize_checked );
19167 0 : break;
19168 0 : }
19169 0 : case 11: {
19170 0 : fd_authorize_checked_with_seed_args_destroy( &self->authorize_checked_with_seed );
19171 0 : break;
19172 0 : }
19173 0 : case 12: {
19174 0 : fd_lockup_checked_args_destroy( &self->set_lockup_checked );
19175 0 : break;
19176 0 : }
19177 0 : case 16: {
19178 0 : break;
19179 0 : }
19180 0 : case 17: {
19181 0 : break;
19182 0 : }
19183 0 : default: break; // FD_LOG_ERR(( "unhandled type" ));
19184 0 : }
19185 0 : }
19186 0 : void fd_stake_instruction_destroy( fd_stake_instruction_t * self ) {
19187 0 : fd_stake_instruction_inner_destroy( &self->inner, self->discriminant );
19188 0 : }
19189 :
19190 0 : ulong fd_stake_instruction_footprint( void ){ return FD_STAKE_INSTRUCTION_FOOTPRINT; }
19191 0 : ulong fd_stake_instruction_align( void ){ return FD_STAKE_INSTRUCTION_ALIGN; }
19192 :
19193 0 : void fd_stake_instruction_walk( void * w, fd_stake_instruction_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
19194 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_stake_instruction", level++);
19195 0 : switch( self->discriminant ) {
19196 0 : case 0: {
19197 0 : fun( w, self, "initialize", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
19198 0 : fd_stake_instruction_initialize_walk( w, &self->inner.initialize, fun, "initialize", level );
19199 0 : break;
19200 0 : }
19201 0 : case 1: {
19202 0 : fun( w, self, "authorize", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
19203 0 : fd_stake_instruction_authorize_walk( w, &self->inner.authorize, fun, "authorize", level );
19204 0 : break;
19205 0 : }
19206 0 : case 2: {
19207 0 : fun( w, self, "delegate_stake", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
19208 0 : break;
19209 0 : }
19210 0 : case 3: {
19211 0 : fun( w, self, "split", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
19212 0 : fun( w, &self->inner.split, "split", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
19213 0 : break;
19214 0 : }
19215 0 : case 4: {
19216 0 : fun( w, self, "withdraw", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
19217 0 : fun( w, &self->inner.withdraw, "withdraw", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
19218 0 : break;
19219 0 : }
19220 0 : case 5: {
19221 0 : fun( w, self, "deactivate", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
19222 0 : break;
19223 0 : }
19224 0 : case 6: {
19225 0 : fun( w, self, "set_lockup", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
19226 0 : fd_lockup_args_walk( w, &self->inner.set_lockup, fun, "set_lockup", level );
19227 0 : break;
19228 0 : }
19229 0 : case 7: {
19230 0 : fun( w, self, "merge", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
19231 0 : break;
19232 0 : }
19233 0 : case 8: {
19234 0 : fun( w, self, "authorize_with_seed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
19235 0 : fd_authorize_with_seed_args_walk( w, &self->inner.authorize_with_seed, fun, "authorize_with_seed", level );
19236 0 : break;
19237 0 : }
19238 0 : case 9: {
19239 0 : fun( w, self, "initialize_checked", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
19240 0 : break;
19241 0 : }
19242 0 : case 10: {
19243 0 : fun( w, self, "authorize_checked", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
19244 0 : fd_stake_authorize_walk( w, &self->inner.authorize_checked, fun, "authorize_checked", level );
19245 0 : break;
19246 0 : }
19247 0 : case 11: {
19248 0 : fun( w, self, "authorize_checked_with_seed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
19249 0 : fd_authorize_checked_with_seed_args_walk( w, &self->inner.authorize_checked_with_seed, fun, "authorize_checked_with_seed", level );
19250 0 : break;
19251 0 : }
19252 0 : case 12: {
19253 0 : fun( w, self, "set_lockup_checked", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
19254 0 : fd_lockup_checked_args_walk( w, &self->inner.set_lockup_checked, fun, "set_lockup_checked", level );
19255 0 : break;
19256 0 : }
19257 0 : case 13: {
19258 0 : fun( w, self, "get_minimum_delegation", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
19259 0 : break;
19260 0 : }
19261 0 : case 14: {
19262 0 : fun( w, self, "deactivate_delinquent", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
19263 0 : break;
19264 0 : }
19265 0 : case 15: {
19266 0 : fun( w, self, "redelegate", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
19267 0 : break;
19268 0 : }
19269 0 : case 16: {
19270 0 : fun( w, self, "move_stake", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
19271 0 : fun( w, &self->inner.move_stake, "move_stake", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
19272 0 : break;
19273 0 : }
19274 0 : case 17: {
19275 0 : fun( w, self, "move_lamports", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
19276 0 : fun( w, &self->inner.move_lamports, "move_lamports", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
19277 0 : break;
19278 0 : }
19279 0 : }
19280 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_stake_instruction", level-- );
19281 0 : }
19282 0 : ulong fd_stake_instruction_size( fd_stake_instruction_t const * self ) {
19283 0 : ulong size = 0;
19284 0 : size += sizeof(uint);
19285 0 : switch (self->discriminant) {
19286 0 : case 0: {
19287 0 : size += fd_stake_instruction_initialize_size( &self->inner.initialize );
19288 0 : break;
19289 0 : }
19290 0 : case 1: {
19291 0 : size += fd_stake_instruction_authorize_size( &self->inner.authorize );
19292 0 : break;
19293 0 : }
19294 0 : case 3: {
19295 0 : size += sizeof(ulong);
19296 0 : break;
19297 0 : }
19298 0 : case 4: {
19299 0 : size += sizeof(ulong);
19300 0 : break;
19301 0 : }
19302 0 : case 6: {
19303 0 : size += fd_lockup_args_size( &self->inner.set_lockup );
19304 0 : break;
19305 0 : }
19306 0 : case 8: {
19307 0 : size += fd_authorize_with_seed_args_size( &self->inner.authorize_with_seed );
19308 0 : break;
19309 0 : }
19310 0 : case 10: {
19311 0 : size += fd_stake_authorize_size( &self->inner.authorize_checked );
19312 0 : break;
19313 0 : }
19314 0 : case 11: {
19315 0 : size += fd_authorize_checked_with_seed_args_size( &self->inner.authorize_checked_with_seed );
19316 0 : break;
19317 0 : }
19318 0 : case 12: {
19319 0 : size += fd_lockup_checked_args_size( &self->inner.set_lockup_checked );
19320 0 : break;
19321 0 : }
19322 0 : case 16: {
19323 0 : size += sizeof(ulong);
19324 0 : break;
19325 0 : }
19326 0 : case 17: {
19327 0 : size += sizeof(ulong);
19328 0 : break;
19329 0 : }
19330 0 : }
19331 0 : return size;
19332 0 : }
19333 :
19334 0 : int fd_stake_instruction_inner_encode( fd_stake_instruction_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
19335 0 : int err;
19336 0 : switch (discriminant) {
19337 0 : case 0: {
19338 0 : err = fd_stake_instruction_initialize_encode( &self->initialize, ctx );
19339 0 : if( FD_UNLIKELY( err ) ) return err;
19340 0 : break;
19341 0 : }
19342 0 : case 1: {
19343 0 : err = fd_stake_instruction_authorize_encode( &self->authorize, ctx );
19344 0 : if( FD_UNLIKELY( err ) ) return err;
19345 0 : break;
19346 0 : }
19347 0 : case 3: {
19348 0 : err = fd_bincode_uint64_encode( self->split, ctx );
19349 0 : if( FD_UNLIKELY( err ) ) return err;
19350 0 : break;
19351 0 : }
19352 0 : case 4: {
19353 0 : err = fd_bincode_uint64_encode( self->withdraw, ctx );
19354 0 : if( FD_UNLIKELY( err ) ) return err;
19355 0 : break;
19356 0 : }
19357 0 : case 6: {
19358 0 : err = fd_lockup_args_encode( &self->set_lockup, ctx );
19359 0 : if( FD_UNLIKELY( err ) ) return err;
19360 0 : break;
19361 0 : }
19362 0 : case 8: {
19363 0 : err = fd_authorize_with_seed_args_encode( &self->authorize_with_seed, ctx );
19364 0 : if( FD_UNLIKELY( err ) ) return err;
19365 0 : break;
19366 0 : }
19367 0 : case 10: {
19368 0 : err = fd_stake_authorize_encode( &self->authorize_checked, ctx );
19369 0 : if( FD_UNLIKELY( err ) ) return err;
19370 0 : break;
19371 0 : }
19372 0 : case 11: {
19373 0 : err = fd_authorize_checked_with_seed_args_encode( &self->authorize_checked_with_seed, ctx );
19374 0 : if( FD_UNLIKELY( err ) ) return err;
19375 0 : break;
19376 0 : }
19377 0 : case 12: {
19378 0 : err = fd_lockup_checked_args_encode( &self->set_lockup_checked, ctx );
19379 0 : if( FD_UNLIKELY( err ) ) return err;
19380 0 : break;
19381 0 : }
19382 0 : case 16: {
19383 0 : err = fd_bincode_uint64_encode( self->move_stake, ctx );
19384 0 : if( FD_UNLIKELY( err ) ) return err;
19385 0 : break;
19386 0 : }
19387 0 : case 17: {
19388 0 : err = fd_bincode_uint64_encode( self->move_lamports, ctx );
19389 0 : if( FD_UNLIKELY( err ) ) return err;
19390 0 : break;
19391 0 : }
19392 0 : }
19393 0 : return FD_BINCODE_SUCCESS;
19394 0 : }
19395 0 : int fd_stake_instruction_encode( fd_stake_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
19396 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
19397 0 : if( FD_UNLIKELY( err ) ) return err;
19398 0 : return fd_stake_instruction_inner_encode( &self->inner, self->discriminant, ctx );
19399 0 : }
19400 :
19401 12 : int fd_stake_meta_encode( fd_stake_meta_t const * self, fd_bincode_encode_ctx_t * ctx ) {
19402 12 : int err;
19403 12 : err = fd_bincode_uint64_encode( self->rent_exempt_reserve, ctx );
19404 12 : if( FD_UNLIKELY( err ) ) return err;
19405 12 : err = fd_stake_authorized_encode( &self->authorized, ctx );
19406 12 : if( FD_UNLIKELY( err ) ) return err;
19407 12 : err = fd_stake_lockup_encode( &self->lockup, ctx );
19408 12 : if( FD_UNLIKELY( err ) ) return err;
19409 12 : return FD_BINCODE_SUCCESS;
19410 12 : }
19411 0 : int fd_stake_meta_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
19412 0 : *total_sz += sizeof(fd_stake_meta_t);
19413 0 : void const * start_data = ctx->data;
19414 0 : int err = fd_stake_meta_decode_footprint_inner( ctx, total_sz );
19415 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
19416 0 : ctx->data = start_data;
19417 0 : return err;
19418 0 : }
19419 0 : int fd_stake_meta_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
19420 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
19421 0 : int err = 0;
19422 0 : err = fd_bincode_uint64_decode_footprint( ctx );
19423 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19424 0 : err = fd_stake_authorized_decode_footprint_inner( ctx, total_sz );
19425 0 : if( FD_UNLIKELY( err ) ) return err;
19426 0 : err = fd_stake_lockup_decode_footprint_inner( ctx, total_sz );
19427 0 : if( FD_UNLIKELY( err ) ) return err;
19428 0 : return 0;
19429 0 : }
19430 0 : void * fd_stake_meta_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
19431 0 : fd_stake_meta_t * self = (fd_stake_meta_t *)mem;
19432 0 : fd_stake_meta_new( self );
19433 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_meta_t);
19434 0 : void * * alloc_mem = &alloc_region;
19435 0 : fd_stake_meta_decode_inner( mem, alloc_mem, ctx );
19436 0 : return self;
19437 0 : }
19438 0 : void fd_stake_meta_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
19439 0 : fd_stake_meta_t * self = (fd_stake_meta_t *)struct_mem;
19440 0 : fd_bincode_uint64_decode_unsafe( &self->rent_exempt_reserve, ctx );
19441 0 : fd_stake_authorized_decode_inner( &self->authorized, alloc_mem, ctx );
19442 0 : fd_stake_lockup_decode_inner( &self->lockup, alloc_mem, ctx );
19443 0 : }
19444 0 : void * fd_stake_meta_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
19445 0 : fd_stake_meta_global_t * self = (fd_stake_meta_global_t *)mem;
19446 0 : fd_stake_meta_new( (fd_stake_meta_t *)self );
19447 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_meta_global_t);
19448 0 : void * * alloc_mem = &alloc_region;
19449 0 : fd_stake_meta_decode_inner_global( mem, alloc_mem, ctx );
19450 0 : return self;
19451 0 : }
19452 0 : void fd_stake_meta_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
19453 0 : fd_stake_meta_global_t * self = (fd_stake_meta_global_t *)struct_mem;
19454 0 : fd_bincode_uint64_decode_unsafe( &self->rent_exempt_reserve, ctx );
19455 0 : fd_stake_authorized_decode_inner_global( &self->authorized, alloc_mem, ctx );
19456 0 : fd_stake_lockup_decode_inner_global( &self->lockup, alloc_mem, ctx );
19457 0 : }
19458 0 : int fd_stake_meta_convert_global_to_local( void const * global_self, fd_stake_meta_t * self, fd_bincode_decode_ctx_t * ctx ) {
19459 0 : int err = 0;
19460 0 : fd_stake_meta_global_t const * mem = (fd_stake_meta_global_t const *)global_self;
19461 0 : self->rent_exempt_reserve = mem->rent_exempt_reserve;
19462 0 : err = fd_stake_authorized_convert_global_to_local( &mem->authorized, &self->authorized, ctx );
19463 0 : if( FD_UNLIKELY( err ) ) return err;
19464 0 : err = fd_stake_lockup_convert_global_to_local( &mem->lockup, &self->lockup, ctx );
19465 0 : if( FD_UNLIKELY( err ) ) return err;
19466 0 : return FD_BINCODE_SUCCESS;
19467 0 : }
19468 12 : void fd_stake_meta_new(fd_stake_meta_t * self) {
19469 12 : fd_memset( self, 0, sizeof(fd_stake_meta_t) );
19470 12 : fd_stake_authorized_new( &self->authorized );
19471 12 : fd_stake_lockup_new( &self->lockup );
19472 12 : }
19473 0 : void fd_stake_meta_destroy( fd_stake_meta_t * self ) {
19474 0 : fd_stake_authorized_destroy( &self->authorized );
19475 0 : fd_stake_lockup_destroy( &self->lockup );
19476 0 : }
19477 :
19478 0 : ulong fd_stake_meta_footprint( void ){ return FD_STAKE_META_FOOTPRINT; }
19479 0 : ulong fd_stake_meta_align( void ){ return FD_STAKE_META_ALIGN; }
19480 :
19481 0 : void fd_stake_meta_walk( void * w, fd_stake_meta_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
19482 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_meta", level++ );
19483 0 : fun( w, &self->rent_exempt_reserve, "rent_exempt_reserve", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
19484 0 : fd_stake_authorized_walk( w, &self->authorized, fun, "authorized", level );
19485 0 : fd_stake_lockup_walk( w, &self->lockup, fun, "lockup", level );
19486 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_meta", level-- );
19487 0 : }
19488 0 : ulong fd_stake_meta_size( fd_stake_meta_t const * self ) {
19489 0 : ulong size = 0;
19490 0 : size += sizeof(ulong);
19491 0 : size += fd_stake_authorized_size( &self->authorized );
19492 0 : size += fd_stake_lockup_size( &self->lockup );
19493 0 : return size;
19494 0 : }
19495 :
19496 12 : int fd_stake_flags_encode( fd_stake_flags_t const * self, fd_bincode_encode_ctx_t * ctx ) {
19497 12 : int err;
19498 12 : err = fd_bincode_uint8_encode( (uchar)(self->bits), ctx );
19499 12 : if( FD_UNLIKELY( err ) ) return err;
19500 12 : return FD_BINCODE_SUCCESS;
19501 12 : }
19502 0 : int fd_stake_flags_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
19503 0 : *total_sz += sizeof(fd_stake_flags_t);
19504 0 : void const * start_data = ctx->data;
19505 0 : int err = fd_stake_flags_decode_footprint_inner( ctx, total_sz );
19506 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
19507 0 : ctx->data = start_data;
19508 0 : return err;
19509 0 : }
19510 0 : int fd_stake_flags_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
19511 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
19512 0 : int err = 0;
19513 0 : err = fd_bincode_uint8_decode_footprint( ctx );
19514 0 : if( FD_UNLIKELY( err ) ) return err;
19515 0 : return 0;
19516 0 : }
19517 0 : void * fd_stake_flags_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
19518 0 : fd_stake_flags_t * self = (fd_stake_flags_t *)mem;
19519 0 : fd_stake_flags_new( self );
19520 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_flags_t);
19521 0 : void * * alloc_mem = &alloc_region;
19522 0 : fd_stake_flags_decode_inner( mem, alloc_mem, ctx );
19523 0 : return self;
19524 0 : }
19525 0 : void fd_stake_flags_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
19526 0 : fd_stake_flags_t * self = (fd_stake_flags_t *)struct_mem;
19527 0 : fd_bincode_uint8_decode_unsafe( &self->bits, ctx );
19528 0 : }
19529 0 : void * fd_stake_flags_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
19530 0 : fd_stake_flags_global_t * self = (fd_stake_flags_global_t *)mem;
19531 0 : fd_stake_flags_new( (fd_stake_flags_t *)self );
19532 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_flags_global_t);
19533 0 : void * * alloc_mem = &alloc_region;
19534 0 : fd_stake_flags_decode_inner_global( mem, alloc_mem, ctx );
19535 0 : return self;
19536 0 : }
19537 0 : void fd_stake_flags_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
19538 0 : fd_stake_flags_global_t * self = (fd_stake_flags_global_t *)struct_mem;
19539 0 : fd_bincode_uint8_decode_unsafe( &self->bits, ctx );
19540 0 : }
19541 0 : int fd_stake_flags_convert_global_to_local( void const * global_self, fd_stake_flags_t * self, fd_bincode_decode_ctx_t * ctx ) {
19542 0 : int err = 0;
19543 0 : fd_stake_flags_global_t const * mem = (fd_stake_flags_global_t const *)global_self;
19544 0 : self->bits = mem->bits;
19545 0 : return FD_BINCODE_SUCCESS;
19546 0 : }
19547 12 : void fd_stake_flags_new(fd_stake_flags_t * self) {
19548 12 : fd_memset( self, 0, sizeof(fd_stake_flags_t) );
19549 12 : }
19550 0 : void fd_stake_flags_destroy( fd_stake_flags_t * self ) {
19551 0 : }
19552 :
19553 0 : ulong fd_stake_flags_footprint( void ){ return FD_STAKE_FLAGS_FOOTPRINT; }
19554 0 : ulong fd_stake_flags_align( void ){ return FD_STAKE_FLAGS_ALIGN; }
19555 :
19556 0 : void fd_stake_flags_walk( void * w, fd_stake_flags_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
19557 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_flags", level++ );
19558 0 : fun( w, &self->bits, "bits", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
19559 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_flags", level-- );
19560 0 : }
19561 0 : ulong fd_stake_flags_size( fd_stake_flags_t const * self ) {
19562 0 : ulong size = 0;
19563 0 : size += sizeof(char);
19564 0 : return size;
19565 0 : }
19566 :
19567 0 : int fd_stake_state_v2_initialized_encode( fd_stake_state_v2_initialized_t const * self, fd_bincode_encode_ctx_t * ctx ) {
19568 0 : int err;
19569 0 : err = fd_stake_meta_encode( &self->meta, ctx );
19570 0 : if( FD_UNLIKELY( err ) ) return err;
19571 0 : return FD_BINCODE_SUCCESS;
19572 0 : }
19573 0 : int fd_stake_state_v2_initialized_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
19574 0 : *total_sz += sizeof(fd_stake_state_v2_initialized_t);
19575 0 : void const * start_data = ctx->data;
19576 0 : int err = fd_stake_state_v2_initialized_decode_footprint_inner( ctx, total_sz );
19577 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
19578 0 : ctx->data = start_data;
19579 0 : return err;
19580 0 : }
19581 0 : int fd_stake_state_v2_initialized_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
19582 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
19583 0 : int err = 0;
19584 0 : err = fd_stake_meta_decode_footprint_inner( ctx, total_sz );
19585 0 : if( FD_UNLIKELY( err ) ) return err;
19586 0 : return 0;
19587 0 : }
19588 0 : void * fd_stake_state_v2_initialized_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
19589 0 : fd_stake_state_v2_initialized_t * self = (fd_stake_state_v2_initialized_t *)mem;
19590 0 : fd_stake_state_v2_initialized_new( self );
19591 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_state_v2_initialized_t);
19592 0 : void * * alloc_mem = &alloc_region;
19593 0 : fd_stake_state_v2_initialized_decode_inner( mem, alloc_mem, ctx );
19594 0 : return self;
19595 0 : }
19596 0 : void fd_stake_state_v2_initialized_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
19597 0 : fd_stake_state_v2_initialized_t * self = (fd_stake_state_v2_initialized_t *)struct_mem;
19598 0 : fd_stake_meta_decode_inner( &self->meta, alloc_mem, ctx );
19599 0 : }
19600 0 : void * fd_stake_state_v2_initialized_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
19601 0 : fd_stake_state_v2_initialized_global_t * self = (fd_stake_state_v2_initialized_global_t *)mem;
19602 0 : fd_stake_state_v2_initialized_new( (fd_stake_state_v2_initialized_t *)self );
19603 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_state_v2_initialized_global_t);
19604 0 : void * * alloc_mem = &alloc_region;
19605 0 : fd_stake_state_v2_initialized_decode_inner_global( mem, alloc_mem, ctx );
19606 0 : return self;
19607 0 : }
19608 0 : void fd_stake_state_v2_initialized_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
19609 0 : fd_stake_state_v2_initialized_global_t * self = (fd_stake_state_v2_initialized_global_t *)struct_mem;
19610 0 : fd_stake_meta_decode_inner_global( &self->meta, alloc_mem, ctx );
19611 0 : }
19612 0 : int fd_stake_state_v2_initialized_convert_global_to_local( void const * global_self, fd_stake_state_v2_initialized_t * self, fd_bincode_decode_ctx_t * ctx ) {
19613 0 : int err = 0;
19614 0 : fd_stake_state_v2_initialized_global_t const * mem = (fd_stake_state_v2_initialized_global_t const *)global_self;
19615 0 : err = fd_stake_meta_convert_global_to_local( &mem->meta, &self->meta, ctx );
19616 0 : if( FD_UNLIKELY( err ) ) return err;
19617 0 : return FD_BINCODE_SUCCESS;
19618 0 : }
19619 0 : void fd_stake_state_v2_initialized_new(fd_stake_state_v2_initialized_t * self) {
19620 0 : fd_memset( self, 0, sizeof(fd_stake_state_v2_initialized_t) );
19621 0 : fd_stake_meta_new( &self->meta );
19622 0 : }
19623 0 : void fd_stake_state_v2_initialized_destroy( fd_stake_state_v2_initialized_t * self ) {
19624 0 : fd_stake_meta_destroy( &self->meta );
19625 0 : }
19626 :
19627 0 : ulong fd_stake_state_v2_initialized_footprint( void ){ return FD_STAKE_STATE_V2_INITIALIZED_FOOTPRINT; }
19628 0 : ulong fd_stake_state_v2_initialized_align( void ){ return FD_STAKE_STATE_V2_INITIALIZED_ALIGN; }
19629 :
19630 0 : void fd_stake_state_v2_initialized_walk( void * w, fd_stake_state_v2_initialized_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
19631 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_state_v2_initialized", level++ );
19632 0 : fd_stake_meta_walk( w, &self->meta, fun, "meta", level );
19633 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_state_v2_initialized", level-- );
19634 0 : }
19635 0 : ulong fd_stake_state_v2_initialized_size( fd_stake_state_v2_initialized_t const * self ) {
19636 0 : ulong size = 0;
19637 0 : size += fd_stake_meta_size( &self->meta );
19638 0 : return size;
19639 0 : }
19640 :
19641 12 : int fd_stake_state_v2_stake_encode( fd_stake_state_v2_stake_t const * self, fd_bincode_encode_ctx_t * ctx ) {
19642 12 : int err;
19643 12 : err = fd_stake_meta_encode( &self->meta, ctx );
19644 12 : if( FD_UNLIKELY( err ) ) return err;
19645 12 : err = fd_stake_encode( &self->stake, ctx );
19646 12 : if( FD_UNLIKELY( err ) ) return err;
19647 12 : err = fd_stake_flags_encode( &self->stake_flags, ctx );
19648 12 : if( FD_UNLIKELY( err ) ) return err;
19649 12 : return FD_BINCODE_SUCCESS;
19650 12 : }
19651 0 : int fd_stake_state_v2_stake_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
19652 0 : *total_sz += sizeof(fd_stake_state_v2_stake_t);
19653 0 : void const * start_data = ctx->data;
19654 0 : int err = fd_stake_state_v2_stake_decode_footprint_inner( ctx, total_sz );
19655 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
19656 0 : ctx->data = start_data;
19657 0 : return err;
19658 0 : }
19659 0 : int fd_stake_state_v2_stake_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
19660 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
19661 0 : int err = 0;
19662 0 : err = fd_stake_meta_decode_footprint_inner( ctx, total_sz );
19663 0 : if( FD_UNLIKELY( err ) ) return err;
19664 0 : err = fd_stake_decode_footprint_inner( ctx, total_sz );
19665 0 : if( FD_UNLIKELY( err ) ) return err;
19666 0 : err = fd_stake_flags_decode_footprint_inner( ctx, total_sz );
19667 0 : if( FD_UNLIKELY( err ) ) return err;
19668 0 : return 0;
19669 0 : }
19670 0 : void * fd_stake_state_v2_stake_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
19671 0 : fd_stake_state_v2_stake_t * self = (fd_stake_state_v2_stake_t *)mem;
19672 0 : fd_stake_state_v2_stake_new( self );
19673 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_state_v2_stake_t);
19674 0 : void * * alloc_mem = &alloc_region;
19675 0 : fd_stake_state_v2_stake_decode_inner( mem, alloc_mem, ctx );
19676 0 : return self;
19677 0 : }
19678 0 : void fd_stake_state_v2_stake_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
19679 0 : fd_stake_state_v2_stake_t * self = (fd_stake_state_v2_stake_t *)struct_mem;
19680 0 : fd_stake_meta_decode_inner( &self->meta, alloc_mem, ctx );
19681 0 : fd_stake_decode_inner( &self->stake, alloc_mem, ctx );
19682 0 : fd_stake_flags_decode_inner( &self->stake_flags, alloc_mem, ctx );
19683 0 : }
19684 0 : void * fd_stake_state_v2_stake_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
19685 0 : fd_stake_state_v2_stake_global_t * self = (fd_stake_state_v2_stake_global_t *)mem;
19686 0 : fd_stake_state_v2_stake_new( (fd_stake_state_v2_stake_t *)self );
19687 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_state_v2_stake_global_t);
19688 0 : void * * alloc_mem = &alloc_region;
19689 0 : fd_stake_state_v2_stake_decode_inner_global( mem, alloc_mem, ctx );
19690 0 : return self;
19691 0 : }
19692 0 : void fd_stake_state_v2_stake_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
19693 0 : fd_stake_state_v2_stake_global_t * self = (fd_stake_state_v2_stake_global_t *)struct_mem;
19694 0 : fd_stake_meta_decode_inner_global( &self->meta, alloc_mem, ctx );
19695 0 : fd_stake_decode_inner_global( &self->stake, alloc_mem, ctx );
19696 0 : fd_stake_flags_decode_inner_global( &self->stake_flags, alloc_mem, ctx );
19697 0 : }
19698 0 : int fd_stake_state_v2_stake_convert_global_to_local( void const * global_self, fd_stake_state_v2_stake_t * self, fd_bincode_decode_ctx_t * ctx ) {
19699 0 : int err = 0;
19700 0 : fd_stake_state_v2_stake_global_t const * mem = (fd_stake_state_v2_stake_global_t const *)global_self;
19701 0 : err = fd_stake_meta_convert_global_to_local( &mem->meta, &self->meta, ctx );
19702 0 : if( FD_UNLIKELY( err ) ) return err;
19703 0 : err = fd_stake_convert_global_to_local( &mem->stake, &self->stake, ctx );
19704 0 : if( FD_UNLIKELY( err ) ) return err;
19705 0 : err = fd_stake_flags_convert_global_to_local( &mem->stake_flags, &self->stake_flags, ctx );
19706 0 : if( FD_UNLIKELY( err ) ) return err;
19707 0 : return FD_BINCODE_SUCCESS;
19708 0 : }
19709 12 : void fd_stake_state_v2_stake_new(fd_stake_state_v2_stake_t * self) {
19710 12 : fd_memset( self, 0, sizeof(fd_stake_state_v2_stake_t) );
19711 12 : fd_stake_meta_new( &self->meta );
19712 12 : fd_stake_new( &self->stake );
19713 12 : fd_stake_flags_new( &self->stake_flags );
19714 12 : }
19715 0 : void fd_stake_state_v2_stake_destroy( fd_stake_state_v2_stake_t * self ) {
19716 0 : fd_stake_meta_destroy( &self->meta );
19717 0 : fd_stake_destroy( &self->stake );
19718 0 : fd_stake_flags_destroy( &self->stake_flags );
19719 0 : }
19720 :
19721 0 : ulong fd_stake_state_v2_stake_footprint( void ){ return FD_STAKE_STATE_V2_STAKE_FOOTPRINT; }
19722 0 : ulong fd_stake_state_v2_stake_align( void ){ return FD_STAKE_STATE_V2_STAKE_ALIGN; }
19723 :
19724 0 : void fd_stake_state_v2_stake_walk( void * w, fd_stake_state_v2_stake_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
19725 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_state_v2_stake", level++ );
19726 0 : fd_stake_meta_walk( w, &self->meta, fun, "meta", level );
19727 0 : fd_stake_walk( w, &self->stake, fun, "stake", level );
19728 0 : fd_stake_flags_walk( w, &self->stake_flags, fun, "stake_flags", level );
19729 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_state_v2_stake", level-- );
19730 0 : }
19731 0 : ulong fd_stake_state_v2_stake_size( fd_stake_state_v2_stake_t const * self ) {
19732 0 : ulong size = 0;
19733 0 : size += fd_stake_meta_size( &self->meta );
19734 0 : size += fd_stake_size( &self->stake );
19735 0 : size += fd_stake_flags_size( &self->stake_flags );
19736 0 : return size;
19737 0 : }
19738 :
19739 0 : FD_FN_PURE uchar fd_stake_state_v2_is_uninitialized(fd_stake_state_v2_t const * self) {
19740 0 : return self->discriminant == 0;
19741 0 : }
19742 0 : FD_FN_PURE uchar fd_stake_state_v2_is_initialized(fd_stake_state_v2_t const * self) {
19743 0 : return self->discriminant == 1;
19744 0 : }
19745 0 : FD_FN_PURE uchar fd_stake_state_v2_is_stake(fd_stake_state_v2_t const * self) {
19746 0 : return self->discriminant == 2;
19747 0 : }
19748 0 : FD_FN_PURE uchar fd_stake_state_v2_is_rewards_pool(fd_stake_state_v2_t const * self) {
19749 0 : return self->discriminant == 3;
19750 0 : }
19751 : void fd_stake_state_v2_inner_new( fd_stake_state_v2_inner_t * self, uint discriminant );
19752 0 : int fd_stake_state_v2_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
19753 0 : int err;
19754 0 : switch (discriminant) {
19755 0 : case 0: {
19756 0 : return FD_BINCODE_SUCCESS;
19757 0 : }
19758 0 : case 1: {
19759 0 : err = fd_stake_state_v2_initialized_decode_footprint_inner( ctx, total_sz );
19760 0 : if( FD_UNLIKELY( err ) ) return err;
19761 0 : return FD_BINCODE_SUCCESS;
19762 0 : }
19763 0 : case 2: {
19764 0 : err = fd_stake_state_v2_stake_decode_footprint_inner( ctx, total_sz );
19765 0 : if( FD_UNLIKELY( err ) ) return err;
19766 0 : return FD_BINCODE_SUCCESS;
19767 0 : }
19768 0 : case 3: {
19769 0 : return FD_BINCODE_SUCCESS;
19770 0 : }
19771 0 : default: return FD_BINCODE_ERR_ENCODING;
19772 0 : }
19773 0 : }
19774 0 : int fd_stake_state_v2_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
19775 0 : *total_sz += sizeof(fd_stake_state_v2_t);
19776 0 : void const * start_data = ctx->data;
19777 0 : int err = fd_stake_state_v2_decode_footprint_inner( ctx, total_sz );
19778 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
19779 0 : ctx->data = start_data;
19780 0 : return err;
19781 0 : }
19782 0 : int fd_stake_state_v2_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
19783 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
19784 0 : uint discriminant = 0;
19785 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
19786 0 : if( FD_UNLIKELY( err ) ) return err;
19787 0 : return fd_stake_state_v2_inner_decode_footprint( discriminant, ctx, total_sz );
19788 0 : }
19789 0 : 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 ) {
19790 0 : switch (discriminant) {
19791 0 : case 0: {
19792 0 : break;
19793 0 : }
19794 0 : case 1: {
19795 0 : fd_stake_state_v2_initialized_decode_inner( &self->initialized, alloc_mem, ctx );
19796 0 : break;
19797 0 : }
19798 0 : case 2: {
19799 0 : fd_stake_state_v2_stake_decode_inner( &self->stake, alloc_mem, ctx );
19800 0 : break;
19801 0 : }
19802 0 : case 3: {
19803 0 : break;
19804 0 : }
19805 0 : }
19806 0 : }
19807 0 : void fd_stake_state_v2_inner_decode_inner_global( fd_stake_state_v2_inner_global_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
19808 0 : switch (discriminant) {
19809 0 : case 0: {
19810 0 : break;
19811 0 : }
19812 0 : case 1: {
19813 0 : fd_stake_state_v2_initialized_decode_inner_global( &self->initialized, alloc_mem, ctx );
19814 0 : break;
19815 0 : }
19816 0 : case 2: {
19817 0 : fd_stake_state_v2_stake_decode_inner_global( &self->stake, alloc_mem, ctx );
19818 0 : break;
19819 0 : }
19820 0 : case 3: {
19821 0 : break;
19822 0 : }
19823 0 : }
19824 0 : }
19825 0 : int fd_stake_state_v2_convert_global_to_local_inner( fd_stake_state_v2_inner_global_t const * mem, fd_stake_state_v2_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
19826 0 : int err = 0;
19827 0 : switch( discriminant ) {
19828 0 : case 0: {
19829 0 : break;
19830 0 : }
19831 0 : case 1: {
19832 0 : err = fd_stake_state_v2_initialized_convert_global_to_local( &mem->initialized, &self->initialized, ctx );
19833 0 : if( FD_UNLIKELY( err ) ) return err;
19834 0 : break;
19835 0 : }
19836 0 : case 2: {
19837 0 : err = fd_stake_state_v2_stake_convert_global_to_local( &mem->stake, &self->stake, ctx );
19838 0 : if( FD_UNLIKELY( err ) ) return err;
19839 0 : break;
19840 0 : }
19841 0 : case 3: {
19842 0 : break;
19843 0 : }
19844 0 : }
19845 0 : return FD_BINCODE_SUCCESS;
19846 0 : }
19847 0 : int fd_stake_state_v2_convert_global_to_local( void const * global_self, fd_stake_state_v2_t * self, fd_bincode_decode_ctx_t * ctx ) {
19848 0 : fd_stake_state_v2_global_t const * mem = (fd_stake_state_v2_global_t const *)global_self;
19849 0 : uint discriminant = mem->discriminant;
19850 0 : self->discriminant = mem->discriminant;
19851 0 : int err = fd_stake_state_v2_convert_global_to_local_inner( &mem->inner, &self->inner, discriminant, ctx );
19852 0 : return FD_BINCODE_SUCCESS;
19853 0 : }
19854 0 : void fd_stake_state_v2_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
19855 0 : fd_stake_state_v2_t * self = (fd_stake_state_v2_t *)struct_mem;
19856 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
19857 0 : fd_stake_state_v2_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
19858 0 : }
19859 0 : void * fd_stake_state_v2_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
19860 0 : fd_stake_state_v2_t * self = (fd_stake_state_v2_t *)mem;
19861 0 : fd_stake_state_v2_new( self );
19862 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_state_v2_t);
19863 0 : void * * alloc_mem = &alloc_region;
19864 0 : fd_stake_state_v2_decode_inner( mem, alloc_mem, ctx );
19865 0 : return self;
19866 0 : }
19867 0 : void * fd_stake_state_v2_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
19868 0 : fd_stake_state_v2_t * self = (fd_stake_state_v2_t *)mem;
19869 0 : fd_stake_state_v2_new( self );
19870 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_state_v2_t);
19871 0 : void * * alloc_mem = &alloc_region;
19872 0 : fd_stake_state_v2_decode_inner_global( mem, alloc_mem, ctx );
19873 0 : return self;
19874 0 : }
19875 0 : void fd_stake_state_v2_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
19876 0 : fd_stake_state_v2_global_t * self = (fd_stake_state_v2_global_t *)struct_mem;
19877 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
19878 0 : fd_stake_state_v2_inner_decode_inner_global( &self->inner, alloc_mem, self->discriminant, ctx );
19879 0 : }
19880 12 : void fd_stake_state_v2_inner_new( fd_stake_state_v2_inner_t * self, uint discriminant ) {
19881 12 : switch( discriminant ) {
19882 0 : case 0: {
19883 0 : break;
19884 0 : }
19885 0 : case 1: {
19886 0 : fd_stake_state_v2_initialized_new( &self->initialized );
19887 0 : break;
19888 0 : }
19889 12 : case 2: {
19890 12 : fd_stake_state_v2_stake_new( &self->stake );
19891 12 : break;
19892 0 : }
19893 0 : case 3: {
19894 0 : break;
19895 0 : }
19896 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
19897 12 : }
19898 12 : }
19899 12 : void fd_stake_state_v2_new_disc( fd_stake_state_v2_t * self, uint discriminant ) {
19900 12 : self->discriminant = discriminant;
19901 12 : fd_stake_state_v2_inner_new( &self->inner, self->discriminant );
19902 12 : }
19903 0 : void fd_stake_state_v2_new( fd_stake_state_v2_t * self ) {
19904 0 : fd_memset( self, 0, sizeof(fd_stake_state_v2_t) );
19905 0 : fd_stake_state_v2_new_disc( self, UINT_MAX );
19906 0 : }
19907 0 : void fd_stake_state_v2_inner_destroy( fd_stake_state_v2_inner_t * self, uint discriminant ) {
19908 0 : switch( discriminant ) {
19909 0 : case 1: {
19910 0 : fd_stake_state_v2_initialized_destroy( &self->initialized );
19911 0 : break;
19912 0 : }
19913 0 : case 2: {
19914 0 : fd_stake_state_v2_stake_destroy( &self->stake );
19915 0 : break;
19916 0 : }
19917 0 : default: break; // FD_LOG_ERR(( "unhandled type" ));
19918 0 : }
19919 0 : }
19920 0 : void fd_stake_state_v2_destroy( fd_stake_state_v2_t * self ) {
19921 0 : fd_stake_state_v2_inner_destroy( &self->inner, self->discriminant );
19922 0 : }
19923 :
19924 0 : ulong fd_stake_state_v2_footprint( void ){ return FD_STAKE_STATE_V2_FOOTPRINT; }
19925 0 : ulong fd_stake_state_v2_align( void ){ return FD_STAKE_STATE_V2_ALIGN; }
19926 :
19927 0 : void fd_stake_state_v2_walk( void * w, fd_stake_state_v2_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
19928 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_stake_state_v2", level++);
19929 0 : switch( self->discriminant ) {
19930 0 : case 0: {
19931 0 : fun( w, self, "uninitialized", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
19932 0 : break;
19933 0 : }
19934 0 : case 1: {
19935 0 : fun( w, self, "initialized", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
19936 0 : fd_stake_state_v2_initialized_walk( w, &self->inner.initialized, fun, "initialized", level );
19937 0 : break;
19938 0 : }
19939 0 : case 2: {
19940 0 : fun( w, self, "stake", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
19941 0 : fd_stake_state_v2_stake_walk( w, &self->inner.stake, fun, "stake", level );
19942 0 : break;
19943 0 : }
19944 0 : case 3: {
19945 0 : fun( w, self, "rewards_pool", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
19946 0 : break;
19947 0 : }
19948 0 : }
19949 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_stake_state_v2", level-- );
19950 0 : }
19951 0 : ulong fd_stake_state_v2_size( fd_stake_state_v2_t const * self ) {
19952 0 : ulong size = 0;
19953 0 : size += sizeof(uint);
19954 0 : switch (self->discriminant) {
19955 0 : case 1: {
19956 0 : size += fd_stake_state_v2_initialized_size( &self->inner.initialized );
19957 0 : break;
19958 0 : }
19959 0 : case 2: {
19960 0 : size += fd_stake_state_v2_stake_size( &self->inner.stake );
19961 0 : break;
19962 0 : }
19963 0 : }
19964 0 : return size;
19965 0 : }
19966 :
19967 12 : int fd_stake_state_v2_inner_encode( fd_stake_state_v2_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
19968 12 : int err;
19969 12 : switch (discriminant) {
19970 0 : case 1: {
19971 0 : err = fd_stake_state_v2_initialized_encode( &self->initialized, ctx );
19972 0 : if( FD_UNLIKELY( err ) ) return err;
19973 0 : break;
19974 0 : }
19975 12 : case 2: {
19976 12 : err = fd_stake_state_v2_stake_encode( &self->stake, ctx );
19977 12 : if( FD_UNLIKELY( err ) ) return err;
19978 12 : break;
19979 12 : }
19980 12 : }
19981 12 : return FD_BINCODE_SUCCESS;
19982 12 : }
19983 12 : int fd_stake_state_v2_encode( fd_stake_state_v2_t const * self, fd_bincode_encode_ctx_t * ctx ) {
19984 12 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
19985 12 : if( FD_UNLIKELY( err ) ) return err;
19986 12 : return fd_stake_state_v2_inner_encode( &self->inner, self->discriminant, ctx );
19987 12 : }
19988 :
19989 0 : int fd_nonce_data_encode( fd_nonce_data_t const * self, fd_bincode_encode_ctx_t * ctx ) {
19990 0 : int err;
19991 0 : err = fd_pubkey_encode( &self->authority, ctx );
19992 0 : if( FD_UNLIKELY( err ) ) return err;
19993 0 : err = fd_hash_encode( &self->durable_nonce, ctx );
19994 0 : if( FD_UNLIKELY( err ) ) return err;
19995 0 : err = fd_fee_calculator_encode( &self->fee_calculator, ctx );
19996 0 : if( FD_UNLIKELY( err ) ) return err;
19997 0 : return FD_BINCODE_SUCCESS;
19998 0 : }
19999 0 : int fd_nonce_data_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
20000 0 : *total_sz += sizeof(fd_nonce_data_t);
20001 0 : void const * start_data = ctx->data;
20002 0 : int err = fd_nonce_data_decode_footprint_inner( ctx, total_sz );
20003 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
20004 0 : ctx->data = start_data;
20005 0 : return err;
20006 0 : }
20007 0 : int fd_nonce_data_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
20008 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
20009 0 : int err = 0;
20010 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
20011 0 : if( FD_UNLIKELY( err ) ) return err;
20012 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
20013 0 : if( FD_UNLIKELY( err ) ) return err;
20014 0 : err = fd_fee_calculator_decode_footprint_inner( ctx, total_sz );
20015 0 : if( FD_UNLIKELY( err ) ) return err;
20016 0 : return 0;
20017 0 : }
20018 0 : void * fd_nonce_data_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
20019 0 : fd_nonce_data_t * self = (fd_nonce_data_t *)mem;
20020 0 : fd_nonce_data_new( self );
20021 0 : void * alloc_region = (uchar *)mem + sizeof(fd_nonce_data_t);
20022 0 : void * * alloc_mem = &alloc_region;
20023 0 : fd_nonce_data_decode_inner( mem, alloc_mem, ctx );
20024 0 : return self;
20025 0 : }
20026 0 : void fd_nonce_data_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
20027 0 : fd_nonce_data_t * self = (fd_nonce_data_t *)struct_mem;
20028 0 : fd_pubkey_decode_inner( &self->authority, alloc_mem, ctx );
20029 0 : fd_hash_decode_inner( &self->durable_nonce, alloc_mem, ctx );
20030 0 : fd_fee_calculator_decode_inner( &self->fee_calculator, alloc_mem, ctx );
20031 0 : }
20032 0 : void * fd_nonce_data_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
20033 0 : fd_nonce_data_global_t * self = (fd_nonce_data_global_t *)mem;
20034 0 : fd_nonce_data_new( (fd_nonce_data_t *)self );
20035 0 : void * alloc_region = (uchar *)mem + sizeof(fd_nonce_data_global_t);
20036 0 : void * * alloc_mem = &alloc_region;
20037 0 : fd_nonce_data_decode_inner_global( mem, alloc_mem, ctx );
20038 0 : return self;
20039 0 : }
20040 0 : void fd_nonce_data_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
20041 0 : fd_nonce_data_global_t * self = (fd_nonce_data_global_t *)struct_mem;
20042 0 : fd_pubkey_decode_inner_global( &self->authority, alloc_mem, ctx );
20043 0 : fd_hash_decode_inner_global( &self->durable_nonce, alloc_mem, ctx );
20044 0 : fd_fee_calculator_decode_inner_global( &self->fee_calculator, alloc_mem, ctx );
20045 0 : }
20046 0 : int fd_nonce_data_convert_global_to_local( void const * global_self, fd_nonce_data_t * self, fd_bincode_decode_ctx_t * ctx ) {
20047 0 : int err = 0;
20048 0 : fd_nonce_data_global_t const * mem = (fd_nonce_data_global_t const *)global_self;
20049 0 : err = fd_pubkey_convert_global_to_local( &mem->authority, &self->authority, ctx );
20050 0 : if( FD_UNLIKELY( err ) ) return err;
20051 0 : err = fd_hash_convert_global_to_local( &mem->durable_nonce, &self->durable_nonce, ctx );
20052 0 : if( FD_UNLIKELY( err ) ) return err;
20053 0 : err = fd_fee_calculator_convert_global_to_local( &mem->fee_calculator, &self->fee_calculator, ctx );
20054 0 : if( FD_UNLIKELY( err ) ) return err;
20055 0 : return FD_BINCODE_SUCCESS;
20056 0 : }
20057 0 : void fd_nonce_data_new(fd_nonce_data_t * self) {
20058 0 : fd_memset( self, 0, sizeof(fd_nonce_data_t) );
20059 0 : fd_pubkey_new( &self->authority );
20060 0 : fd_hash_new( &self->durable_nonce );
20061 0 : fd_fee_calculator_new( &self->fee_calculator );
20062 0 : }
20063 0 : void fd_nonce_data_destroy( fd_nonce_data_t * self ) {
20064 0 : fd_pubkey_destroy( &self->authority );
20065 0 : fd_hash_destroy( &self->durable_nonce );
20066 0 : fd_fee_calculator_destroy( &self->fee_calculator );
20067 0 : }
20068 :
20069 0 : ulong fd_nonce_data_footprint( void ){ return FD_NONCE_DATA_FOOTPRINT; }
20070 0 : ulong fd_nonce_data_align( void ){ return FD_NONCE_DATA_ALIGN; }
20071 :
20072 0 : void fd_nonce_data_walk( void * w, fd_nonce_data_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
20073 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_nonce_data", level++ );
20074 0 : fd_pubkey_walk( w, &self->authority, fun, "authority", level );
20075 0 : fd_hash_walk( w, &self->durable_nonce, fun, "durable_nonce", level );
20076 0 : fd_fee_calculator_walk( w, &self->fee_calculator, fun, "fee_calculator", level );
20077 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_nonce_data", level-- );
20078 0 : }
20079 0 : ulong fd_nonce_data_size( fd_nonce_data_t const * self ) {
20080 0 : ulong size = 0;
20081 0 : size += fd_pubkey_size( &self->authority );
20082 0 : size += fd_hash_size( &self->durable_nonce );
20083 0 : size += fd_fee_calculator_size( &self->fee_calculator );
20084 0 : return size;
20085 0 : }
20086 :
20087 0 : FD_FN_PURE uchar fd_nonce_state_is_uninitialized(fd_nonce_state_t const * self) {
20088 0 : return self->discriminant == 0;
20089 0 : }
20090 0 : FD_FN_PURE uchar fd_nonce_state_is_initialized(fd_nonce_state_t const * self) {
20091 0 : return self->discriminant == 1;
20092 0 : }
20093 : void fd_nonce_state_inner_new( fd_nonce_state_inner_t * self, uint discriminant );
20094 0 : int fd_nonce_state_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
20095 0 : int err;
20096 0 : switch (discriminant) {
20097 0 : case 0: {
20098 0 : return FD_BINCODE_SUCCESS;
20099 0 : }
20100 0 : case 1: {
20101 0 : err = fd_nonce_data_decode_footprint_inner( ctx, total_sz );
20102 0 : if( FD_UNLIKELY( err ) ) return err;
20103 0 : return FD_BINCODE_SUCCESS;
20104 0 : }
20105 0 : default: return FD_BINCODE_ERR_ENCODING;
20106 0 : }
20107 0 : }
20108 0 : int fd_nonce_state_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
20109 0 : *total_sz += sizeof(fd_nonce_state_t);
20110 0 : void const * start_data = ctx->data;
20111 0 : int err = fd_nonce_state_decode_footprint_inner( ctx, total_sz );
20112 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
20113 0 : ctx->data = start_data;
20114 0 : return err;
20115 0 : }
20116 0 : int fd_nonce_state_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
20117 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
20118 0 : uint discriminant = 0;
20119 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
20120 0 : if( FD_UNLIKELY( err ) ) return err;
20121 0 : return fd_nonce_state_inner_decode_footprint( discriminant, ctx, total_sz );
20122 0 : }
20123 0 : void fd_nonce_state_inner_decode_inner( fd_nonce_state_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
20124 0 : switch (discriminant) {
20125 0 : case 0: {
20126 0 : break;
20127 0 : }
20128 0 : case 1: {
20129 0 : fd_nonce_data_decode_inner( &self->initialized, alloc_mem, ctx );
20130 0 : break;
20131 0 : }
20132 0 : }
20133 0 : }
20134 0 : void fd_nonce_state_inner_decode_inner_global( fd_nonce_state_inner_global_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
20135 0 : switch (discriminant) {
20136 0 : case 0: {
20137 0 : break;
20138 0 : }
20139 0 : case 1: {
20140 0 : fd_nonce_data_decode_inner_global( &self->initialized, alloc_mem, ctx );
20141 0 : break;
20142 0 : }
20143 0 : }
20144 0 : }
20145 0 : int fd_nonce_state_convert_global_to_local_inner( fd_nonce_state_inner_global_t const * mem, fd_nonce_state_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
20146 0 : int err = 0;
20147 0 : switch( discriminant ) {
20148 0 : case 0: {
20149 0 : break;
20150 0 : }
20151 0 : case 1: {
20152 0 : err = fd_nonce_data_convert_global_to_local( &mem->initialized, &self->initialized, ctx );
20153 0 : if( FD_UNLIKELY( err ) ) return err;
20154 0 : break;
20155 0 : }
20156 0 : }
20157 0 : return FD_BINCODE_SUCCESS;
20158 0 : }
20159 0 : int fd_nonce_state_convert_global_to_local( void const * global_self, fd_nonce_state_t * self, fd_bincode_decode_ctx_t * ctx ) {
20160 0 : fd_nonce_state_global_t const * mem = (fd_nonce_state_global_t const *)global_self;
20161 0 : uint discriminant = mem->discriminant;
20162 0 : self->discriminant = mem->discriminant;
20163 0 : int err = fd_nonce_state_convert_global_to_local_inner( &mem->inner, &self->inner, discriminant, ctx );
20164 0 : return FD_BINCODE_SUCCESS;
20165 0 : }
20166 0 : void fd_nonce_state_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
20167 0 : fd_nonce_state_t * self = (fd_nonce_state_t *)struct_mem;
20168 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
20169 0 : fd_nonce_state_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
20170 0 : }
20171 0 : void * fd_nonce_state_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
20172 0 : fd_nonce_state_t * self = (fd_nonce_state_t *)mem;
20173 0 : fd_nonce_state_new( self );
20174 0 : void * alloc_region = (uchar *)mem + sizeof(fd_nonce_state_t);
20175 0 : void * * alloc_mem = &alloc_region;
20176 0 : fd_nonce_state_decode_inner( mem, alloc_mem, ctx );
20177 0 : return self;
20178 0 : }
20179 0 : void * fd_nonce_state_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
20180 0 : fd_nonce_state_t * self = (fd_nonce_state_t *)mem;
20181 0 : fd_nonce_state_new( self );
20182 0 : void * alloc_region = (uchar *)mem + sizeof(fd_nonce_state_t);
20183 0 : void * * alloc_mem = &alloc_region;
20184 0 : fd_nonce_state_decode_inner_global( mem, alloc_mem, ctx );
20185 0 : return self;
20186 0 : }
20187 0 : void fd_nonce_state_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
20188 0 : fd_nonce_state_global_t * self = (fd_nonce_state_global_t *)struct_mem;
20189 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
20190 0 : fd_nonce_state_inner_decode_inner_global( &self->inner, alloc_mem, self->discriminant, ctx );
20191 0 : }
20192 0 : void fd_nonce_state_inner_new( fd_nonce_state_inner_t * self, uint discriminant ) {
20193 0 : switch( discriminant ) {
20194 0 : case 0: {
20195 0 : break;
20196 0 : }
20197 0 : case 1: {
20198 0 : fd_nonce_data_new( &self->initialized );
20199 0 : break;
20200 0 : }
20201 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
20202 0 : }
20203 0 : }
20204 0 : void fd_nonce_state_new_disc( fd_nonce_state_t * self, uint discriminant ) {
20205 0 : self->discriminant = discriminant;
20206 0 : fd_nonce_state_inner_new( &self->inner, self->discriminant );
20207 0 : }
20208 0 : void fd_nonce_state_new( fd_nonce_state_t * self ) {
20209 0 : fd_memset( self, 0, sizeof(fd_nonce_state_t) );
20210 0 : fd_nonce_state_new_disc( self, UINT_MAX );
20211 0 : }
20212 0 : void fd_nonce_state_inner_destroy( fd_nonce_state_inner_t * self, uint discriminant ) {
20213 0 : switch( discriminant ) {
20214 0 : case 1: {
20215 0 : fd_nonce_data_destroy( &self->initialized );
20216 0 : break;
20217 0 : }
20218 0 : default: break; // FD_LOG_ERR(( "unhandled type" ));
20219 0 : }
20220 0 : }
20221 0 : void fd_nonce_state_destroy( fd_nonce_state_t * self ) {
20222 0 : fd_nonce_state_inner_destroy( &self->inner, self->discriminant );
20223 0 : }
20224 :
20225 0 : ulong fd_nonce_state_footprint( void ){ return FD_NONCE_STATE_FOOTPRINT; }
20226 0 : ulong fd_nonce_state_align( void ){ return FD_NONCE_STATE_ALIGN; }
20227 :
20228 0 : void fd_nonce_state_walk( void * w, fd_nonce_state_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
20229 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_nonce_state", level++);
20230 0 : switch( self->discriminant ) {
20231 0 : case 0: {
20232 0 : fun( w, self, "uninitialized", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
20233 0 : break;
20234 0 : }
20235 0 : case 1: {
20236 0 : fun( w, self, "initialized", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
20237 0 : fd_nonce_data_walk( w, &self->inner.initialized, fun, "initialized", level );
20238 0 : break;
20239 0 : }
20240 0 : }
20241 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_nonce_state", level-- );
20242 0 : }
20243 0 : ulong fd_nonce_state_size( fd_nonce_state_t const * self ) {
20244 0 : ulong size = 0;
20245 0 : size += sizeof(uint);
20246 0 : switch (self->discriminant) {
20247 0 : case 1: {
20248 0 : size += fd_nonce_data_size( &self->inner.initialized );
20249 0 : break;
20250 0 : }
20251 0 : }
20252 0 : return size;
20253 0 : }
20254 :
20255 0 : int fd_nonce_state_inner_encode( fd_nonce_state_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
20256 0 : int err;
20257 0 : switch (discriminant) {
20258 0 : case 1: {
20259 0 : err = fd_nonce_data_encode( &self->initialized, ctx );
20260 0 : if( FD_UNLIKELY( err ) ) return err;
20261 0 : break;
20262 0 : }
20263 0 : }
20264 0 : return FD_BINCODE_SUCCESS;
20265 0 : }
20266 0 : int fd_nonce_state_encode( fd_nonce_state_t const * self, fd_bincode_encode_ctx_t * ctx ) {
20267 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
20268 0 : if( FD_UNLIKELY( err ) ) return err;
20269 0 : return fd_nonce_state_inner_encode( &self->inner, self->discriminant, ctx );
20270 0 : }
20271 :
20272 0 : FD_FN_PURE uchar fd_nonce_state_versions_is_legacy(fd_nonce_state_versions_t const * self) {
20273 0 : return self->discriminant == 0;
20274 0 : }
20275 0 : FD_FN_PURE uchar fd_nonce_state_versions_is_current(fd_nonce_state_versions_t const * self) {
20276 0 : return self->discriminant == 1;
20277 0 : }
20278 : void fd_nonce_state_versions_inner_new( fd_nonce_state_versions_inner_t * self, uint discriminant );
20279 0 : int fd_nonce_state_versions_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
20280 0 : int err;
20281 0 : switch (discriminant) {
20282 0 : case 0: {
20283 0 : err = fd_nonce_state_decode_footprint_inner( ctx, total_sz );
20284 0 : if( FD_UNLIKELY( err ) ) return err;
20285 0 : return FD_BINCODE_SUCCESS;
20286 0 : }
20287 0 : case 1: {
20288 0 : err = fd_nonce_state_decode_footprint_inner( ctx, total_sz );
20289 0 : if( FD_UNLIKELY( err ) ) return err;
20290 0 : return FD_BINCODE_SUCCESS;
20291 0 : }
20292 0 : default: return FD_BINCODE_ERR_ENCODING;
20293 0 : }
20294 0 : }
20295 0 : int fd_nonce_state_versions_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
20296 0 : *total_sz += sizeof(fd_nonce_state_versions_t);
20297 0 : void const * start_data = ctx->data;
20298 0 : int err = fd_nonce_state_versions_decode_footprint_inner( ctx, total_sz );
20299 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
20300 0 : ctx->data = start_data;
20301 0 : return err;
20302 0 : }
20303 0 : int fd_nonce_state_versions_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
20304 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
20305 0 : uint discriminant = 0;
20306 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
20307 0 : if( FD_UNLIKELY( err ) ) return err;
20308 0 : return fd_nonce_state_versions_inner_decode_footprint( discriminant, ctx, total_sz );
20309 0 : }
20310 0 : 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 ) {
20311 0 : switch (discriminant) {
20312 0 : case 0: {
20313 0 : fd_nonce_state_decode_inner( &self->legacy, alloc_mem, ctx );
20314 0 : break;
20315 0 : }
20316 0 : case 1: {
20317 0 : fd_nonce_state_decode_inner( &self->current, alloc_mem, ctx );
20318 0 : break;
20319 0 : }
20320 0 : }
20321 0 : }
20322 0 : void fd_nonce_state_versions_inner_decode_inner_global( fd_nonce_state_versions_inner_global_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
20323 0 : switch (discriminant) {
20324 0 : case 0: {
20325 0 : fd_nonce_state_decode_inner_global( &self->legacy, alloc_mem, ctx );
20326 0 : break;
20327 0 : }
20328 0 : case 1: {
20329 0 : fd_nonce_state_decode_inner_global( &self->current, alloc_mem, ctx );
20330 0 : break;
20331 0 : }
20332 0 : }
20333 0 : }
20334 0 : int fd_nonce_state_versions_convert_global_to_local_inner( fd_nonce_state_versions_inner_global_t const * mem, fd_nonce_state_versions_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
20335 0 : int err = 0;
20336 0 : switch( discriminant ) {
20337 0 : case 0: {
20338 0 : err = fd_nonce_state_convert_global_to_local( &mem->legacy, &self->legacy, ctx );
20339 0 : if( FD_UNLIKELY( err ) ) return err;
20340 0 : break;
20341 0 : }
20342 0 : case 1: {
20343 0 : err = fd_nonce_state_convert_global_to_local( &mem->current, &self->current, ctx );
20344 0 : if( FD_UNLIKELY( err ) ) return err;
20345 0 : break;
20346 0 : }
20347 0 : }
20348 0 : return FD_BINCODE_SUCCESS;
20349 0 : }
20350 0 : int fd_nonce_state_versions_convert_global_to_local( void const * global_self, fd_nonce_state_versions_t * self, fd_bincode_decode_ctx_t * ctx ) {
20351 0 : fd_nonce_state_versions_global_t const * mem = (fd_nonce_state_versions_global_t const *)global_self;
20352 0 : uint discriminant = mem->discriminant;
20353 0 : self->discriminant = mem->discriminant;
20354 0 : int err = fd_nonce_state_versions_convert_global_to_local_inner( &mem->inner, &self->inner, discriminant, ctx );
20355 0 : return FD_BINCODE_SUCCESS;
20356 0 : }
20357 0 : void fd_nonce_state_versions_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
20358 0 : fd_nonce_state_versions_t * self = (fd_nonce_state_versions_t *)struct_mem;
20359 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
20360 0 : fd_nonce_state_versions_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
20361 0 : }
20362 0 : void * fd_nonce_state_versions_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
20363 0 : fd_nonce_state_versions_t * self = (fd_nonce_state_versions_t *)mem;
20364 0 : fd_nonce_state_versions_new( self );
20365 0 : void * alloc_region = (uchar *)mem + sizeof(fd_nonce_state_versions_t);
20366 0 : void * * alloc_mem = &alloc_region;
20367 0 : fd_nonce_state_versions_decode_inner( mem, alloc_mem, ctx );
20368 0 : return self;
20369 0 : }
20370 0 : void * fd_nonce_state_versions_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
20371 0 : fd_nonce_state_versions_t * self = (fd_nonce_state_versions_t *)mem;
20372 0 : fd_nonce_state_versions_new( self );
20373 0 : void * alloc_region = (uchar *)mem + sizeof(fd_nonce_state_versions_t);
20374 0 : void * * alloc_mem = &alloc_region;
20375 0 : fd_nonce_state_versions_decode_inner_global( mem, alloc_mem, ctx );
20376 0 : return self;
20377 0 : }
20378 0 : void fd_nonce_state_versions_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
20379 0 : fd_nonce_state_versions_global_t * self = (fd_nonce_state_versions_global_t *)struct_mem;
20380 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
20381 0 : fd_nonce_state_versions_inner_decode_inner_global( &self->inner, alloc_mem, self->discriminant, ctx );
20382 0 : }
20383 0 : void fd_nonce_state_versions_inner_new( fd_nonce_state_versions_inner_t * self, uint discriminant ) {
20384 0 : switch( discriminant ) {
20385 0 : case 0: {
20386 0 : fd_nonce_state_new( &self->legacy );
20387 0 : break;
20388 0 : }
20389 0 : case 1: {
20390 0 : fd_nonce_state_new( &self->current );
20391 0 : break;
20392 0 : }
20393 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
20394 0 : }
20395 0 : }
20396 0 : void fd_nonce_state_versions_new_disc( fd_nonce_state_versions_t * self, uint discriminant ) {
20397 0 : self->discriminant = discriminant;
20398 0 : fd_nonce_state_versions_inner_new( &self->inner, self->discriminant );
20399 0 : }
20400 0 : void fd_nonce_state_versions_new( fd_nonce_state_versions_t * self ) {
20401 0 : fd_memset( self, 0, sizeof(fd_nonce_state_versions_t) );
20402 0 : fd_nonce_state_versions_new_disc( self, UINT_MAX );
20403 0 : }
20404 0 : void fd_nonce_state_versions_inner_destroy( fd_nonce_state_versions_inner_t * self, uint discriminant ) {
20405 0 : switch( discriminant ) {
20406 0 : case 0: {
20407 0 : fd_nonce_state_destroy( &self->legacy );
20408 0 : break;
20409 0 : }
20410 0 : case 1: {
20411 0 : fd_nonce_state_destroy( &self->current );
20412 0 : break;
20413 0 : }
20414 0 : default: break; // FD_LOG_ERR(( "unhandled type" ));
20415 0 : }
20416 0 : }
20417 0 : void fd_nonce_state_versions_destroy( fd_nonce_state_versions_t * self ) {
20418 0 : fd_nonce_state_versions_inner_destroy( &self->inner, self->discriminant );
20419 0 : }
20420 :
20421 0 : ulong fd_nonce_state_versions_footprint( void ){ return FD_NONCE_STATE_VERSIONS_FOOTPRINT; }
20422 0 : ulong fd_nonce_state_versions_align( void ){ return FD_NONCE_STATE_VERSIONS_ALIGN; }
20423 :
20424 0 : void fd_nonce_state_versions_walk( void * w, fd_nonce_state_versions_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
20425 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_nonce_state_versions", level++);
20426 0 : switch( self->discriminant ) {
20427 0 : case 0: {
20428 0 : fun( w, self, "legacy", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
20429 0 : fd_nonce_state_walk( w, &self->inner.legacy, fun, "legacy", level );
20430 0 : break;
20431 0 : }
20432 0 : case 1: {
20433 0 : fun( w, self, "current", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
20434 0 : fd_nonce_state_walk( w, &self->inner.current, fun, "current", level );
20435 0 : break;
20436 0 : }
20437 0 : }
20438 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_nonce_state_versions", level-- );
20439 0 : }
20440 0 : ulong fd_nonce_state_versions_size( fd_nonce_state_versions_t const * self ) {
20441 0 : ulong size = 0;
20442 0 : size += sizeof(uint);
20443 0 : switch (self->discriminant) {
20444 0 : case 0: {
20445 0 : size += fd_nonce_state_size( &self->inner.legacy );
20446 0 : break;
20447 0 : }
20448 0 : case 1: {
20449 0 : size += fd_nonce_state_size( &self->inner.current );
20450 0 : break;
20451 0 : }
20452 0 : }
20453 0 : return size;
20454 0 : }
20455 :
20456 0 : int fd_nonce_state_versions_inner_encode( fd_nonce_state_versions_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
20457 0 : int err;
20458 0 : switch (discriminant) {
20459 0 : case 0: {
20460 0 : err = fd_nonce_state_encode( &self->legacy, ctx );
20461 0 : if( FD_UNLIKELY( err ) ) return err;
20462 0 : break;
20463 0 : }
20464 0 : case 1: {
20465 0 : err = fd_nonce_state_encode( &self->current, ctx );
20466 0 : if( FD_UNLIKELY( err ) ) return err;
20467 0 : break;
20468 0 : }
20469 0 : }
20470 0 : return FD_BINCODE_SUCCESS;
20471 0 : }
20472 0 : int fd_nonce_state_versions_encode( fd_nonce_state_versions_t const * self, fd_bincode_encode_ctx_t * ctx ) {
20473 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
20474 0 : if( FD_UNLIKELY( err ) ) return err;
20475 0 : return fd_nonce_state_versions_inner_encode( &self->inner, self->discriminant, ctx );
20476 0 : }
20477 :
20478 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 ) {
20479 0 : int err;
20480 0 : err = fd_bincode_uint32_encode( self->units, ctx );
20481 0 : if( FD_UNLIKELY( err ) ) return err;
20482 0 : err = fd_bincode_uint32_encode( self->additional_fee, ctx );
20483 0 : if( FD_UNLIKELY( err ) ) return err;
20484 0 : return FD_BINCODE_SUCCESS;
20485 0 : }
20486 0 : int fd_compute_budget_program_instruction_request_units_deprecated_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
20487 0 : *total_sz += sizeof(fd_compute_budget_program_instruction_request_units_deprecated_t);
20488 0 : void const * start_data = ctx->data;
20489 0 : int err = fd_compute_budget_program_instruction_request_units_deprecated_decode_footprint_inner( ctx, total_sz );
20490 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
20491 0 : ctx->data = start_data;
20492 0 : return err;
20493 0 : }
20494 0 : int fd_compute_budget_program_instruction_request_units_deprecated_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
20495 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
20496 0 : int err = 0;
20497 0 : err = fd_bincode_uint32_decode_footprint( ctx );
20498 0 : if( FD_UNLIKELY( err ) ) return err;
20499 0 : err = fd_bincode_uint32_decode_footprint( ctx );
20500 0 : if( FD_UNLIKELY( err ) ) return err;
20501 0 : return 0;
20502 0 : }
20503 0 : void * fd_compute_budget_program_instruction_request_units_deprecated_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
20504 0 : fd_compute_budget_program_instruction_request_units_deprecated_t * self = (fd_compute_budget_program_instruction_request_units_deprecated_t *)mem;
20505 0 : fd_compute_budget_program_instruction_request_units_deprecated_new( self );
20506 0 : void * alloc_region = (uchar *)mem + sizeof(fd_compute_budget_program_instruction_request_units_deprecated_t);
20507 0 : void * * alloc_mem = &alloc_region;
20508 0 : fd_compute_budget_program_instruction_request_units_deprecated_decode_inner( mem, alloc_mem, ctx );
20509 0 : return self;
20510 0 : }
20511 0 : void fd_compute_budget_program_instruction_request_units_deprecated_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
20512 0 : fd_compute_budget_program_instruction_request_units_deprecated_t * self = (fd_compute_budget_program_instruction_request_units_deprecated_t *)struct_mem;
20513 0 : fd_bincode_uint32_decode_unsafe( &self->units, ctx );
20514 0 : fd_bincode_uint32_decode_unsafe( &self->additional_fee, ctx );
20515 0 : }
20516 0 : void * fd_compute_budget_program_instruction_request_units_deprecated_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
20517 0 : fd_compute_budget_program_instruction_request_units_deprecated_global_t * self = (fd_compute_budget_program_instruction_request_units_deprecated_global_t *)mem;
20518 0 : fd_compute_budget_program_instruction_request_units_deprecated_new( (fd_compute_budget_program_instruction_request_units_deprecated_t *)self );
20519 0 : void * alloc_region = (uchar *)mem + sizeof(fd_compute_budget_program_instruction_request_units_deprecated_global_t);
20520 0 : void * * alloc_mem = &alloc_region;
20521 0 : fd_compute_budget_program_instruction_request_units_deprecated_decode_inner_global( mem, alloc_mem, ctx );
20522 0 : return self;
20523 0 : }
20524 0 : void fd_compute_budget_program_instruction_request_units_deprecated_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
20525 0 : fd_compute_budget_program_instruction_request_units_deprecated_global_t * self = (fd_compute_budget_program_instruction_request_units_deprecated_global_t *)struct_mem;
20526 0 : fd_bincode_uint32_decode_unsafe( &self->units, ctx );
20527 0 : fd_bincode_uint32_decode_unsafe( &self->additional_fee, ctx );
20528 0 : }
20529 0 : int fd_compute_budget_program_instruction_request_units_deprecated_convert_global_to_local( void const * global_self, fd_compute_budget_program_instruction_request_units_deprecated_t * self, fd_bincode_decode_ctx_t * ctx ) {
20530 0 : int err = 0;
20531 0 : fd_compute_budget_program_instruction_request_units_deprecated_global_t const * mem = (fd_compute_budget_program_instruction_request_units_deprecated_global_t const *)global_self;
20532 0 : self->units = mem->units;
20533 0 : self->additional_fee = mem->additional_fee;
20534 0 : return FD_BINCODE_SUCCESS;
20535 0 : }
20536 0 : void fd_compute_budget_program_instruction_request_units_deprecated_new(fd_compute_budget_program_instruction_request_units_deprecated_t * self) {
20537 0 : fd_memset( self, 0, sizeof(fd_compute_budget_program_instruction_request_units_deprecated_t) );
20538 0 : }
20539 0 : void fd_compute_budget_program_instruction_request_units_deprecated_destroy( fd_compute_budget_program_instruction_request_units_deprecated_t * self ) {
20540 0 : }
20541 :
20542 0 : ulong fd_compute_budget_program_instruction_request_units_deprecated_footprint( void ){ return FD_COMPUTE_BUDGET_PROGRAM_INSTRUCTION_REQUEST_UNITS_DEPRECATED_FOOTPRINT; }
20543 0 : ulong fd_compute_budget_program_instruction_request_units_deprecated_align( void ){ return FD_COMPUTE_BUDGET_PROGRAM_INSTRUCTION_REQUEST_UNITS_DEPRECATED_ALIGN; }
20544 :
20545 0 : void fd_compute_budget_program_instruction_request_units_deprecated_walk( void * w, fd_compute_budget_program_instruction_request_units_deprecated_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
20546 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_compute_budget_program_instruction_request_units_deprecated", level++ );
20547 0 : fun( w, &self->units, "units", FD_FLAMENCO_TYPE_UINT, "uint", level );
20548 0 : fun( w, &self->additional_fee, "additional_fee", FD_FLAMENCO_TYPE_UINT, "uint", level );
20549 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_compute_budget_program_instruction_request_units_deprecated", level-- );
20550 0 : }
20551 0 : ulong fd_compute_budget_program_instruction_request_units_deprecated_size( fd_compute_budget_program_instruction_request_units_deprecated_t const * self ) {
20552 0 : ulong size = 0;
20553 0 : size += sizeof(uint);
20554 0 : size += sizeof(uint);
20555 0 : return size;
20556 0 : }
20557 :
20558 0 : FD_FN_PURE uchar fd_compute_budget_program_instruction_is_request_units_deprecated(fd_compute_budget_program_instruction_t const * self) {
20559 0 : return self->discriminant == 0;
20560 0 : }
20561 0 : FD_FN_PURE uchar fd_compute_budget_program_instruction_is_request_heap_frame(fd_compute_budget_program_instruction_t const * self) {
20562 0 : return self->discriminant == 1;
20563 0 : }
20564 0 : FD_FN_PURE uchar fd_compute_budget_program_instruction_is_set_compute_unit_limit(fd_compute_budget_program_instruction_t const * self) {
20565 0 : return self->discriminant == 2;
20566 0 : }
20567 0 : FD_FN_PURE uchar fd_compute_budget_program_instruction_is_set_compute_unit_price(fd_compute_budget_program_instruction_t const * self) {
20568 0 : return self->discriminant == 3;
20569 0 : }
20570 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) {
20571 0 : return self->discriminant == 4;
20572 0 : }
20573 : void fd_compute_budget_program_instruction_inner_new( fd_compute_budget_program_instruction_inner_t * self, uint discriminant );
20574 0 : int fd_compute_budget_program_instruction_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
20575 0 : int err;
20576 0 : switch (discriminant) {
20577 0 : case 0: {
20578 0 : err = fd_compute_budget_program_instruction_request_units_deprecated_decode_footprint_inner( ctx, total_sz );
20579 0 : if( FD_UNLIKELY( err ) ) return err;
20580 0 : return FD_BINCODE_SUCCESS;
20581 0 : }
20582 0 : case 1: {
20583 0 : err = fd_bincode_uint32_decode_footprint( ctx );
20584 0 : if( FD_UNLIKELY( err ) ) return err;
20585 0 : return FD_BINCODE_SUCCESS;
20586 0 : }
20587 0 : case 2: {
20588 0 : err = fd_bincode_uint32_decode_footprint( ctx );
20589 0 : if( FD_UNLIKELY( err ) ) return err;
20590 0 : return FD_BINCODE_SUCCESS;
20591 0 : }
20592 0 : case 3: {
20593 0 : err = fd_bincode_uint64_decode_footprint( ctx );
20594 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
20595 0 : return FD_BINCODE_SUCCESS;
20596 0 : }
20597 0 : case 4: {
20598 0 : err = fd_bincode_uint32_decode_footprint( ctx );
20599 0 : if( FD_UNLIKELY( err ) ) return err;
20600 0 : return FD_BINCODE_SUCCESS;
20601 0 : }
20602 0 : default: return FD_BINCODE_ERR_ENCODING;
20603 0 : }
20604 0 : }
20605 0 : int fd_compute_budget_program_instruction_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
20606 0 : *total_sz += sizeof(fd_compute_budget_program_instruction_t);
20607 0 : void const * start_data = ctx->data;
20608 0 : int err = fd_compute_budget_program_instruction_decode_footprint_inner( ctx, total_sz );
20609 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
20610 0 : ctx->data = start_data;
20611 0 : return err;
20612 0 : }
20613 0 : int fd_compute_budget_program_instruction_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
20614 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
20615 0 : ushort discriminant = 0;
20616 0 : int err = fd_bincode_compact_u16_decode( &discriminant, ctx );
20617 0 : if( FD_UNLIKELY( err ) ) return err;
20618 0 : return fd_compute_budget_program_instruction_inner_decode_footprint( discriminant, ctx, total_sz );
20619 0 : }
20620 0 : 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 ) {
20621 0 : switch (discriminant) {
20622 0 : case 0: {
20623 0 : fd_compute_budget_program_instruction_request_units_deprecated_decode_inner( &self->request_units_deprecated, alloc_mem, ctx );
20624 0 : break;
20625 0 : }
20626 0 : case 1: {
20627 0 : fd_bincode_uint32_decode_unsafe( &self->request_heap_frame, ctx );
20628 0 : break;
20629 0 : }
20630 0 : case 2: {
20631 0 : fd_bincode_uint32_decode_unsafe( &self->set_compute_unit_limit, ctx );
20632 0 : break;
20633 0 : }
20634 0 : case 3: {
20635 0 : fd_bincode_uint64_decode_unsafe( &self->set_compute_unit_price, ctx );
20636 0 : break;
20637 0 : }
20638 0 : case 4: {
20639 0 : fd_bincode_uint32_decode_unsafe( &self->set_loaded_accounts_data_size_limit, ctx );
20640 0 : break;
20641 0 : }
20642 0 : }
20643 0 : }
20644 0 : void fd_compute_budget_program_instruction_inner_decode_inner_global( fd_compute_budget_program_instruction_inner_global_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
20645 0 : switch (discriminant) {
20646 0 : case 0: {
20647 0 : fd_compute_budget_program_instruction_request_units_deprecated_decode_inner_global( &self->request_units_deprecated, alloc_mem, ctx );
20648 0 : break;
20649 0 : }
20650 0 : case 1: {
20651 0 : fd_bincode_uint32_decode_unsafe( &self->request_heap_frame, ctx );
20652 0 : break;
20653 0 : }
20654 0 : case 2: {
20655 0 : fd_bincode_uint32_decode_unsafe( &self->set_compute_unit_limit, ctx );
20656 0 : break;
20657 0 : }
20658 0 : case 3: {
20659 0 : fd_bincode_uint64_decode_unsafe( &self->set_compute_unit_price, ctx );
20660 0 : break;
20661 0 : }
20662 0 : case 4: {
20663 0 : fd_bincode_uint32_decode_unsafe( &self->set_loaded_accounts_data_size_limit, ctx );
20664 0 : break;
20665 0 : }
20666 0 : }
20667 0 : }
20668 0 : int fd_compute_budget_program_instruction_convert_global_to_local_inner( fd_compute_budget_program_instruction_inner_global_t const * mem, fd_compute_budget_program_instruction_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
20669 0 : int err = 0;
20670 0 : switch( discriminant ) {
20671 0 : case 0: {
20672 0 : err = fd_compute_budget_program_instruction_request_units_deprecated_convert_global_to_local( &mem->request_units_deprecated, &self->request_units_deprecated, ctx );
20673 0 : if( FD_UNLIKELY( err ) ) return err;
20674 0 : break;
20675 0 : }
20676 0 : case 1: {
20677 0 : self->request_heap_frame = mem->request_heap_frame;
20678 0 : break;
20679 0 : }
20680 0 : case 2: {
20681 0 : self->set_compute_unit_limit = mem->set_compute_unit_limit;
20682 0 : break;
20683 0 : }
20684 0 : case 3: {
20685 0 : self->set_compute_unit_price = mem->set_compute_unit_price;
20686 0 : break;
20687 0 : }
20688 0 : case 4: {
20689 0 : self->set_loaded_accounts_data_size_limit = mem->set_loaded_accounts_data_size_limit;
20690 0 : break;
20691 0 : }
20692 0 : }
20693 0 : return FD_BINCODE_SUCCESS;
20694 0 : }
20695 0 : int fd_compute_budget_program_instruction_convert_global_to_local( void const * global_self, fd_compute_budget_program_instruction_t * self, fd_bincode_decode_ctx_t * ctx ) {
20696 0 : fd_compute_budget_program_instruction_global_t const * mem = (fd_compute_budget_program_instruction_global_t const *)global_self;
20697 0 : uint discriminant = mem->discriminant;
20698 0 : self->discriminant = mem->discriminant;
20699 0 : int err = fd_compute_budget_program_instruction_convert_global_to_local_inner( &mem->inner, &self->inner, discriminant, ctx );
20700 0 : return FD_BINCODE_SUCCESS;
20701 0 : }
20702 0 : void fd_compute_budget_program_instruction_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
20703 0 : fd_compute_budget_program_instruction_t * self = (fd_compute_budget_program_instruction_t *)struct_mem;
20704 0 : ushort tmp = 0;
20705 0 : fd_bincode_compact_u16_decode_unsafe( &tmp, ctx );
20706 0 : self->discriminant = tmp;
20707 0 : fd_compute_budget_program_instruction_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
20708 0 : }
20709 0 : void * fd_compute_budget_program_instruction_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
20710 0 : fd_compute_budget_program_instruction_t * self = (fd_compute_budget_program_instruction_t *)mem;
20711 0 : fd_compute_budget_program_instruction_new( self );
20712 0 : void * alloc_region = (uchar *)mem + sizeof(fd_compute_budget_program_instruction_t);
20713 0 : void * * alloc_mem = &alloc_region;
20714 0 : fd_compute_budget_program_instruction_decode_inner( mem, alloc_mem, ctx );
20715 0 : return self;
20716 0 : }
20717 0 : void * fd_compute_budget_program_instruction_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
20718 0 : fd_compute_budget_program_instruction_t * self = (fd_compute_budget_program_instruction_t *)mem;
20719 0 : fd_compute_budget_program_instruction_new( self );
20720 0 : void * alloc_region = (uchar *)mem + sizeof(fd_compute_budget_program_instruction_t);
20721 0 : void * * alloc_mem = &alloc_region;
20722 0 : fd_compute_budget_program_instruction_decode_inner_global( mem, alloc_mem, ctx );
20723 0 : return self;
20724 0 : }
20725 0 : void fd_compute_budget_program_instruction_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
20726 0 : fd_compute_budget_program_instruction_global_t * self = (fd_compute_budget_program_instruction_global_t *)struct_mem;
20727 0 : ushort tmp = 0;
20728 0 : fd_bincode_compact_u16_decode_unsafe( &tmp, ctx );
20729 0 : self->discriminant = tmp;
20730 0 : fd_compute_budget_program_instruction_inner_decode_inner_global( &self->inner, alloc_mem, self->discriminant, ctx );
20731 0 : }
20732 0 : void fd_compute_budget_program_instruction_inner_new( fd_compute_budget_program_instruction_inner_t * self, uint discriminant ) {
20733 0 : switch( discriminant ) {
20734 0 : case 0: {
20735 0 : fd_compute_budget_program_instruction_request_units_deprecated_new( &self->request_units_deprecated );
20736 0 : break;
20737 0 : }
20738 0 : case 1: {
20739 0 : break;
20740 0 : }
20741 0 : case 2: {
20742 0 : break;
20743 0 : }
20744 0 : case 3: {
20745 0 : break;
20746 0 : }
20747 0 : case 4: {
20748 0 : break;
20749 0 : }
20750 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
20751 0 : }
20752 0 : }
20753 0 : void fd_compute_budget_program_instruction_new_disc( fd_compute_budget_program_instruction_t * self, uint discriminant ) {
20754 0 : self->discriminant = discriminant;
20755 0 : fd_compute_budget_program_instruction_inner_new( &self->inner, self->discriminant );
20756 0 : }
20757 0 : void fd_compute_budget_program_instruction_new( fd_compute_budget_program_instruction_t * self ) {
20758 0 : fd_memset( self, 0, sizeof(fd_compute_budget_program_instruction_t) );
20759 0 : fd_compute_budget_program_instruction_new_disc( self, UINT_MAX );
20760 0 : }
20761 0 : void fd_compute_budget_program_instruction_inner_destroy( fd_compute_budget_program_instruction_inner_t * self, uint discriminant ) {
20762 0 : switch( discriminant ) {
20763 0 : case 0: {
20764 0 : fd_compute_budget_program_instruction_request_units_deprecated_destroy( &self->request_units_deprecated );
20765 0 : break;
20766 0 : }
20767 0 : case 1: {
20768 0 : break;
20769 0 : }
20770 0 : case 2: {
20771 0 : break;
20772 0 : }
20773 0 : case 3: {
20774 0 : break;
20775 0 : }
20776 0 : case 4: {
20777 0 : break;
20778 0 : }
20779 0 : default: break; // FD_LOG_ERR(( "unhandled type" ));
20780 0 : }
20781 0 : }
20782 0 : void fd_compute_budget_program_instruction_destroy( fd_compute_budget_program_instruction_t * self ) {
20783 0 : fd_compute_budget_program_instruction_inner_destroy( &self->inner, self->discriminant );
20784 0 : }
20785 :
20786 0 : ulong fd_compute_budget_program_instruction_footprint( void ){ return FD_COMPUTE_BUDGET_PROGRAM_INSTRUCTION_FOOTPRINT; }
20787 0 : ulong fd_compute_budget_program_instruction_align( void ){ return FD_COMPUTE_BUDGET_PROGRAM_INSTRUCTION_ALIGN; }
20788 :
20789 0 : void fd_compute_budget_program_instruction_walk( void * w, fd_compute_budget_program_instruction_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
20790 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_compute_budget_program_instruction", level++);
20791 0 : switch( self->discriminant ) {
20792 0 : case 0: {
20793 0 : fun( w, self, "request_units_deprecated", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
20794 0 : fd_compute_budget_program_instruction_request_units_deprecated_walk( w, &self->inner.request_units_deprecated, fun, "request_units_deprecated", level );
20795 0 : break;
20796 0 : }
20797 0 : case 1: {
20798 0 : fun( w, self, "request_heap_frame", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
20799 0 : fun( w, &self->inner.request_heap_frame, "request_heap_frame", FD_FLAMENCO_TYPE_UINT, "uint", level );
20800 0 : break;
20801 0 : }
20802 0 : case 2: {
20803 0 : fun( w, self, "set_compute_unit_limit", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
20804 0 : fun( w, &self->inner.set_compute_unit_limit, "set_compute_unit_limit", FD_FLAMENCO_TYPE_UINT, "uint", level );
20805 0 : break;
20806 0 : }
20807 0 : case 3: {
20808 0 : fun( w, self, "set_compute_unit_price", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
20809 0 : fun( w, &self->inner.set_compute_unit_price, "set_compute_unit_price", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
20810 0 : break;
20811 0 : }
20812 0 : case 4: {
20813 0 : fun( w, self, "set_loaded_accounts_data_size_limit", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
20814 0 : fun( w, &self->inner.set_loaded_accounts_data_size_limit, "set_loaded_accounts_data_size_limit", FD_FLAMENCO_TYPE_UINT, "uint", level );
20815 0 : break;
20816 0 : }
20817 0 : }
20818 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_compute_budget_program_instruction", level-- );
20819 0 : }
20820 0 : ulong fd_compute_budget_program_instruction_size( fd_compute_budget_program_instruction_t const * self ) {
20821 0 : ulong size = 0;
20822 0 : size += sizeof(uint);
20823 0 : switch (self->discriminant) {
20824 0 : case 0: {
20825 0 : size += fd_compute_budget_program_instruction_request_units_deprecated_size( &self->inner.request_units_deprecated );
20826 0 : break;
20827 0 : }
20828 0 : case 1: {
20829 0 : size += sizeof(uint);
20830 0 : break;
20831 0 : }
20832 0 : case 2: {
20833 0 : size += sizeof(uint);
20834 0 : break;
20835 0 : }
20836 0 : case 3: {
20837 0 : size += sizeof(ulong);
20838 0 : break;
20839 0 : }
20840 0 : case 4: {
20841 0 : size += sizeof(uint);
20842 0 : break;
20843 0 : }
20844 0 : }
20845 0 : return size;
20846 0 : }
20847 :
20848 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 ) {
20849 0 : int err;
20850 0 : switch (discriminant) {
20851 0 : case 0: {
20852 0 : err = fd_compute_budget_program_instruction_request_units_deprecated_encode( &self->request_units_deprecated, ctx );
20853 0 : if( FD_UNLIKELY( err ) ) return err;
20854 0 : break;
20855 0 : }
20856 0 : case 1: {
20857 0 : err = fd_bincode_uint32_encode( self->request_heap_frame, ctx );
20858 0 : if( FD_UNLIKELY( err ) ) return err;
20859 0 : break;
20860 0 : }
20861 0 : case 2: {
20862 0 : err = fd_bincode_uint32_encode( self->set_compute_unit_limit, ctx );
20863 0 : if( FD_UNLIKELY( err ) ) return err;
20864 0 : break;
20865 0 : }
20866 0 : case 3: {
20867 0 : err = fd_bincode_uint64_encode( self->set_compute_unit_price, ctx );
20868 0 : if( FD_UNLIKELY( err ) ) return err;
20869 0 : break;
20870 0 : }
20871 0 : case 4: {
20872 0 : err = fd_bincode_uint32_encode( self->set_loaded_accounts_data_size_limit, ctx );
20873 0 : if( FD_UNLIKELY( err ) ) return err;
20874 0 : break;
20875 0 : }
20876 0 : }
20877 0 : return FD_BINCODE_SUCCESS;
20878 0 : }
20879 0 : int fd_compute_budget_program_instruction_encode( fd_compute_budget_program_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
20880 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
20881 0 : if( FD_UNLIKELY( err ) ) return err;
20882 0 : return fd_compute_budget_program_instruction_inner_encode( &self->inner, self->discriminant, ctx );
20883 0 : }
20884 :
20885 0 : int fd_config_keys_encode( fd_config_keys_t const * self, fd_bincode_encode_ctx_t * ctx ) {
20886 0 : int err;
20887 0 : err = fd_bincode_compact_u16_encode( &self->keys_len, ctx );
20888 0 : if( FD_UNLIKELY(err) ) return err;
20889 0 : if( self->keys_len ) {
20890 0 : for( ulong i=0; i < self->keys_len; i++ ) {
20891 0 : err = fd_config_keys_pair_encode( self->keys + i, ctx );
20892 0 : if( FD_UNLIKELY( err ) ) return err;
20893 0 : }
20894 0 : }
20895 0 : return FD_BINCODE_SUCCESS;
20896 0 : }
20897 0 : int fd_config_keys_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
20898 0 : *total_sz += sizeof(fd_config_keys_t);
20899 0 : void const * start_data = ctx->data;
20900 0 : int err = fd_config_keys_decode_footprint_inner( ctx, total_sz );
20901 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
20902 0 : ctx->data = start_data;
20903 0 : return err;
20904 0 : }
20905 0 : int fd_config_keys_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
20906 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
20907 0 : int err = 0;
20908 0 : ushort keys_len;
20909 0 : err = fd_bincode_compact_u16_decode( &keys_len, ctx );
20910 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
20911 0 : if( keys_len ) {
20912 0 : *total_sz += FD_CONFIG_KEYS_PAIR_ALIGN + FD_CONFIG_KEYS_PAIR_FOOTPRINT*keys_len;
20913 0 : for( ulong i=0; i < keys_len; i++ ) {
20914 0 : err = fd_config_keys_pair_decode_footprint_inner( ctx, total_sz );
20915 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
20916 0 : }
20917 0 : }
20918 0 : return 0;
20919 0 : }
20920 0 : void * fd_config_keys_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
20921 0 : fd_config_keys_t * self = (fd_config_keys_t *)mem;
20922 0 : fd_config_keys_new( self );
20923 0 : void * alloc_region = (uchar *)mem + sizeof(fd_config_keys_t);
20924 0 : void * * alloc_mem = &alloc_region;
20925 0 : fd_config_keys_decode_inner( mem, alloc_mem, ctx );
20926 0 : return self;
20927 0 : }
20928 0 : void fd_config_keys_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
20929 0 : fd_config_keys_t * self = (fd_config_keys_t *)struct_mem;
20930 0 : fd_bincode_compact_u16_decode_unsafe( &self->keys_len, ctx );
20931 0 : if( self->keys_len ) {
20932 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_CONFIG_KEYS_PAIR_ALIGN );
20933 0 : self->keys = *alloc_mem;
20934 0 : *alloc_mem = (uchar *)(*alloc_mem) + FD_CONFIG_KEYS_PAIR_FOOTPRINT*self->keys_len;
20935 0 : for( ulong i=0; i < self->keys_len; i++ ) {
20936 0 : fd_config_keys_pair_new( self->keys + i );
20937 0 : fd_config_keys_pair_decode_inner( self->keys + i, alloc_mem, ctx );
20938 0 : }
20939 0 : } else
20940 0 : self->keys = NULL;
20941 0 : }
20942 0 : void * fd_config_keys_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
20943 0 : fd_config_keys_global_t * self = (fd_config_keys_global_t *)mem;
20944 0 : fd_config_keys_new( (fd_config_keys_t *)self );
20945 0 : void * alloc_region = (uchar *)mem + sizeof(fd_config_keys_global_t);
20946 0 : void * * alloc_mem = &alloc_region;
20947 0 : fd_config_keys_decode_inner_global( mem, alloc_mem, ctx );
20948 0 : return self;
20949 0 : }
20950 0 : void fd_config_keys_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
20951 0 : fd_config_keys_global_t * self = (fd_config_keys_global_t *)struct_mem;
20952 0 : fd_bincode_compact_u16_decode_unsafe( &self->keys_len, ctx );
20953 0 : if( self->keys_len ) {
20954 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_CONFIG_KEYS_PAIR_ALIGN );
20955 0 : self->keys_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
20956 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
20957 0 : *alloc_mem = (uchar *)(*alloc_mem) + FD_CONFIG_KEYS_PAIR_FOOTPRINT*self->keys_len;
20958 0 : for( ulong i=0; i < self->keys_len; i++ ) {
20959 0 : fd_config_keys_pair_new( (fd_config_keys_pair_t *)(cur_mem + FD_CONFIG_KEYS_PAIR_FOOTPRINT * i) );
20960 0 : fd_config_keys_pair_decode_inner_global( cur_mem + FD_CONFIG_KEYS_PAIR_FOOTPRINT * i, alloc_mem, ctx );
20961 0 : }
20962 0 : } else
20963 0 : self->keys_gaddr = 0UL;
20964 0 : }
20965 0 : int fd_config_keys_convert_global_to_local( void const * global_self, fd_config_keys_t * self, fd_bincode_decode_ctx_t * ctx ) {
20966 0 : int err = 0;
20967 0 : fd_config_keys_global_t const * mem = (fd_config_keys_global_t const *)global_self;
20968 0 : self->keys_len = mem->keys_len;
20969 0 : self->keys = fd_wksp_laddr_fast( ctx->wksp, mem->keys_gaddr );
20970 0 : return FD_BINCODE_SUCCESS;
20971 0 : }
20972 0 : void fd_config_keys_new(fd_config_keys_t * self) {
20973 0 : fd_memset( self, 0, sizeof(fd_config_keys_t) );
20974 0 : }
20975 0 : void fd_config_keys_destroy( fd_config_keys_t * self ) {
20976 0 : if( self->keys ) {
20977 0 : for( ulong i=0; i < self->keys_len; i++ )
20978 0 : fd_config_keys_pair_destroy( self->keys + i );
20979 0 : self->keys = NULL;
20980 0 : }
20981 0 : }
20982 :
20983 0 : ulong fd_config_keys_footprint( void ){ return FD_CONFIG_KEYS_FOOTPRINT; }
20984 0 : ulong fd_config_keys_align( void ){ return FD_CONFIG_KEYS_ALIGN; }
20985 :
20986 0 : void fd_config_keys_walk( void * w, fd_config_keys_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
20987 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_config_keys", level++ );
20988 0 : if( self->keys_len ) {
20989 0 : fun( w, NULL, "keys", FD_FLAMENCO_TYPE_ARR, "array", level++ );
20990 0 : for( ulong i=0; i < self->keys_len; i++ )
20991 0 : fd_config_keys_pair_walk(w, self->keys + i, fun, "config_keys_pair", level );
20992 0 : fun( w, NULL, "keys", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
20993 0 : }
20994 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_config_keys", level-- );
20995 0 : }
20996 0 : ulong fd_config_keys_size( fd_config_keys_t const * self ) {
20997 0 : ulong size = 0;
20998 0 : do {
20999 0 : ushort tmp = (ushort)self->keys_len;
21000 0 : size += fd_bincode_compact_u16_size( &tmp );
21001 0 : for( ulong i=0; i < self->keys_len; i++ )
21002 0 : size += fd_config_keys_pair_size( self->keys + i );
21003 0 : } while(0);
21004 0 : return size;
21005 0 : }
21006 :
21007 0 : int fd_bpf_loader_program_instruction_write_encode( fd_bpf_loader_program_instruction_write_t const * self, fd_bincode_encode_ctx_t * ctx ) {
21008 0 : int err;
21009 0 : err = fd_bincode_uint32_encode( self->offset, ctx );
21010 0 : if( FD_UNLIKELY( err ) ) return err;
21011 0 : err = fd_bincode_uint64_encode( self->bytes_len, ctx );
21012 0 : if( FD_UNLIKELY(err) ) return err;
21013 0 : if( self->bytes_len ) {
21014 0 : err = fd_bincode_bytes_encode( self->bytes, self->bytes_len, ctx );
21015 0 : if( FD_UNLIKELY( err ) ) return err;
21016 0 : }
21017 0 : return FD_BINCODE_SUCCESS;
21018 0 : }
21019 0 : int fd_bpf_loader_program_instruction_write_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
21020 0 : *total_sz += sizeof(fd_bpf_loader_program_instruction_write_t);
21021 0 : void const * start_data = ctx->data;
21022 0 : int err = fd_bpf_loader_program_instruction_write_decode_footprint_inner( ctx, total_sz );
21023 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
21024 0 : ctx->data = start_data;
21025 0 : return err;
21026 0 : }
21027 0 : int fd_bpf_loader_program_instruction_write_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
21028 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
21029 0 : int err = 0;
21030 0 : err = fd_bincode_uint32_decode_footprint( ctx );
21031 0 : if( FD_UNLIKELY( err ) ) return err;
21032 0 : ulong bytes_len;
21033 0 : err = fd_bincode_uint64_decode( &bytes_len, ctx );
21034 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
21035 0 : if( bytes_len ) {
21036 0 : *total_sz += 8UL + bytes_len;
21037 0 : err = fd_bincode_bytes_decode_footprint( bytes_len, ctx );
21038 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
21039 0 : }
21040 0 : return 0;
21041 0 : }
21042 0 : void * fd_bpf_loader_program_instruction_write_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
21043 0 : fd_bpf_loader_program_instruction_write_t * self = (fd_bpf_loader_program_instruction_write_t *)mem;
21044 0 : fd_bpf_loader_program_instruction_write_new( self );
21045 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_loader_program_instruction_write_t);
21046 0 : void * * alloc_mem = &alloc_region;
21047 0 : fd_bpf_loader_program_instruction_write_decode_inner( mem, alloc_mem, ctx );
21048 0 : return self;
21049 0 : }
21050 0 : void fd_bpf_loader_program_instruction_write_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
21051 0 : fd_bpf_loader_program_instruction_write_t * self = (fd_bpf_loader_program_instruction_write_t *)struct_mem;
21052 0 : fd_bincode_uint32_decode_unsafe( &self->offset, ctx );
21053 0 : fd_bincode_uint64_decode_unsafe( &self->bytes_len, ctx );
21054 0 : if( self->bytes_len ) {
21055 0 : self->bytes = *alloc_mem;
21056 0 : fd_bincode_bytes_decode_unsafe( self->bytes, self->bytes_len, ctx );
21057 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->bytes_len;
21058 0 : } else
21059 0 : self->bytes = NULL;
21060 0 : }
21061 0 : void * fd_bpf_loader_program_instruction_write_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
21062 0 : fd_bpf_loader_program_instruction_write_global_t * self = (fd_bpf_loader_program_instruction_write_global_t *)mem;
21063 0 : fd_bpf_loader_program_instruction_write_new( (fd_bpf_loader_program_instruction_write_t *)self );
21064 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_loader_program_instruction_write_global_t);
21065 0 : void * * alloc_mem = &alloc_region;
21066 0 : fd_bpf_loader_program_instruction_write_decode_inner_global( mem, alloc_mem, ctx );
21067 0 : return self;
21068 0 : }
21069 0 : void fd_bpf_loader_program_instruction_write_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
21070 0 : fd_bpf_loader_program_instruction_write_global_t * self = (fd_bpf_loader_program_instruction_write_global_t *)struct_mem;
21071 0 : fd_bincode_uint32_decode_unsafe( &self->offset, ctx );
21072 0 : fd_bincode_uint64_decode_unsafe( &self->bytes_len, ctx );
21073 0 : if( self->bytes_len ) {
21074 0 : self->bytes_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
21075 0 : fd_bincode_bytes_decode_unsafe( *alloc_mem, self->bytes_len, ctx );
21076 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->bytes_len;
21077 0 : } else
21078 0 : self->bytes_gaddr = 0UL;
21079 0 : }
21080 0 : int fd_bpf_loader_program_instruction_write_convert_global_to_local( void const * global_self, fd_bpf_loader_program_instruction_write_t * self, fd_bincode_decode_ctx_t * ctx ) {
21081 0 : int err = 0;
21082 0 : fd_bpf_loader_program_instruction_write_global_t const * mem = (fd_bpf_loader_program_instruction_write_global_t const *)global_self;
21083 0 : self->offset = mem->offset;
21084 0 : self->bytes_len = mem->bytes_len;
21085 0 : self->bytes = fd_wksp_laddr_fast( ctx->wksp, mem->bytes_gaddr );
21086 0 : return FD_BINCODE_SUCCESS;
21087 0 : }
21088 0 : void fd_bpf_loader_program_instruction_write_new(fd_bpf_loader_program_instruction_write_t * self) {
21089 0 : fd_memset( self, 0, sizeof(fd_bpf_loader_program_instruction_write_t) );
21090 0 : }
21091 0 : void fd_bpf_loader_program_instruction_write_destroy( fd_bpf_loader_program_instruction_write_t * self ) {
21092 0 : if( self->bytes ) {
21093 0 : self->bytes = NULL;
21094 0 : }
21095 0 : }
21096 :
21097 0 : ulong fd_bpf_loader_program_instruction_write_footprint( void ){ return FD_BPF_LOADER_PROGRAM_INSTRUCTION_WRITE_FOOTPRINT; }
21098 0 : ulong fd_bpf_loader_program_instruction_write_align( void ){ return FD_BPF_LOADER_PROGRAM_INSTRUCTION_WRITE_ALIGN; }
21099 :
21100 0 : void fd_bpf_loader_program_instruction_write_walk( void * w, fd_bpf_loader_program_instruction_write_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
21101 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_bpf_loader_program_instruction_write", level++ );
21102 0 : fun( w, &self->offset, "offset", FD_FLAMENCO_TYPE_UINT, "uint", level );
21103 0 : fun(w, self->bytes, "bytes", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
21104 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_bpf_loader_program_instruction_write", level-- );
21105 0 : }
21106 0 : ulong fd_bpf_loader_program_instruction_write_size( fd_bpf_loader_program_instruction_write_t const * self ) {
21107 0 : ulong size = 0;
21108 0 : size += sizeof(uint);
21109 0 : do {
21110 0 : size += sizeof(ulong);
21111 0 : size += self->bytes_len;
21112 0 : } while(0);
21113 0 : return size;
21114 0 : }
21115 :
21116 0 : FD_FN_PURE uchar fd_bpf_loader_program_instruction_is_write(fd_bpf_loader_program_instruction_t const * self) {
21117 0 : return self->discriminant == 0;
21118 0 : }
21119 0 : FD_FN_PURE uchar fd_bpf_loader_program_instruction_is_finalize(fd_bpf_loader_program_instruction_t const * self) {
21120 0 : return self->discriminant == 1;
21121 0 : }
21122 : void fd_bpf_loader_program_instruction_inner_new( fd_bpf_loader_program_instruction_inner_t * self, uint discriminant );
21123 0 : int fd_bpf_loader_program_instruction_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
21124 0 : int err;
21125 0 : switch (discriminant) {
21126 0 : case 0: {
21127 0 : err = fd_bpf_loader_program_instruction_write_decode_footprint_inner( ctx, total_sz );
21128 0 : if( FD_UNLIKELY( err ) ) return err;
21129 0 : return FD_BINCODE_SUCCESS;
21130 0 : }
21131 0 : case 1: {
21132 0 : return FD_BINCODE_SUCCESS;
21133 0 : }
21134 0 : default: return FD_BINCODE_ERR_ENCODING;
21135 0 : }
21136 0 : }
21137 0 : int fd_bpf_loader_program_instruction_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
21138 0 : *total_sz += sizeof(fd_bpf_loader_program_instruction_t);
21139 0 : void const * start_data = ctx->data;
21140 0 : int err = fd_bpf_loader_program_instruction_decode_footprint_inner( ctx, total_sz );
21141 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
21142 0 : ctx->data = start_data;
21143 0 : return err;
21144 0 : }
21145 0 : int fd_bpf_loader_program_instruction_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
21146 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
21147 0 : uint discriminant = 0;
21148 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
21149 0 : if( FD_UNLIKELY( err ) ) return err;
21150 0 : return fd_bpf_loader_program_instruction_inner_decode_footprint( discriminant, ctx, total_sz );
21151 0 : }
21152 0 : 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 ) {
21153 0 : switch (discriminant) {
21154 0 : case 0: {
21155 0 : fd_bpf_loader_program_instruction_write_decode_inner( &self->write, alloc_mem, ctx );
21156 0 : break;
21157 0 : }
21158 0 : case 1: {
21159 0 : break;
21160 0 : }
21161 0 : }
21162 0 : }
21163 0 : void fd_bpf_loader_program_instruction_inner_decode_inner_global( fd_bpf_loader_program_instruction_inner_global_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
21164 0 : switch (discriminant) {
21165 0 : case 0: {
21166 0 : fd_bpf_loader_program_instruction_write_decode_inner_global( &self->write, alloc_mem, ctx );
21167 0 : break;
21168 0 : }
21169 0 : case 1: {
21170 0 : break;
21171 0 : }
21172 0 : }
21173 0 : }
21174 0 : int fd_bpf_loader_program_instruction_convert_global_to_local_inner( fd_bpf_loader_program_instruction_inner_global_t const * mem, fd_bpf_loader_program_instruction_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
21175 0 : int err = 0;
21176 0 : switch( discriminant ) {
21177 0 : case 0: {
21178 0 : err = fd_bpf_loader_program_instruction_write_convert_global_to_local( &mem->write, &self->write, ctx );
21179 0 : if( FD_UNLIKELY( err ) ) return err;
21180 0 : break;
21181 0 : }
21182 0 : case 1: {
21183 0 : break;
21184 0 : }
21185 0 : }
21186 0 : return FD_BINCODE_SUCCESS;
21187 0 : }
21188 0 : int fd_bpf_loader_program_instruction_convert_global_to_local( void const * global_self, fd_bpf_loader_program_instruction_t * self, fd_bincode_decode_ctx_t * ctx ) {
21189 0 : fd_bpf_loader_program_instruction_global_t const * mem = (fd_bpf_loader_program_instruction_global_t const *)global_self;
21190 0 : uint discriminant = mem->discriminant;
21191 0 : self->discriminant = mem->discriminant;
21192 0 : int err = fd_bpf_loader_program_instruction_convert_global_to_local_inner( &mem->inner, &self->inner, discriminant, ctx );
21193 0 : return FD_BINCODE_SUCCESS;
21194 0 : }
21195 0 : void fd_bpf_loader_program_instruction_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
21196 0 : fd_bpf_loader_program_instruction_t * self = (fd_bpf_loader_program_instruction_t *)struct_mem;
21197 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
21198 0 : fd_bpf_loader_program_instruction_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
21199 0 : }
21200 0 : void * fd_bpf_loader_program_instruction_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
21201 0 : fd_bpf_loader_program_instruction_t * self = (fd_bpf_loader_program_instruction_t *)mem;
21202 0 : fd_bpf_loader_program_instruction_new( self );
21203 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_loader_program_instruction_t);
21204 0 : void * * alloc_mem = &alloc_region;
21205 0 : fd_bpf_loader_program_instruction_decode_inner( mem, alloc_mem, ctx );
21206 0 : return self;
21207 0 : }
21208 0 : void * fd_bpf_loader_program_instruction_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
21209 0 : fd_bpf_loader_program_instruction_t * self = (fd_bpf_loader_program_instruction_t *)mem;
21210 0 : fd_bpf_loader_program_instruction_new( self );
21211 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_loader_program_instruction_t);
21212 0 : void * * alloc_mem = &alloc_region;
21213 0 : fd_bpf_loader_program_instruction_decode_inner_global( mem, alloc_mem, ctx );
21214 0 : return self;
21215 0 : }
21216 0 : void fd_bpf_loader_program_instruction_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
21217 0 : fd_bpf_loader_program_instruction_global_t * self = (fd_bpf_loader_program_instruction_global_t *)struct_mem;
21218 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
21219 0 : fd_bpf_loader_program_instruction_inner_decode_inner_global( &self->inner, alloc_mem, self->discriminant, ctx );
21220 0 : }
21221 0 : void fd_bpf_loader_program_instruction_inner_new( fd_bpf_loader_program_instruction_inner_t * self, uint discriminant ) {
21222 0 : switch( discriminant ) {
21223 0 : case 0: {
21224 0 : fd_bpf_loader_program_instruction_write_new( &self->write );
21225 0 : break;
21226 0 : }
21227 0 : case 1: {
21228 0 : break;
21229 0 : }
21230 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
21231 0 : }
21232 0 : }
21233 0 : void fd_bpf_loader_program_instruction_new_disc( fd_bpf_loader_program_instruction_t * self, uint discriminant ) {
21234 0 : self->discriminant = discriminant;
21235 0 : fd_bpf_loader_program_instruction_inner_new( &self->inner, self->discriminant );
21236 0 : }
21237 0 : void fd_bpf_loader_program_instruction_new( fd_bpf_loader_program_instruction_t * self ) {
21238 0 : fd_memset( self, 0, sizeof(fd_bpf_loader_program_instruction_t) );
21239 0 : fd_bpf_loader_program_instruction_new_disc( self, UINT_MAX );
21240 0 : }
21241 0 : void fd_bpf_loader_program_instruction_inner_destroy( fd_bpf_loader_program_instruction_inner_t * self, uint discriminant ) {
21242 0 : switch( discriminant ) {
21243 0 : case 0: {
21244 0 : fd_bpf_loader_program_instruction_write_destroy( &self->write );
21245 0 : break;
21246 0 : }
21247 0 : default: break; // FD_LOG_ERR(( "unhandled type" ));
21248 0 : }
21249 0 : }
21250 0 : void fd_bpf_loader_program_instruction_destroy( fd_bpf_loader_program_instruction_t * self ) {
21251 0 : fd_bpf_loader_program_instruction_inner_destroy( &self->inner, self->discriminant );
21252 0 : }
21253 :
21254 0 : ulong fd_bpf_loader_program_instruction_footprint( void ){ return FD_BPF_LOADER_PROGRAM_INSTRUCTION_FOOTPRINT; }
21255 0 : ulong fd_bpf_loader_program_instruction_align( void ){ return FD_BPF_LOADER_PROGRAM_INSTRUCTION_ALIGN; }
21256 :
21257 0 : void fd_bpf_loader_program_instruction_walk( void * w, fd_bpf_loader_program_instruction_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
21258 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_bpf_loader_program_instruction", level++);
21259 0 : switch( self->discriminant ) {
21260 0 : case 0: {
21261 0 : fun( w, self, "write", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
21262 0 : fd_bpf_loader_program_instruction_write_walk( w, &self->inner.write, fun, "write", level );
21263 0 : break;
21264 0 : }
21265 0 : case 1: {
21266 0 : fun( w, self, "finalize", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
21267 0 : break;
21268 0 : }
21269 0 : }
21270 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_bpf_loader_program_instruction", level-- );
21271 0 : }
21272 0 : ulong fd_bpf_loader_program_instruction_size( fd_bpf_loader_program_instruction_t const * self ) {
21273 0 : ulong size = 0;
21274 0 : size += sizeof(uint);
21275 0 : switch (self->discriminant) {
21276 0 : case 0: {
21277 0 : size += fd_bpf_loader_program_instruction_write_size( &self->inner.write );
21278 0 : break;
21279 0 : }
21280 0 : }
21281 0 : return size;
21282 0 : }
21283 :
21284 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 ) {
21285 0 : int err;
21286 0 : switch (discriminant) {
21287 0 : case 0: {
21288 0 : err = fd_bpf_loader_program_instruction_write_encode( &self->write, ctx );
21289 0 : if( FD_UNLIKELY( err ) ) return err;
21290 0 : break;
21291 0 : }
21292 0 : }
21293 0 : return FD_BINCODE_SUCCESS;
21294 0 : }
21295 0 : int fd_bpf_loader_program_instruction_encode( fd_bpf_loader_program_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
21296 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
21297 0 : if( FD_UNLIKELY( err ) ) return err;
21298 0 : return fd_bpf_loader_program_instruction_inner_encode( &self->inner, self->discriminant, ctx );
21299 0 : }
21300 :
21301 0 : int fd_loader_v4_program_instruction_write_encode( fd_loader_v4_program_instruction_write_t const * self, fd_bincode_encode_ctx_t * ctx ) {
21302 0 : int err;
21303 0 : err = fd_bincode_uint32_encode( self->offset, ctx );
21304 0 : if( FD_UNLIKELY( err ) ) return err;
21305 0 : err = fd_bincode_uint64_encode( self->bytes_len, ctx );
21306 0 : if( FD_UNLIKELY(err) ) return err;
21307 0 : if( self->bytes_len ) {
21308 0 : err = fd_bincode_bytes_encode( self->bytes, self->bytes_len, ctx );
21309 0 : if( FD_UNLIKELY( err ) ) return err;
21310 0 : }
21311 0 : return FD_BINCODE_SUCCESS;
21312 0 : }
21313 0 : int fd_loader_v4_program_instruction_write_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
21314 0 : *total_sz += sizeof(fd_loader_v4_program_instruction_write_t);
21315 0 : void const * start_data = ctx->data;
21316 0 : int err = fd_loader_v4_program_instruction_write_decode_footprint_inner( ctx, total_sz );
21317 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
21318 0 : ctx->data = start_data;
21319 0 : return err;
21320 0 : }
21321 0 : int fd_loader_v4_program_instruction_write_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
21322 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
21323 0 : int err = 0;
21324 0 : err = fd_bincode_uint32_decode_footprint( ctx );
21325 0 : if( FD_UNLIKELY( err ) ) return err;
21326 0 : ulong bytes_len;
21327 0 : err = fd_bincode_uint64_decode( &bytes_len, ctx );
21328 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
21329 0 : if( bytes_len ) {
21330 0 : *total_sz += 8UL + bytes_len;
21331 0 : err = fd_bincode_bytes_decode_footprint( bytes_len, ctx );
21332 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
21333 0 : }
21334 0 : return 0;
21335 0 : }
21336 0 : void * fd_loader_v4_program_instruction_write_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
21337 0 : fd_loader_v4_program_instruction_write_t * self = (fd_loader_v4_program_instruction_write_t *)mem;
21338 0 : fd_loader_v4_program_instruction_write_new( self );
21339 0 : void * alloc_region = (uchar *)mem + sizeof(fd_loader_v4_program_instruction_write_t);
21340 0 : void * * alloc_mem = &alloc_region;
21341 0 : fd_loader_v4_program_instruction_write_decode_inner( mem, alloc_mem, ctx );
21342 0 : return self;
21343 0 : }
21344 0 : void fd_loader_v4_program_instruction_write_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
21345 0 : fd_loader_v4_program_instruction_write_t * self = (fd_loader_v4_program_instruction_write_t *)struct_mem;
21346 0 : fd_bincode_uint32_decode_unsafe( &self->offset, ctx );
21347 0 : fd_bincode_uint64_decode_unsafe( &self->bytes_len, ctx );
21348 0 : if( self->bytes_len ) {
21349 0 : self->bytes = *alloc_mem;
21350 0 : fd_bincode_bytes_decode_unsafe( self->bytes, self->bytes_len, ctx );
21351 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->bytes_len;
21352 0 : } else
21353 0 : self->bytes = NULL;
21354 0 : }
21355 0 : void * fd_loader_v4_program_instruction_write_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
21356 0 : fd_loader_v4_program_instruction_write_global_t * self = (fd_loader_v4_program_instruction_write_global_t *)mem;
21357 0 : fd_loader_v4_program_instruction_write_new( (fd_loader_v4_program_instruction_write_t *)self );
21358 0 : void * alloc_region = (uchar *)mem + sizeof(fd_loader_v4_program_instruction_write_global_t);
21359 0 : void * * alloc_mem = &alloc_region;
21360 0 : fd_loader_v4_program_instruction_write_decode_inner_global( mem, alloc_mem, ctx );
21361 0 : return self;
21362 0 : }
21363 0 : void fd_loader_v4_program_instruction_write_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
21364 0 : fd_loader_v4_program_instruction_write_global_t * self = (fd_loader_v4_program_instruction_write_global_t *)struct_mem;
21365 0 : fd_bincode_uint32_decode_unsafe( &self->offset, ctx );
21366 0 : fd_bincode_uint64_decode_unsafe( &self->bytes_len, ctx );
21367 0 : if( self->bytes_len ) {
21368 0 : self->bytes_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
21369 0 : fd_bincode_bytes_decode_unsafe( *alloc_mem, self->bytes_len, ctx );
21370 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->bytes_len;
21371 0 : } else
21372 0 : self->bytes_gaddr = 0UL;
21373 0 : }
21374 0 : int fd_loader_v4_program_instruction_write_convert_global_to_local( void const * global_self, fd_loader_v4_program_instruction_write_t * self, fd_bincode_decode_ctx_t * ctx ) {
21375 0 : int err = 0;
21376 0 : fd_loader_v4_program_instruction_write_global_t const * mem = (fd_loader_v4_program_instruction_write_global_t const *)global_self;
21377 0 : self->offset = mem->offset;
21378 0 : self->bytes_len = mem->bytes_len;
21379 0 : self->bytes = fd_wksp_laddr_fast( ctx->wksp, mem->bytes_gaddr );
21380 0 : return FD_BINCODE_SUCCESS;
21381 0 : }
21382 0 : void fd_loader_v4_program_instruction_write_new(fd_loader_v4_program_instruction_write_t * self) {
21383 0 : fd_memset( self, 0, sizeof(fd_loader_v4_program_instruction_write_t) );
21384 0 : }
21385 0 : void fd_loader_v4_program_instruction_write_destroy( fd_loader_v4_program_instruction_write_t * self ) {
21386 0 : if( self->bytes ) {
21387 0 : self->bytes = NULL;
21388 0 : }
21389 0 : }
21390 :
21391 0 : ulong fd_loader_v4_program_instruction_write_footprint( void ){ return FD_LOADER_V4_PROGRAM_INSTRUCTION_WRITE_FOOTPRINT; }
21392 0 : ulong fd_loader_v4_program_instruction_write_align( void ){ return FD_LOADER_V4_PROGRAM_INSTRUCTION_WRITE_ALIGN; }
21393 :
21394 0 : void fd_loader_v4_program_instruction_write_walk( void * w, fd_loader_v4_program_instruction_write_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
21395 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_loader_v4_program_instruction_write", level++ );
21396 0 : fun( w, &self->offset, "offset", FD_FLAMENCO_TYPE_UINT, "uint", level );
21397 0 : fun(w, self->bytes, "bytes", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
21398 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_loader_v4_program_instruction_write", level-- );
21399 0 : }
21400 0 : ulong fd_loader_v4_program_instruction_write_size( fd_loader_v4_program_instruction_write_t const * self ) {
21401 0 : ulong size = 0;
21402 0 : size += sizeof(uint);
21403 0 : do {
21404 0 : size += sizeof(ulong);
21405 0 : size += self->bytes_len;
21406 0 : } while(0);
21407 0 : return size;
21408 0 : }
21409 :
21410 0 : int fd_loader_v4_program_instruction_truncate_encode( fd_loader_v4_program_instruction_truncate_t const * self, fd_bincode_encode_ctx_t * ctx ) {
21411 0 : int err;
21412 0 : err = fd_bincode_uint32_encode( self->new_size, ctx );
21413 0 : if( FD_UNLIKELY( err ) ) return err;
21414 0 : return FD_BINCODE_SUCCESS;
21415 0 : }
21416 0 : int fd_loader_v4_program_instruction_truncate_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
21417 0 : *total_sz += sizeof(fd_loader_v4_program_instruction_truncate_t);
21418 0 : void const * start_data = ctx->data;
21419 0 : int err = fd_loader_v4_program_instruction_truncate_decode_footprint_inner( ctx, total_sz );
21420 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
21421 0 : ctx->data = start_data;
21422 0 : return err;
21423 0 : }
21424 0 : int fd_loader_v4_program_instruction_truncate_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
21425 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
21426 0 : int err = 0;
21427 0 : err = fd_bincode_uint32_decode_footprint( ctx );
21428 0 : if( FD_UNLIKELY( err ) ) return err;
21429 0 : return 0;
21430 0 : }
21431 0 : void * fd_loader_v4_program_instruction_truncate_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
21432 0 : fd_loader_v4_program_instruction_truncate_t * self = (fd_loader_v4_program_instruction_truncate_t *)mem;
21433 0 : fd_loader_v4_program_instruction_truncate_new( self );
21434 0 : void * alloc_region = (uchar *)mem + sizeof(fd_loader_v4_program_instruction_truncate_t);
21435 0 : void * * alloc_mem = &alloc_region;
21436 0 : fd_loader_v4_program_instruction_truncate_decode_inner( mem, alloc_mem, ctx );
21437 0 : return self;
21438 0 : }
21439 0 : void fd_loader_v4_program_instruction_truncate_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
21440 0 : fd_loader_v4_program_instruction_truncate_t * self = (fd_loader_v4_program_instruction_truncate_t *)struct_mem;
21441 0 : fd_bincode_uint32_decode_unsafe( &self->new_size, ctx );
21442 0 : }
21443 0 : void * fd_loader_v4_program_instruction_truncate_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
21444 0 : fd_loader_v4_program_instruction_truncate_global_t * self = (fd_loader_v4_program_instruction_truncate_global_t *)mem;
21445 0 : fd_loader_v4_program_instruction_truncate_new( (fd_loader_v4_program_instruction_truncate_t *)self );
21446 0 : void * alloc_region = (uchar *)mem + sizeof(fd_loader_v4_program_instruction_truncate_global_t);
21447 0 : void * * alloc_mem = &alloc_region;
21448 0 : fd_loader_v4_program_instruction_truncate_decode_inner_global( mem, alloc_mem, ctx );
21449 0 : return self;
21450 0 : }
21451 0 : void fd_loader_v4_program_instruction_truncate_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
21452 0 : fd_loader_v4_program_instruction_truncate_global_t * self = (fd_loader_v4_program_instruction_truncate_global_t *)struct_mem;
21453 0 : fd_bincode_uint32_decode_unsafe( &self->new_size, ctx );
21454 0 : }
21455 0 : int fd_loader_v4_program_instruction_truncate_convert_global_to_local( void const * global_self, fd_loader_v4_program_instruction_truncate_t * self, fd_bincode_decode_ctx_t * ctx ) {
21456 0 : int err = 0;
21457 0 : fd_loader_v4_program_instruction_truncate_global_t const * mem = (fd_loader_v4_program_instruction_truncate_global_t const *)global_self;
21458 0 : self->new_size = mem->new_size;
21459 0 : return FD_BINCODE_SUCCESS;
21460 0 : }
21461 0 : void fd_loader_v4_program_instruction_truncate_new(fd_loader_v4_program_instruction_truncate_t * self) {
21462 0 : fd_memset( self, 0, sizeof(fd_loader_v4_program_instruction_truncate_t) );
21463 0 : }
21464 0 : void fd_loader_v4_program_instruction_truncate_destroy( fd_loader_v4_program_instruction_truncate_t * self ) {
21465 0 : }
21466 :
21467 0 : ulong fd_loader_v4_program_instruction_truncate_footprint( void ){ return FD_LOADER_V4_PROGRAM_INSTRUCTION_TRUNCATE_FOOTPRINT; }
21468 0 : ulong fd_loader_v4_program_instruction_truncate_align( void ){ return FD_LOADER_V4_PROGRAM_INSTRUCTION_TRUNCATE_ALIGN; }
21469 :
21470 0 : void fd_loader_v4_program_instruction_truncate_walk( void * w, fd_loader_v4_program_instruction_truncate_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
21471 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_loader_v4_program_instruction_truncate", level++ );
21472 0 : fun( w, &self->new_size, "new_size", FD_FLAMENCO_TYPE_UINT, "uint", level );
21473 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_loader_v4_program_instruction_truncate", level-- );
21474 0 : }
21475 0 : ulong fd_loader_v4_program_instruction_truncate_size( fd_loader_v4_program_instruction_truncate_t const * self ) {
21476 0 : ulong size = 0;
21477 0 : size += sizeof(uint);
21478 0 : return size;
21479 0 : }
21480 :
21481 0 : FD_FN_PURE uchar fd_loader_v4_program_instruction_is_write(fd_loader_v4_program_instruction_t const * self) {
21482 0 : return self->discriminant == 0;
21483 0 : }
21484 0 : FD_FN_PURE uchar fd_loader_v4_program_instruction_is_truncate(fd_loader_v4_program_instruction_t const * self) {
21485 0 : return self->discriminant == 1;
21486 0 : }
21487 0 : FD_FN_PURE uchar fd_loader_v4_program_instruction_is_deploy(fd_loader_v4_program_instruction_t const * self) {
21488 0 : return self->discriminant == 2;
21489 0 : }
21490 0 : FD_FN_PURE uchar fd_loader_v4_program_instruction_is_retract(fd_loader_v4_program_instruction_t const * self) {
21491 0 : return self->discriminant == 3;
21492 0 : }
21493 0 : FD_FN_PURE uchar fd_loader_v4_program_instruction_is_transfer_authority(fd_loader_v4_program_instruction_t const * self) {
21494 0 : return self->discriminant == 4;
21495 0 : }
21496 0 : FD_FN_PURE uchar fd_loader_v4_program_instruction_is_finalize(fd_loader_v4_program_instruction_t const * self) {
21497 0 : return self->discriminant == 5;
21498 0 : }
21499 : void fd_loader_v4_program_instruction_inner_new( fd_loader_v4_program_instruction_inner_t * self, uint discriminant );
21500 0 : int fd_loader_v4_program_instruction_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
21501 0 : int err;
21502 0 : switch (discriminant) {
21503 0 : case 0: {
21504 0 : err = fd_loader_v4_program_instruction_write_decode_footprint_inner( ctx, total_sz );
21505 0 : if( FD_UNLIKELY( err ) ) return err;
21506 0 : return FD_BINCODE_SUCCESS;
21507 0 : }
21508 0 : case 1: {
21509 0 : err = fd_loader_v4_program_instruction_truncate_decode_footprint_inner( ctx, total_sz );
21510 0 : if( FD_UNLIKELY( err ) ) return err;
21511 0 : return FD_BINCODE_SUCCESS;
21512 0 : }
21513 0 : case 2: {
21514 0 : return FD_BINCODE_SUCCESS;
21515 0 : }
21516 0 : case 3: {
21517 0 : return FD_BINCODE_SUCCESS;
21518 0 : }
21519 0 : case 4: {
21520 0 : return FD_BINCODE_SUCCESS;
21521 0 : }
21522 0 : case 5: {
21523 0 : return FD_BINCODE_SUCCESS;
21524 0 : }
21525 0 : default: return FD_BINCODE_ERR_ENCODING;
21526 0 : }
21527 0 : }
21528 0 : int fd_loader_v4_program_instruction_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
21529 0 : *total_sz += sizeof(fd_loader_v4_program_instruction_t);
21530 0 : void const * start_data = ctx->data;
21531 0 : int err = fd_loader_v4_program_instruction_decode_footprint_inner( ctx, total_sz );
21532 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
21533 0 : ctx->data = start_data;
21534 0 : return err;
21535 0 : }
21536 0 : int fd_loader_v4_program_instruction_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
21537 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
21538 0 : uint discriminant = 0;
21539 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
21540 0 : if( FD_UNLIKELY( err ) ) return err;
21541 0 : return fd_loader_v4_program_instruction_inner_decode_footprint( discriminant, ctx, total_sz );
21542 0 : }
21543 0 : 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 ) {
21544 0 : switch (discriminant) {
21545 0 : case 0: {
21546 0 : fd_loader_v4_program_instruction_write_decode_inner( &self->write, alloc_mem, ctx );
21547 0 : break;
21548 0 : }
21549 0 : case 1: {
21550 0 : fd_loader_v4_program_instruction_truncate_decode_inner( &self->truncate, alloc_mem, ctx );
21551 0 : break;
21552 0 : }
21553 0 : case 2: {
21554 0 : break;
21555 0 : }
21556 0 : case 3: {
21557 0 : break;
21558 0 : }
21559 0 : case 4: {
21560 0 : break;
21561 0 : }
21562 0 : case 5: {
21563 0 : break;
21564 0 : }
21565 0 : }
21566 0 : }
21567 0 : void fd_loader_v4_program_instruction_inner_decode_inner_global( fd_loader_v4_program_instruction_inner_global_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
21568 0 : switch (discriminant) {
21569 0 : case 0: {
21570 0 : fd_loader_v4_program_instruction_write_decode_inner_global( &self->write, alloc_mem, ctx );
21571 0 : break;
21572 0 : }
21573 0 : case 1: {
21574 0 : fd_loader_v4_program_instruction_truncate_decode_inner_global( &self->truncate, alloc_mem, ctx );
21575 0 : break;
21576 0 : }
21577 0 : case 2: {
21578 0 : break;
21579 0 : }
21580 0 : case 3: {
21581 0 : break;
21582 0 : }
21583 0 : case 4: {
21584 0 : break;
21585 0 : }
21586 0 : case 5: {
21587 0 : break;
21588 0 : }
21589 0 : }
21590 0 : }
21591 0 : int fd_loader_v4_program_instruction_convert_global_to_local_inner( fd_loader_v4_program_instruction_inner_global_t const * mem, fd_loader_v4_program_instruction_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
21592 0 : int err = 0;
21593 0 : switch( discriminant ) {
21594 0 : case 0: {
21595 0 : err = fd_loader_v4_program_instruction_write_convert_global_to_local( &mem->write, &self->write, ctx );
21596 0 : if( FD_UNLIKELY( err ) ) return err;
21597 0 : break;
21598 0 : }
21599 0 : case 1: {
21600 0 : err = fd_loader_v4_program_instruction_truncate_convert_global_to_local( &mem->truncate, &self->truncate, ctx );
21601 0 : if( FD_UNLIKELY( err ) ) return err;
21602 0 : break;
21603 0 : }
21604 0 : case 2: {
21605 0 : break;
21606 0 : }
21607 0 : case 3: {
21608 0 : break;
21609 0 : }
21610 0 : case 4: {
21611 0 : break;
21612 0 : }
21613 0 : case 5: {
21614 0 : break;
21615 0 : }
21616 0 : }
21617 0 : return FD_BINCODE_SUCCESS;
21618 0 : }
21619 0 : int fd_loader_v4_program_instruction_convert_global_to_local( void const * global_self, fd_loader_v4_program_instruction_t * self, fd_bincode_decode_ctx_t * ctx ) {
21620 0 : fd_loader_v4_program_instruction_global_t const * mem = (fd_loader_v4_program_instruction_global_t const *)global_self;
21621 0 : uint discriminant = mem->discriminant;
21622 0 : self->discriminant = mem->discriminant;
21623 0 : int err = fd_loader_v4_program_instruction_convert_global_to_local_inner( &mem->inner, &self->inner, discriminant, ctx );
21624 0 : return FD_BINCODE_SUCCESS;
21625 0 : }
21626 0 : void fd_loader_v4_program_instruction_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
21627 0 : fd_loader_v4_program_instruction_t * self = (fd_loader_v4_program_instruction_t *)struct_mem;
21628 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
21629 0 : fd_loader_v4_program_instruction_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
21630 0 : }
21631 0 : void * fd_loader_v4_program_instruction_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
21632 0 : fd_loader_v4_program_instruction_t * self = (fd_loader_v4_program_instruction_t *)mem;
21633 0 : fd_loader_v4_program_instruction_new( self );
21634 0 : void * alloc_region = (uchar *)mem + sizeof(fd_loader_v4_program_instruction_t);
21635 0 : void * * alloc_mem = &alloc_region;
21636 0 : fd_loader_v4_program_instruction_decode_inner( mem, alloc_mem, ctx );
21637 0 : return self;
21638 0 : }
21639 0 : void * fd_loader_v4_program_instruction_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
21640 0 : fd_loader_v4_program_instruction_t * self = (fd_loader_v4_program_instruction_t *)mem;
21641 0 : fd_loader_v4_program_instruction_new( self );
21642 0 : void * alloc_region = (uchar *)mem + sizeof(fd_loader_v4_program_instruction_t);
21643 0 : void * * alloc_mem = &alloc_region;
21644 0 : fd_loader_v4_program_instruction_decode_inner_global( mem, alloc_mem, ctx );
21645 0 : return self;
21646 0 : }
21647 0 : void fd_loader_v4_program_instruction_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
21648 0 : fd_loader_v4_program_instruction_global_t * self = (fd_loader_v4_program_instruction_global_t *)struct_mem;
21649 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
21650 0 : fd_loader_v4_program_instruction_inner_decode_inner_global( &self->inner, alloc_mem, self->discriminant, ctx );
21651 0 : }
21652 0 : void fd_loader_v4_program_instruction_inner_new( fd_loader_v4_program_instruction_inner_t * self, uint discriminant ) {
21653 0 : switch( discriminant ) {
21654 0 : case 0: {
21655 0 : fd_loader_v4_program_instruction_write_new( &self->write );
21656 0 : break;
21657 0 : }
21658 0 : case 1: {
21659 0 : fd_loader_v4_program_instruction_truncate_new( &self->truncate );
21660 0 : break;
21661 0 : }
21662 0 : case 2: {
21663 0 : break;
21664 0 : }
21665 0 : case 3: {
21666 0 : break;
21667 0 : }
21668 0 : case 4: {
21669 0 : break;
21670 0 : }
21671 0 : case 5: {
21672 0 : break;
21673 0 : }
21674 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
21675 0 : }
21676 0 : }
21677 0 : void fd_loader_v4_program_instruction_new_disc( fd_loader_v4_program_instruction_t * self, uint discriminant ) {
21678 0 : self->discriminant = discriminant;
21679 0 : fd_loader_v4_program_instruction_inner_new( &self->inner, self->discriminant );
21680 0 : }
21681 0 : void fd_loader_v4_program_instruction_new( fd_loader_v4_program_instruction_t * self ) {
21682 0 : fd_memset( self, 0, sizeof(fd_loader_v4_program_instruction_t) );
21683 0 : fd_loader_v4_program_instruction_new_disc( self, UINT_MAX );
21684 0 : }
21685 0 : void fd_loader_v4_program_instruction_inner_destroy( fd_loader_v4_program_instruction_inner_t * self, uint discriminant ) {
21686 0 : switch( discriminant ) {
21687 0 : case 0: {
21688 0 : fd_loader_v4_program_instruction_write_destroy( &self->write );
21689 0 : break;
21690 0 : }
21691 0 : case 1: {
21692 0 : fd_loader_v4_program_instruction_truncate_destroy( &self->truncate );
21693 0 : break;
21694 0 : }
21695 0 : default: break; // FD_LOG_ERR(( "unhandled type" ));
21696 0 : }
21697 0 : }
21698 0 : void fd_loader_v4_program_instruction_destroy( fd_loader_v4_program_instruction_t * self ) {
21699 0 : fd_loader_v4_program_instruction_inner_destroy( &self->inner, self->discriminant );
21700 0 : }
21701 :
21702 0 : ulong fd_loader_v4_program_instruction_footprint( void ){ return FD_LOADER_V4_PROGRAM_INSTRUCTION_FOOTPRINT; }
21703 0 : ulong fd_loader_v4_program_instruction_align( void ){ return FD_LOADER_V4_PROGRAM_INSTRUCTION_ALIGN; }
21704 :
21705 0 : void fd_loader_v4_program_instruction_walk( void * w, fd_loader_v4_program_instruction_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
21706 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_loader_v4_program_instruction", level++);
21707 0 : switch( self->discriminant ) {
21708 0 : case 0: {
21709 0 : fun( w, self, "write", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
21710 0 : fd_loader_v4_program_instruction_write_walk( w, &self->inner.write, fun, "write", level );
21711 0 : break;
21712 0 : }
21713 0 : case 1: {
21714 0 : fun( w, self, "truncate", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
21715 0 : fd_loader_v4_program_instruction_truncate_walk( w, &self->inner.truncate, fun, "truncate", level );
21716 0 : break;
21717 0 : }
21718 0 : case 2: {
21719 0 : fun( w, self, "deploy", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
21720 0 : break;
21721 0 : }
21722 0 : case 3: {
21723 0 : fun( w, self, "retract", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
21724 0 : break;
21725 0 : }
21726 0 : case 4: {
21727 0 : fun( w, self, "transfer_authority", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
21728 0 : break;
21729 0 : }
21730 0 : case 5: {
21731 0 : fun( w, self, "finalize", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
21732 0 : break;
21733 0 : }
21734 0 : }
21735 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_loader_v4_program_instruction", level-- );
21736 0 : }
21737 0 : ulong fd_loader_v4_program_instruction_size( fd_loader_v4_program_instruction_t const * self ) {
21738 0 : ulong size = 0;
21739 0 : size += sizeof(uint);
21740 0 : switch (self->discriminant) {
21741 0 : case 0: {
21742 0 : size += fd_loader_v4_program_instruction_write_size( &self->inner.write );
21743 0 : break;
21744 0 : }
21745 0 : case 1: {
21746 0 : size += fd_loader_v4_program_instruction_truncate_size( &self->inner.truncate );
21747 0 : break;
21748 0 : }
21749 0 : }
21750 0 : return size;
21751 0 : }
21752 :
21753 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 ) {
21754 0 : int err;
21755 0 : switch (discriminant) {
21756 0 : case 0: {
21757 0 : err = fd_loader_v4_program_instruction_write_encode( &self->write, ctx );
21758 0 : if( FD_UNLIKELY( err ) ) return err;
21759 0 : break;
21760 0 : }
21761 0 : case 1: {
21762 0 : err = fd_loader_v4_program_instruction_truncate_encode( &self->truncate, ctx );
21763 0 : if( FD_UNLIKELY( err ) ) return err;
21764 0 : break;
21765 0 : }
21766 0 : }
21767 0 : return FD_BINCODE_SUCCESS;
21768 0 : }
21769 0 : int fd_loader_v4_program_instruction_encode( fd_loader_v4_program_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
21770 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
21771 0 : if( FD_UNLIKELY( err ) ) return err;
21772 0 : return fd_loader_v4_program_instruction_inner_encode( &self->inner, self->discriminant, ctx );
21773 0 : }
21774 :
21775 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 ) {
21776 0 : int err;
21777 0 : err = fd_bincode_uint32_encode( self->offset, ctx );
21778 0 : if( FD_UNLIKELY( err ) ) return err;
21779 0 : err = fd_bincode_uint64_encode( self->bytes_len, ctx );
21780 0 : if( FD_UNLIKELY(err) ) return err;
21781 0 : if( self->bytes_len ) {
21782 0 : err = fd_bincode_bytes_encode( self->bytes, self->bytes_len, ctx );
21783 0 : if( FD_UNLIKELY( err ) ) return err;
21784 0 : }
21785 0 : return FD_BINCODE_SUCCESS;
21786 0 : }
21787 0 : int fd_bpf_upgradeable_loader_program_instruction_write_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
21788 0 : *total_sz += sizeof(fd_bpf_upgradeable_loader_program_instruction_write_t);
21789 0 : void const * start_data = ctx->data;
21790 0 : int err = fd_bpf_upgradeable_loader_program_instruction_write_decode_footprint_inner( ctx, total_sz );
21791 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
21792 0 : ctx->data = start_data;
21793 0 : return err;
21794 0 : }
21795 0 : int fd_bpf_upgradeable_loader_program_instruction_write_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
21796 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
21797 0 : int err = 0;
21798 0 : err = fd_bincode_uint32_decode_footprint( ctx );
21799 0 : if( FD_UNLIKELY( err ) ) return err;
21800 0 : ulong bytes_len;
21801 0 : err = fd_bincode_uint64_decode( &bytes_len, ctx );
21802 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
21803 0 : if( bytes_len ) {
21804 0 : *total_sz += 8UL + bytes_len;
21805 0 : err = fd_bincode_bytes_decode_footprint( bytes_len, ctx );
21806 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
21807 0 : }
21808 0 : return 0;
21809 0 : }
21810 0 : void * fd_bpf_upgradeable_loader_program_instruction_write_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
21811 0 : fd_bpf_upgradeable_loader_program_instruction_write_t * self = (fd_bpf_upgradeable_loader_program_instruction_write_t *)mem;
21812 0 : fd_bpf_upgradeable_loader_program_instruction_write_new( self );
21813 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_program_instruction_write_t);
21814 0 : void * * alloc_mem = &alloc_region;
21815 0 : fd_bpf_upgradeable_loader_program_instruction_write_decode_inner( mem, alloc_mem, ctx );
21816 0 : return self;
21817 0 : }
21818 0 : void fd_bpf_upgradeable_loader_program_instruction_write_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
21819 0 : fd_bpf_upgradeable_loader_program_instruction_write_t * self = (fd_bpf_upgradeable_loader_program_instruction_write_t *)struct_mem;
21820 0 : fd_bincode_uint32_decode_unsafe( &self->offset, ctx );
21821 0 : fd_bincode_uint64_decode_unsafe( &self->bytes_len, ctx );
21822 0 : if( self->bytes_len ) {
21823 0 : self->bytes = *alloc_mem;
21824 0 : fd_bincode_bytes_decode_unsafe( self->bytes, self->bytes_len, ctx );
21825 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->bytes_len;
21826 0 : } else
21827 0 : self->bytes = NULL;
21828 0 : }
21829 0 : void * fd_bpf_upgradeable_loader_program_instruction_write_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
21830 0 : fd_bpf_upgradeable_loader_program_instruction_write_global_t * self = (fd_bpf_upgradeable_loader_program_instruction_write_global_t *)mem;
21831 0 : fd_bpf_upgradeable_loader_program_instruction_write_new( (fd_bpf_upgradeable_loader_program_instruction_write_t *)self );
21832 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_program_instruction_write_global_t);
21833 0 : void * * alloc_mem = &alloc_region;
21834 0 : fd_bpf_upgradeable_loader_program_instruction_write_decode_inner_global( mem, alloc_mem, ctx );
21835 0 : return self;
21836 0 : }
21837 0 : void fd_bpf_upgradeable_loader_program_instruction_write_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
21838 0 : fd_bpf_upgradeable_loader_program_instruction_write_global_t * self = (fd_bpf_upgradeable_loader_program_instruction_write_global_t *)struct_mem;
21839 0 : fd_bincode_uint32_decode_unsafe( &self->offset, ctx );
21840 0 : fd_bincode_uint64_decode_unsafe( &self->bytes_len, ctx );
21841 0 : if( self->bytes_len ) {
21842 0 : self->bytes_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
21843 0 : fd_bincode_bytes_decode_unsafe( *alloc_mem, self->bytes_len, ctx );
21844 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->bytes_len;
21845 0 : } else
21846 0 : self->bytes_gaddr = 0UL;
21847 0 : }
21848 0 : int fd_bpf_upgradeable_loader_program_instruction_write_convert_global_to_local( void const * global_self, fd_bpf_upgradeable_loader_program_instruction_write_t * self, fd_bincode_decode_ctx_t * ctx ) {
21849 0 : int err = 0;
21850 0 : fd_bpf_upgradeable_loader_program_instruction_write_global_t const * mem = (fd_bpf_upgradeable_loader_program_instruction_write_global_t const *)global_self;
21851 0 : self->offset = mem->offset;
21852 0 : self->bytes_len = mem->bytes_len;
21853 0 : self->bytes = fd_wksp_laddr_fast( ctx->wksp, mem->bytes_gaddr );
21854 0 : return FD_BINCODE_SUCCESS;
21855 0 : }
21856 0 : void fd_bpf_upgradeable_loader_program_instruction_write_new(fd_bpf_upgradeable_loader_program_instruction_write_t * self) {
21857 0 : fd_memset( self, 0, sizeof(fd_bpf_upgradeable_loader_program_instruction_write_t) );
21858 0 : }
21859 0 : void fd_bpf_upgradeable_loader_program_instruction_write_destroy( fd_bpf_upgradeable_loader_program_instruction_write_t * self ) {
21860 0 : if( self->bytes ) {
21861 0 : self->bytes = NULL;
21862 0 : }
21863 0 : }
21864 :
21865 0 : ulong fd_bpf_upgradeable_loader_program_instruction_write_footprint( void ){ return FD_BPF_UPGRADEABLE_LOADER_PROGRAM_INSTRUCTION_WRITE_FOOTPRINT; }
21866 0 : ulong fd_bpf_upgradeable_loader_program_instruction_write_align( void ){ return FD_BPF_UPGRADEABLE_LOADER_PROGRAM_INSTRUCTION_WRITE_ALIGN; }
21867 :
21868 0 : void fd_bpf_upgradeable_loader_program_instruction_write_walk( void * w, fd_bpf_upgradeable_loader_program_instruction_write_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
21869 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_bpf_upgradeable_loader_program_instruction_write", level++ );
21870 0 : fun( w, &self->offset, "offset", FD_FLAMENCO_TYPE_UINT, "uint", level );
21871 0 : fun(w, self->bytes, "bytes", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
21872 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_bpf_upgradeable_loader_program_instruction_write", level-- );
21873 0 : }
21874 0 : ulong fd_bpf_upgradeable_loader_program_instruction_write_size( fd_bpf_upgradeable_loader_program_instruction_write_t const * self ) {
21875 0 : ulong size = 0;
21876 0 : size += sizeof(uint);
21877 0 : do {
21878 0 : size += sizeof(ulong);
21879 0 : size += self->bytes_len;
21880 0 : } while(0);
21881 0 : return size;
21882 0 : }
21883 :
21884 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 ) {
21885 0 : int err;
21886 0 : err = fd_bincode_uint64_encode( self->max_data_len, ctx );
21887 0 : if( FD_UNLIKELY( err ) ) return err;
21888 0 : return FD_BINCODE_SUCCESS;
21889 0 : }
21890 0 : int fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
21891 0 : *total_sz += sizeof(fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_t);
21892 0 : void const * start_data = ctx->data;
21893 0 : int err = fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_decode_footprint_inner( ctx, total_sz );
21894 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
21895 0 : ctx->data = start_data;
21896 0 : return err;
21897 0 : }
21898 0 : int fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
21899 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
21900 0 : int err = 0;
21901 0 : err = fd_bincode_uint64_decode_footprint( ctx );
21902 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
21903 0 : return 0;
21904 0 : }
21905 0 : void * fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
21906 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;
21907 0 : fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_new( self );
21908 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_t);
21909 0 : void * * alloc_mem = &alloc_region;
21910 0 : fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_decode_inner( mem, alloc_mem, ctx );
21911 0 : return self;
21912 0 : }
21913 0 : 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 ) {
21914 0 : fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_t * self = (fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_t *)struct_mem;
21915 0 : fd_bincode_uint64_decode_unsafe( &self->max_data_len, ctx );
21916 0 : }
21917 0 : void * fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
21918 0 : fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_global_t * self = (fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_global_t *)mem;
21919 0 : fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_new( (fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_t *)self );
21920 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_global_t);
21921 0 : void * * alloc_mem = &alloc_region;
21922 0 : fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_decode_inner_global( mem, alloc_mem, ctx );
21923 0 : return self;
21924 0 : }
21925 0 : void fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
21926 0 : fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_global_t * self = (fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_global_t *)struct_mem;
21927 0 : fd_bincode_uint64_decode_unsafe( &self->max_data_len, ctx );
21928 0 : }
21929 0 : int fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_convert_global_to_local( void const * global_self, fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_t * self, fd_bincode_decode_ctx_t * ctx ) {
21930 0 : int err = 0;
21931 0 : fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_global_t const * mem = (fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_global_t const *)global_self;
21932 0 : self->max_data_len = mem->max_data_len;
21933 0 : return FD_BINCODE_SUCCESS;
21934 0 : }
21935 0 : void fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_new(fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_t * self) {
21936 0 : fd_memset( self, 0, sizeof(fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_t) );
21937 0 : }
21938 0 : void fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_destroy( fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_t * self ) {
21939 0 : }
21940 :
21941 0 : ulong fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_footprint( void ){ return FD_BPF_UPGRADEABLE_LOADER_PROGRAM_INSTRUCTION_DEPLOY_WITH_MAX_DATA_LEN_FOOTPRINT; }
21942 0 : ulong fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_align( void ){ return FD_BPF_UPGRADEABLE_LOADER_PROGRAM_INSTRUCTION_DEPLOY_WITH_MAX_DATA_LEN_ALIGN; }
21943 :
21944 0 : void fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_walk( void * w, fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
21945 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len", level++ );
21946 0 : fun( w, &self->max_data_len, "max_data_len", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
21947 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len", level-- );
21948 0 : }
21949 0 : ulong fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_size( fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_t const * self ) {
21950 0 : ulong size = 0;
21951 0 : size += sizeof(ulong);
21952 0 : return size;
21953 0 : }
21954 :
21955 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 ) {
21956 0 : int err;
21957 0 : err = fd_bincode_uint32_encode( self->additional_bytes, ctx );
21958 0 : if( FD_UNLIKELY( err ) ) return err;
21959 0 : return FD_BINCODE_SUCCESS;
21960 0 : }
21961 0 : int fd_bpf_upgradeable_loader_program_instruction_extend_program_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
21962 0 : *total_sz += sizeof(fd_bpf_upgradeable_loader_program_instruction_extend_program_t);
21963 0 : void const * start_data = ctx->data;
21964 0 : int err = fd_bpf_upgradeable_loader_program_instruction_extend_program_decode_footprint_inner( ctx, total_sz );
21965 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
21966 0 : ctx->data = start_data;
21967 0 : return err;
21968 0 : }
21969 0 : int fd_bpf_upgradeable_loader_program_instruction_extend_program_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
21970 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
21971 0 : int err = 0;
21972 0 : err = fd_bincode_uint32_decode_footprint( ctx );
21973 0 : if( FD_UNLIKELY( err ) ) return err;
21974 0 : return 0;
21975 0 : }
21976 0 : void * fd_bpf_upgradeable_loader_program_instruction_extend_program_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
21977 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_t * self = (fd_bpf_upgradeable_loader_program_instruction_extend_program_t *)mem;
21978 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_new( self );
21979 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_program_instruction_extend_program_t);
21980 0 : void * * alloc_mem = &alloc_region;
21981 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_decode_inner( mem, alloc_mem, ctx );
21982 0 : return self;
21983 0 : }
21984 0 : void fd_bpf_upgradeable_loader_program_instruction_extend_program_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
21985 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_t * self = (fd_bpf_upgradeable_loader_program_instruction_extend_program_t *)struct_mem;
21986 0 : fd_bincode_uint32_decode_unsafe( &self->additional_bytes, ctx );
21987 0 : }
21988 0 : void * fd_bpf_upgradeable_loader_program_instruction_extend_program_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
21989 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_global_t * self = (fd_bpf_upgradeable_loader_program_instruction_extend_program_global_t *)mem;
21990 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_new( (fd_bpf_upgradeable_loader_program_instruction_extend_program_t *)self );
21991 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_program_instruction_extend_program_global_t);
21992 0 : void * * alloc_mem = &alloc_region;
21993 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_decode_inner_global( mem, alloc_mem, ctx );
21994 0 : return self;
21995 0 : }
21996 0 : void fd_bpf_upgradeable_loader_program_instruction_extend_program_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
21997 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_global_t * self = (fd_bpf_upgradeable_loader_program_instruction_extend_program_global_t *)struct_mem;
21998 0 : fd_bincode_uint32_decode_unsafe( &self->additional_bytes, ctx );
21999 0 : }
22000 0 : int fd_bpf_upgradeable_loader_program_instruction_extend_program_convert_global_to_local( void const * global_self, fd_bpf_upgradeable_loader_program_instruction_extend_program_t * self, fd_bincode_decode_ctx_t * ctx ) {
22001 0 : int err = 0;
22002 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_global_t const * mem = (fd_bpf_upgradeable_loader_program_instruction_extend_program_global_t const *)global_self;
22003 0 : self->additional_bytes = mem->additional_bytes;
22004 0 : return FD_BINCODE_SUCCESS;
22005 0 : }
22006 0 : void fd_bpf_upgradeable_loader_program_instruction_extend_program_new(fd_bpf_upgradeable_loader_program_instruction_extend_program_t * self) {
22007 0 : fd_memset( self, 0, sizeof(fd_bpf_upgradeable_loader_program_instruction_extend_program_t) );
22008 0 : }
22009 0 : void fd_bpf_upgradeable_loader_program_instruction_extend_program_destroy( fd_bpf_upgradeable_loader_program_instruction_extend_program_t * self ) {
22010 0 : }
22011 :
22012 0 : ulong fd_bpf_upgradeable_loader_program_instruction_extend_program_footprint( void ){ return FD_BPF_UPGRADEABLE_LOADER_PROGRAM_INSTRUCTION_EXTEND_PROGRAM_FOOTPRINT; }
22013 0 : ulong fd_bpf_upgradeable_loader_program_instruction_extend_program_align( void ){ return FD_BPF_UPGRADEABLE_LOADER_PROGRAM_INSTRUCTION_EXTEND_PROGRAM_ALIGN; }
22014 :
22015 0 : void fd_bpf_upgradeable_loader_program_instruction_extend_program_walk( void * w, fd_bpf_upgradeable_loader_program_instruction_extend_program_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
22016 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_bpf_upgradeable_loader_program_instruction_extend_program", level++ );
22017 0 : fun( w, &self->additional_bytes, "additional_bytes", FD_FLAMENCO_TYPE_UINT, "uint", level );
22018 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_bpf_upgradeable_loader_program_instruction_extend_program", level-- );
22019 0 : }
22020 0 : ulong fd_bpf_upgradeable_loader_program_instruction_extend_program_size( fd_bpf_upgradeable_loader_program_instruction_extend_program_t const * self ) {
22021 0 : ulong size = 0;
22022 0 : size += sizeof(uint);
22023 0 : return size;
22024 0 : }
22025 :
22026 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_initialize_buffer(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
22027 0 : return self->discriminant == 0;
22028 0 : }
22029 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_write(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
22030 0 : return self->discriminant == 1;
22031 0 : }
22032 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) {
22033 0 : return self->discriminant == 2;
22034 0 : }
22035 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_upgrade(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
22036 0 : return self->discriminant == 3;
22037 0 : }
22038 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_set_authority(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
22039 0 : return self->discriminant == 4;
22040 0 : }
22041 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_close(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
22042 0 : return self->discriminant == 5;
22043 0 : }
22044 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_extend_program(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
22045 0 : return self->discriminant == 6;
22046 0 : }
22047 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_set_authority_checked(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
22048 0 : return self->discriminant == 7;
22049 0 : }
22050 : void fd_bpf_upgradeable_loader_program_instruction_inner_new( fd_bpf_upgradeable_loader_program_instruction_inner_t * self, uint discriminant );
22051 0 : int fd_bpf_upgradeable_loader_program_instruction_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
22052 0 : int err;
22053 0 : switch (discriminant) {
22054 0 : case 0: {
22055 0 : return FD_BINCODE_SUCCESS;
22056 0 : }
22057 0 : case 1: {
22058 0 : err = fd_bpf_upgradeable_loader_program_instruction_write_decode_footprint_inner( ctx, total_sz );
22059 0 : if( FD_UNLIKELY( err ) ) return err;
22060 0 : return FD_BINCODE_SUCCESS;
22061 0 : }
22062 0 : case 2: {
22063 0 : err = fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_decode_footprint_inner( ctx, total_sz );
22064 0 : if( FD_UNLIKELY( err ) ) return err;
22065 0 : return FD_BINCODE_SUCCESS;
22066 0 : }
22067 0 : case 3: {
22068 0 : return FD_BINCODE_SUCCESS;
22069 0 : }
22070 0 : case 4: {
22071 0 : return FD_BINCODE_SUCCESS;
22072 0 : }
22073 0 : case 5: {
22074 0 : return FD_BINCODE_SUCCESS;
22075 0 : }
22076 0 : case 6: {
22077 0 : err = fd_bpf_upgradeable_loader_program_instruction_extend_program_decode_footprint_inner( ctx, total_sz );
22078 0 : if( FD_UNLIKELY( err ) ) return err;
22079 0 : return FD_BINCODE_SUCCESS;
22080 0 : }
22081 0 : case 7: {
22082 0 : return FD_BINCODE_SUCCESS;
22083 0 : }
22084 0 : default: return FD_BINCODE_ERR_ENCODING;
22085 0 : }
22086 0 : }
22087 0 : int fd_bpf_upgradeable_loader_program_instruction_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
22088 0 : *total_sz += sizeof(fd_bpf_upgradeable_loader_program_instruction_t);
22089 0 : void const * start_data = ctx->data;
22090 0 : int err = fd_bpf_upgradeable_loader_program_instruction_decode_footprint_inner( ctx, total_sz );
22091 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
22092 0 : ctx->data = start_data;
22093 0 : return err;
22094 0 : }
22095 0 : int fd_bpf_upgradeable_loader_program_instruction_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
22096 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
22097 0 : uint discriminant = 0;
22098 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
22099 0 : if( FD_UNLIKELY( err ) ) return err;
22100 0 : return fd_bpf_upgradeable_loader_program_instruction_inner_decode_footprint( discriminant, ctx, total_sz );
22101 0 : }
22102 0 : 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 ) {
22103 0 : switch (discriminant) {
22104 0 : case 0: {
22105 0 : break;
22106 0 : }
22107 0 : case 1: {
22108 0 : fd_bpf_upgradeable_loader_program_instruction_write_decode_inner( &self->write, alloc_mem, ctx );
22109 0 : break;
22110 0 : }
22111 0 : case 2: {
22112 0 : fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_decode_inner( &self->deploy_with_max_data_len, alloc_mem, ctx );
22113 0 : break;
22114 0 : }
22115 0 : case 3: {
22116 0 : break;
22117 0 : }
22118 0 : case 4: {
22119 0 : break;
22120 0 : }
22121 0 : case 5: {
22122 0 : break;
22123 0 : }
22124 0 : case 6: {
22125 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_decode_inner( &self->extend_program, alloc_mem, ctx );
22126 0 : break;
22127 0 : }
22128 0 : case 7: {
22129 0 : break;
22130 0 : }
22131 0 : }
22132 0 : }
22133 0 : void fd_bpf_upgradeable_loader_program_instruction_inner_decode_inner_global( fd_bpf_upgradeable_loader_program_instruction_inner_global_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
22134 0 : switch (discriminant) {
22135 0 : case 0: {
22136 0 : break;
22137 0 : }
22138 0 : case 1: {
22139 0 : fd_bpf_upgradeable_loader_program_instruction_write_decode_inner_global( &self->write, alloc_mem, ctx );
22140 0 : break;
22141 0 : }
22142 0 : case 2: {
22143 0 : fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_decode_inner_global( &self->deploy_with_max_data_len, alloc_mem, ctx );
22144 0 : break;
22145 0 : }
22146 0 : case 3: {
22147 0 : break;
22148 0 : }
22149 0 : case 4: {
22150 0 : break;
22151 0 : }
22152 0 : case 5: {
22153 0 : break;
22154 0 : }
22155 0 : case 6: {
22156 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_decode_inner_global( &self->extend_program, alloc_mem, ctx );
22157 0 : break;
22158 0 : }
22159 0 : case 7: {
22160 0 : break;
22161 0 : }
22162 0 : }
22163 0 : }
22164 0 : int fd_bpf_upgradeable_loader_program_instruction_convert_global_to_local_inner( fd_bpf_upgradeable_loader_program_instruction_inner_global_t const * mem, fd_bpf_upgradeable_loader_program_instruction_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
22165 0 : int err = 0;
22166 0 : switch( discriminant ) {
22167 0 : case 0: {
22168 0 : break;
22169 0 : }
22170 0 : case 1: {
22171 0 : err = fd_bpf_upgradeable_loader_program_instruction_write_convert_global_to_local( &mem->write, &self->write, ctx );
22172 0 : if( FD_UNLIKELY( err ) ) return err;
22173 0 : break;
22174 0 : }
22175 0 : case 2: {
22176 0 : err = fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_convert_global_to_local( &mem->deploy_with_max_data_len, &self->deploy_with_max_data_len, ctx );
22177 0 : if( FD_UNLIKELY( err ) ) return err;
22178 0 : break;
22179 0 : }
22180 0 : case 3: {
22181 0 : break;
22182 0 : }
22183 0 : case 4: {
22184 0 : break;
22185 0 : }
22186 0 : case 5: {
22187 0 : break;
22188 0 : }
22189 0 : case 6: {
22190 0 : err = fd_bpf_upgradeable_loader_program_instruction_extend_program_convert_global_to_local( &mem->extend_program, &self->extend_program, ctx );
22191 0 : if( FD_UNLIKELY( err ) ) return err;
22192 0 : break;
22193 0 : }
22194 0 : case 7: {
22195 0 : break;
22196 0 : }
22197 0 : }
22198 0 : return FD_BINCODE_SUCCESS;
22199 0 : }
22200 0 : int fd_bpf_upgradeable_loader_program_instruction_convert_global_to_local( void const * global_self, fd_bpf_upgradeable_loader_program_instruction_t * self, fd_bincode_decode_ctx_t * ctx ) {
22201 0 : fd_bpf_upgradeable_loader_program_instruction_global_t const * mem = (fd_bpf_upgradeable_loader_program_instruction_global_t const *)global_self;
22202 0 : uint discriminant = mem->discriminant;
22203 0 : self->discriminant = mem->discriminant;
22204 0 : int err = fd_bpf_upgradeable_loader_program_instruction_convert_global_to_local_inner( &mem->inner, &self->inner, discriminant, ctx );
22205 0 : return FD_BINCODE_SUCCESS;
22206 0 : }
22207 0 : void fd_bpf_upgradeable_loader_program_instruction_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
22208 0 : fd_bpf_upgradeable_loader_program_instruction_t * self = (fd_bpf_upgradeable_loader_program_instruction_t *)struct_mem;
22209 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
22210 0 : fd_bpf_upgradeable_loader_program_instruction_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
22211 0 : }
22212 0 : void * fd_bpf_upgradeable_loader_program_instruction_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
22213 0 : fd_bpf_upgradeable_loader_program_instruction_t * self = (fd_bpf_upgradeable_loader_program_instruction_t *)mem;
22214 0 : fd_bpf_upgradeable_loader_program_instruction_new( self );
22215 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_program_instruction_t);
22216 0 : void * * alloc_mem = &alloc_region;
22217 0 : fd_bpf_upgradeable_loader_program_instruction_decode_inner( mem, alloc_mem, ctx );
22218 0 : return self;
22219 0 : }
22220 0 : void * fd_bpf_upgradeable_loader_program_instruction_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
22221 0 : fd_bpf_upgradeable_loader_program_instruction_t * self = (fd_bpf_upgradeable_loader_program_instruction_t *)mem;
22222 0 : fd_bpf_upgradeable_loader_program_instruction_new( self );
22223 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_program_instruction_t);
22224 0 : void * * alloc_mem = &alloc_region;
22225 0 : fd_bpf_upgradeable_loader_program_instruction_decode_inner_global( mem, alloc_mem, ctx );
22226 0 : return self;
22227 0 : }
22228 0 : void fd_bpf_upgradeable_loader_program_instruction_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
22229 0 : fd_bpf_upgradeable_loader_program_instruction_global_t * self = (fd_bpf_upgradeable_loader_program_instruction_global_t *)struct_mem;
22230 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
22231 0 : fd_bpf_upgradeable_loader_program_instruction_inner_decode_inner_global( &self->inner, alloc_mem, self->discriminant, ctx );
22232 0 : }
22233 0 : void fd_bpf_upgradeable_loader_program_instruction_inner_new( fd_bpf_upgradeable_loader_program_instruction_inner_t * self, uint discriminant ) {
22234 0 : switch( discriminant ) {
22235 0 : case 0: {
22236 0 : break;
22237 0 : }
22238 0 : case 1: {
22239 0 : fd_bpf_upgradeable_loader_program_instruction_write_new( &self->write );
22240 0 : break;
22241 0 : }
22242 0 : case 2: {
22243 0 : fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_new( &self->deploy_with_max_data_len );
22244 0 : break;
22245 0 : }
22246 0 : case 3: {
22247 0 : break;
22248 0 : }
22249 0 : case 4: {
22250 0 : break;
22251 0 : }
22252 0 : case 5: {
22253 0 : break;
22254 0 : }
22255 0 : case 6: {
22256 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_new( &self->extend_program );
22257 0 : break;
22258 0 : }
22259 0 : case 7: {
22260 0 : break;
22261 0 : }
22262 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
22263 0 : }
22264 0 : }
22265 0 : void fd_bpf_upgradeable_loader_program_instruction_new_disc( fd_bpf_upgradeable_loader_program_instruction_t * self, uint discriminant ) {
22266 0 : self->discriminant = discriminant;
22267 0 : fd_bpf_upgradeable_loader_program_instruction_inner_new( &self->inner, self->discriminant );
22268 0 : }
22269 0 : void fd_bpf_upgradeable_loader_program_instruction_new( fd_bpf_upgradeable_loader_program_instruction_t * self ) {
22270 0 : fd_memset( self, 0, sizeof(fd_bpf_upgradeable_loader_program_instruction_t) );
22271 0 : fd_bpf_upgradeable_loader_program_instruction_new_disc( self, UINT_MAX );
22272 0 : }
22273 0 : void fd_bpf_upgradeable_loader_program_instruction_inner_destroy( fd_bpf_upgradeable_loader_program_instruction_inner_t * self, uint discriminant ) {
22274 0 : switch( discriminant ) {
22275 0 : case 1: {
22276 0 : fd_bpf_upgradeable_loader_program_instruction_write_destroy( &self->write );
22277 0 : break;
22278 0 : }
22279 0 : case 2: {
22280 0 : fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_destroy( &self->deploy_with_max_data_len );
22281 0 : break;
22282 0 : }
22283 0 : case 6: {
22284 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_destroy( &self->extend_program );
22285 0 : break;
22286 0 : }
22287 0 : default: break; // FD_LOG_ERR(( "unhandled type" ));
22288 0 : }
22289 0 : }
22290 0 : void fd_bpf_upgradeable_loader_program_instruction_destroy( fd_bpf_upgradeable_loader_program_instruction_t * self ) {
22291 0 : fd_bpf_upgradeable_loader_program_instruction_inner_destroy( &self->inner, self->discriminant );
22292 0 : }
22293 :
22294 0 : ulong fd_bpf_upgradeable_loader_program_instruction_footprint( void ){ return FD_BPF_UPGRADEABLE_LOADER_PROGRAM_INSTRUCTION_FOOTPRINT; }
22295 0 : ulong fd_bpf_upgradeable_loader_program_instruction_align( void ){ return FD_BPF_UPGRADEABLE_LOADER_PROGRAM_INSTRUCTION_ALIGN; }
22296 :
22297 0 : void fd_bpf_upgradeable_loader_program_instruction_walk( void * w, fd_bpf_upgradeable_loader_program_instruction_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
22298 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_bpf_upgradeable_loader_program_instruction", level++);
22299 0 : switch( self->discriminant ) {
22300 0 : case 0: {
22301 0 : fun( w, self, "initialize_buffer", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
22302 0 : break;
22303 0 : }
22304 0 : case 1: {
22305 0 : fun( w, self, "write", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
22306 0 : fd_bpf_upgradeable_loader_program_instruction_write_walk( w, &self->inner.write, fun, "write", level );
22307 0 : break;
22308 0 : }
22309 0 : case 2: {
22310 0 : fun( w, self, "deploy_with_max_data_len", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
22311 0 : fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_walk( w, &self->inner.deploy_with_max_data_len, fun, "deploy_with_max_data_len", level );
22312 0 : break;
22313 0 : }
22314 0 : case 3: {
22315 0 : fun( w, self, "upgrade", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
22316 0 : break;
22317 0 : }
22318 0 : case 4: {
22319 0 : fun( w, self, "set_authority", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
22320 0 : break;
22321 0 : }
22322 0 : case 5: {
22323 0 : fun( w, self, "close", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
22324 0 : break;
22325 0 : }
22326 0 : case 6: {
22327 0 : fun( w, self, "extend_program", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
22328 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_walk( w, &self->inner.extend_program, fun, "extend_program", level );
22329 0 : break;
22330 0 : }
22331 0 : case 7: {
22332 0 : fun( w, self, "set_authority_checked", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
22333 0 : break;
22334 0 : }
22335 0 : }
22336 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_bpf_upgradeable_loader_program_instruction", level-- );
22337 0 : }
22338 0 : ulong fd_bpf_upgradeable_loader_program_instruction_size( fd_bpf_upgradeable_loader_program_instruction_t const * self ) {
22339 0 : ulong size = 0;
22340 0 : size += sizeof(uint);
22341 0 : switch (self->discriminant) {
22342 0 : case 1: {
22343 0 : size += fd_bpf_upgradeable_loader_program_instruction_write_size( &self->inner.write );
22344 0 : break;
22345 0 : }
22346 0 : case 2: {
22347 0 : size += fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_size( &self->inner.deploy_with_max_data_len );
22348 0 : break;
22349 0 : }
22350 0 : case 6: {
22351 0 : size += fd_bpf_upgradeable_loader_program_instruction_extend_program_size( &self->inner.extend_program );
22352 0 : break;
22353 0 : }
22354 0 : }
22355 0 : return size;
22356 0 : }
22357 :
22358 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 ) {
22359 0 : int err;
22360 0 : switch (discriminant) {
22361 0 : case 1: {
22362 0 : err = fd_bpf_upgradeable_loader_program_instruction_write_encode( &self->write, ctx );
22363 0 : if( FD_UNLIKELY( err ) ) return err;
22364 0 : break;
22365 0 : }
22366 0 : case 2: {
22367 0 : err = fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_encode( &self->deploy_with_max_data_len, ctx );
22368 0 : if( FD_UNLIKELY( err ) ) return err;
22369 0 : break;
22370 0 : }
22371 0 : case 6: {
22372 0 : err = fd_bpf_upgradeable_loader_program_instruction_extend_program_encode( &self->extend_program, ctx );
22373 0 : if( FD_UNLIKELY( err ) ) return err;
22374 0 : break;
22375 0 : }
22376 0 : }
22377 0 : return FD_BINCODE_SUCCESS;
22378 0 : }
22379 0 : int fd_bpf_upgradeable_loader_program_instruction_encode( fd_bpf_upgradeable_loader_program_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
22380 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
22381 0 : if( FD_UNLIKELY( err ) ) return err;
22382 0 : return fd_bpf_upgradeable_loader_program_instruction_inner_encode( &self->inner, self->discriminant, ctx );
22383 0 : }
22384 :
22385 0 : int fd_bpf_upgradeable_loader_state_buffer_encode( fd_bpf_upgradeable_loader_state_buffer_t const * self, fd_bincode_encode_ctx_t * ctx ) {
22386 0 : int err;
22387 0 : if( self->authority_address != NULL ) {
22388 0 : err = fd_bincode_bool_encode( 1, ctx );
22389 0 : if( FD_UNLIKELY( err ) ) return err;
22390 0 : err = fd_pubkey_encode( self->authority_address, ctx );
22391 0 : if( FD_UNLIKELY( err ) ) return err;
22392 0 : } else {
22393 0 : err = fd_bincode_bool_encode( 0, ctx );
22394 0 : if( FD_UNLIKELY( err ) ) return err;
22395 0 : }
22396 0 : return FD_BINCODE_SUCCESS;
22397 0 : }
22398 0 : int fd_bpf_upgradeable_loader_state_buffer_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
22399 0 : *total_sz += sizeof(fd_bpf_upgradeable_loader_state_buffer_t);
22400 0 : void const * start_data = ctx->data;
22401 0 : int err = fd_bpf_upgradeable_loader_state_buffer_decode_footprint_inner( ctx, total_sz );
22402 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
22403 0 : ctx->data = start_data;
22404 0 : return err;
22405 0 : }
22406 0 : int fd_bpf_upgradeable_loader_state_buffer_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
22407 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
22408 0 : int err = 0;
22409 0 : {
22410 0 : uchar o;
22411 0 : err = fd_bincode_bool_decode( &o, ctx );
22412 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
22413 0 : if( o ) {
22414 0 : *total_sz += FD_PUBKEY_ALIGN + FD_PUBKEY_FOOTPRINT;
22415 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
22416 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
22417 0 : }
22418 0 : }
22419 0 : return 0;
22420 0 : }
22421 0 : void * fd_bpf_upgradeable_loader_state_buffer_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
22422 0 : fd_bpf_upgradeable_loader_state_buffer_t * self = (fd_bpf_upgradeable_loader_state_buffer_t *)mem;
22423 0 : fd_bpf_upgradeable_loader_state_buffer_new( self );
22424 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_state_buffer_t);
22425 0 : void * * alloc_mem = &alloc_region;
22426 0 : fd_bpf_upgradeable_loader_state_buffer_decode_inner( mem, alloc_mem, ctx );
22427 0 : return self;
22428 0 : }
22429 0 : void fd_bpf_upgradeable_loader_state_buffer_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
22430 0 : fd_bpf_upgradeable_loader_state_buffer_t * self = (fd_bpf_upgradeable_loader_state_buffer_t *)struct_mem;
22431 0 : {
22432 0 : uchar o;
22433 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
22434 0 : if( o ) {
22435 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, FD_PUBKEY_ALIGN );
22436 0 : self->authority_address = *alloc_mem;
22437 0 : *alloc_mem = (uchar *)*alloc_mem + FD_PUBKEY_FOOTPRINT;
22438 0 : fd_pubkey_new( self->authority_address );
22439 0 : fd_pubkey_decode_inner( self->authority_address, alloc_mem, ctx );
22440 0 : } else {
22441 0 : self->authority_address = NULL;
22442 0 : }
22443 0 : }
22444 0 : }
22445 0 : void * fd_bpf_upgradeable_loader_state_buffer_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
22446 0 : fd_bpf_upgradeable_loader_state_buffer_global_t * self = (fd_bpf_upgradeable_loader_state_buffer_global_t *)mem;
22447 0 : fd_bpf_upgradeable_loader_state_buffer_new( (fd_bpf_upgradeable_loader_state_buffer_t *)self );
22448 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_state_buffer_global_t);
22449 0 : void * * alloc_mem = &alloc_region;
22450 0 : fd_bpf_upgradeable_loader_state_buffer_decode_inner_global( mem, alloc_mem, ctx );
22451 0 : return self;
22452 0 : }
22453 0 : void fd_bpf_upgradeable_loader_state_buffer_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
22454 0 : fd_bpf_upgradeable_loader_state_buffer_global_t * self = (fd_bpf_upgradeable_loader_state_buffer_global_t *)struct_mem;
22455 0 : {
22456 0 : uchar o;
22457 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
22458 0 : if( o ) {
22459 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, FD_PUBKEY_ALIGN );
22460 0 : self->authority_address_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
22461 0 : fd_pubkey_new( *alloc_mem );
22462 0 : *alloc_mem = (uchar *)*alloc_mem + FD_PUBKEY_FOOTPRINT;
22463 0 : fd_pubkey_decode_inner_global( fd_wksp_laddr_fast( ctx->wksp, self->authority_address_gaddr ), alloc_mem, ctx );
22464 0 : } else {
22465 0 : self->authority_address_gaddr = 0UL;
22466 0 : }
22467 0 : }
22468 0 : }
22469 0 : int fd_bpf_upgradeable_loader_state_buffer_convert_global_to_local( void const * global_self, fd_bpf_upgradeable_loader_state_buffer_t * self, fd_bincode_decode_ctx_t * ctx ) {
22470 0 : int err = 0;
22471 0 : fd_bpf_upgradeable_loader_state_buffer_global_t const * mem = (fd_bpf_upgradeable_loader_state_buffer_global_t const *)global_self;
22472 0 : self->authority_address = fd_wksp_laddr_fast( ctx->wksp, mem->authority_address_gaddr );
22473 0 : return FD_BINCODE_SUCCESS;
22474 0 : }
22475 0 : void fd_bpf_upgradeable_loader_state_buffer_new(fd_bpf_upgradeable_loader_state_buffer_t * self) {
22476 0 : fd_memset( self, 0, sizeof(fd_bpf_upgradeable_loader_state_buffer_t) );
22477 0 : }
22478 0 : void fd_bpf_upgradeable_loader_state_buffer_destroy( fd_bpf_upgradeable_loader_state_buffer_t * self ) {
22479 0 : if( self->authority_address ) {
22480 0 : fd_pubkey_destroy( self->authority_address );
22481 0 : self->authority_address = NULL;
22482 0 : }
22483 0 : }
22484 :
22485 0 : ulong fd_bpf_upgradeable_loader_state_buffer_footprint( void ){ return FD_BPF_UPGRADEABLE_LOADER_STATE_BUFFER_FOOTPRINT; }
22486 0 : ulong fd_bpf_upgradeable_loader_state_buffer_align( void ){ return FD_BPF_UPGRADEABLE_LOADER_STATE_BUFFER_ALIGN; }
22487 :
22488 0 : void fd_bpf_upgradeable_loader_state_buffer_walk( void * w, fd_bpf_upgradeable_loader_state_buffer_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
22489 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_bpf_upgradeable_loader_state_buffer", level++ );
22490 0 : if( !self->authority_address ) {
22491 0 : fun( w, NULL, "authority_address", FD_FLAMENCO_TYPE_NULL, "pubkey", level );
22492 0 : } else {
22493 0 : fd_pubkey_walk( w, self->authority_address, fun, "authority_address", level );
22494 0 : }
22495 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_bpf_upgradeable_loader_state_buffer", level-- );
22496 0 : }
22497 0 : ulong fd_bpf_upgradeable_loader_state_buffer_size( fd_bpf_upgradeable_loader_state_buffer_t const * self ) {
22498 0 : ulong size = 0;
22499 0 : size += sizeof(char);
22500 0 : if( NULL != self->authority_address ) {
22501 0 : size += fd_pubkey_size( self->authority_address );
22502 0 : }
22503 0 : return size;
22504 0 : }
22505 :
22506 0 : int fd_bpf_upgradeable_loader_state_program_encode( fd_bpf_upgradeable_loader_state_program_t const * self, fd_bincode_encode_ctx_t * ctx ) {
22507 0 : int err;
22508 0 : err = fd_pubkey_encode( &self->programdata_address, ctx );
22509 0 : if( FD_UNLIKELY( err ) ) return err;
22510 0 : return FD_BINCODE_SUCCESS;
22511 0 : }
22512 0 : int fd_bpf_upgradeable_loader_state_program_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
22513 0 : *total_sz += sizeof(fd_bpf_upgradeable_loader_state_program_t);
22514 0 : void const * start_data = ctx->data;
22515 0 : int err = fd_bpf_upgradeable_loader_state_program_decode_footprint_inner( ctx, total_sz );
22516 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
22517 0 : ctx->data = start_data;
22518 0 : return err;
22519 0 : }
22520 0 : int fd_bpf_upgradeable_loader_state_program_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
22521 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
22522 0 : int err = 0;
22523 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
22524 0 : if( FD_UNLIKELY( err ) ) return err;
22525 0 : return 0;
22526 0 : }
22527 0 : void * fd_bpf_upgradeable_loader_state_program_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
22528 0 : fd_bpf_upgradeable_loader_state_program_t * self = (fd_bpf_upgradeable_loader_state_program_t *)mem;
22529 0 : fd_bpf_upgradeable_loader_state_program_new( self );
22530 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_state_program_t);
22531 0 : void * * alloc_mem = &alloc_region;
22532 0 : fd_bpf_upgradeable_loader_state_program_decode_inner( mem, alloc_mem, ctx );
22533 0 : return self;
22534 0 : }
22535 0 : void fd_bpf_upgradeable_loader_state_program_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
22536 0 : fd_bpf_upgradeable_loader_state_program_t * self = (fd_bpf_upgradeable_loader_state_program_t *)struct_mem;
22537 0 : fd_pubkey_decode_inner( &self->programdata_address, alloc_mem, ctx );
22538 0 : }
22539 0 : void * fd_bpf_upgradeable_loader_state_program_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
22540 0 : fd_bpf_upgradeable_loader_state_program_global_t * self = (fd_bpf_upgradeable_loader_state_program_global_t *)mem;
22541 0 : fd_bpf_upgradeable_loader_state_program_new( (fd_bpf_upgradeable_loader_state_program_t *)self );
22542 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_state_program_global_t);
22543 0 : void * * alloc_mem = &alloc_region;
22544 0 : fd_bpf_upgradeable_loader_state_program_decode_inner_global( mem, alloc_mem, ctx );
22545 0 : return self;
22546 0 : }
22547 0 : void fd_bpf_upgradeable_loader_state_program_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
22548 0 : fd_bpf_upgradeable_loader_state_program_global_t * self = (fd_bpf_upgradeable_loader_state_program_global_t *)struct_mem;
22549 0 : fd_pubkey_decode_inner_global( &self->programdata_address, alloc_mem, ctx );
22550 0 : }
22551 0 : int fd_bpf_upgradeable_loader_state_program_convert_global_to_local( void const * global_self, fd_bpf_upgradeable_loader_state_program_t * self, fd_bincode_decode_ctx_t * ctx ) {
22552 0 : int err = 0;
22553 0 : fd_bpf_upgradeable_loader_state_program_global_t const * mem = (fd_bpf_upgradeable_loader_state_program_global_t const *)global_self;
22554 0 : err = fd_pubkey_convert_global_to_local( &mem->programdata_address, &self->programdata_address, ctx );
22555 0 : if( FD_UNLIKELY( err ) ) return err;
22556 0 : return FD_BINCODE_SUCCESS;
22557 0 : }
22558 0 : void fd_bpf_upgradeable_loader_state_program_new(fd_bpf_upgradeable_loader_state_program_t * self) {
22559 0 : fd_memset( self, 0, sizeof(fd_bpf_upgradeable_loader_state_program_t) );
22560 0 : fd_pubkey_new( &self->programdata_address );
22561 0 : }
22562 0 : void fd_bpf_upgradeable_loader_state_program_destroy( fd_bpf_upgradeable_loader_state_program_t * self ) {
22563 0 : fd_pubkey_destroy( &self->programdata_address );
22564 0 : }
22565 :
22566 0 : ulong fd_bpf_upgradeable_loader_state_program_footprint( void ){ return FD_BPF_UPGRADEABLE_LOADER_STATE_PROGRAM_FOOTPRINT; }
22567 0 : ulong fd_bpf_upgradeable_loader_state_program_align( void ){ return FD_BPF_UPGRADEABLE_LOADER_STATE_PROGRAM_ALIGN; }
22568 :
22569 0 : void fd_bpf_upgradeable_loader_state_program_walk( void * w, fd_bpf_upgradeable_loader_state_program_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
22570 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_bpf_upgradeable_loader_state_program", level++ );
22571 0 : fd_pubkey_walk( w, &self->programdata_address, fun, "programdata_address", level );
22572 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_bpf_upgradeable_loader_state_program", level-- );
22573 0 : }
22574 0 : ulong fd_bpf_upgradeable_loader_state_program_size( fd_bpf_upgradeable_loader_state_program_t const * self ) {
22575 0 : ulong size = 0;
22576 0 : size += fd_pubkey_size( &self->programdata_address );
22577 0 : return size;
22578 0 : }
22579 :
22580 0 : int fd_bpf_upgradeable_loader_state_program_data_encode( fd_bpf_upgradeable_loader_state_program_data_t const * self, fd_bincode_encode_ctx_t * ctx ) {
22581 0 : int err;
22582 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
22583 0 : if( FD_UNLIKELY( err ) ) return err;
22584 0 : if( self->upgrade_authority_address != NULL ) {
22585 0 : err = fd_bincode_bool_encode( 1, ctx );
22586 0 : if( FD_UNLIKELY( err ) ) return err;
22587 0 : err = fd_pubkey_encode( self->upgrade_authority_address, ctx );
22588 0 : if( FD_UNLIKELY( err ) ) return err;
22589 0 : } else {
22590 0 : err = fd_bincode_bool_encode( 0, ctx );
22591 0 : if( FD_UNLIKELY( err ) ) return err;
22592 0 : }
22593 0 : return FD_BINCODE_SUCCESS;
22594 0 : }
22595 0 : int fd_bpf_upgradeable_loader_state_program_data_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
22596 0 : *total_sz += sizeof(fd_bpf_upgradeable_loader_state_program_data_t);
22597 0 : void const * start_data = ctx->data;
22598 0 : int err = fd_bpf_upgradeable_loader_state_program_data_decode_footprint_inner( ctx, total_sz );
22599 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
22600 0 : ctx->data = start_data;
22601 0 : return err;
22602 0 : }
22603 0 : int fd_bpf_upgradeable_loader_state_program_data_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
22604 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
22605 0 : int err = 0;
22606 0 : err = fd_bincode_uint64_decode_footprint( ctx );
22607 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
22608 0 : {
22609 0 : uchar o;
22610 0 : err = fd_bincode_bool_decode( &o, ctx );
22611 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
22612 0 : if( o ) {
22613 0 : *total_sz += FD_PUBKEY_ALIGN + FD_PUBKEY_FOOTPRINT;
22614 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
22615 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
22616 0 : }
22617 0 : }
22618 0 : return 0;
22619 0 : }
22620 0 : void * fd_bpf_upgradeable_loader_state_program_data_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
22621 0 : fd_bpf_upgradeable_loader_state_program_data_t * self = (fd_bpf_upgradeable_loader_state_program_data_t *)mem;
22622 0 : fd_bpf_upgradeable_loader_state_program_data_new( self );
22623 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_state_program_data_t);
22624 0 : void * * alloc_mem = &alloc_region;
22625 0 : fd_bpf_upgradeable_loader_state_program_data_decode_inner( mem, alloc_mem, ctx );
22626 0 : return self;
22627 0 : }
22628 0 : void fd_bpf_upgradeable_loader_state_program_data_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
22629 0 : fd_bpf_upgradeable_loader_state_program_data_t * self = (fd_bpf_upgradeable_loader_state_program_data_t *)struct_mem;
22630 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
22631 0 : {
22632 0 : uchar o;
22633 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
22634 0 : if( o ) {
22635 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, FD_PUBKEY_ALIGN );
22636 0 : self->upgrade_authority_address = *alloc_mem;
22637 0 : *alloc_mem = (uchar *)*alloc_mem + FD_PUBKEY_FOOTPRINT;
22638 0 : fd_pubkey_new( self->upgrade_authority_address );
22639 0 : fd_pubkey_decode_inner( self->upgrade_authority_address, alloc_mem, ctx );
22640 0 : } else {
22641 0 : self->upgrade_authority_address = NULL;
22642 0 : }
22643 0 : }
22644 0 : }
22645 0 : void * fd_bpf_upgradeable_loader_state_program_data_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
22646 0 : fd_bpf_upgradeable_loader_state_program_data_global_t * self = (fd_bpf_upgradeable_loader_state_program_data_global_t *)mem;
22647 0 : fd_bpf_upgradeable_loader_state_program_data_new( (fd_bpf_upgradeable_loader_state_program_data_t *)self );
22648 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_state_program_data_global_t);
22649 0 : void * * alloc_mem = &alloc_region;
22650 0 : fd_bpf_upgradeable_loader_state_program_data_decode_inner_global( mem, alloc_mem, ctx );
22651 0 : return self;
22652 0 : }
22653 0 : void fd_bpf_upgradeable_loader_state_program_data_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
22654 0 : fd_bpf_upgradeable_loader_state_program_data_global_t * self = (fd_bpf_upgradeable_loader_state_program_data_global_t *)struct_mem;
22655 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
22656 0 : {
22657 0 : uchar o;
22658 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
22659 0 : if( o ) {
22660 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, FD_PUBKEY_ALIGN );
22661 0 : self->upgrade_authority_address_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
22662 0 : fd_pubkey_new( *alloc_mem );
22663 0 : *alloc_mem = (uchar *)*alloc_mem + FD_PUBKEY_FOOTPRINT;
22664 0 : fd_pubkey_decode_inner_global( fd_wksp_laddr_fast( ctx->wksp, self->upgrade_authority_address_gaddr ), alloc_mem, ctx );
22665 0 : } else {
22666 0 : self->upgrade_authority_address_gaddr = 0UL;
22667 0 : }
22668 0 : }
22669 0 : }
22670 0 : int fd_bpf_upgradeable_loader_state_program_data_convert_global_to_local( void const * global_self, fd_bpf_upgradeable_loader_state_program_data_t * self, fd_bincode_decode_ctx_t * ctx ) {
22671 0 : int err = 0;
22672 0 : fd_bpf_upgradeable_loader_state_program_data_global_t const * mem = (fd_bpf_upgradeable_loader_state_program_data_global_t const *)global_self;
22673 0 : self->slot = mem->slot;
22674 0 : self->upgrade_authority_address = fd_wksp_laddr_fast( ctx->wksp, mem->upgrade_authority_address_gaddr );
22675 0 : return FD_BINCODE_SUCCESS;
22676 0 : }
22677 0 : void fd_bpf_upgradeable_loader_state_program_data_new(fd_bpf_upgradeable_loader_state_program_data_t * self) {
22678 0 : fd_memset( self, 0, sizeof(fd_bpf_upgradeable_loader_state_program_data_t) );
22679 0 : }
22680 0 : void fd_bpf_upgradeable_loader_state_program_data_destroy( fd_bpf_upgradeable_loader_state_program_data_t * self ) {
22681 0 : if( self->upgrade_authority_address ) {
22682 0 : fd_pubkey_destroy( self->upgrade_authority_address );
22683 0 : self->upgrade_authority_address = NULL;
22684 0 : }
22685 0 : }
22686 :
22687 0 : ulong fd_bpf_upgradeable_loader_state_program_data_footprint( void ){ return FD_BPF_UPGRADEABLE_LOADER_STATE_PROGRAM_DATA_FOOTPRINT; }
22688 0 : ulong fd_bpf_upgradeable_loader_state_program_data_align( void ){ return FD_BPF_UPGRADEABLE_LOADER_STATE_PROGRAM_DATA_ALIGN; }
22689 :
22690 0 : void fd_bpf_upgradeable_loader_state_program_data_walk( void * w, fd_bpf_upgradeable_loader_state_program_data_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
22691 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_bpf_upgradeable_loader_state_program_data", level++ );
22692 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
22693 0 : if( !self->upgrade_authority_address ) {
22694 0 : fun( w, NULL, "upgrade_authority_address", FD_FLAMENCO_TYPE_NULL, "pubkey", level );
22695 0 : } else {
22696 0 : fd_pubkey_walk( w, self->upgrade_authority_address, fun, "upgrade_authority_address", level );
22697 0 : }
22698 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_bpf_upgradeable_loader_state_program_data", level-- );
22699 0 : }
22700 0 : ulong fd_bpf_upgradeable_loader_state_program_data_size( fd_bpf_upgradeable_loader_state_program_data_t const * self ) {
22701 0 : ulong size = 0;
22702 0 : size += sizeof(ulong);
22703 0 : size += sizeof(char);
22704 0 : if( NULL != self->upgrade_authority_address ) {
22705 0 : size += fd_pubkey_size( self->upgrade_authority_address );
22706 0 : }
22707 0 : return size;
22708 0 : }
22709 :
22710 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_state_is_uninitialized(fd_bpf_upgradeable_loader_state_t const * self) {
22711 0 : return self->discriminant == 0;
22712 0 : }
22713 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_state_is_buffer(fd_bpf_upgradeable_loader_state_t const * self) {
22714 0 : return self->discriminant == 1;
22715 0 : }
22716 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_state_is_program(fd_bpf_upgradeable_loader_state_t const * self) {
22717 0 : return self->discriminant == 2;
22718 0 : }
22719 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_state_is_program_data(fd_bpf_upgradeable_loader_state_t const * self) {
22720 0 : return self->discriminant == 3;
22721 0 : }
22722 : void fd_bpf_upgradeable_loader_state_inner_new( fd_bpf_upgradeable_loader_state_inner_t * self, uint discriminant );
22723 0 : int fd_bpf_upgradeable_loader_state_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
22724 0 : int err;
22725 0 : switch (discriminant) {
22726 0 : case 0: {
22727 0 : return FD_BINCODE_SUCCESS;
22728 0 : }
22729 0 : case 1: {
22730 0 : err = fd_bpf_upgradeable_loader_state_buffer_decode_footprint_inner( ctx, total_sz );
22731 0 : if( FD_UNLIKELY( err ) ) return err;
22732 0 : return FD_BINCODE_SUCCESS;
22733 0 : }
22734 0 : case 2: {
22735 0 : err = fd_bpf_upgradeable_loader_state_program_decode_footprint_inner( ctx, total_sz );
22736 0 : if( FD_UNLIKELY( err ) ) return err;
22737 0 : return FD_BINCODE_SUCCESS;
22738 0 : }
22739 0 : case 3: {
22740 0 : err = fd_bpf_upgradeable_loader_state_program_data_decode_footprint_inner( ctx, total_sz );
22741 0 : if( FD_UNLIKELY( err ) ) return err;
22742 0 : return FD_BINCODE_SUCCESS;
22743 0 : }
22744 0 : default: return FD_BINCODE_ERR_ENCODING;
22745 0 : }
22746 0 : }
22747 0 : int fd_bpf_upgradeable_loader_state_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
22748 0 : *total_sz += sizeof(fd_bpf_upgradeable_loader_state_t);
22749 0 : void const * start_data = ctx->data;
22750 0 : int err = fd_bpf_upgradeable_loader_state_decode_footprint_inner( ctx, total_sz );
22751 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
22752 0 : ctx->data = start_data;
22753 0 : return err;
22754 0 : }
22755 0 : int fd_bpf_upgradeable_loader_state_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
22756 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
22757 0 : uint discriminant = 0;
22758 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
22759 0 : if( FD_UNLIKELY( err ) ) return err;
22760 0 : return fd_bpf_upgradeable_loader_state_inner_decode_footprint( discriminant, ctx, total_sz );
22761 0 : }
22762 0 : 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 ) {
22763 0 : switch (discriminant) {
22764 0 : case 0: {
22765 0 : break;
22766 0 : }
22767 0 : case 1: {
22768 0 : fd_bpf_upgradeable_loader_state_buffer_decode_inner( &self->buffer, alloc_mem, ctx );
22769 0 : break;
22770 0 : }
22771 0 : case 2: {
22772 0 : fd_bpf_upgradeable_loader_state_program_decode_inner( &self->program, alloc_mem, ctx );
22773 0 : break;
22774 0 : }
22775 0 : case 3: {
22776 0 : fd_bpf_upgradeable_loader_state_program_data_decode_inner( &self->program_data, alloc_mem, ctx );
22777 0 : break;
22778 0 : }
22779 0 : }
22780 0 : }
22781 0 : void fd_bpf_upgradeable_loader_state_inner_decode_inner_global( fd_bpf_upgradeable_loader_state_inner_global_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
22782 0 : switch (discriminant) {
22783 0 : case 0: {
22784 0 : break;
22785 0 : }
22786 0 : case 1: {
22787 0 : fd_bpf_upgradeable_loader_state_buffer_decode_inner_global( &self->buffer, alloc_mem, ctx );
22788 0 : break;
22789 0 : }
22790 0 : case 2: {
22791 0 : fd_bpf_upgradeable_loader_state_program_decode_inner_global( &self->program, alloc_mem, ctx );
22792 0 : break;
22793 0 : }
22794 0 : case 3: {
22795 0 : fd_bpf_upgradeable_loader_state_program_data_decode_inner_global( &self->program_data, alloc_mem, ctx );
22796 0 : break;
22797 0 : }
22798 0 : }
22799 0 : }
22800 0 : int fd_bpf_upgradeable_loader_state_convert_global_to_local_inner( fd_bpf_upgradeable_loader_state_inner_global_t const * mem, fd_bpf_upgradeable_loader_state_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
22801 0 : int err = 0;
22802 0 : switch( discriminant ) {
22803 0 : case 0: {
22804 0 : break;
22805 0 : }
22806 0 : case 1: {
22807 0 : err = fd_bpf_upgradeable_loader_state_buffer_convert_global_to_local( &mem->buffer, &self->buffer, ctx );
22808 0 : if( FD_UNLIKELY( err ) ) return err;
22809 0 : break;
22810 0 : }
22811 0 : case 2: {
22812 0 : err = fd_bpf_upgradeable_loader_state_program_convert_global_to_local( &mem->program, &self->program, ctx );
22813 0 : if( FD_UNLIKELY( err ) ) return err;
22814 0 : break;
22815 0 : }
22816 0 : case 3: {
22817 0 : err = fd_bpf_upgradeable_loader_state_program_data_convert_global_to_local( &mem->program_data, &self->program_data, ctx );
22818 0 : if( FD_UNLIKELY( err ) ) return err;
22819 0 : break;
22820 0 : }
22821 0 : }
22822 0 : return FD_BINCODE_SUCCESS;
22823 0 : }
22824 0 : int fd_bpf_upgradeable_loader_state_convert_global_to_local( void const * global_self, fd_bpf_upgradeable_loader_state_t * self, fd_bincode_decode_ctx_t * ctx ) {
22825 0 : fd_bpf_upgradeable_loader_state_global_t const * mem = (fd_bpf_upgradeable_loader_state_global_t const *)global_self;
22826 0 : uint discriminant = mem->discriminant;
22827 0 : self->discriminant = mem->discriminant;
22828 0 : int err = fd_bpf_upgradeable_loader_state_convert_global_to_local_inner( &mem->inner, &self->inner, discriminant, ctx );
22829 0 : return FD_BINCODE_SUCCESS;
22830 0 : }
22831 0 : void fd_bpf_upgradeable_loader_state_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
22832 0 : fd_bpf_upgradeable_loader_state_t * self = (fd_bpf_upgradeable_loader_state_t *)struct_mem;
22833 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
22834 0 : fd_bpf_upgradeable_loader_state_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
22835 0 : }
22836 0 : void * fd_bpf_upgradeable_loader_state_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
22837 0 : fd_bpf_upgradeable_loader_state_t * self = (fd_bpf_upgradeable_loader_state_t *)mem;
22838 0 : fd_bpf_upgradeable_loader_state_new( self );
22839 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_state_t);
22840 0 : void * * alloc_mem = &alloc_region;
22841 0 : fd_bpf_upgradeable_loader_state_decode_inner( mem, alloc_mem, ctx );
22842 0 : return self;
22843 0 : }
22844 0 : void * fd_bpf_upgradeable_loader_state_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
22845 0 : fd_bpf_upgradeable_loader_state_t * self = (fd_bpf_upgradeable_loader_state_t *)mem;
22846 0 : fd_bpf_upgradeable_loader_state_new( self );
22847 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_state_t);
22848 0 : void * * alloc_mem = &alloc_region;
22849 0 : fd_bpf_upgradeable_loader_state_decode_inner_global( mem, alloc_mem, ctx );
22850 0 : return self;
22851 0 : }
22852 0 : void fd_bpf_upgradeable_loader_state_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
22853 0 : fd_bpf_upgradeable_loader_state_global_t * self = (fd_bpf_upgradeable_loader_state_global_t *)struct_mem;
22854 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
22855 0 : fd_bpf_upgradeable_loader_state_inner_decode_inner_global( &self->inner, alloc_mem, self->discriminant, ctx );
22856 0 : }
22857 0 : void fd_bpf_upgradeable_loader_state_inner_new( fd_bpf_upgradeable_loader_state_inner_t * self, uint discriminant ) {
22858 0 : switch( discriminant ) {
22859 0 : case 0: {
22860 0 : break;
22861 0 : }
22862 0 : case 1: {
22863 0 : fd_bpf_upgradeable_loader_state_buffer_new( &self->buffer );
22864 0 : break;
22865 0 : }
22866 0 : case 2: {
22867 0 : fd_bpf_upgradeable_loader_state_program_new( &self->program );
22868 0 : break;
22869 0 : }
22870 0 : case 3: {
22871 0 : fd_bpf_upgradeable_loader_state_program_data_new( &self->program_data );
22872 0 : break;
22873 0 : }
22874 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
22875 0 : }
22876 0 : }
22877 0 : void fd_bpf_upgradeable_loader_state_new_disc( fd_bpf_upgradeable_loader_state_t * self, uint discriminant ) {
22878 0 : self->discriminant = discriminant;
22879 0 : fd_bpf_upgradeable_loader_state_inner_new( &self->inner, self->discriminant );
22880 0 : }
22881 0 : void fd_bpf_upgradeable_loader_state_new( fd_bpf_upgradeable_loader_state_t * self ) {
22882 0 : fd_memset( self, 0, sizeof(fd_bpf_upgradeable_loader_state_t) );
22883 0 : fd_bpf_upgradeable_loader_state_new_disc( self, UINT_MAX );
22884 0 : }
22885 0 : void fd_bpf_upgradeable_loader_state_inner_destroy( fd_bpf_upgradeable_loader_state_inner_t * self, uint discriminant ) {
22886 0 : switch( discriminant ) {
22887 0 : case 1: {
22888 0 : fd_bpf_upgradeable_loader_state_buffer_destroy( &self->buffer );
22889 0 : break;
22890 0 : }
22891 0 : case 2: {
22892 0 : fd_bpf_upgradeable_loader_state_program_destroy( &self->program );
22893 0 : break;
22894 0 : }
22895 0 : case 3: {
22896 0 : fd_bpf_upgradeable_loader_state_program_data_destroy( &self->program_data );
22897 0 : break;
22898 0 : }
22899 0 : default: break; // FD_LOG_ERR(( "unhandled type" ));
22900 0 : }
22901 0 : }
22902 0 : void fd_bpf_upgradeable_loader_state_destroy( fd_bpf_upgradeable_loader_state_t * self ) {
22903 0 : fd_bpf_upgradeable_loader_state_inner_destroy( &self->inner, self->discriminant );
22904 0 : }
22905 :
22906 0 : ulong fd_bpf_upgradeable_loader_state_footprint( void ){ return FD_BPF_UPGRADEABLE_LOADER_STATE_FOOTPRINT; }
22907 0 : ulong fd_bpf_upgradeable_loader_state_align( void ){ return FD_BPF_UPGRADEABLE_LOADER_STATE_ALIGN; }
22908 :
22909 0 : void fd_bpf_upgradeable_loader_state_walk( void * w, fd_bpf_upgradeable_loader_state_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
22910 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_bpf_upgradeable_loader_state", level++);
22911 0 : switch( self->discriminant ) {
22912 0 : case 0: {
22913 0 : fun( w, self, "uninitialized", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
22914 0 : break;
22915 0 : }
22916 0 : case 1: {
22917 0 : fun( w, self, "buffer", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
22918 0 : fd_bpf_upgradeable_loader_state_buffer_walk( w, &self->inner.buffer, fun, "buffer", level );
22919 0 : break;
22920 0 : }
22921 0 : case 2: {
22922 0 : fun( w, self, "program", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
22923 0 : fd_bpf_upgradeable_loader_state_program_walk( w, &self->inner.program, fun, "program", level );
22924 0 : break;
22925 0 : }
22926 0 : case 3: {
22927 0 : fun( w, self, "program_data", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
22928 0 : fd_bpf_upgradeable_loader_state_program_data_walk( w, &self->inner.program_data, fun, "program_data", level );
22929 0 : break;
22930 0 : }
22931 0 : }
22932 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_bpf_upgradeable_loader_state", level-- );
22933 0 : }
22934 0 : ulong fd_bpf_upgradeable_loader_state_size( fd_bpf_upgradeable_loader_state_t const * self ) {
22935 0 : ulong size = 0;
22936 0 : size += sizeof(uint);
22937 0 : switch (self->discriminant) {
22938 0 : case 1: {
22939 0 : size += fd_bpf_upgradeable_loader_state_buffer_size( &self->inner.buffer );
22940 0 : break;
22941 0 : }
22942 0 : case 2: {
22943 0 : size += fd_bpf_upgradeable_loader_state_program_size( &self->inner.program );
22944 0 : break;
22945 0 : }
22946 0 : case 3: {
22947 0 : size += fd_bpf_upgradeable_loader_state_program_data_size( &self->inner.program_data );
22948 0 : break;
22949 0 : }
22950 0 : }
22951 0 : return size;
22952 0 : }
22953 :
22954 0 : int fd_bpf_upgradeable_loader_state_inner_encode( fd_bpf_upgradeable_loader_state_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
22955 0 : int err;
22956 0 : switch (discriminant) {
22957 0 : case 1: {
22958 0 : err = fd_bpf_upgradeable_loader_state_buffer_encode( &self->buffer, ctx );
22959 0 : if( FD_UNLIKELY( err ) ) return err;
22960 0 : break;
22961 0 : }
22962 0 : case 2: {
22963 0 : err = fd_bpf_upgradeable_loader_state_program_encode( &self->program, ctx );
22964 0 : if( FD_UNLIKELY( err ) ) return err;
22965 0 : break;
22966 0 : }
22967 0 : case 3: {
22968 0 : err = fd_bpf_upgradeable_loader_state_program_data_encode( &self->program_data, ctx );
22969 0 : if( FD_UNLIKELY( err ) ) return err;
22970 0 : break;
22971 0 : }
22972 0 : }
22973 0 : return FD_BINCODE_SUCCESS;
22974 0 : }
22975 0 : int fd_bpf_upgradeable_loader_state_encode( fd_bpf_upgradeable_loader_state_t const * self, fd_bincode_encode_ctx_t * ctx ) {
22976 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
22977 0 : if( FD_UNLIKELY( err ) ) return err;
22978 0 : return fd_bpf_upgradeable_loader_state_inner_encode( &self->inner, self->discriminant, ctx );
22979 0 : }
22980 :
22981 0 : int fd_loader_v4_state_encode( fd_loader_v4_state_t const * self, fd_bincode_encode_ctx_t * ctx ) {
22982 0 : int err;
22983 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
22984 0 : if( FD_UNLIKELY( err ) ) return err;
22985 0 : err = fd_pubkey_encode( &self->authority_address_or_next_version, ctx );
22986 0 : if( FD_UNLIKELY( err ) ) return err;
22987 0 : err = fd_bincode_uint64_encode( self->status, ctx );
22988 0 : if( FD_UNLIKELY( err ) ) return err;
22989 0 : return FD_BINCODE_SUCCESS;
22990 0 : }
22991 0 : int fd_loader_v4_state_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
22992 0 : *total_sz += sizeof(fd_loader_v4_state_t);
22993 0 : void const * start_data = ctx->data;
22994 0 : int err = fd_loader_v4_state_decode_footprint_inner( ctx, total_sz );
22995 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
22996 0 : ctx->data = start_data;
22997 0 : return err;
22998 0 : }
22999 0 : int fd_loader_v4_state_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
23000 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
23001 0 : int err = 0;
23002 0 : err = fd_bincode_uint64_decode_footprint( ctx );
23003 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
23004 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
23005 0 : if( FD_UNLIKELY( err ) ) return err;
23006 0 : err = fd_bincode_uint64_decode_footprint( ctx );
23007 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
23008 0 : return 0;
23009 0 : }
23010 0 : void * fd_loader_v4_state_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
23011 0 : fd_loader_v4_state_t * self = (fd_loader_v4_state_t *)mem;
23012 0 : fd_loader_v4_state_new( self );
23013 0 : void * alloc_region = (uchar *)mem + sizeof(fd_loader_v4_state_t);
23014 0 : void * * alloc_mem = &alloc_region;
23015 0 : fd_loader_v4_state_decode_inner( mem, alloc_mem, ctx );
23016 0 : return self;
23017 0 : }
23018 0 : void fd_loader_v4_state_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
23019 0 : fd_loader_v4_state_t * self = (fd_loader_v4_state_t *)struct_mem;
23020 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
23021 0 : fd_pubkey_decode_inner( &self->authority_address_or_next_version, alloc_mem, ctx );
23022 0 : fd_bincode_uint64_decode_unsafe( &self->status, ctx );
23023 0 : }
23024 0 : void * fd_loader_v4_state_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
23025 0 : fd_loader_v4_state_global_t * self = (fd_loader_v4_state_global_t *)mem;
23026 0 : fd_loader_v4_state_new( (fd_loader_v4_state_t *)self );
23027 0 : void * alloc_region = (uchar *)mem + sizeof(fd_loader_v4_state_global_t);
23028 0 : void * * alloc_mem = &alloc_region;
23029 0 : fd_loader_v4_state_decode_inner_global( mem, alloc_mem, ctx );
23030 0 : return self;
23031 0 : }
23032 0 : void fd_loader_v4_state_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
23033 0 : fd_loader_v4_state_global_t * self = (fd_loader_v4_state_global_t *)struct_mem;
23034 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
23035 0 : fd_pubkey_decode_inner_global( &self->authority_address_or_next_version, alloc_mem, ctx );
23036 0 : fd_bincode_uint64_decode_unsafe( &self->status, ctx );
23037 0 : }
23038 0 : int fd_loader_v4_state_convert_global_to_local( void const * global_self, fd_loader_v4_state_t * self, fd_bincode_decode_ctx_t * ctx ) {
23039 0 : int err = 0;
23040 0 : fd_loader_v4_state_global_t const * mem = (fd_loader_v4_state_global_t const *)global_self;
23041 0 : self->slot = mem->slot;
23042 0 : err = fd_pubkey_convert_global_to_local( &mem->authority_address_or_next_version, &self->authority_address_or_next_version, ctx );
23043 0 : if( FD_UNLIKELY( err ) ) return err;
23044 0 : self->status = mem->status;
23045 0 : return FD_BINCODE_SUCCESS;
23046 0 : }
23047 0 : void fd_loader_v4_state_new(fd_loader_v4_state_t * self) {
23048 0 : fd_memset( self, 0, sizeof(fd_loader_v4_state_t) );
23049 0 : fd_pubkey_new( &self->authority_address_or_next_version );
23050 0 : }
23051 0 : void fd_loader_v4_state_destroy( fd_loader_v4_state_t * self ) {
23052 0 : fd_pubkey_destroy( &self->authority_address_or_next_version );
23053 0 : }
23054 :
23055 0 : ulong fd_loader_v4_state_footprint( void ){ return FD_LOADER_V4_STATE_FOOTPRINT; }
23056 0 : ulong fd_loader_v4_state_align( void ){ return FD_LOADER_V4_STATE_ALIGN; }
23057 :
23058 0 : void fd_loader_v4_state_walk( void * w, fd_loader_v4_state_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
23059 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_loader_v4_state", level++ );
23060 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
23061 0 : fd_pubkey_walk( w, &self->authority_address_or_next_version, fun, "authority_address_or_next_version", level );
23062 0 : fun( w, &self->status, "status", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
23063 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_loader_v4_state", level-- );
23064 0 : }
23065 0 : ulong fd_loader_v4_state_size( fd_loader_v4_state_t const * self ) {
23066 0 : ulong size = 0;
23067 0 : size += sizeof(ulong);
23068 0 : size += fd_pubkey_size( &self->authority_address_or_next_version );
23069 0 : size += sizeof(ulong);
23070 0 : return size;
23071 0 : }
23072 :
23073 0 : int fd_frozen_hash_status_encode( fd_frozen_hash_status_t const * self, fd_bincode_encode_ctx_t * ctx ) {
23074 0 : int err;
23075 0 : err = fd_hash_encode( &self->frozen_hash, ctx );
23076 0 : if( FD_UNLIKELY( err ) ) return err;
23077 0 : err = fd_bincode_bool_encode( (uchar)(self->is_duplicate_confirmed), ctx );
23078 0 : if( FD_UNLIKELY( err ) ) return err;
23079 0 : return FD_BINCODE_SUCCESS;
23080 0 : }
23081 0 : int fd_frozen_hash_status_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
23082 0 : *total_sz += sizeof(fd_frozen_hash_status_t);
23083 0 : void const * start_data = ctx->data;
23084 0 : int err = fd_frozen_hash_status_decode_footprint_inner( ctx, total_sz );
23085 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
23086 0 : ctx->data = start_data;
23087 0 : return err;
23088 0 : }
23089 0 : int fd_frozen_hash_status_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
23090 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
23091 0 : int err = 0;
23092 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
23093 0 : if( FD_UNLIKELY( err ) ) return err;
23094 0 : err = fd_bincode_bool_decode_footprint( ctx );
23095 0 : if( FD_UNLIKELY( err ) ) return err;
23096 0 : return 0;
23097 0 : }
23098 0 : void * fd_frozen_hash_status_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
23099 0 : fd_frozen_hash_status_t * self = (fd_frozen_hash_status_t *)mem;
23100 0 : fd_frozen_hash_status_new( self );
23101 0 : void * alloc_region = (uchar *)mem + sizeof(fd_frozen_hash_status_t);
23102 0 : void * * alloc_mem = &alloc_region;
23103 0 : fd_frozen_hash_status_decode_inner( mem, alloc_mem, ctx );
23104 0 : return self;
23105 0 : }
23106 0 : void fd_frozen_hash_status_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
23107 0 : fd_frozen_hash_status_t * self = (fd_frozen_hash_status_t *)struct_mem;
23108 0 : fd_hash_decode_inner( &self->frozen_hash, alloc_mem, ctx );
23109 0 : fd_bincode_bool_decode_unsafe( &self->is_duplicate_confirmed, ctx );
23110 0 : }
23111 0 : void * fd_frozen_hash_status_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
23112 0 : fd_frozen_hash_status_global_t * self = (fd_frozen_hash_status_global_t *)mem;
23113 0 : fd_frozen_hash_status_new( (fd_frozen_hash_status_t *)self );
23114 0 : void * alloc_region = (uchar *)mem + sizeof(fd_frozen_hash_status_global_t);
23115 0 : void * * alloc_mem = &alloc_region;
23116 0 : fd_frozen_hash_status_decode_inner_global( mem, alloc_mem, ctx );
23117 0 : return self;
23118 0 : }
23119 0 : void fd_frozen_hash_status_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
23120 0 : fd_frozen_hash_status_global_t * self = (fd_frozen_hash_status_global_t *)struct_mem;
23121 0 : fd_hash_decode_inner_global( &self->frozen_hash, alloc_mem, ctx );
23122 0 : fd_bincode_bool_decode_unsafe( &self->is_duplicate_confirmed, ctx );
23123 0 : }
23124 0 : int fd_frozen_hash_status_convert_global_to_local( void const * global_self, fd_frozen_hash_status_t * self, fd_bincode_decode_ctx_t * ctx ) {
23125 0 : int err = 0;
23126 0 : fd_frozen_hash_status_global_t const * mem = (fd_frozen_hash_status_global_t const *)global_self;
23127 0 : err = fd_hash_convert_global_to_local( &mem->frozen_hash, &self->frozen_hash, ctx );
23128 0 : if( FD_UNLIKELY( err ) ) return err;
23129 0 : self->is_duplicate_confirmed = mem->is_duplicate_confirmed;
23130 0 : return FD_BINCODE_SUCCESS;
23131 0 : }
23132 0 : void fd_frozen_hash_status_new(fd_frozen_hash_status_t * self) {
23133 0 : fd_memset( self, 0, sizeof(fd_frozen_hash_status_t) );
23134 0 : fd_hash_new( &self->frozen_hash );
23135 0 : }
23136 0 : void fd_frozen_hash_status_destroy( fd_frozen_hash_status_t * self ) {
23137 0 : fd_hash_destroy( &self->frozen_hash );
23138 0 : }
23139 :
23140 0 : ulong fd_frozen_hash_status_footprint( void ){ return FD_FROZEN_HASH_STATUS_FOOTPRINT; }
23141 0 : ulong fd_frozen_hash_status_align( void ){ return FD_FROZEN_HASH_STATUS_ALIGN; }
23142 :
23143 0 : void fd_frozen_hash_status_walk( void * w, fd_frozen_hash_status_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
23144 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_frozen_hash_status", level++ );
23145 0 : fd_hash_walk( w, &self->frozen_hash, fun, "frozen_hash", level );
23146 0 : fun( w, &self->is_duplicate_confirmed, "is_duplicate_confirmed", FD_FLAMENCO_TYPE_BOOL, "bool", level );
23147 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_frozen_hash_status", level-- );
23148 0 : }
23149 0 : ulong fd_frozen_hash_status_size( fd_frozen_hash_status_t const * self ) {
23150 0 : ulong size = 0;
23151 0 : size += fd_hash_size( &self->frozen_hash );
23152 0 : size += sizeof(char);
23153 0 : return size;
23154 0 : }
23155 :
23156 0 : FD_FN_PURE uchar fd_frozen_hash_versioned_is_current(fd_frozen_hash_versioned_t const * self) {
23157 0 : return self->discriminant == 0;
23158 0 : }
23159 : void fd_frozen_hash_versioned_inner_new( fd_frozen_hash_versioned_inner_t * self, uint discriminant );
23160 0 : int fd_frozen_hash_versioned_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
23161 0 : int err;
23162 0 : switch (discriminant) {
23163 0 : case 0: {
23164 0 : err = fd_frozen_hash_status_decode_footprint_inner( ctx, total_sz );
23165 0 : if( FD_UNLIKELY( err ) ) return err;
23166 0 : return FD_BINCODE_SUCCESS;
23167 0 : }
23168 0 : default: return FD_BINCODE_ERR_ENCODING;
23169 0 : }
23170 0 : }
23171 0 : int fd_frozen_hash_versioned_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
23172 0 : *total_sz += sizeof(fd_frozen_hash_versioned_t);
23173 0 : void const * start_data = ctx->data;
23174 0 : int err = fd_frozen_hash_versioned_decode_footprint_inner( ctx, total_sz );
23175 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
23176 0 : ctx->data = start_data;
23177 0 : return err;
23178 0 : }
23179 0 : int fd_frozen_hash_versioned_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
23180 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
23181 0 : uint discriminant = 0;
23182 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
23183 0 : if( FD_UNLIKELY( err ) ) return err;
23184 0 : return fd_frozen_hash_versioned_inner_decode_footprint( discriminant, ctx, total_sz );
23185 0 : }
23186 0 : 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 ) {
23187 0 : switch (discriminant) {
23188 0 : case 0: {
23189 0 : fd_frozen_hash_status_decode_inner( &self->current, alloc_mem, ctx );
23190 0 : break;
23191 0 : }
23192 0 : }
23193 0 : }
23194 0 : void fd_frozen_hash_versioned_inner_decode_inner_global( fd_frozen_hash_versioned_inner_global_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
23195 0 : switch (discriminant) {
23196 0 : case 0: {
23197 0 : fd_frozen_hash_status_decode_inner_global( &self->current, alloc_mem, ctx );
23198 0 : break;
23199 0 : }
23200 0 : }
23201 0 : }
23202 0 : int fd_frozen_hash_versioned_convert_global_to_local_inner( fd_frozen_hash_versioned_inner_global_t const * mem, fd_frozen_hash_versioned_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
23203 0 : int err = 0;
23204 0 : switch( discriminant ) {
23205 0 : case 0: {
23206 0 : err = fd_frozen_hash_status_convert_global_to_local( &mem->current, &self->current, ctx );
23207 0 : if( FD_UNLIKELY( err ) ) return err;
23208 0 : break;
23209 0 : }
23210 0 : }
23211 0 : return FD_BINCODE_SUCCESS;
23212 0 : }
23213 0 : int fd_frozen_hash_versioned_convert_global_to_local( void const * global_self, fd_frozen_hash_versioned_t * self, fd_bincode_decode_ctx_t * ctx ) {
23214 0 : fd_frozen_hash_versioned_global_t const * mem = (fd_frozen_hash_versioned_global_t const *)global_self;
23215 0 : uint discriminant = mem->discriminant;
23216 0 : self->discriminant = mem->discriminant;
23217 0 : int err = fd_frozen_hash_versioned_convert_global_to_local_inner( &mem->inner, &self->inner, discriminant, ctx );
23218 0 : return FD_BINCODE_SUCCESS;
23219 0 : }
23220 0 : void fd_frozen_hash_versioned_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
23221 0 : fd_frozen_hash_versioned_t * self = (fd_frozen_hash_versioned_t *)struct_mem;
23222 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
23223 0 : fd_frozen_hash_versioned_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
23224 0 : }
23225 0 : void * fd_frozen_hash_versioned_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
23226 0 : fd_frozen_hash_versioned_t * self = (fd_frozen_hash_versioned_t *)mem;
23227 0 : fd_frozen_hash_versioned_new( self );
23228 0 : void * alloc_region = (uchar *)mem + sizeof(fd_frozen_hash_versioned_t);
23229 0 : void * * alloc_mem = &alloc_region;
23230 0 : fd_frozen_hash_versioned_decode_inner( mem, alloc_mem, ctx );
23231 0 : return self;
23232 0 : }
23233 0 : void * fd_frozen_hash_versioned_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
23234 0 : fd_frozen_hash_versioned_t * self = (fd_frozen_hash_versioned_t *)mem;
23235 0 : fd_frozen_hash_versioned_new( self );
23236 0 : void * alloc_region = (uchar *)mem + sizeof(fd_frozen_hash_versioned_t);
23237 0 : void * * alloc_mem = &alloc_region;
23238 0 : fd_frozen_hash_versioned_decode_inner_global( mem, alloc_mem, ctx );
23239 0 : return self;
23240 0 : }
23241 0 : void fd_frozen_hash_versioned_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
23242 0 : fd_frozen_hash_versioned_global_t * self = (fd_frozen_hash_versioned_global_t *)struct_mem;
23243 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
23244 0 : fd_frozen_hash_versioned_inner_decode_inner_global( &self->inner, alloc_mem, self->discriminant, ctx );
23245 0 : }
23246 0 : void fd_frozen_hash_versioned_inner_new( fd_frozen_hash_versioned_inner_t * self, uint discriminant ) {
23247 0 : switch( discriminant ) {
23248 0 : case 0: {
23249 0 : fd_frozen_hash_status_new( &self->current );
23250 0 : break;
23251 0 : }
23252 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
23253 0 : }
23254 0 : }
23255 0 : void fd_frozen_hash_versioned_new_disc( fd_frozen_hash_versioned_t * self, uint discriminant ) {
23256 0 : self->discriminant = discriminant;
23257 0 : fd_frozen_hash_versioned_inner_new( &self->inner, self->discriminant );
23258 0 : }
23259 0 : void fd_frozen_hash_versioned_new( fd_frozen_hash_versioned_t * self ) {
23260 0 : fd_memset( self, 0, sizeof(fd_frozen_hash_versioned_t) );
23261 0 : fd_frozen_hash_versioned_new_disc( self, UINT_MAX );
23262 0 : }
23263 0 : void fd_frozen_hash_versioned_inner_destroy( fd_frozen_hash_versioned_inner_t * self, uint discriminant ) {
23264 0 : switch( discriminant ) {
23265 0 : case 0: {
23266 0 : fd_frozen_hash_status_destroy( &self->current );
23267 0 : break;
23268 0 : }
23269 0 : default: break; // FD_LOG_ERR(( "unhandled type" ));
23270 0 : }
23271 0 : }
23272 0 : void fd_frozen_hash_versioned_destroy( fd_frozen_hash_versioned_t * self ) {
23273 0 : fd_frozen_hash_versioned_inner_destroy( &self->inner, self->discriminant );
23274 0 : }
23275 :
23276 0 : ulong fd_frozen_hash_versioned_footprint( void ){ return FD_FROZEN_HASH_VERSIONED_FOOTPRINT; }
23277 0 : ulong fd_frozen_hash_versioned_align( void ){ return FD_FROZEN_HASH_VERSIONED_ALIGN; }
23278 :
23279 0 : void fd_frozen_hash_versioned_walk( void * w, fd_frozen_hash_versioned_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
23280 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_frozen_hash_versioned", level++);
23281 0 : switch( self->discriminant ) {
23282 0 : case 0: {
23283 0 : fun( w, self, "current", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
23284 0 : fd_frozen_hash_status_walk( w, &self->inner.current, fun, "current", level );
23285 0 : break;
23286 0 : }
23287 0 : }
23288 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_frozen_hash_versioned", level-- );
23289 0 : }
23290 0 : ulong fd_frozen_hash_versioned_size( fd_frozen_hash_versioned_t const * self ) {
23291 0 : ulong size = 0;
23292 0 : size += sizeof(uint);
23293 0 : switch (self->discriminant) {
23294 0 : case 0: {
23295 0 : size += fd_frozen_hash_status_size( &self->inner.current );
23296 0 : break;
23297 0 : }
23298 0 : }
23299 0 : return size;
23300 0 : }
23301 :
23302 0 : int fd_frozen_hash_versioned_inner_encode( fd_frozen_hash_versioned_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
23303 0 : int err;
23304 0 : switch (discriminant) {
23305 0 : case 0: {
23306 0 : err = fd_frozen_hash_status_encode( &self->current, ctx );
23307 0 : if( FD_UNLIKELY( err ) ) return err;
23308 0 : break;
23309 0 : }
23310 0 : }
23311 0 : return FD_BINCODE_SUCCESS;
23312 0 : }
23313 0 : int fd_frozen_hash_versioned_encode( fd_frozen_hash_versioned_t const * self, fd_bincode_encode_ctx_t * ctx ) {
23314 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
23315 0 : if( FD_UNLIKELY( err ) ) return err;
23316 0 : return fd_frozen_hash_versioned_inner_encode( &self->inner, self->discriminant, ctx );
23317 0 : }
23318 :
23319 0 : int fd_lookup_table_meta_encode( fd_lookup_table_meta_t const * self, fd_bincode_encode_ctx_t * ctx ) {
23320 0 : int err;
23321 0 : err = fd_bincode_uint64_encode( self->deactivation_slot, ctx );
23322 0 : if( FD_UNLIKELY( err ) ) return err;
23323 0 : err = fd_bincode_uint64_encode( self->last_extended_slot, ctx );
23324 0 : if( FD_UNLIKELY( err ) ) return err;
23325 0 : err = fd_bincode_uint8_encode( (uchar)(self->last_extended_slot_start_index), ctx );
23326 0 : if( FD_UNLIKELY( err ) ) return err;
23327 0 : err = fd_bincode_bool_encode( self->has_authority, ctx );
23328 0 : if( FD_UNLIKELY( err ) ) return err;
23329 0 : if( self->has_authority ) {
23330 0 : err = fd_pubkey_encode( &self->authority, ctx );
23331 0 : if( FD_UNLIKELY( err ) ) return err;
23332 0 : }
23333 0 : err = fd_bincode_uint16_encode( self->_padding, ctx );
23334 0 : if( FD_UNLIKELY( err ) ) return err;
23335 0 : return FD_BINCODE_SUCCESS;
23336 0 : }
23337 0 : int fd_lookup_table_meta_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
23338 0 : *total_sz += sizeof(fd_lookup_table_meta_t);
23339 0 : void const * start_data = ctx->data;
23340 0 : int err = fd_lookup_table_meta_decode_footprint_inner( ctx, total_sz );
23341 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
23342 0 : ctx->data = start_data;
23343 0 : return err;
23344 0 : }
23345 0 : int fd_lookup_table_meta_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
23346 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
23347 0 : int err = 0;
23348 0 : err = fd_bincode_uint64_decode_footprint( ctx );
23349 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
23350 0 : err = fd_bincode_uint64_decode_footprint( ctx );
23351 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
23352 0 : err = fd_bincode_uint8_decode_footprint( ctx );
23353 0 : if( FD_UNLIKELY( err ) ) return err;
23354 0 : {
23355 0 : uchar o;
23356 0 : err = fd_bincode_bool_decode( &o, ctx );
23357 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
23358 0 : if( o ) {
23359 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
23360 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
23361 0 : }
23362 0 : }
23363 0 : err = fd_bincode_uint16_decode_footprint( ctx );
23364 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
23365 0 : return 0;
23366 0 : }
23367 0 : void * fd_lookup_table_meta_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
23368 0 : fd_lookup_table_meta_t * self = (fd_lookup_table_meta_t *)mem;
23369 0 : fd_lookup_table_meta_new( self );
23370 0 : void * alloc_region = (uchar *)mem + sizeof(fd_lookup_table_meta_t);
23371 0 : void * * alloc_mem = &alloc_region;
23372 0 : fd_lookup_table_meta_decode_inner( mem, alloc_mem, ctx );
23373 0 : return self;
23374 0 : }
23375 0 : void fd_lookup_table_meta_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
23376 0 : fd_lookup_table_meta_t * self = (fd_lookup_table_meta_t *)struct_mem;
23377 0 : fd_bincode_uint64_decode_unsafe( &self->deactivation_slot, ctx );
23378 0 : fd_bincode_uint64_decode_unsafe( &self->last_extended_slot, ctx );
23379 0 : fd_bincode_uint8_decode_unsafe( &self->last_extended_slot_start_index, ctx );
23380 0 : {
23381 0 : uchar o;
23382 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
23383 0 : self->has_authority = !!o;
23384 0 : if( o ) {
23385 0 : fd_pubkey_new( &self->authority );
23386 0 : fd_pubkey_decode_inner( &self->authority, alloc_mem, ctx );
23387 0 : }
23388 0 : }
23389 0 : fd_bincode_uint16_decode_unsafe( &self->_padding, ctx );
23390 0 : }
23391 0 : void * fd_lookup_table_meta_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
23392 0 : fd_lookup_table_meta_global_t * self = (fd_lookup_table_meta_global_t *)mem;
23393 0 : fd_lookup_table_meta_new( (fd_lookup_table_meta_t *)self );
23394 0 : void * alloc_region = (uchar *)mem + sizeof(fd_lookup_table_meta_global_t);
23395 0 : void * * alloc_mem = &alloc_region;
23396 0 : fd_lookup_table_meta_decode_inner_global( mem, alloc_mem, ctx );
23397 0 : return self;
23398 0 : }
23399 0 : void fd_lookup_table_meta_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
23400 0 : fd_lookup_table_meta_global_t * self = (fd_lookup_table_meta_global_t *)struct_mem;
23401 0 : fd_bincode_uint64_decode_unsafe( &self->deactivation_slot, ctx );
23402 0 : fd_bincode_uint64_decode_unsafe( &self->last_extended_slot, ctx );
23403 0 : fd_bincode_uint8_decode_unsafe( &self->last_extended_slot_start_index, ctx );
23404 0 : {
23405 0 : uchar o;
23406 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
23407 0 : self->has_authority = !!o;
23408 0 : if( o ) {
23409 0 : fd_pubkey_new( &self->authority );
23410 0 : fd_pubkey_decode_inner_global( &self->authority, alloc_mem, ctx );
23411 0 : }
23412 0 : }
23413 0 : fd_bincode_uint16_decode_unsafe( &self->_padding, ctx );
23414 0 : }
23415 0 : int fd_lookup_table_meta_convert_global_to_local( void const * global_self, fd_lookup_table_meta_t * self, fd_bincode_decode_ctx_t * ctx ) {
23416 0 : int err = 0;
23417 0 : fd_lookup_table_meta_global_t const * mem = (fd_lookup_table_meta_global_t const *)global_self;
23418 0 : self->deactivation_slot = mem->deactivation_slot;
23419 0 : self->last_extended_slot = mem->last_extended_slot;
23420 0 : self->last_extended_slot_start_index = mem->last_extended_slot_start_index;
23421 0 : self->authority = mem->authority;
23422 0 : self->has_authority = mem->has_authority;
23423 0 : self->_padding = mem->_padding;
23424 0 : return FD_BINCODE_SUCCESS;
23425 0 : }
23426 0 : void fd_lookup_table_meta_new(fd_lookup_table_meta_t * self) {
23427 0 : fd_memset( self, 0, sizeof(fd_lookup_table_meta_t) );
23428 0 : }
23429 0 : void fd_lookup_table_meta_destroy( fd_lookup_table_meta_t * self ) {
23430 0 : if( self->has_authority ) {
23431 0 : fd_pubkey_destroy( &self->authority );
23432 0 : self->has_authority = 0;
23433 0 : }
23434 0 : }
23435 :
23436 0 : ulong fd_lookup_table_meta_footprint( void ){ return FD_LOOKUP_TABLE_META_FOOTPRINT; }
23437 0 : ulong fd_lookup_table_meta_align( void ){ return FD_LOOKUP_TABLE_META_ALIGN; }
23438 :
23439 0 : void fd_lookup_table_meta_walk( void * w, fd_lookup_table_meta_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
23440 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_lookup_table_meta", level++ );
23441 0 : fun( w, &self->deactivation_slot, "deactivation_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
23442 0 : fun( w, &self->last_extended_slot, "last_extended_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
23443 0 : fun( w, &self->last_extended_slot_start_index, "last_extended_slot_start_index", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
23444 0 : if( !self->has_authority ) {
23445 0 : fun( w, NULL, "authority", FD_FLAMENCO_TYPE_NULL, "pubkey", level );
23446 0 : } else {
23447 0 : fd_pubkey_walk( w, &self->authority, fun, "authority", level );
23448 0 : }
23449 0 : fun( w, &self->_padding, "_padding", FD_FLAMENCO_TYPE_USHORT, "ushort", level );
23450 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_lookup_table_meta", level-- );
23451 0 : }
23452 0 : ulong fd_lookup_table_meta_size( fd_lookup_table_meta_t const * self ) {
23453 0 : ulong size = 0;
23454 0 : size += sizeof(ulong);
23455 0 : size += sizeof(ulong);
23456 0 : size += sizeof(char);
23457 0 : size += sizeof(char);
23458 0 : if( self->has_authority ) {
23459 0 : size += fd_pubkey_size( &self->authority );
23460 0 : }
23461 0 : size += sizeof(ushort);
23462 0 : return size;
23463 0 : }
23464 :
23465 0 : int fd_address_lookup_table_encode( fd_address_lookup_table_t const * self, fd_bincode_encode_ctx_t * ctx ) {
23466 0 : int err;
23467 0 : err = fd_lookup_table_meta_encode( &self->meta, ctx );
23468 0 : if( FD_UNLIKELY( err ) ) return err;
23469 0 : return FD_BINCODE_SUCCESS;
23470 0 : }
23471 0 : int fd_address_lookup_table_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
23472 0 : *total_sz += sizeof(fd_address_lookup_table_t);
23473 0 : void const * start_data = ctx->data;
23474 0 : int err = fd_address_lookup_table_decode_footprint_inner( ctx, total_sz );
23475 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
23476 0 : ctx->data = start_data;
23477 0 : return err;
23478 0 : }
23479 0 : int fd_address_lookup_table_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
23480 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
23481 0 : int err = 0;
23482 0 : err = fd_lookup_table_meta_decode_footprint_inner( ctx, total_sz );
23483 0 : if( FD_UNLIKELY( err ) ) return err;
23484 0 : return 0;
23485 0 : }
23486 0 : void * fd_address_lookup_table_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
23487 0 : fd_address_lookup_table_t * self = (fd_address_lookup_table_t *)mem;
23488 0 : fd_address_lookup_table_new( self );
23489 0 : void * alloc_region = (uchar *)mem + sizeof(fd_address_lookup_table_t);
23490 0 : void * * alloc_mem = &alloc_region;
23491 0 : fd_address_lookup_table_decode_inner( mem, alloc_mem, ctx );
23492 0 : return self;
23493 0 : }
23494 0 : void fd_address_lookup_table_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
23495 0 : fd_address_lookup_table_t * self = (fd_address_lookup_table_t *)struct_mem;
23496 0 : fd_lookup_table_meta_decode_inner( &self->meta, alloc_mem, ctx );
23497 0 : }
23498 0 : void * fd_address_lookup_table_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
23499 0 : fd_address_lookup_table_global_t * self = (fd_address_lookup_table_global_t *)mem;
23500 0 : fd_address_lookup_table_new( (fd_address_lookup_table_t *)self );
23501 0 : void * alloc_region = (uchar *)mem + sizeof(fd_address_lookup_table_global_t);
23502 0 : void * * alloc_mem = &alloc_region;
23503 0 : fd_address_lookup_table_decode_inner_global( mem, alloc_mem, ctx );
23504 0 : return self;
23505 0 : }
23506 0 : void fd_address_lookup_table_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
23507 0 : fd_address_lookup_table_global_t * self = (fd_address_lookup_table_global_t *)struct_mem;
23508 0 : fd_lookup_table_meta_decode_inner_global( &self->meta, alloc_mem, ctx );
23509 0 : }
23510 0 : int fd_address_lookup_table_convert_global_to_local( void const * global_self, fd_address_lookup_table_t * self, fd_bincode_decode_ctx_t * ctx ) {
23511 0 : int err = 0;
23512 0 : fd_address_lookup_table_global_t const * mem = (fd_address_lookup_table_global_t const *)global_self;
23513 0 : err = fd_lookup_table_meta_convert_global_to_local( &mem->meta, &self->meta, ctx );
23514 0 : if( FD_UNLIKELY( err ) ) return err;
23515 0 : return FD_BINCODE_SUCCESS;
23516 0 : }
23517 0 : void fd_address_lookup_table_new(fd_address_lookup_table_t * self) {
23518 0 : fd_memset( self, 0, sizeof(fd_address_lookup_table_t) );
23519 0 : fd_lookup_table_meta_new( &self->meta );
23520 0 : }
23521 0 : void fd_address_lookup_table_destroy( fd_address_lookup_table_t * self ) {
23522 0 : fd_lookup_table_meta_destroy( &self->meta );
23523 0 : }
23524 :
23525 0 : ulong fd_address_lookup_table_footprint( void ){ return FD_ADDRESS_LOOKUP_TABLE_FOOTPRINT; }
23526 0 : ulong fd_address_lookup_table_align( void ){ return FD_ADDRESS_LOOKUP_TABLE_ALIGN; }
23527 :
23528 0 : void fd_address_lookup_table_walk( void * w, fd_address_lookup_table_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
23529 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_address_lookup_table", level++ );
23530 0 : fd_lookup_table_meta_walk( w, &self->meta, fun, "meta", level );
23531 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_address_lookup_table", level-- );
23532 0 : }
23533 0 : ulong fd_address_lookup_table_size( fd_address_lookup_table_t const * self ) {
23534 0 : ulong size = 0;
23535 0 : size += fd_lookup_table_meta_size( &self->meta );
23536 0 : return size;
23537 0 : }
23538 :
23539 0 : FD_FN_PURE uchar fd_address_lookup_table_state_is_uninitialized(fd_address_lookup_table_state_t const * self) {
23540 0 : return self->discriminant == 0;
23541 0 : }
23542 0 : FD_FN_PURE uchar fd_address_lookup_table_state_is_lookup_table(fd_address_lookup_table_state_t const * self) {
23543 0 : return self->discriminant == 1;
23544 0 : }
23545 : void fd_address_lookup_table_state_inner_new( fd_address_lookup_table_state_inner_t * self, uint discriminant );
23546 0 : int fd_address_lookup_table_state_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
23547 0 : int err;
23548 0 : switch (discriminant) {
23549 0 : case 0: {
23550 0 : return FD_BINCODE_SUCCESS;
23551 0 : }
23552 0 : case 1: {
23553 0 : err = fd_address_lookup_table_decode_footprint_inner( ctx, total_sz );
23554 0 : if( FD_UNLIKELY( err ) ) return err;
23555 0 : return FD_BINCODE_SUCCESS;
23556 0 : }
23557 0 : default: return FD_BINCODE_ERR_ENCODING;
23558 0 : }
23559 0 : }
23560 0 : int fd_address_lookup_table_state_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
23561 0 : *total_sz += sizeof(fd_address_lookup_table_state_t);
23562 0 : void const * start_data = ctx->data;
23563 0 : int err = fd_address_lookup_table_state_decode_footprint_inner( ctx, total_sz );
23564 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
23565 0 : ctx->data = start_data;
23566 0 : return err;
23567 0 : }
23568 0 : int fd_address_lookup_table_state_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
23569 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
23570 0 : uint discriminant = 0;
23571 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
23572 0 : if( FD_UNLIKELY( err ) ) return err;
23573 0 : return fd_address_lookup_table_state_inner_decode_footprint( discriminant, ctx, total_sz );
23574 0 : }
23575 0 : 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 ) {
23576 0 : switch (discriminant) {
23577 0 : case 0: {
23578 0 : break;
23579 0 : }
23580 0 : case 1: {
23581 0 : fd_address_lookup_table_decode_inner( &self->lookup_table, alloc_mem, ctx );
23582 0 : break;
23583 0 : }
23584 0 : }
23585 0 : }
23586 0 : void fd_address_lookup_table_state_inner_decode_inner_global( fd_address_lookup_table_state_inner_global_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
23587 0 : switch (discriminant) {
23588 0 : case 0: {
23589 0 : break;
23590 0 : }
23591 0 : case 1: {
23592 0 : fd_address_lookup_table_decode_inner_global( &self->lookup_table, alloc_mem, ctx );
23593 0 : break;
23594 0 : }
23595 0 : }
23596 0 : }
23597 0 : int fd_address_lookup_table_state_convert_global_to_local_inner( fd_address_lookup_table_state_inner_global_t const * mem, fd_address_lookup_table_state_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
23598 0 : int err = 0;
23599 0 : switch( discriminant ) {
23600 0 : case 0: {
23601 0 : break;
23602 0 : }
23603 0 : case 1: {
23604 0 : err = fd_address_lookup_table_convert_global_to_local( &mem->lookup_table, &self->lookup_table, ctx );
23605 0 : if( FD_UNLIKELY( err ) ) return err;
23606 0 : break;
23607 0 : }
23608 0 : }
23609 0 : return FD_BINCODE_SUCCESS;
23610 0 : }
23611 0 : int fd_address_lookup_table_state_convert_global_to_local( void const * global_self, fd_address_lookup_table_state_t * self, fd_bincode_decode_ctx_t * ctx ) {
23612 0 : fd_address_lookup_table_state_global_t const * mem = (fd_address_lookup_table_state_global_t const *)global_self;
23613 0 : uint discriminant = mem->discriminant;
23614 0 : self->discriminant = mem->discriminant;
23615 0 : int err = fd_address_lookup_table_state_convert_global_to_local_inner( &mem->inner, &self->inner, discriminant, ctx );
23616 0 : return FD_BINCODE_SUCCESS;
23617 0 : }
23618 0 : void fd_address_lookup_table_state_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
23619 0 : fd_address_lookup_table_state_t * self = (fd_address_lookup_table_state_t *)struct_mem;
23620 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
23621 0 : fd_address_lookup_table_state_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
23622 0 : }
23623 0 : void * fd_address_lookup_table_state_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
23624 0 : fd_address_lookup_table_state_t * self = (fd_address_lookup_table_state_t *)mem;
23625 0 : fd_address_lookup_table_state_new( self );
23626 0 : void * alloc_region = (uchar *)mem + sizeof(fd_address_lookup_table_state_t);
23627 0 : void * * alloc_mem = &alloc_region;
23628 0 : fd_address_lookup_table_state_decode_inner( mem, alloc_mem, ctx );
23629 0 : return self;
23630 0 : }
23631 0 : void * fd_address_lookup_table_state_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
23632 0 : fd_address_lookup_table_state_t * self = (fd_address_lookup_table_state_t *)mem;
23633 0 : fd_address_lookup_table_state_new( self );
23634 0 : void * alloc_region = (uchar *)mem + sizeof(fd_address_lookup_table_state_t);
23635 0 : void * * alloc_mem = &alloc_region;
23636 0 : fd_address_lookup_table_state_decode_inner_global( mem, alloc_mem, ctx );
23637 0 : return self;
23638 0 : }
23639 0 : void fd_address_lookup_table_state_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
23640 0 : fd_address_lookup_table_state_global_t * self = (fd_address_lookup_table_state_global_t *)struct_mem;
23641 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
23642 0 : fd_address_lookup_table_state_inner_decode_inner_global( &self->inner, alloc_mem, self->discriminant, ctx );
23643 0 : }
23644 0 : void fd_address_lookup_table_state_inner_new( fd_address_lookup_table_state_inner_t * self, uint discriminant ) {
23645 0 : switch( discriminant ) {
23646 0 : case 0: {
23647 0 : break;
23648 0 : }
23649 0 : case 1: {
23650 0 : fd_address_lookup_table_new( &self->lookup_table );
23651 0 : break;
23652 0 : }
23653 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
23654 0 : }
23655 0 : }
23656 0 : void fd_address_lookup_table_state_new_disc( fd_address_lookup_table_state_t * self, uint discriminant ) {
23657 0 : self->discriminant = discriminant;
23658 0 : fd_address_lookup_table_state_inner_new( &self->inner, self->discriminant );
23659 0 : }
23660 0 : void fd_address_lookup_table_state_new( fd_address_lookup_table_state_t * self ) {
23661 0 : fd_memset( self, 0, sizeof(fd_address_lookup_table_state_t) );
23662 0 : fd_address_lookup_table_state_new_disc( self, UINT_MAX );
23663 0 : }
23664 0 : void fd_address_lookup_table_state_inner_destroy( fd_address_lookup_table_state_inner_t * self, uint discriminant ) {
23665 0 : switch( discriminant ) {
23666 0 : case 1: {
23667 0 : fd_address_lookup_table_destroy( &self->lookup_table );
23668 0 : break;
23669 0 : }
23670 0 : default: break; // FD_LOG_ERR(( "unhandled type" ));
23671 0 : }
23672 0 : }
23673 0 : void fd_address_lookup_table_state_destroy( fd_address_lookup_table_state_t * self ) {
23674 0 : fd_address_lookup_table_state_inner_destroy( &self->inner, self->discriminant );
23675 0 : }
23676 :
23677 0 : ulong fd_address_lookup_table_state_footprint( void ){ return FD_ADDRESS_LOOKUP_TABLE_STATE_FOOTPRINT; }
23678 0 : ulong fd_address_lookup_table_state_align( void ){ return FD_ADDRESS_LOOKUP_TABLE_STATE_ALIGN; }
23679 :
23680 0 : void fd_address_lookup_table_state_walk( void * w, fd_address_lookup_table_state_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
23681 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_address_lookup_table_state", level++);
23682 0 : switch( self->discriminant ) {
23683 0 : case 0: {
23684 0 : fun( w, self, "uninitialized", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
23685 0 : break;
23686 0 : }
23687 0 : case 1: {
23688 0 : fun( w, self, "lookup_table", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
23689 0 : fd_address_lookup_table_walk( w, &self->inner.lookup_table, fun, "lookup_table", level );
23690 0 : break;
23691 0 : }
23692 0 : }
23693 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_address_lookup_table_state", level-- );
23694 0 : }
23695 0 : ulong fd_address_lookup_table_state_size( fd_address_lookup_table_state_t const * self ) {
23696 0 : ulong size = 0;
23697 0 : size += sizeof(uint);
23698 0 : switch (self->discriminant) {
23699 0 : case 1: {
23700 0 : size += fd_address_lookup_table_size( &self->inner.lookup_table );
23701 0 : break;
23702 0 : }
23703 0 : }
23704 0 : return size;
23705 0 : }
23706 :
23707 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 ) {
23708 0 : int err;
23709 0 : switch (discriminant) {
23710 0 : case 1: {
23711 0 : err = fd_address_lookup_table_encode( &self->lookup_table, ctx );
23712 0 : if( FD_UNLIKELY( err ) ) return err;
23713 0 : break;
23714 0 : }
23715 0 : }
23716 0 : return FD_BINCODE_SUCCESS;
23717 0 : }
23718 0 : int fd_address_lookup_table_state_encode( fd_address_lookup_table_state_t const * self, fd_bincode_encode_ctx_t * ctx ) {
23719 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
23720 0 : if( FD_UNLIKELY( err ) ) return err;
23721 0 : return fd_address_lookup_table_state_inner_encode( &self->inner, self->discriminant, ctx );
23722 0 : }
23723 :
23724 0 : int fd_gossip_bitvec_u8_inner_encode( fd_gossip_bitvec_u8_inner_t const * self, fd_bincode_encode_ctx_t * ctx ) {
23725 0 : int err;
23726 0 : err = fd_bincode_uint64_encode( self->vec_len, ctx );
23727 0 : if( FD_UNLIKELY(err) ) return err;
23728 0 : if( self->vec_len ) {
23729 0 : err = fd_bincode_bytes_encode( self->vec, self->vec_len, ctx );
23730 0 : if( FD_UNLIKELY( err ) ) return err;
23731 0 : }
23732 0 : return FD_BINCODE_SUCCESS;
23733 0 : }
23734 0 : int fd_gossip_bitvec_u8_inner_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
23735 0 : *total_sz += sizeof(fd_gossip_bitvec_u8_inner_t);
23736 0 : void const * start_data = ctx->data;
23737 0 : int err = fd_gossip_bitvec_u8_inner_decode_footprint_inner( ctx, total_sz );
23738 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
23739 0 : ctx->data = start_data;
23740 0 : return err;
23741 0 : }
23742 0 : int fd_gossip_bitvec_u8_inner_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
23743 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
23744 0 : int err = 0;
23745 0 : ulong vec_len;
23746 0 : err = fd_bincode_uint64_decode( &vec_len, ctx );
23747 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
23748 0 : if( vec_len ) {
23749 0 : *total_sz += 8UL + vec_len;
23750 0 : err = fd_bincode_bytes_decode_footprint( vec_len, ctx );
23751 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
23752 0 : }
23753 0 : return 0;
23754 0 : }
23755 0 : void * fd_gossip_bitvec_u8_inner_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
23756 0 : fd_gossip_bitvec_u8_inner_t * self = (fd_gossip_bitvec_u8_inner_t *)mem;
23757 0 : fd_gossip_bitvec_u8_inner_new( self );
23758 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_bitvec_u8_inner_t);
23759 0 : void * * alloc_mem = &alloc_region;
23760 0 : fd_gossip_bitvec_u8_inner_decode_inner( mem, alloc_mem, ctx );
23761 0 : return self;
23762 0 : }
23763 0 : void fd_gossip_bitvec_u8_inner_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
23764 0 : fd_gossip_bitvec_u8_inner_t * self = (fd_gossip_bitvec_u8_inner_t *)struct_mem;
23765 0 : fd_bincode_uint64_decode_unsafe( &self->vec_len, ctx );
23766 0 : if( self->vec_len ) {
23767 0 : self->vec = *alloc_mem;
23768 0 : fd_bincode_bytes_decode_unsafe( self->vec, self->vec_len, ctx );
23769 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->vec_len;
23770 0 : } else
23771 0 : self->vec = NULL;
23772 0 : }
23773 0 : void * fd_gossip_bitvec_u8_inner_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
23774 0 : fd_gossip_bitvec_u8_inner_global_t * self = (fd_gossip_bitvec_u8_inner_global_t *)mem;
23775 0 : fd_gossip_bitvec_u8_inner_new( (fd_gossip_bitvec_u8_inner_t *)self );
23776 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_bitvec_u8_inner_global_t);
23777 0 : void * * alloc_mem = &alloc_region;
23778 0 : fd_gossip_bitvec_u8_inner_decode_inner_global( mem, alloc_mem, ctx );
23779 0 : return self;
23780 0 : }
23781 0 : void fd_gossip_bitvec_u8_inner_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
23782 0 : fd_gossip_bitvec_u8_inner_global_t * self = (fd_gossip_bitvec_u8_inner_global_t *)struct_mem;
23783 0 : fd_bincode_uint64_decode_unsafe( &self->vec_len, ctx );
23784 0 : if( self->vec_len ) {
23785 0 : self->vec_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
23786 0 : fd_bincode_bytes_decode_unsafe( *alloc_mem, self->vec_len, ctx );
23787 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->vec_len;
23788 0 : } else
23789 0 : self->vec_gaddr = 0UL;
23790 0 : }
23791 0 : int fd_gossip_bitvec_u8_inner_convert_global_to_local( void const * global_self, fd_gossip_bitvec_u8_inner_t * self, fd_bincode_decode_ctx_t * ctx ) {
23792 0 : int err = 0;
23793 0 : fd_gossip_bitvec_u8_inner_global_t const * mem = (fd_gossip_bitvec_u8_inner_global_t const *)global_self;
23794 0 : self->vec_len = mem->vec_len;
23795 0 : self->vec = fd_wksp_laddr_fast( ctx->wksp, mem->vec_gaddr );
23796 0 : return FD_BINCODE_SUCCESS;
23797 0 : }
23798 0 : void fd_gossip_bitvec_u8_inner_new(fd_gossip_bitvec_u8_inner_t * self) {
23799 0 : fd_memset( self, 0, sizeof(fd_gossip_bitvec_u8_inner_t) );
23800 0 : }
23801 0 : void fd_gossip_bitvec_u8_inner_destroy( fd_gossip_bitvec_u8_inner_t * self ) {
23802 0 : if( self->vec ) {
23803 0 : self->vec = NULL;
23804 0 : }
23805 0 : }
23806 :
23807 0 : ulong fd_gossip_bitvec_u8_inner_footprint( void ){ return FD_GOSSIP_BITVEC_U8_INNER_FOOTPRINT; }
23808 0 : ulong fd_gossip_bitvec_u8_inner_align( void ){ return FD_GOSSIP_BITVEC_U8_INNER_ALIGN; }
23809 :
23810 0 : void fd_gossip_bitvec_u8_inner_walk( void * w, fd_gossip_bitvec_u8_inner_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
23811 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_bitvec_u8_inner", level++ );
23812 0 : fun(w, self->vec, "vec", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
23813 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_bitvec_u8_inner", level-- );
23814 0 : }
23815 0 : ulong fd_gossip_bitvec_u8_inner_size( fd_gossip_bitvec_u8_inner_t const * self ) {
23816 0 : ulong size = 0;
23817 0 : do {
23818 0 : size += sizeof(ulong);
23819 0 : size += self->vec_len;
23820 0 : } while(0);
23821 0 : return size;
23822 0 : }
23823 :
23824 0 : int fd_gossip_bitvec_u8_encode( fd_gossip_bitvec_u8_t const * self, fd_bincode_encode_ctx_t * ctx ) {
23825 0 : int err;
23826 0 : err = fd_bincode_bool_encode( self->has_bits, ctx );
23827 0 : if( FD_UNLIKELY( err ) ) return err;
23828 0 : if( self->has_bits ) {
23829 0 : err = fd_gossip_bitvec_u8_inner_encode( &self->bits, ctx );
23830 0 : if( FD_UNLIKELY( err ) ) return err;
23831 0 : }
23832 0 : err = fd_bincode_uint64_encode( self->len, ctx );
23833 0 : if( FD_UNLIKELY( err ) ) return err;
23834 0 : return FD_BINCODE_SUCCESS;
23835 0 : }
23836 0 : int fd_gossip_bitvec_u8_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
23837 0 : *total_sz += sizeof(fd_gossip_bitvec_u8_t);
23838 0 : void const * start_data = ctx->data;
23839 0 : int err = fd_gossip_bitvec_u8_decode_footprint_inner( ctx, total_sz );
23840 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
23841 0 : ctx->data = start_data;
23842 0 : return err;
23843 0 : }
23844 0 : int fd_gossip_bitvec_u8_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
23845 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
23846 0 : int err = 0;
23847 0 : {
23848 0 : uchar o;
23849 0 : err = fd_bincode_bool_decode( &o, ctx );
23850 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
23851 0 : if( o ) {
23852 0 : err = fd_gossip_bitvec_u8_inner_decode_footprint_inner( ctx, total_sz );
23853 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
23854 0 : }
23855 0 : }
23856 0 : err = fd_bincode_uint64_decode_footprint( ctx );
23857 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
23858 0 : return 0;
23859 0 : }
23860 0 : void * fd_gossip_bitvec_u8_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
23861 0 : fd_gossip_bitvec_u8_t * self = (fd_gossip_bitvec_u8_t *)mem;
23862 0 : fd_gossip_bitvec_u8_new( self );
23863 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_bitvec_u8_t);
23864 0 : void * * alloc_mem = &alloc_region;
23865 0 : fd_gossip_bitvec_u8_decode_inner( mem, alloc_mem, ctx );
23866 0 : return self;
23867 0 : }
23868 0 : void fd_gossip_bitvec_u8_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
23869 0 : fd_gossip_bitvec_u8_t * self = (fd_gossip_bitvec_u8_t *)struct_mem;
23870 0 : {
23871 0 : uchar o;
23872 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
23873 0 : self->has_bits = !!o;
23874 0 : if( o ) {
23875 0 : fd_gossip_bitvec_u8_inner_new( &self->bits );
23876 0 : fd_gossip_bitvec_u8_inner_decode_inner( &self->bits, alloc_mem, ctx );
23877 0 : }
23878 0 : }
23879 0 : fd_bincode_uint64_decode_unsafe( &self->len, ctx );
23880 0 : }
23881 0 : void * fd_gossip_bitvec_u8_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
23882 0 : fd_gossip_bitvec_u8_global_t * self = (fd_gossip_bitvec_u8_global_t *)mem;
23883 0 : fd_gossip_bitvec_u8_new( (fd_gossip_bitvec_u8_t *)self );
23884 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_bitvec_u8_global_t);
23885 0 : void * * alloc_mem = &alloc_region;
23886 0 : fd_gossip_bitvec_u8_decode_inner_global( mem, alloc_mem, ctx );
23887 0 : return self;
23888 0 : }
23889 0 : void fd_gossip_bitvec_u8_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
23890 0 : fd_gossip_bitvec_u8_global_t * self = (fd_gossip_bitvec_u8_global_t *)struct_mem;
23891 0 : {
23892 0 : uchar o;
23893 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
23894 0 : self->has_bits = !!o;
23895 0 : if( o ) {
23896 0 : fd_gossip_bitvec_u8_inner_new( &self->bits );
23897 0 : fd_gossip_bitvec_u8_inner_decode_inner_global( &self->bits, alloc_mem, ctx );
23898 0 : }
23899 0 : }
23900 0 : fd_bincode_uint64_decode_unsafe( &self->len, ctx );
23901 0 : }
23902 0 : int fd_gossip_bitvec_u8_convert_global_to_local( void const * global_self, fd_gossip_bitvec_u8_t * self, fd_bincode_decode_ctx_t * ctx ) {
23903 0 : int err = 0;
23904 0 : fd_gossip_bitvec_u8_global_t const * mem = (fd_gossip_bitvec_u8_global_t const *)global_self;
23905 0 : self->bits = mem->bits;
23906 0 : self->has_bits = mem->has_bits;
23907 0 : self->len = mem->len;
23908 0 : return FD_BINCODE_SUCCESS;
23909 0 : }
23910 0 : void fd_gossip_bitvec_u8_new(fd_gossip_bitvec_u8_t * self) {
23911 0 : fd_memset( self, 0, sizeof(fd_gossip_bitvec_u8_t) );
23912 0 : }
23913 0 : void fd_gossip_bitvec_u8_destroy( fd_gossip_bitvec_u8_t * self ) {
23914 0 : if( self->has_bits ) {
23915 0 : fd_gossip_bitvec_u8_inner_destroy( &self->bits );
23916 0 : self->has_bits = 0;
23917 0 : }
23918 0 : }
23919 :
23920 0 : ulong fd_gossip_bitvec_u8_footprint( void ){ return FD_GOSSIP_BITVEC_U8_FOOTPRINT; }
23921 0 : ulong fd_gossip_bitvec_u8_align( void ){ return FD_GOSSIP_BITVEC_U8_ALIGN; }
23922 :
23923 0 : void fd_gossip_bitvec_u8_walk( void * w, fd_gossip_bitvec_u8_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
23924 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_bitvec_u8", level++ );
23925 0 : if( !self->has_bits ) {
23926 0 : fun( w, NULL, "bits", FD_FLAMENCO_TYPE_NULL, "gossip_bitvec_u8_inner", level );
23927 0 : } else {
23928 0 : fd_gossip_bitvec_u8_inner_walk( w, &self->bits, fun, "bits", level );
23929 0 : }
23930 0 : fun( w, &self->len, "len", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
23931 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_bitvec_u8", level-- );
23932 0 : }
23933 0 : ulong fd_gossip_bitvec_u8_size( fd_gossip_bitvec_u8_t const * self ) {
23934 0 : ulong size = 0;
23935 0 : size += sizeof(char);
23936 0 : if( self->has_bits ) {
23937 0 : size += fd_gossip_bitvec_u8_inner_size( &self->bits );
23938 0 : }
23939 0 : size += sizeof(ulong);
23940 0 : return size;
23941 0 : }
23942 :
23943 0 : int fd_gossip_bitvec_u64_inner_encode( fd_gossip_bitvec_u64_inner_t const * self, fd_bincode_encode_ctx_t * ctx ) {
23944 0 : int err;
23945 0 : err = fd_bincode_uint64_encode( self->vec_len, ctx );
23946 0 : if( FD_UNLIKELY(err) ) return err;
23947 0 : if( self->vec_len ) {
23948 0 : for( ulong i=0; i < self->vec_len; i++ ) {
23949 0 : err = fd_bincode_uint64_encode( self->vec[i], ctx );
23950 0 : }
23951 0 : }
23952 0 : return FD_BINCODE_SUCCESS;
23953 0 : }
23954 0 : int fd_gossip_bitvec_u64_inner_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
23955 0 : *total_sz += sizeof(fd_gossip_bitvec_u64_inner_t);
23956 0 : void const * start_data = ctx->data;
23957 0 : int err = fd_gossip_bitvec_u64_inner_decode_footprint_inner( ctx, total_sz );
23958 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
23959 0 : ctx->data = start_data;
23960 0 : return err;
23961 0 : }
23962 3 : int fd_gossip_bitvec_u64_inner_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
23963 3 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
23964 3 : int err = 0;
23965 3 : ulong vec_len;
23966 3 : err = fd_bincode_uint64_decode( &vec_len, ctx );
23967 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
23968 3 : if( vec_len ) {
23969 3 : *total_sz += 8UL + sizeof(ulong)*vec_len;
23970 294 : for( ulong i=0; i < vec_len; i++ ) {
23971 291 : err = fd_bincode_uint64_decode_footprint( ctx );
23972 291 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
23973 291 : }
23974 3 : }
23975 3 : return 0;
23976 3 : }
23977 0 : void * fd_gossip_bitvec_u64_inner_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
23978 0 : fd_gossip_bitvec_u64_inner_t * self = (fd_gossip_bitvec_u64_inner_t *)mem;
23979 0 : fd_gossip_bitvec_u64_inner_new( self );
23980 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_bitvec_u64_inner_t);
23981 0 : void * * alloc_mem = &alloc_region;
23982 0 : fd_gossip_bitvec_u64_inner_decode_inner( mem, alloc_mem, ctx );
23983 0 : return self;
23984 0 : }
23985 3 : void fd_gossip_bitvec_u64_inner_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
23986 3 : fd_gossip_bitvec_u64_inner_t * self = (fd_gossip_bitvec_u64_inner_t *)struct_mem;
23987 3 : fd_bincode_uint64_decode_unsafe( &self->vec_len, ctx );
23988 3 : if( self->vec_len ) {
23989 3 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), 8UL );
23990 3 : self->vec = *alloc_mem;
23991 3 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(ulong)*self->vec_len;
23992 294 : for( ulong i=0; i < self->vec_len; i++ ) {
23993 291 : fd_bincode_uint64_decode_unsafe( self->vec + i, ctx );
23994 291 : }
23995 3 : } else
23996 0 : self->vec = NULL;
23997 3 : }
23998 0 : void * fd_gossip_bitvec_u64_inner_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
23999 0 : fd_gossip_bitvec_u64_inner_global_t * self = (fd_gossip_bitvec_u64_inner_global_t *)mem;
24000 0 : fd_gossip_bitvec_u64_inner_new( (fd_gossip_bitvec_u64_inner_t *)self );
24001 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_bitvec_u64_inner_global_t);
24002 0 : void * * alloc_mem = &alloc_region;
24003 0 : fd_gossip_bitvec_u64_inner_decode_inner_global( mem, alloc_mem, ctx );
24004 0 : return self;
24005 0 : }
24006 0 : void fd_gossip_bitvec_u64_inner_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
24007 0 : fd_gossip_bitvec_u64_inner_global_t * self = (fd_gossip_bitvec_u64_inner_global_t *)struct_mem;
24008 0 : fd_bincode_uint64_decode_unsafe( &self->vec_len, ctx );
24009 0 : if( self->vec_len ) {
24010 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), 8UL );
24011 0 : self->vec_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
24012 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
24013 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(ulong)*self->vec_len;
24014 0 : for( ulong i=0; i < self->vec_len; i++ ) {
24015 0 : fd_bincode_uint64_decode_unsafe( (ulong*)(cur_mem + sizeof(ulong) * i), ctx );
24016 0 : }
24017 0 : } else
24018 0 : self->vec_gaddr = 0UL;
24019 0 : }
24020 0 : int fd_gossip_bitvec_u64_inner_convert_global_to_local( void const * global_self, fd_gossip_bitvec_u64_inner_t * self, fd_bincode_decode_ctx_t * ctx ) {
24021 0 : int err = 0;
24022 0 : fd_gossip_bitvec_u64_inner_global_t const * mem = (fd_gossip_bitvec_u64_inner_global_t const *)global_self;
24023 0 : self->vec_len = mem->vec_len;
24024 0 : self->vec = fd_wksp_laddr_fast( ctx->wksp, mem->vec_gaddr );
24025 0 : return FD_BINCODE_SUCCESS;
24026 0 : }
24027 3 : void fd_gossip_bitvec_u64_inner_new(fd_gossip_bitvec_u64_inner_t * self) {
24028 3 : fd_memset( self, 0, sizeof(fd_gossip_bitvec_u64_inner_t) );
24029 3 : }
24030 0 : void fd_gossip_bitvec_u64_inner_destroy( fd_gossip_bitvec_u64_inner_t * self ) {
24031 0 : if( self->vec ) {
24032 0 : self->vec = NULL;
24033 0 : }
24034 0 : }
24035 :
24036 0 : ulong fd_gossip_bitvec_u64_inner_footprint( void ){ return FD_GOSSIP_BITVEC_U64_INNER_FOOTPRINT; }
24037 0 : ulong fd_gossip_bitvec_u64_inner_align( void ){ return FD_GOSSIP_BITVEC_U64_INNER_ALIGN; }
24038 :
24039 3 : void fd_gossip_bitvec_u64_inner_walk( void * w, fd_gossip_bitvec_u64_inner_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
24040 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_bitvec_u64_inner", level++ );
24041 3 : if( self->vec_len ) {
24042 3 : fun( w, NULL, "vec", FD_FLAMENCO_TYPE_ARR, "array", level++ );
24043 294 : for( ulong i=0; i < self->vec_len; i++ )
24044 291 : fun( w, self->vec + i, "vec", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
24045 3 : fun( w, NULL, "vec", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
24046 3 : }
24047 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_bitvec_u64_inner", level-- );
24048 3 : }
24049 0 : ulong fd_gossip_bitvec_u64_inner_size( fd_gossip_bitvec_u64_inner_t const * self ) {
24050 0 : ulong size = 0;
24051 0 : do {
24052 0 : size += sizeof(ulong);
24053 0 : size += self->vec_len * sizeof(ulong);
24054 0 : } while(0);
24055 0 : return size;
24056 0 : }
24057 :
24058 0 : int fd_gossip_bitvec_u64_encode( fd_gossip_bitvec_u64_t const * self, fd_bincode_encode_ctx_t * ctx ) {
24059 0 : int err;
24060 0 : err = fd_bincode_bool_encode( self->has_bits, ctx );
24061 0 : if( FD_UNLIKELY( err ) ) return err;
24062 0 : if( self->has_bits ) {
24063 0 : err = fd_gossip_bitvec_u64_inner_encode( &self->bits, ctx );
24064 0 : if( FD_UNLIKELY( err ) ) return err;
24065 0 : }
24066 0 : err = fd_bincode_uint64_encode( self->len, ctx );
24067 0 : if( FD_UNLIKELY( err ) ) return err;
24068 0 : return FD_BINCODE_SUCCESS;
24069 0 : }
24070 0 : int fd_gossip_bitvec_u64_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
24071 0 : *total_sz += sizeof(fd_gossip_bitvec_u64_t);
24072 0 : void const * start_data = ctx->data;
24073 0 : int err = fd_gossip_bitvec_u64_decode_footprint_inner( ctx, total_sz );
24074 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
24075 0 : ctx->data = start_data;
24076 0 : return err;
24077 0 : }
24078 3 : int fd_gossip_bitvec_u64_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
24079 3 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
24080 3 : int err = 0;
24081 3 : {
24082 3 : uchar o;
24083 3 : err = fd_bincode_bool_decode( &o, ctx );
24084 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24085 3 : if( o ) {
24086 3 : err = fd_gossip_bitvec_u64_inner_decode_footprint_inner( ctx, total_sz );
24087 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24088 3 : }
24089 3 : }
24090 3 : err = fd_bincode_uint64_decode_footprint( ctx );
24091 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24092 3 : return 0;
24093 3 : }
24094 0 : void * fd_gossip_bitvec_u64_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
24095 0 : fd_gossip_bitvec_u64_t * self = (fd_gossip_bitvec_u64_t *)mem;
24096 0 : fd_gossip_bitvec_u64_new( self );
24097 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_bitvec_u64_t);
24098 0 : void * * alloc_mem = &alloc_region;
24099 0 : fd_gossip_bitvec_u64_decode_inner( mem, alloc_mem, ctx );
24100 0 : return self;
24101 0 : }
24102 3 : void fd_gossip_bitvec_u64_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
24103 3 : fd_gossip_bitvec_u64_t * self = (fd_gossip_bitvec_u64_t *)struct_mem;
24104 3 : {
24105 3 : uchar o;
24106 3 : fd_bincode_bool_decode_unsafe( &o, ctx );
24107 3 : self->has_bits = !!o;
24108 3 : if( o ) {
24109 3 : fd_gossip_bitvec_u64_inner_new( &self->bits );
24110 3 : fd_gossip_bitvec_u64_inner_decode_inner( &self->bits, alloc_mem, ctx );
24111 3 : }
24112 3 : }
24113 3 : fd_bincode_uint64_decode_unsafe( &self->len, ctx );
24114 3 : }
24115 0 : void * fd_gossip_bitvec_u64_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
24116 0 : fd_gossip_bitvec_u64_global_t * self = (fd_gossip_bitvec_u64_global_t *)mem;
24117 0 : fd_gossip_bitvec_u64_new( (fd_gossip_bitvec_u64_t *)self );
24118 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_bitvec_u64_global_t);
24119 0 : void * * alloc_mem = &alloc_region;
24120 0 : fd_gossip_bitvec_u64_decode_inner_global( mem, alloc_mem, ctx );
24121 0 : return self;
24122 0 : }
24123 0 : void fd_gossip_bitvec_u64_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
24124 0 : fd_gossip_bitvec_u64_global_t * self = (fd_gossip_bitvec_u64_global_t *)struct_mem;
24125 0 : {
24126 0 : uchar o;
24127 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
24128 0 : self->has_bits = !!o;
24129 0 : if( o ) {
24130 0 : fd_gossip_bitvec_u64_inner_new( &self->bits );
24131 0 : fd_gossip_bitvec_u64_inner_decode_inner_global( &self->bits, alloc_mem, ctx );
24132 0 : }
24133 0 : }
24134 0 : fd_bincode_uint64_decode_unsafe( &self->len, ctx );
24135 0 : }
24136 0 : int fd_gossip_bitvec_u64_convert_global_to_local( void const * global_self, fd_gossip_bitvec_u64_t * self, fd_bincode_decode_ctx_t * ctx ) {
24137 0 : int err = 0;
24138 0 : fd_gossip_bitvec_u64_global_t const * mem = (fd_gossip_bitvec_u64_global_t const *)global_self;
24139 0 : self->bits = mem->bits;
24140 0 : self->has_bits = mem->has_bits;
24141 0 : self->len = mem->len;
24142 0 : return FD_BINCODE_SUCCESS;
24143 0 : }
24144 0 : void fd_gossip_bitvec_u64_new(fd_gossip_bitvec_u64_t * self) {
24145 0 : fd_memset( self, 0, sizeof(fd_gossip_bitvec_u64_t) );
24146 0 : }
24147 0 : void fd_gossip_bitvec_u64_destroy( fd_gossip_bitvec_u64_t * self ) {
24148 0 : if( self->has_bits ) {
24149 0 : fd_gossip_bitvec_u64_inner_destroy( &self->bits );
24150 0 : self->has_bits = 0;
24151 0 : }
24152 0 : }
24153 :
24154 0 : ulong fd_gossip_bitvec_u64_footprint( void ){ return FD_GOSSIP_BITVEC_U64_FOOTPRINT; }
24155 0 : ulong fd_gossip_bitvec_u64_align( void ){ return FD_GOSSIP_BITVEC_U64_ALIGN; }
24156 :
24157 3 : void fd_gossip_bitvec_u64_walk( void * w, fd_gossip_bitvec_u64_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
24158 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_bitvec_u64", level++ );
24159 3 : if( !self->has_bits ) {
24160 0 : fun( w, NULL, "bits", FD_FLAMENCO_TYPE_NULL, "gossip_bitvec_u64_inner", level );
24161 3 : } else {
24162 3 : fd_gossip_bitvec_u64_inner_walk( w, &self->bits, fun, "bits", level );
24163 3 : }
24164 3 : fun( w, &self->len, "len", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
24165 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_bitvec_u64", level-- );
24166 3 : }
24167 0 : ulong fd_gossip_bitvec_u64_size( fd_gossip_bitvec_u64_t const * self ) {
24168 0 : ulong size = 0;
24169 0 : size += sizeof(char);
24170 0 : if( self->has_bits ) {
24171 0 : size += fd_gossip_bitvec_u64_inner_size( &self->bits );
24172 0 : }
24173 0 : size += sizeof(ulong);
24174 0 : return size;
24175 0 : }
24176 :
24177 0 : int fd_gossip_ping_encode( fd_gossip_ping_t const * self, fd_bincode_encode_ctx_t * ctx ) {
24178 0 : int err;
24179 0 : err = fd_pubkey_encode( &self->from, ctx );
24180 0 : if( FD_UNLIKELY( err ) ) return err;
24181 0 : err = fd_hash_encode( &self->token, ctx );
24182 0 : if( FD_UNLIKELY( err ) ) return err;
24183 0 : err = fd_signature_encode( &self->signature, ctx );
24184 0 : if( FD_UNLIKELY( err ) ) return err;
24185 0 : return FD_BINCODE_SUCCESS;
24186 0 : }
24187 0 : int fd_gossip_ping_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
24188 0 : *total_sz += sizeof(fd_gossip_ping_t);
24189 0 : void const * start_data = ctx->data;
24190 0 : int err = fd_gossip_ping_decode_footprint_inner( ctx, total_sz );
24191 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
24192 0 : ctx->data = start_data;
24193 0 : return err;
24194 0 : }
24195 0 : int fd_gossip_ping_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
24196 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
24197 0 : int err = 0;
24198 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
24199 0 : if( FD_UNLIKELY( err ) ) return err;
24200 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
24201 0 : if( FD_UNLIKELY( err ) ) return err;
24202 0 : err = fd_signature_decode_footprint_inner( ctx, total_sz );
24203 0 : if( FD_UNLIKELY( err ) ) return err;
24204 0 : return 0;
24205 0 : }
24206 0 : void * fd_gossip_ping_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
24207 0 : fd_gossip_ping_t * self = (fd_gossip_ping_t *)mem;
24208 0 : fd_gossip_ping_new( self );
24209 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_ping_t);
24210 0 : void * * alloc_mem = &alloc_region;
24211 0 : fd_gossip_ping_decode_inner( mem, alloc_mem, ctx );
24212 0 : return self;
24213 0 : }
24214 0 : void fd_gossip_ping_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
24215 0 : fd_gossip_ping_t * self = (fd_gossip_ping_t *)struct_mem;
24216 0 : fd_pubkey_decode_inner( &self->from, alloc_mem, ctx );
24217 0 : fd_hash_decode_inner( &self->token, alloc_mem, ctx );
24218 0 : fd_signature_decode_inner( &self->signature, alloc_mem, ctx );
24219 0 : }
24220 0 : void * fd_gossip_ping_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
24221 0 : fd_gossip_ping_global_t * self = (fd_gossip_ping_global_t *)mem;
24222 0 : fd_gossip_ping_new( (fd_gossip_ping_t *)self );
24223 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_ping_global_t);
24224 0 : void * * alloc_mem = &alloc_region;
24225 0 : fd_gossip_ping_decode_inner_global( mem, alloc_mem, ctx );
24226 0 : return self;
24227 0 : }
24228 0 : void fd_gossip_ping_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
24229 0 : fd_gossip_ping_global_t * self = (fd_gossip_ping_global_t *)struct_mem;
24230 0 : fd_pubkey_decode_inner_global( &self->from, alloc_mem, ctx );
24231 0 : fd_hash_decode_inner_global( &self->token, alloc_mem, ctx );
24232 0 : fd_signature_decode_inner_global( &self->signature, alloc_mem, ctx );
24233 0 : }
24234 0 : int fd_gossip_ping_convert_global_to_local( void const * global_self, fd_gossip_ping_t * self, fd_bincode_decode_ctx_t * ctx ) {
24235 0 : int err = 0;
24236 0 : fd_gossip_ping_global_t const * mem = (fd_gossip_ping_global_t const *)global_self;
24237 0 : err = fd_pubkey_convert_global_to_local( &mem->from, &self->from, ctx );
24238 0 : if( FD_UNLIKELY( err ) ) return err;
24239 0 : err = fd_hash_convert_global_to_local( &mem->token, &self->token, ctx );
24240 0 : if( FD_UNLIKELY( err ) ) return err;
24241 0 : err = fd_signature_convert_global_to_local( &mem->signature, &self->signature, ctx );
24242 0 : if( FD_UNLIKELY( err ) ) return err;
24243 0 : return FD_BINCODE_SUCCESS;
24244 0 : }
24245 0 : void fd_gossip_ping_new(fd_gossip_ping_t * self) {
24246 0 : fd_memset( self, 0, sizeof(fd_gossip_ping_t) );
24247 0 : fd_pubkey_new( &self->from );
24248 0 : fd_hash_new( &self->token );
24249 0 : fd_signature_new( &self->signature );
24250 0 : }
24251 0 : void fd_gossip_ping_destroy( fd_gossip_ping_t * self ) {
24252 0 : fd_pubkey_destroy( &self->from );
24253 0 : fd_hash_destroy( &self->token );
24254 0 : fd_signature_destroy( &self->signature );
24255 0 : }
24256 :
24257 0 : ulong fd_gossip_ping_footprint( void ){ return FD_GOSSIP_PING_FOOTPRINT; }
24258 0 : ulong fd_gossip_ping_align( void ){ return FD_GOSSIP_PING_ALIGN; }
24259 :
24260 0 : void fd_gossip_ping_walk( void * w, fd_gossip_ping_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
24261 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_ping", level++ );
24262 0 : fd_pubkey_walk( w, &self->from, fun, "from", level );
24263 0 : fd_hash_walk( w, &self->token, fun, "token", level );
24264 0 : fd_signature_walk( w, &self->signature, fun, "signature", level );
24265 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_ping", level-- );
24266 0 : }
24267 0 : ulong fd_gossip_ping_size( fd_gossip_ping_t const * self ) {
24268 0 : ulong size = 0;
24269 0 : size += fd_pubkey_size( &self->from );
24270 0 : size += fd_hash_size( &self->token );
24271 0 : size += fd_signature_size( &self->signature );
24272 0 : return size;
24273 0 : }
24274 :
24275 0 : FD_FN_PURE uchar fd_gossip_ip_addr_is_ip4(fd_gossip_ip_addr_t const * self) {
24276 0 : return self->discriminant == 0;
24277 0 : }
24278 0 : FD_FN_PURE uchar fd_gossip_ip_addr_is_ip6(fd_gossip_ip_addr_t const * self) {
24279 0 : return self->discriminant == 1;
24280 0 : }
24281 : void fd_gossip_ip_addr_inner_new( fd_gossip_ip_addr_inner_t * self, uint discriminant );
24282 3 : int fd_gossip_ip_addr_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
24283 3 : int err;
24284 3 : switch (discriminant) {
24285 3 : case 0: {
24286 3 : err = fd_gossip_ip4_addr_decode_footprint_inner( ctx, total_sz );
24287 3 : if( FD_UNLIKELY( err ) ) return err;
24288 3 : return FD_BINCODE_SUCCESS;
24289 3 : }
24290 0 : case 1: {
24291 0 : err = fd_gossip_ip6_addr_decode_footprint_inner( ctx, total_sz );
24292 0 : if( FD_UNLIKELY( err ) ) return err;
24293 0 : return FD_BINCODE_SUCCESS;
24294 0 : }
24295 0 : default: return FD_BINCODE_ERR_ENCODING;
24296 3 : }
24297 3 : }
24298 0 : int fd_gossip_ip_addr_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
24299 0 : *total_sz += sizeof(fd_gossip_ip_addr_t);
24300 0 : void const * start_data = ctx->data;
24301 0 : int err = fd_gossip_ip_addr_decode_footprint_inner( ctx, total_sz );
24302 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
24303 0 : ctx->data = start_data;
24304 0 : return err;
24305 0 : }
24306 3 : int fd_gossip_ip_addr_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
24307 3 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
24308 3 : uint discriminant = 0;
24309 3 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
24310 3 : if( FD_UNLIKELY( err ) ) return err;
24311 3 : return fd_gossip_ip_addr_inner_decode_footprint( discriminant, ctx, total_sz );
24312 3 : }
24313 3 : void fd_gossip_ip_addr_inner_decode_inner( fd_gossip_ip_addr_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
24314 3 : switch (discriminant) {
24315 3 : case 0: {
24316 3 : fd_gossip_ip4_addr_decode_inner( &self->ip4, alloc_mem, ctx );
24317 3 : break;
24318 0 : }
24319 0 : case 1: {
24320 0 : fd_gossip_ip6_addr_decode_inner( &self->ip6, alloc_mem, ctx );
24321 0 : break;
24322 0 : }
24323 3 : }
24324 3 : }
24325 0 : void fd_gossip_ip_addr_inner_decode_inner_global( fd_gossip_ip_addr_inner_global_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
24326 0 : switch (discriminant) {
24327 0 : case 0: {
24328 0 : fd_gossip_ip4_addr_decode_inner_global( &self->ip4, alloc_mem, ctx );
24329 0 : break;
24330 0 : }
24331 0 : case 1: {
24332 0 : fd_gossip_ip6_addr_decode_inner_global( &self->ip6, alloc_mem, ctx );
24333 0 : break;
24334 0 : }
24335 0 : }
24336 0 : }
24337 0 : int fd_gossip_ip_addr_convert_global_to_local_inner( fd_gossip_ip_addr_inner_global_t const * mem, fd_gossip_ip_addr_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
24338 0 : int err = 0;
24339 0 : switch( discriminant ) {
24340 0 : case 0: {
24341 0 : err = fd_gossip_ip4_addr_convert_global_to_local( &mem->ip4, &self->ip4, ctx );
24342 0 : if( FD_UNLIKELY( err ) ) return err;
24343 0 : break;
24344 0 : }
24345 0 : case 1: {
24346 0 : err = fd_gossip_ip6_addr_convert_global_to_local( &mem->ip6, &self->ip6, ctx );
24347 0 : if( FD_UNLIKELY( err ) ) return err;
24348 0 : break;
24349 0 : }
24350 0 : }
24351 0 : return FD_BINCODE_SUCCESS;
24352 0 : }
24353 0 : int fd_gossip_ip_addr_convert_global_to_local( void const * global_self, fd_gossip_ip_addr_t * self, fd_bincode_decode_ctx_t * ctx ) {
24354 0 : fd_gossip_ip_addr_global_t const * mem = (fd_gossip_ip_addr_global_t const *)global_self;
24355 0 : uint discriminant = mem->discriminant;
24356 0 : self->discriminant = mem->discriminant;
24357 0 : int err = fd_gossip_ip_addr_convert_global_to_local_inner( &mem->inner, &self->inner, discriminant, ctx );
24358 0 : return FD_BINCODE_SUCCESS;
24359 0 : }
24360 3 : void fd_gossip_ip_addr_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
24361 3 : fd_gossip_ip_addr_t * self = (fd_gossip_ip_addr_t *)struct_mem;
24362 3 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
24363 3 : fd_gossip_ip_addr_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
24364 3 : }
24365 0 : void * fd_gossip_ip_addr_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
24366 0 : fd_gossip_ip_addr_t * self = (fd_gossip_ip_addr_t *)mem;
24367 0 : fd_gossip_ip_addr_new( self );
24368 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_ip_addr_t);
24369 0 : void * * alloc_mem = &alloc_region;
24370 0 : fd_gossip_ip_addr_decode_inner( mem, alloc_mem, ctx );
24371 0 : return self;
24372 0 : }
24373 0 : void * fd_gossip_ip_addr_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
24374 0 : fd_gossip_ip_addr_t * self = (fd_gossip_ip_addr_t *)mem;
24375 0 : fd_gossip_ip_addr_new( self );
24376 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_ip_addr_t);
24377 0 : void * * alloc_mem = &alloc_region;
24378 0 : fd_gossip_ip_addr_decode_inner_global( mem, alloc_mem, ctx );
24379 0 : return self;
24380 0 : }
24381 0 : void fd_gossip_ip_addr_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
24382 0 : fd_gossip_ip_addr_global_t * self = (fd_gossip_ip_addr_global_t *)struct_mem;
24383 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
24384 0 : fd_gossip_ip_addr_inner_decode_inner_global( &self->inner, alloc_mem, self->discriminant, ctx );
24385 0 : }
24386 3 : void fd_gossip_ip_addr_inner_new( fd_gossip_ip_addr_inner_t * self, uint discriminant ) {
24387 3 : switch( discriminant ) {
24388 0 : case 0: {
24389 0 : fd_gossip_ip4_addr_new( &self->ip4 );
24390 0 : break;
24391 0 : }
24392 0 : case 1: {
24393 0 : fd_gossip_ip6_addr_new( &self->ip6 );
24394 0 : break;
24395 0 : }
24396 3 : default: break; // FD_LOG_ERR(( "unhandled type"));
24397 3 : }
24398 3 : }
24399 3 : void fd_gossip_ip_addr_new_disc( fd_gossip_ip_addr_t * self, uint discriminant ) {
24400 3 : self->discriminant = discriminant;
24401 3 : fd_gossip_ip_addr_inner_new( &self->inner, self->discriminant );
24402 3 : }
24403 3 : void fd_gossip_ip_addr_new( fd_gossip_ip_addr_t * self ) {
24404 3 : fd_memset( self, 0, sizeof(fd_gossip_ip_addr_t) );
24405 3 : fd_gossip_ip_addr_new_disc( self, UINT_MAX );
24406 3 : }
24407 0 : void fd_gossip_ip_addr_inner_destroy( fd_gossip_ip_addr_inner_t * self, uint discriminant ) {
24408 0 : switch( discriminant ) {
24409 0 : case 0: {
24410 0 : fd_gossip_ip4_addr_destroy( &self->ip4 );
24411 0 : break;
24412 0 : }
24413 0 : case 1: {
24414 0 : fd_gossip_ip6_addr_destroy( &self->ip6 );
24415 0 : break;
24416 0 : }
24417 0 : default: break; // FD_LOG_ERR(( "unhandled type" ));
24418 0 : }
24419 0 : }
24420 0 : void fd_gossip_ip_addr_destroy( fd_gossip_ip_addr_t * self ) {
24421 0 : fd_gossip_ip_addr_inner_destroy( &self->inner, self->discriminant );
24422 0 : }
24423 :
24424 0 : ulong fd_gossip_ip_addr_footprint( void ){ return FD_GOSSIP_IP_ADDR_FOOTPRINT; }
24425 0 : ulong fd_gossip_ip_addr_align( void ){ return FD_GOSSIP_IP_ADDR_ALIGN; }
24426 :
24427 3 : void fd_gossip_ip_addr_walk( void * w, fd_gossip_ip_addr_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
24428 3 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_gossip_ip_addr", level++);
24429 3 : switch( self->discriminant ) {
24430 3 : case 0: {
24431 3 : fun( w, self, "ip4", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
24432 3 : fd_gossip_ip4_addr_walk( w, &self->inner.ip4, fun, "ip4", level );
24433 3 : break;
24434 0 : }
24435 0 : case 1: {
24436 0 : fun( w, self, "ip6", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
24437 0 : fd_gossip_ip6_addr_walk( w, &self->inner.ip6, fun, "ip6", level );
24438 0 : break;
24439 0 : }
24440 3 : }
24441 3 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_gossip_ip_addr", level-- );
24442 3 : }
24443 0 : ulong fd_gossip_ip_addr_size( fd_gossip_ip_addr_t const * self ) {
24444 0 : ulong size = 0;
24445 0 : size += sizeof(uint);
24446 0 : switch (self->discriminant) {
24447 0 : case 0: {
24448 0 : size += fd_gossip_ip4_addr_size( &self->inner.ip4 );
24449 0 : break;
24450 0 : }
24451 0 : case 1: {
24452 0 : size += fd_gossip_ip6_addr_size( &self->inner.ip6 );
24453 0 : break;
24454 0 : }
24455 0 : }
24456 0 : return size;
24457 0 : }
24458 :
24459 0 : int fd_gossip_ip_addr_inner_encode( fd_gossip_ip_addr_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
24460 0 : int err;
24461 0 : switch (discriminant) {
24462 0 : case 0: {
24463 0 : err = fd_gossip_ip4_addr_encode( &self->ip4, ctx );
24464 0 : if( FD_UNLIKELY( err ) ) return err;
24465 0 : break;
24466 0 : }
24467 0 : case 1: {
24468 0 : err = fd_gossip_ip6_addr_encode( &self->ip6, ctx );
24469 0 : if( FD_UNLIKELY( err ) ) return err;
24470 0 : break;
24471 0 : }
24472 0 : }
24473 0 : return FD_BINCODE_SUCCESS;
24474 0 : }
24475 0 : int fd_gossip_ip_addr_encode( fd_gossip_ip_addr_t const * self, fd_bincode_encode_ctx_t * ctx ) {
24476 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
24477 0 : if( FD_UNLIKELY( err ) ) return err;
24478 0 : return fd_gossip_ip_addr_inner_encode( &self->inner, self->discriminant, ctx );
24479 0 : }
24480 :
24481 0 : int fd_gossip_prune_data_encode( fd_gossip_prune_data_t const * self, fd_bincode_encode_ctx_t * ctx ) {
24482 0 : int err;
24483 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
24484 0 : if( FD_UNLIKELY( err ) ) return err;
24485 0 : err = fd_bincode_uint64_encode( self->prunes_len, ctx );
24486 0 : if( FD_UNLIKELY(err) ) return err;
24487 0 : if( self->prunes_len ) {
24488 0 : for( ulong i=0; i < self->prunes_len; i++ ) {
24489 0 : err = fd_pubkey_encode( self->prunes + i, ctx );
24490 0 : if( FD_UNLIKELY( err ) ) return err;
24491 0 : }
24492 0 : }
24493 0 : err = fd_signature_encode( &self->signature, ctx );
24494 0 : if( FD_UNLIKELY( err ) ) return err;
24495 0 : err = fd_pubkey_encode( &self->destination, ctx );
24496 0 : if( FD_UNLIKELY( err ) ) return err;
24497 0 : err = fd_bincode_uint64_encode( self->wallclock, ctx );
24498 0 : if( FD_UNLIKELY( err ) ) return err;
24499 0 : return FD_BINCODE_SUCCESS;
24500 0 : }
24501 0 : int fd_gossip_prune_data_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
24502 0 : *total_sz += sizeof(fd_gossip_prune_data_t);
24503 0 : void const * start_data = ctx->data;
24504 0 : int err = fd_gossip_prune_data_decode_footprint_inner( ctx, total_sz );
24505 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
24506 0 : ctx->data = start_data;
24507 0 : return err;
24508 0 : }
24509 0 : int fd_gossip_prune_data_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
24510 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
24511 0 : int err = 0;
24512 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
24513 0 : if( FD_UNLIKELY( err ) ) return err;
24514 0 : ulong prunes_len;
24515 0 : err = fd_bincode_uint64_decode( &prunes_len, ctx );
24516 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24517 0 : if( prunes_len ) {
24518 0 : *total_sz += FD_PUBKEY_ALIGN + FD_PUBKEY_FOOTPRINT*prunes_len;
24519 0 : for( ulong i=0; i < prunes_len; i++ ) {
24520 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
24521 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24522 0 : }
24523 0 : }
24524 0 : err = fd_signature_decode_footprint_inner( ctx, total_sz );
24525 0 : if( FD_UNLIKELY( err ) ) return err;
24526 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
24527 0 : if( FD_UNLIKELY( err ) ) return err;
24528 0 : err = fd_bincode_uint64_decode_footprint( ctx );
24529 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24530 0 : return 0;
24531 0 : }
24532 0 : void * fd_gossip_prune_data_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
24533 0 : fd_gossip_prune_data_t * self = (fd_gossip_prune_data_t *)mem;
24534 0 : fd_gossip_prune_data_new( self );
24535 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_prune_data_t);
24536 0 : void * * alloc_mem = &alloc_region;
24537 0 : fd_gossip_prune_data_decode_inner( mem, alloc_mem, ctx );
24538 0 : return self;
24539 0 : }
24540 0 : void fd_gossip_prune_data_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
24541 0 : fd_gossip_prune_data_t * self = (fd_gossip_prune_data_t *)struct_mem;
24542 0 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
24543 0 : fd_bincode_uint64_decode_unsafe( &self->prunes_len, ctx );
24544 0 : if( self->prunes_len ) {
24545 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_ALIGN );
24546 0 : self->prunes = *alloc_mem;
24547 0 : *alloc_mem = (uchar *)(*alloc_mem) + FD_PUBKEY_FOOTPRINT*self->prunes_len;
24548 0 : for( ulong i=0; i < self->prunes_len; i++ ) {
24549 0 : fd_pubkey_new( self->prunes + i );
24550 0 : fd_pubkey_decode_inner( self->prunes + i, alloc_mem, ctx );
24551 0 : }
24552 0 : } else
24553 0 : self->prunes = NULL;
24554 0 : fd_signature_decode_inner( &self->signature, alloc_mem, ctx );
24555 0 : fd_pubkey_decode_inner( &self->destination, alloc_mem, ctx );
24556 0 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
24557 0 : }
24558 0 : void * fd_gossip_prune_data_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
24559 0 : fd_gossip_prune_data_global_t * self = (fd_gossip_prune_data_global_t *)mem;
24560 0 : fd_gossip_prune_data_new( (fd_gossip_prune_data_t *)self );
24561 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_prune_data_global_t);
24562 0 : void * * alloc_mem = &alloc_region;
24563 0 : fd_gossip_prune_data_decode_inner_global( mem, alloc_mem, ctx );
24564 0 : return self;
24565 0 : }
24566 0 : void fd_gossip_prune_data_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
24567 0 : fd_gossip_prune_data_global_t * self = (fd_gossip_prune_data_global_t *)struct_mem;
24568 0 : fd_pubkey_decode_inner_global( &self->pubkey, alloc_mem, ctx );
24569 0 : fd_bincode_uint64_decode_unsafe( &self->prunes_len, ctx );
24570 0 : if( self->prunes_len ) {
24571 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_ALIGN );
24572 0 : self->prunes_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
24573 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
24574 0 : *alloc_mem = (uchar *)(*alloc_mem) + FD_PUBKEY_FOOTPRINT*self->prunes_len;
24575 0 : for( ulong i=0; i < self->prunes_len; i++ ) {
24576 0 : fd_pubkey_new( (fd_pubkey_t *)(cur_mem + FD_PUBKEY_FOOTPRINT * i) );
24577 0 : fd_pubkey_decode_inner_global( cur_mem + FD_PUBKEY_FOOTPRINT * i, alloc_mem, ctx );
24578 0 : }
24579 0 : } else
24580 0 : self->prunes_gaddr = 0UL;
24581 0 : fd_signature_decode_inner_global( &self->signature, alloc_mem, ctx );
24582 0 : fd_pubkey_decode_inner_global( &self->destination, alloc_mem, ctx );
24583 0 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
24584 0 : }
24585 0 : int fd_gossip_prune_data_convert_global_to_local( void const * global_self, fd_gossip_prune_data_t * self, fd_bincode_decode_ctx_t * ctx ) {
24586 0 : int err = 0;
24587 0 : fd_gossip_prune_data_global_t const * mem = (fd_gossip_prune_data_global_t const *)global_self;
24588 0 : err = fd_pubkey_convert_global_to_local( &mem->pubkey, &self->pubkey, ctx );
24589 0 : if( FD_UNLIKELY( err ) ) return err;
24590 0 : self->prunes_len = mem->prunes_len;
24591 0 : self->prunes = fd_wksp_laddr_fast( ctx->wksp, mem->prunes_gaddr );
24592 0 : err = fd_signature_convert_global_to_local( &mem->signature, &self->signature, ctx );
24593 0 : if( FD_UNLIKELY( err ) ) return err;
24594 0 : err = fd_pubkey_convert_global_to_local( &mem->destination, &self->destination, ctx );
24595 0 : if( FD_UNLIKELY( err ) ) return err;
24596 0 : self->wallclock = mem->wallclock;
24597 0 : return FD_BINCODE_SUCCESS;
24598 0 : }
24599 0 : void fd_gossip_prune_data_new(fd_gossip_prune_data_t * self) {
24600 0 : fd_memset( self, 0, sizeof(fd_gossip_prune_data_t) );
24601 0 : fd_pubkey_new( &self->pubkey );
24602 0 : fd_signature_new( &self->signature );
24603 0 : fd_pubkey_new( &self->destination );
24604 0 : }
24605 0 : void fd_gossip_prune_data_destroy( fd_gossip_prune_data_t * self ) {
24606 0 : fd_pubkey_destroy( &self->pubkey );
24607 0 : if( self->prunes ) {
24608 0 : for( ulong i=0; i < self->prunes_len; i++ )
24609 0 : fd_pubkey_destroy( self->prunes + i );
24610 0 : self->prunes = NULL;
24611 0 : }
24612 0 : fd_signature_destroy( &self->signature );
24613 0 : fd_pubkey_destroy( &self->destination );
24614 0 : }
24615 :
24616 0 : ulong fd_gossip_prune_data_footprint( void ){ return FD_GOSSIP_PRUNE_DATA_FOOTPRINT; }
24617 0 : ulong fd_gossip_prune_data_align( void ){ return FD_GOSSIP_PRUNE_DATA_ALIGN; }
24618 :
24619 0 : void fd_gossip_prune_data_walk( void * w, fd_gossip_prune_data_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
24620 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_prune_data", level++ );
24621 0 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level );
24622 0 : if( self->prunes_len ) {
24623 0 : fun( w, NULL, "prunes", FD_FLAMENCO_TYPE_ARR, "array", level++ );
24624 0 : for( ulong i=0; i < self->prunes_len; i++ )
24625 0 : fd_pubkey_walk(w, self->prunes + i, fun, "pubkey", level );
24626 0 : fun( w, NULL, "prunes", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
24627 0 : }
24628 0 : fd_signature_walk( w, &self->signature, fun, "signature", level );
24629 0 : fd_pubkey_walk( w, &self->destination, fun, "destination", level );
24630 0 : fun( w, &self->wallclock, "wallclock", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
24631 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_prune_data", level-- );
24632 0 : }
24633 0 : ulong fd_gossip_prune_data_size( fd_gossip_prune_data_t const * self ) {
24634 0 : ulong size = 0;
24635 0 : size += fd_pubkey_size( &self->pubkey );
24636 0 : do {
24637 0 : size += sizeof(ulong);
24638 0 : for( ulong i=0; i < self->prunes_len; i++ )
24639 0 : size += fd_pubkey_size( self->prunes + i );
24640 0 : } while(0);
24641 0 : size += fd_signature_size( &self->signature );
24642 0 : size += fd_pubkey_size( &self->destination );
24643 0 : size += sizeof(ulong);
24644 0 : return size;
24645 0 : }
24646 :
24647 0 : int fd_gossip_prune_sign_data_encode( fd_gossip_prune_sign_data_t const * self, fd_bincode_encode_ctx_t * ctx ) {
24648 0 : int err;
24649 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
24650 0 : if( FD_UNLIKELY( err ) ) return err;
24651 0 : err = fd_bincode_uint64_encode( self->prunes_len, ctx );
24652 0 : if( FD_UNLIKELY(err) ) return err;
24653 0 : if( self->prunes_len ) {
24654 0 : for( ulong i=0; i < self->prunes_len; i++ ) {
24655 0 : err = fd_pubkey_encode( self->prunes + i, ctx );
24656 0 : if( FD_UNLIKELY( err ) ) return err;
24657 0 : }
24658 0 : }
24659 0 : err = fd_pubkey_encode( &self->destination, ctx );
24660 0 : if( FD_UNLIKELY( err ) ) return err;
24661 0 : err = fd_bincode_uint64_encode( self->wallclock, ctx );
24662 0 : if( FD_UNLIKELY( err ) ) return err;
24663 0 : return FD_BINCODE_SUCCESS;
24664 0 : }
24665 0 : int fd_gossip_prune_sign_data_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
24666 0 : *total_sz += sizeof(fd_gossip_prune_sign_data_t);
24667 0 : void const * start_data = ctx->data;
24668 0 : int err = fd_gossip_prune_sign_data_decode_footprint_inner( ctx, total_sz );
24669 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
24670 0 : ctx->data = start_data;
24671 0 : return err;
24672 0 : }
24673 0 : int fd_gossip_prune_sign_data_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
24674 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
24675 0 : int err = 0;
24676 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
24677 0 : if( FD_UNLIKELY( err ) ) return err;
24678 0 : ulong prunes_len;
24679 0 : err = fd_bincode_uint64_decode( &prunes_len, ctx );
24680 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24681 0 : if( prunes_len ) {
24682 0 : *total_sz += FD_PUBKEY_ALIGN + FD_PUBKEY_FOOTPRINT*prunes_len;
24683 0 : for( ulong i=0; i < prunes_len; i++ ) {
24684 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
24685 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24686 0 : }
24687 0 : }
24688 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
24689 0 : if( FD_UNLIKELY( err ) ) return err;
24690 0 : err = fd_bincode_uint64_decode_footprint( ctx );
24691 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24692 0 : return 0;
24693 0 : }
24694 0 : void * fd_gossip_prune_sign_data_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
24695 0 : fd_gossip_prune_sign_data_t * self = (fd_gossip_prune_sign_data_t *)mem;
24696 0 : fd_gossip_prune_sign_data_new( self );
24697 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_prune_sign_data_t);
24698 0 : void * * alloc_mem = &alloc_region;
24699 0 : fd_gossip_prune_sign_data_decode_inner( mem, alloc_mem, ctx );
24700 0 : return self;
24701 0 : }
24702 0 : void fd_gossip_prune_sign_data_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
24703 0 : fd_gossip_prune_sign_data_t * self = (fd_gossip_prune_sign_data_t *)struct_mem;
24704 0 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
24705 0 : fd_bincode_uint64_decode_unsafe( &self->prunes_len, ctx );
24706 0 : if( self->prunes_len ) {
24707 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_ALIGN );
24708 0 : self->prunes = *alloc_mem;
24709 0 : *alloc_mem = (uchar *)(*alloc_mem) + FD_PUBKEY_FOOTPRINT*self->prunes_len;
24710 0 : for( ulong i=0; i < self->prunes_len; i++ ) {
24711 0 : fd_pubkey_new( self->prunes + i );
24712 0 : fd_pubkey_decode_inner( self->prunes + i, alloc_mem, ctx );
24713 0 : }
24714 0 : } else
24715 0 : self->prunes = NULL;
24716 0 : fd_pubkey_decode_inner( &self->destination, alloc_mem, ctx );
24717 0 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
24718 0 : }
24719 0 : void * fd_gossip_prune_sign_data_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
24720 0 : fd_gossip_prune_sign_data_global_t * self = (fd_gossip_prune_sign_data_global_t *)mem;
24721 0 : fd_gossip_prune_sign_data_new( (fd_gossip_prune_sign_data_t *)self );
24722 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_prune_sign_data_global_t);
24723 0 : void * * alloc_mem = &alloc_region;
24724 0 : fd_gossip_prune_sign_data_decode_inner_global( mem, alloc_mem, ctx );
24725 0 : return self;
24726 0 : }
24727 0 : void fd_gossip_prune_sign_data_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
24728 0 : fd_gossip_prune_sign_data_global_t * self = (fd_gossip_prune_sign_data_global_t *)struct_mem;
24729 0 : fd_pubkey_decode_inner_global( &self->pubkey, alloc_mem, ctx );
24730 0 : fd_bincode_uint64_decode_unsafe( &self->prunes_len, ctx );
24731 0 : if( self->prunes_len ) {
24732 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_ALIGN );
24733 0 : self->prunes_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
24734 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
24735 0 : *alloc_mem = (uchar *)(*alloc_mem) + FD_PUBKEY_FOOTPRINT*self->prunes_len;
24736 0 : for( ulong i=0; i < self->prunes_len; i++ ) {
24737 0 : fd_pubkey_new( (fd_pubkey_t *)(cur_mem + FD_PUBKEY_FOOTPRINT * i) );
24738 0 : fd_pubkey_decode_inner_global( cur_mem + FD_PUBKEY_FOOTPRINT * i, alloc_mem, ctx );
24739 0 : }
24740 0 : } else
24741 0 : self->prunes_gaddr = 0UL;
24742 0 : fd_pubkey_decode_inner_global( &self->destination, alloc_mem, ctx );
24743 0 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
24744 0 : }
24745 0 : int fd_gossip_prune_sign_data_convert_global_to_local( void const * global_self, fd_gossip_prune_sign_data_t * self, fd_bincode_decode_ctx_t * ctx ) {
24746 0 : int err = 0;
24747 0 : fd_gossip_prune_sign_data_global_t const * mem = (fd_gossip_prune_sign_data_global_t const *)global_self;
24748 0 : err = fd_pubkey_convert_global_to_local( &mem->pubkey, &self->pubkey, ctx );
24749 0 : if( FD_UNLIKELY( err ) ) return err;
24750 0 : self->prunes_len = mem->prunes_len;
24751 0 : self->prunes = fd_wksp_laddr_fast( ctx->wksp, mem->prunes_gaddr );
24752 0 : err = fd_pubkey_convert_global_to_local( &mem->destination, &self->destination, ctx );
24753 0 : if( FD_UNLIKELY( err ) ) return err;
24754 0 : self->wallclock = mem->wallclock;
24755 0 : return FD_BINCODE_SUCCESS;
24756 0 : }
24757 0 : void fd_gossip_prune_sign_data_new(fd_gossip_prune_sign_data_t * self) {
24758 0 : fd_memset( self, 0, sizeof(fd_gossip_prune_sign_data_t) );
24759 0 : fd_pubkey_new( &self->pubkey );
24760 0 : fd_pubkey_new( &self->destination );
24761 0 : }
24762 0 : void fd_gossip_prune_sign_data_destroy( fd_gossip_prune_sign_data_t * self ) {
24763 0 : fd_pubkey_destroy( &self->pubkey );
24764 0 : if( self->prunes ) {
24765 0 : for( ulong i=0; i < self->prunes_len; i++ )
24766 0 : fd_pubkey_destroy( self->prunes + i );
24767 0 : self->prunes = NULL;
24768 0 : }
24769 0 : fd_pubkey_destroy( &self->destination );
24770 0 : }
24771 :
24772 0 : ulong fd_gossip_prune_sign_data_footprint( void ){ return FD_GOSSIP_PRUNE_SIGN_DATA_FOOTPRINT; }
24773 0 : ulong fd_gossip_prune_sign_data_align( void ){ return FD_GOSSIP_PRUNE_SIGN_DATA_ALIGN; }
24774 :
24775 0 : void fd_gossip_prune_sign_data_walk( void * w, fd_gossip_prune_sign_data_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
24776 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_prune_sign_data", level++ );
24777 0 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level );
24778 0 : if( self->prunes_len ) {
24779 0 : fun( w, NULL, "prunes", FD_FLAMENCO_TYPE_ARR, "array", level++ );
24780 0 : for( ulong i=0; i < self->prunes_len; i++ )
24781 0 : fd_pubkey_walk(w, self->prunes + i, fun, "pubkey", level );
24782 0 : fun( w, NULL, "prunes", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
24783 0 : }
24784 0 : fd_pubkey_walk( w, &self->destination, fun, "destination", level );
24785 0 : fun( w, &self->wallclock, "wallclock", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
24786 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_prune_sign_data", level-- );
24787 0 : }
24788 0 : ulong fd_gossip_prune_sign_data_size( fd_gossip_prune_sign_data_t const * self ) {
24789 0 : ulong size = 0;
24790 0 : size += fd_pubkey_size( &self->pubkey );
24791 0 : do {
24792 0 : size += sizeof(ulong);
24793 0 : for( ulong i=0; i < self->prunes_len; i++ )
24794 0 : size += fd_pubkey_size( self->prunes + i );
24795 0 : } while(0);
24796 0 : size += fd_pubkey_size( &self->destination );
24797 0 : size += sizeof(ulong);
24798 0 : return size;
24799 0 : }
24800 :
24801 0 : int fd_gossip_prune_sign_data_with_prefix_encode( fd_gossip_prune_sign_data_with_prefix_t const * self, fd_bincode_encode_ctx_t * ctx ) {
24802 0 : int err;
24803 0 : err = fd_bincode_uint64_encode( self->prefix_len, ctx );
24804 0 : if( FD_UNLIKELY(err) ) return err;
24805 0 : if( self->prefix_len ) {
24806 0 : err = fd_bincode_bytes_encode( self->prefix, self->prefix_len, ctx );
24807 0 : if( FD_UNLIKELY( err ) ) return err;
24808 0 : }
24809 0 : err = fd_gossip_prune_sign_data_encode( &self->data, ctx );
24810 0 : if( FD_UNLIKELY( err ) ) return err;
24811 0 : return FD_BINCODE_SUCCESS;
24812 0 : }
24813 0 : int fd_gossip_prune_sign_data_with_prefix_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
24814 0 : *total_sz += sizeof(fd_gossip_prune_sign_data_with_prefix_t);
24815 0 : void const * start_data = ctx->data;
24816 0 : int err = fd_gossip_prune_sign_data_with_prefix_decode_footprint_inner( ctx, total_sz );
24817 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
24818 0 : ctx->data = start_data;
24819 0 : return err;
24820 0 : }
24821 0 : int fd_gossip_prune_sign_data_with_prefix_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
24822 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
24823 0 : int err = 0;
24824 0 : ulong prefix_len;
24825 0 : err = fd_bincode_uint64_decode( &prefix_len, ctx );
24826 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24827 0 : *total_sz += prefix_len;
24828 0 : if( prefix_len ) {
24829 0 : err = fd_bincode_bytes_decode_footprint( prefix_len, ctx );
24830 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24831 0 : err = !fd_utf8_verify( (char const *) ctx->data - prefix_len, prefix_len );
24832 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24833 0 : }
24834 0 : err = fd_gossip_prune_sign_data_decode_footprint_inner( ctx, total_sz );
24835 0 : if( FD_UNLIKELY( err ) ) return err;
24836 0 : return 0;
24837 0 : }
24838 0 : void * fd_gossip_prune_sign_data_with_prefix_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
24839 0 : fd_gossip_prune_sign_data_with_prefix_t * self = (fd_gossip_prune_sign_data_with_prefix_t *)mem;
24840 0 : fd_gossip_prune_sign_data_with_prefix_new( self );
24841 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_prune_sign_data_with_prefix_t);
24842 0 : void * * alloc_mem = &alloc_region;
24843 0 : fd_gossip_prune_sign_data_with_prefix_decode_inner( mem, alloc_mem, ctx );
24844 0 : return self;
24845 0 : }
24846 0 : void fd_gossip_prune_sign_data_with_prefix_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
24847 0 : fd_gossip_prune_sign_data_with_prefix_t * self = (fd_gossip_prune_sign_data_with_prefix_t *)struct_mem;
24848 0 : fd_bincode_uint64_decode_unsafe( &self->prefix_len, ctx );
24849 0 : if( self->prefix_len ) {
24850 0 : self->prefix = *alloc_mem;
24851 0 : fd_bincode_bytes_decode_unsafe( self->prefix, self->prefix_len, ctx );
24852 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->prefix_len;
24853 0 : } else
24854 0 : self->prefix = NULL;
24855 0 : fd_gossip_prune_sign_data_decode_inner( &self->data, alloc_mem, ctx );
24856 0 : }
24857 0 : void * fd_gossip_prune_sign_data_with_prefix_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
24858 0 : fd_gossip_prune_sign_data_with_prefix_global_t * self = (fd_gossip_prune_sign_data_with_prefix_global_t *)mem;
24859 0 : fd_gossip_prune_sign_data_with_prefix_new( (fd_gossip_prune_sign_data_with_prefix_t *)self );
24860 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_prune_sign_data_with_prefix_global_t);
24861 0 : void * * alloc_mem = &alloc_region;
24862 0 : fd_gossip_prune_sign_data_with_prefix_decode_inner_global( mem, alloc_mem, ctx );
24863 0 : return self;
24864 0 : }
24865 0 : void fd_gossip_prune_sign_data_with_prefix_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
24866 0 : fd_gossip_prune_sign_data_with_prefix_global_t * self = (fd_gossip_prune_sign_data_with_prefix_global_t *)struct_mem;
24867 0 : fd_bincode_uint64_decode_unsafe( &self->prefix_len, ctx );
24868 0 : if( self->prefix_len ) {
24869 0 : self->prefix_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
24870 0 : fd_bincode_bytes_decode_unsafe( *alloc_mem, self->prefix_len, ctx );
24871 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->prefix_len;
24872 0 : } else
24873 0 : self->prefix_gaddr = 0UL;
24874 0 : fd_gossip_prune_sign_data_decode_inner_global( &self->data, alloc_mem, ctx );
24875 0 : }
24876 0 : int fd_gossip_prune_sign_data_with_prefix_convert_global_to_local( void const * global_self, fd_gossip_prune_sign_data_with_prefix_t * self, fd_bincode_decode_ctx_t * ctx ) {
24877 0 : int err = 0;
24878 0 : fd_gossip_prune_sign_data_with_prefix_global_t const * mem = (fd_gossip_prune_sign_data_with_prefix_global_t const *)global_self;
24879 0 : self->prefix_len = mem->prefix_len;
24880 0 : self->prefix = fd_wksp_laddr_fast( ctx->wksp, mem->prefix_gaddr );
24881 0 : err = fd_gossip_prune_sign_data_convert_global_to_local( &mem->data, &self->data, ctx );
24882 0 : if( FD_UNLIKELY( err ) ) return err;
24883 0 : return FD_BINCODE_SUCCESS;
24884 0 : }
24885 0 : void fd_gossip_prune_sign_data_with_prefix_new(fd_gossip_prune_sign_data_with_prefix_t * self) {
24886 0 : fd_memset( self, 0, sizeof(fd_gossip_prune_sign_data_with_prefix_t) );
24887 0 : fd_gossip_prune_sign_data_new( &self->data );
24888 0 : }
24889 0 : void fd_gossip_prune_sign_data_with_prefix_destroy( fd_gossip_prune_sign_data_with_prefix_t * self ) {
24890 0 : if( self->prefix ) {
24891 0 : self->prefix = NULL;
24892 0 : }
24893 0 : fd_gossip_prune_sign_data_destroy( &self->data );
24894 0 : }
24895 :
24896 0 : ulong fd_gossip_prune_sign_data_with_prefix_footprint( void ){ return FD_GOSSIP_PRUNE_SIGN_DATA_WITH_PREFIX_FOOTPRINT; }
24897 0 : ulong fd_gossip_prune_sign_data_with_prefix_align( void ){ return FD_GOSSIP_PRUNE_SIGN_DATA_WITH_PREFIX_ALIGN; }
24898 :
24899 0 : void fd_gossip_prune_sign_data_with_prefix_walk( void * w, fd_gossip_prune_sign_data_with_prefix_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
24900 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_prune_sign_data_with_prefix", level++ );
24901 0 : fun(w, self->prefix, "prefix", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
24902 0 : fd_gossip_prune_sign_data_walk( w, &self->data, fun, "data", level );
24903 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_prune_sign_data_with_prefix", level-- );
24904 0 : }
24905 0 : ulong fd_gossip_prune_sign_data_with_prefix_size( fd_gossip_prune_sign_data_with_prefix_t const * self ) {
24906 0 : ulong size = 0;
24907 0 : do {
24908 0 : size += sizeof(ulong);
24909 0 : size += self->prefix_len;
24910 0 : } while(0);
24911 0 : size += fd_gossip_prune_sign_data_size( &self->data );
24912 0 : return size;
24913 0 : }
24914 :
24915 0 : int fd_gossip_socket_addr_old_encode( fd_gossip_socket_addr_old_t const * self, fd_bincode_encode_ctx_t * ctx ) {
24916 0 : int err;
24917 0 : err = fd_gossip_ip_addr_encode( &self->addr, ctx );
24918 0 : if( FD_UNLIKELY( err ) ) return err;
24919 0 : err = fd_bincode_uint16_encode( self->port, ctx );
24920 0 : if( FD_UNLIKELY( err ) ) return err;
24921 0 : return FD_BINCODE_SUCCESS;
24922 0 : }
24923 0 : int fd_gossip_socket_addr_old_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
24924 0 : *total_sz += sizeof(fd_gossip_socket_addr_old_t);
24925 0 : void const * start_data = ctx->data;
24926 0 : int err = fd_gossip_socket_addr_old_decode_footprint_inner( ctx, total_sz );
24927 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
24928 0 : ctx->data = start_data;
24929 0 : return err;
24930 0 : }
24931 0 : int fd_gossip_socket_addr_old_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
24932 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
24933 0 : int err = 0;
24934 0 : err = fd_gossip_ip_addr_decode_footprint_inner( ctx, total_sz );
24935 0 : if( FD_UNLIKELY( err ) ) return err;
24936 0 : err = fd_bincode_uint16_decode_footprint( ctx );
24937 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24938 0 : return 0;
24939 0 : }
24940 0 : void * fd_gossip_socket_addr_old_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
24941 0 : fd_gossip_socket_addr_old_t * self = (fd_gossip_socket_addr_old_t *)mem;
24942 0 : fd_gossip_socket_addr_old_new( self );
24943 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_socket_addr_old_t);
24944 0 : void * * alloc_mem = &alloc_region;
24945 0 : fd_gossip_socket_addr_old_decode_inner( mem, alloc_mem, ctx );
24946 0 : return self;
24947 0 : }
24948 0 : void fd_gossip_socket_addr_old_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
24949 0 : fd_gossip_socket_addr_old_t * self = (fd_gossip_socket_addr_old_t *)struct_mem;
24950 0 : fd_gossip_ip_addr_decode_inner( &self->addr, alloc_mem, ctx );
24951 0 : fd_bincode_uint16_decode_unsafe( &self->port, ctx );
24952 0 : }
24953 0 : void * fd_gossip_socket_addr_old_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
24954 0 : fd_gossip_socket_addr_old_global_t * self = (fd_gossip_socket_addr_old_global_t *)mem;
24955 0 : fd_gossip_socket_addr_old_new( (fd_gossip_socket_addr_old_t *)self );
24956 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_socket_addr_old_global_t);
24957 0 : void * * alloc_mem = &alloc_region;
24958 0 : fd_gossip_socket_addr_old_decode_inner_global( mem, alloc_mem, ctx );
24959 0 : return self;
24960 0 : }
24961 0 : void fd_gossip_socket_addr_old_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
24962 0 : fd_gossip_socket_addr_old_global_t * self = (fd_gossip_socket_addr_old_global_t *)struct_mem;
24963 0 : fd_gossip_ip_addr_decode_inner_global( &self->addr, alloc_mem, ctx );
24964 0 : fd_bincode_uint16_decode_unsafe( &self->port, ctx );
24965 0 : }
24966 0 : int fd_gossip_socket_addr_old_convert_global_to_local( void const * global_self, fd_gossip_socket_addr_old_t * self, fd_bincode_decode_ctx_t * ctx ) {
24967 0 : int err = 0;
24968 0 : fd_gossip_socket_addr_old_global_t const * mem = (fd_gossip_socket_addr_old_global_t const *)global_self;
24969 0 : err = fd_gossip_ip_addr_convert_global_to_local( &mem->addr, &self->addr, ctx );
24970 0 : if( FD_UNLIKELY( err ) ) return err;
24971 0 : self->port = mem->port;
24972 0 : return FD_BINCODE_SUCCESS;
24973 0 : }
24974 0 : void fd_gossip_socket_addr_old_new(fd_gossip_socket_addr_old_t * self) {
24975 0 : fd_memset( self, 0, sizeof(fd_gossip_socket_addr_old_t) );
24976 0 : fd_gossip_ip_addr_new( &self->addr );
24977 0 : }
24978 0 : void fd_gossip_socket_addr_old_destroy( fd_gossip_socket_addr_old_t * self ) {
24979 0 : fd_gossip_ip_addr_destroy( &self->addr );
24980 0 : }
24981 :
24982 0 : ulong fd_gossip_socket_addr_old_footprint( void ){ return FD_GOSSIP_SOCKET_ADDR_OLD_FOOTPRINT; }
24983 0 : ulong fd_gossip_socket_addr_old_align( void ){ return FD_GOSSIP_SOCKET_ADDR_OLD_ALIGN; }
24984 :
24985 0 : void fd_gossip_socket_addr_old_walk( void * w, fd_gossip_socket_addr_old_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
24986 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_socket_addr_old", level++ );
24987 0 : fd_gossip_ip_addr_walk( w, &self->addr, fun, "addr", level );
24988 0 : fun( w, &self->port, "port", FD_FLAMENCO_TYPE_USHORT, "ushort", level );
24989 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_socket_addr_old", level-- );
24990 0 : }
24991 0 : ulong fd_gossip_socket_addr_old_size( fd_gossip_socket_addr_old_t const * self ) {
24992 0 : ulong size = 0;
24993 0 : size += fd_gossip_ip_addr_size( &self->addr );
24994 0 : size += sizeof(ushort);
24995 0 : return size;
24996 0 : }
24997 :
24998 0 : int fd_gossip_socket_addr_ip4_encode( fd_gossip_socket_addr_ip4_t const * self, fd_bincode_encode_ctx_t * ctx ) {
24999 0 : int err;
25000 0 : err = fd_gossip_ip4_addr_encode( &self->addr, ctx );
25001 0 : if( FD_UNLIKELY( err ) ) return err;
25002 0 : err = fd_bincode_uint16_encode( self->port, ctx );
25003 0 : if( FD_UNLIKELY( err ) ) return err;
25004 0 : return FD_BINCODE_SUCCESS;
25005 0 : }
25006 0 : int fd_gossip_socket_addr_ip4_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
25007 0 : *total_sz += sizeof(fd_gossip_socket_addr_ip4_t);
25008 0 : void const * start_data = ctx->data;
25009 0 : int err = fd_gossip_socket_addr_ip4_decode_footprint_inner( ctx, total_sz );
25010 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
25011 0 : ctx->data = start_data;
25012 0 : return err;
25013 0 : }
25014 90 : int fd_gossip_socket_addr_ip4_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
25015 90 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
25016 90 : int err = 0;
25017 90 : err = fd_gossip_ip4_addr_decode_footprint_inner( ctx, total_sz );
25018 90 : if( FD_UNLIKELY( err ) ) return err;
25019 90 : err = fd_bincode_uint16_decode_footprint( ctx );
25020 90 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25021 90 : return 0;
25022 90 : }
25023 0 : void * fd_gossip_socket_addr_ip4_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
25024 0 : fd_gossip_socket_addr_ip4_t * self = (fd_gossip_socket_addr_ip4_t *)mem;
25025 0 : fd_gossip_socket_addr_ip4_new( self );
25026 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_socket_addr_ip4_t);
25027 0 : void * * alloc_mem = &alloc_region;
25028 0 : fd_gossip_socket_addr_ip4_decode_inner( mem, alloc_mem, ctx );
25029 0 : return self;
25030 0 : }
25031 90 : void fd_gossip_socket_addr_ip4_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
25032 90 : fd_gossip_socket_addr_ip4_t * self = (fd_gossip_socket_addr_ip4_t *)struct_mem;
25033 90 : fd_gossip_ip4_addr_decode_inner( &self->addr, alloc_mem, ctx );
25034 90 : fd_bincode_uint16_decode_unsafe( &self->port, ctx );
25035 90 : }
25036 0 : void * fd_gossip_socket_addr_ip4_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
25037 0 : fd_gossip_socket_addr_ip4_global_t * self = (fd_gossip_socket_addr_ip4_global_t *)mem;
25038 0 : fd_gossip_socket_addr_ip4_new( (fd_gossip_socket_addr_ip4_t *)self );
25039 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_socket_addr_ip4_global_t);
25040 0 : void * * alloc_mem = &alloc_region;
25041 0 : fd_gossip_socket_addr_ip4_decode_inner_global( mem, alloc_mem, ctx );
25042 0 : return self;
25043 0 : }
25044 0 : void fd_gossip_socket_addr_ip4_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
25045 0 : fd_gossip_socket_addr_ip4_global_t * self = (fd_gossip_socket_addr_ip4_global_t *)struct_mem;
25046 0 : fd_gossip_ip4_addr_decode_inner_global( &self->addr, alloc_mem, ctx );
25047 0 : fd_bincode_uint16_decode_unsafe( &self->port, ctx );
25048 0 : }
25049 0 : int fd_gossip_socket_addr_ip4_convert_global_to_local( void const * global_self, fd_gossip_socket_addr_ip4_t * self, fd_bincode_decode_ctx_t * ctx ) {
25050 0 : int err = 0;
25051 0 : fd_gossip_socket_addr_ip4_global_t const * mem = (fd_gossip_socket_addr_ip4_global_t const *)global_self;
25052 0 : err = fd_gossip_ip4_addr_convert_global_to_local( &mem->addr, &self->addr, ctx );
25053 0 : if( FD_UNLIKELY( err ) ) return err;
25054 0 : self->port = mem->port;
25055 0 : return FD_BINCODE_SUCCESS;
25056 0 : }
25057 0 : void fd_gossip_socket_addr_ip4_new(fd_gossip_socket_addr_ip4_t * self) {
25058 0 : fd_memset( self, 0, sizeof(fd_gossip_socket_addr_ip4_t) );
25059 0 : fd_gossip_ip4_addr_new( &self->addr );
25060 0 : }
25061 0 : void fd_gossip_socket_addr_ip4_destroy( fd_gossip_socket_addr_ip4_t * self ) {
25062 0 : fd_gossip_ip4_addr_destroy( &self->addr );
25063 0 : }
25064 :
25065 0 : ulong fd_gossip_socket_addr_ip4_footprint( void ){ return FD_GOSSIP_SOCKET_ADDR_IP4_FOOTPRINT; }
25066 0 : ulong fd_gossip_socket_addr_ip4_align( void ){ return FD_GOSSIP_SOCKET_ADDR_IP4_ALIGN; }
25067 :
25068 90 : void fd_gossip_socket_addr_ip4_walk( void * w, fd_gossip_socket_addr_ip4_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
25069 90 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_socket_addr_ip4", level++ );
25070 90 : fd_gossip_ip4_addr_walk( w, &self->addr, fun, "addr", level );
25071 90 : fun( w, &self->port, "port", FD_FLAMENCO_TYPE_USHORT, "ushort", level );
25072 90 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_socket_addr_ip4", level-- );
25073 90 : }
25074 0 : ulong fd_gossip_socket_addr_ip4_size( fd_gossip_socket_addr_ip4_t const * self ) {
25075 0 : ulong size = 0;
25076 0 : size += fd_gossip_ip4_addr_size( &self->addr );
25077 0 : size += sizeof(ushort);
25078 0 : return size;
25079 0 : }
25080 :
25081 0 : int fd_gossip_socket_addr_ip6_encode( fd_gossip_socket_addr_ip6_t const * self, fd_bincode_encode_ctx_t * ctx ) {
25082 0 : int err;
25083 0 : err = fd_gossip_ip6_addr_encode( &self->addr, ctx );
25084 0 : if( FD_UNLIKELY( err ) ) return err;
25085 0 : err = fd_bincode_uint16_encode( self->port, ctx );
25086 0 : if( FD_UNLIKELY( err ) ) return err;
25087 0 : err = fd_bincode_uint32_encode( self->flowinfo, ctx );
25088 0 : if( FD_UNLIKELY( err ) ) return err;
25089 0 : err = fd_bincode_uint32_encode( self->scope_id, ctx );
25090 0 : if( FD_UNLIKELY( err ) ) return err;
25091 0 : return FD_BINCODE_SUCCESS;
25092 0 : }
25093 0 : int fd_gossip_socket_addr_ip6_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
25094 0 : *total_sz += sizeof(fd_gossip_socket_addr_ip6_t);
25095 0 : void const * start_data = ctx->data;
25096 0 : int err = fd_gossip_socket_addr_ip6_decode_footprint_inner( ctx, total_sz );
25097 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
25098 0 : ctx->data = start_data;
25099 0 : return err;
25100 0 : }
25101 0 : int fd_gossip_socket_addr_ip6_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
25102 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
25103 0 : int err = 0;
25104 0 : err = fd_gossip_ip6_addr_decode_footprint_inner( ctx, total_sz );
25105 0 : if( FD_UNLIKELY( err ) ) return err;
25106 0 : err = fd_bincode_uint16_decode_footprint( ctx );
25107 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25108 0 : err = fd_bincode_uint32_decode_footprint( ctx );
25109 0 : if( FD_UNLIKELY( err ) ) return err;
25110 0 : err = fd_bincode_uint32_decode_footprint( ctx );
25111 0 : if( FD_UNLIKELY( err ) ) return err;
25112 0 : return 0;
25113 0 : }
25114 0 : void * fd_gossip_socket_addr_ip6_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
25115 0 : fd_gossip_socket_addr_ip6_t * self = (fd_gossip_socket_addr_ip6_t *)mem;
25116 0 : fd_gossip_socket_addr_ip6_new( self );
25117 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_socket_addr_ip6_t);
25118 0 : void * * alloc_mem = &alloc_region;
25119 0 : fd_gossip_socket_addr_ip6_decode_inner( mem, alloc_mem, ctx );
25120 0 : return self;
25121 0 : }
25122 0 : void fd_gossip_socket_addr_ip6_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
25123 0 : fd_gossip_socket_addr_ip6_t * self = (fd_gossip_socket_addr_ip6_t *)struct_mem;
25124 0 : fd_gossip_ip6_addr_decode_inner( &self->addr, alloc_mem, ctx );
25125 0 : fd_bincode_uint16_decode_unsafe( &self->port, ctx );
25126 0 : fd_bincode_uint32_decode_unsafe( &self->flowinfo, ctx );
25127 0 : fd_bincode_uint32_decode_unsafe( &self->scope_id, ctx );
25128 0 : }
25129 0 : void * fd_gossip_socket_addr_ip6_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
25130 0 : fd_gossip_socket_addr_ip6_global_t * self = (fd_gossip_socket_addr_ip6_global_t *)mem;
25131 0 : fd_gossip_socket_addr_ip6_new( (fd_gossip_socket_addr_ip6_t *)self );
25132 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_socket_addr_ip6_global_t);
25133 0 : void * * alloc_mem = &alloc_region;
25134 0 : fd_gossip_socket_addr_ip6_decode_inner_global( mem, alloc_mem, ctx );
25135 0 : return self;
25136 0 : }
25137 0 : void fd_gossip_socket_addr_ip6_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
25138 0 : fd_gossip_socket_addr_ip6_global_t * self = (fd_gossip_socket_addr_ip6_global_t *)struct_mem;
25139 0 : fd_gossip_ip6_addr_decode_inner_global( &self->addr, alloc_mem, ctx );
25140 0 : fd_bincode_uint16_decode_unsafe( &self->port, ctx );
25141 0 : fd_bincode_uint32_decode_unsafe( &self->flowinfo, ctx );
25142 0 : fd_bincode_uint32_decode_unsafe( &self->scope_id, ctx );
25143 0 : }
25144 0 : int fd_gossip_socket_addr_ip6_convert_global_to_local( void const * global_self, fd_gossip_socket_addr_ip6_t * self, fd_bincode_decode_ctx_t * ctx ) {
25145 0 : int err = 0;
25146 0 : fd_gossip_socket_addr_ip6_global_t const * mem = (fd_gossip_socket_addr_ip6_global_t const *)global_self;
25147 0 : err = fd_gossip_ip6_addr_convert_global_to_local( &mem->addr, &self->addr, ctx );
25148 0 : if( FD_UNLIKELY( err ) ) return err;
25149 0 : self->port = mem->port;
25150 0 : self->flowinfo = mem->flowinfo;
25151 0 : self->scope_id = mem->scope_id;
25152 0 : return FD_BINCODE_SUCCESS;
25153 0 : }
25154 0 : void fd_gossip_socket_addr_ip6_new(fd_gossip_socket_addr_ip6_t * self) {
25155 0 : fd_memset( self, 0, sizeof(fd_gossip_socket_addr_ip6_t) );
25156 0 : fd_gossip_ip6_addr_new( &self->addr );
25157 0 : }
25158 0 : void fd_gossip_socket_addr_ip6_destroy( fd_gossip_socket_addr_ip6_t * self ) {
25159 0 : fd_gossip_ip6_addr_destroy( &self->addr );
25160 0 : }
25161 :
25162 0 : ulong fd_gossip_socket_addr_ip6_footprint( void ){ return FD_GOSSIP_SOCKET_ADDR_IP6_FOOTPRINT; }
25163 0 : ulong fd_gossip_socket_addr_ip6_align( void ){ return FD_GOSSIP_SOCKET_ADDR_IP6_ALIGN; }
25164 :
25165 0 : void fd_gossip_socket_addr_ip6_walk( void * w, fd_gossip_socket_addr_ip6_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
25166 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_socket_addr_ip6", level++ );
25167 0 : fd_gossip_ip6_addr_walk( w, &self->addr, fun, "addr", level );
25168 0 : fun( w, &self->port, "port", FD_FLAMENCO_TYPE_USHORT, "ushort", level );
25169 0 : fun( w, &self->flowinfo, "flowinfo", FD_FLAMENCO_TYPE_UINT, "uint", level );
25170 0 : fun( w, &self->scope_id, "scope_id", FD_FLAMENCO_TYPE_UINT, "uint", level );
25171 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_socket_addr_ip6", level-- );
25172 0 : }
25173 0 : ulong fd_gossip_socket_addr_ip6_size( fd_gossip_socket_addr_ip6_t const * self ) {
25174 0 : ulong size = 0;
25175 0 : size += fd_gossip_ip6_addr_size( &self->addr );
25176 0 : size += sizeof(ushort);
25177 0 : size += sizeof(uint);
25178 0 : size += sizeof(uint);
25179 0 : return size;
25180 0 : }
25181 :
25182 0 : FD_FN_PURE uchar fd_gossip_socket_addr_is_ip4(fd_gossip_socket_addr_t const * self) {
25183 0 : return self->discriminant == 0;
25184 0 : }
25185 0 : FD_FN_PURE uchar fd_gossip_socket_addr_is_ip6(fd_gossip_socket_addr_t const * self) {
25186 0 : return self->discriminant == 1;
25187 0 : }
25188 : void fd_gossip_socket_addr_inner_new( fd_gossip_socket_addr_inner_t * self, uint discriminant );
25189 90 : int fd_gossip_socket_addr_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
25190 90 : int err;
25191 90 : switch (discriminant) {
25192 90 : case 0: {
25193 90 : err = fd_gossip_socket_addr_ip4_decode_footprint_inner( ctx, total_sz );
25194 90 : if( FD_UNLIKELY( err ) ) return err;
25195 90 : return FD_BINCODE_SUCCESS;
25196 90 : }
25197 0 : case 1: {
25198 0 : err = fd_gossip_socket_addr_ip6_decode_footprint_inner( ctx, total_sz );
25199 0 : if( FD_UNLIKELY( err ) ) return err;
25200 0 : return FD_BINCODE_SUCCESS;
25201 0 : }
25202 0 : default: return FD_BINCODE_ERR_ENCODING;
25203 90 : }
25204 90 : }
25205 0 : int fd_gossip_socket_addr_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
25206 0 : *total_sz += sizeof(fd_gossip_socket_addr_t);
25207 0 : void const * start_data = ctx->data;
25208 0 : int err = fd_gossip_socket_addr_decode_footprint_inner( ctx, total_sz );
25209 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
25210 0 : ctx->data = start_data;
25211 0 : return err;
25212 0 : }
25213 90 : int fd_gossip_socket_addr_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
25214 90 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
25215 90 : uint discriminant = 0;
25216 90 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
25217 90 : if( FD_UNLIKELY( err ) ) return err;
25218 90 : return fd_gossip_socket_addr_inner_decode_footprint( discriminant, ctx, total_sz );
25219 90 : }
25220 90 : void fd_gossip_socket_addr_inner_decode_inner( fd_gossip_socket_addr_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
25221 90 : switch (discriminant) {
25222 90 : case 0: {
25223 90 : fd_gossip_socket_addr_ip4_decode_inner( &self->ip4, alloc_mem, ctx );
25224 90 : break;
25225 0 : }
25226 0 : case 1: {
25227 0 : fd_gossip_socket_addr_ip6_decode_inner( &self->ip6, alloc_mem, ctx );
25228 0 : break;
25229 0 : }
25230 90 : }
25231 90 : }
25232 0 : void fd_gossip_socket_addr_inner_decode_inner_global( fd_gossip_socket_addr_inner_global_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
25233 0 : switch (discriminant) {
25234 0 : case 0: {
25235 0 : fd_gossip_socket_addr_ip4_decode_inner_global( &self->ip4, alloc_mem, ctx );
25236 0 : break;
25237 0 : }
25238 0 : case 1: {
25239 0 : fd_gossip_socket_addr_ip6_decode_inner_global( &self->ip6, alloc_mem, ctx );
25240 0 : break;
25241 0 : }
25242 0 : }
25243 0 : }
25244 0 : int fd_gossip_socket_addr_convert_global_to_local_inner( fd_gossip_socket_addr_inner_global_t const * mem, fd_gossip_socket_addr_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
25245 0 : int err = 0;
25246 0 : switch( discriminant ) {
25247 0 : case 0: {
25248 0 : err = fd_gossip_socket_addr_ip4_convert_global_to_local( &mem->ip4, &self->ip4, ctx );
25249 0 : if( FD_UNLIKELY( err ) ) return err;
25250 0 : break;
25251 0 : }
25252 0 : case 1: {
25253 0 : err = fd_gossip_socket_addr_ip6_convert_global_to_local( &mem->ip6, &self->ip6, ctx );
25254 0 : if( FD_UNLIKELY( err ) ) return err;
25255 0 : break;
25256 0 : }
25257 0 : }
25258 0 : return FD_BINCODE_SUCCESS;
25259 0 : }
25260 0 : int fd_gossip_socket_addr_convert_global_to_local( void const * global_self, fd_gossip_socket_addr_t * self, fd_bincode_decode_ctx_t * ctx ) {
25261 0 : fd_gossip_socket_addr_global_t const * mem = (fd_gossip_socket_addr_global_t const *)global_self;
25262 0 : uint discriminant = mem->discriminant;
25263 0 : self->discriminant = mem->discriminant;
25264 0 : int err = fd_gossip_socket_addr_convert_global_to_local_inner( &mem->inner, &self->inner, discriminant, ctx );
25265 0 : return FD_BINCODE_SUCCESS;
25266 0 : }
25267 90 : void fd_gossip_socket_addr_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
25268 90 : fd_gossip_socket_addr_t * self = (fd_gossip_socket_addr_t *)struct_mem;
25269 90 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
25270 90 : fd_gossip_socket_addr_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
25271 90 : }
25272 0 : void * fd_gossip_socket_addr_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
25273 0 : fd_gossip_socket_addr_t * self = (fd_gossip_socket_addr_t *)mem;
25274 0 : fd_gossip_socket_addr_new( self );
25275 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_socket_addr_t);
25276 0 : void * * alloc_mem = &alloc_region;
25277 0 : fd_gossip_socket_addr_decode_inner( mem, alloc_mem, ctx );
25278 0 : return self;
25279 0 : }
25280 0 : void * fd_gossip_socket_addr_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
25281 0 : fd_gossip_socket_addr_t * self = (fd_gossip_socket_addr_t *)mem;
25282 0 : fd_gossip_socket_addr_new( self );
25283 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_socket_addr_t);
25284 0 : void * * alloc_mem = &alloc_region;
25285 0 : fd_gossip_socket_addr_decode_inner_global( mem, alloc_mem, ctx );
25286 0 : return self;
25287 0 : }
25288 0 : void fd_gossip_socket_addr_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
25289 0 : fd_gossip_socket_addr_global_t * self = (fd_gossip_socket_addr_global_t *)struct_mem;
25290 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
25291 0 : fd_gossip_socket_addr_inner_decode_inner_global( &self->inner, alloc_mem, self->discriminant, ctx );
25292 0 : }
25293 0 : void fd_gossip_socket_addr_inner_new( fd_gossip_socket_addr_inner_t * self, uint discriminant ) {
25294 0 : switch( discriminant ) {
25295 0 : case 0: {
25296 0 : fd_gossip_socket_addr_ip4_new( &self->ip4 );
25297 0 : break;
25298 0 : }
25299 0 : case 1: {
25300 0 : fd_gossip_socket_addr_ip6_new( &self->ip6 );
25301 0 : break;
25302 0 : }
25303 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
25304 0 : }
25305 0 : }
25306 0 : void fd_gossip_socket_addr_new_disc( fd_gossip_socket_addr_t * self, uint discriminant ) {
25307 0 : self->discriminant = discriminant;
25308 0 : fd_gossip_socket_addr_inner_new( &self->inner, self->discriminant );
25309 0 : }
25310 0 : void fd_gossip_socket_addr_new( fd_gossip_socket_addr_t * self ) {
25311 0 : fd_memset( self, 0, sizeof(fd_gossip_socket_addr_t) );
25312 0 : fd_gossip_socket_addr_new_disc( self, UINT_MAX );
25313 0 : }
25314 0 : void fd_gossip_socket_addr_inner_destroy( fd_gossip_socket_addr_inner_t * self, uint discriminant ) {
25315 0 : switch( discriminant ) {
25316 0 : case 0: {
25317 0 : fd_gossip_socket_addr_ip4_destroy( &self->ip4 );
25318 0 : break;
25319 0 : }
25320 0 : case 1: {
25321 0 : fd_gossip_socket_addr_ip6_destroy( &self->ip6 );
25322 0 : break;
25323 0 : }
25324 0 : default: break; // FD_LOG_ERR(( "unhandled type" ));
25325 0 : }
25326 0 : }
25327 0 : void fd_gossip_socket_addr_destroy( fd_gossip_socket_addr_t * self ) {
25328 0 : fd_gossip_socket_addr_inner_destroy( &self->inner, self->discriminant );
25329 0 : }
25330 :
25331 0 : ulong fd_gossip_socket_addr_footprint( void ){ return FD_GOSSIP_SOCKET_ADDR_FOOTPRINT; }
25332 0 : ulong fd_gossip_socket_addr_align( void ){ return FD_GOSSIP_SOCKET_ADDR_ALIGN; }
25333 :
25334 90 : void fd_gossip_socket_addr_walk( void * w, fd_gossip_socket_addr_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
25335 90 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_gossip_socket_addr", level++);
25336 90 : switch( self->discriminant ) {
25337 90 : case 0: {
25338 90 : fun( w, self, "ip4", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
25339 90 : fd_gossip_socket_addr_ip4_walk( w, &self->inner.ip4, fun, "ip4", level );
25340 90 : break;
25341 0 : }
25342 0 : case 1: {
25343 0 : fun( w, self, "ip6", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
25344 0 : fd_gossip_socket_addr_ip6_walk( w, &self->inner.ip6, fun, "ip6", level );
25345 0 : break;
25346 0 : }
25347 90 : }
25348 90 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_gossip_socket_addr", level-- );
25349 90 : }
25350 0 : ulong fd_gossip_socket_addr_size( fd_gossip_socket_addr_t const * self ) {
25351 0 : ulong size = 0;
25352 0 : size += sizeof(uint);
25353 0 : switch (self->discriminant) {
25354 0 : case 0: {
25355 0 : size += fd_gossip_socket_addr_ip4_size( &self->inner.ip4 );
25356 0 : break;
25357 0 : }
25358 0 : case 1: {
25359 0 : size += fd_gossip_socket_addr_ip6_size( &self->inner.ip6 );
25360 0 : break;
25361 0 : }
25362 0 : }
25363 0 : return size;
25364 0 : }
25365 :
25366 0 : int fd_gossip_socket_addr_inner_encode( fd_gossip_socket_addr_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
25367 0 : int err;
25368 0 : switch (discriminant) {
25369 0 : case 0: {
25370 0 : err = fd_gossip_socket_addr_ip4_encode( &self->ip4, ctx );
25371 0 : if( FD_UNLIKELY( err ) ) return err;
25372 0 : break;
25373 0 : }
25374 0 : case 1: {
25375 0 : err = fd_gossip_socket_addr_ip6_encode( &self->ip6, ctx );
25376 0 : if( FD_UNLIKELY( err ) ) return err;
25377 0 : break;
25378 0 : }
25379 0 : }
25380 0 : return FD_BINCODE_SUCCESS;
25381 0 : }
25382 0 : int fd_gossip_socket_addr_encode( fd_gossip_socket_addr_t const * self, fd_bincode_encode_ctx_t * ctx ) {
25383 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
25384 0 : if( FD_UNLIKELY( err ) ) return err;
25385 0 : return fd_gossip_socket_addr_inner_encode( &self->inner, self->discriminant, ctx );
25386 0 : }
25387 :
25388 0 : int fd_gossip_contact_info_v1_encode( fd_gossip_contact_info_v1_t const * self, fd_bincode_encode_ctx_t * ctx ) {
25389 0 : int err;
25390 0 : err = fd_pubkey_encode( &self->id, ctx );
25391 0 : if( FD_UNLIKELY( err ) ) return err;
25392 0 : err = fd_gossip_socket_addr_encode( &self->gossip, ctx );
25393 0 : if( FD_UNLIKELY( err ) ) return err;
25394 0 : err = fd_gossip_socket_addr_encode( &self->tvu, ctx );
25395 0 : if( FD_UNLIKELY( err ) ) return err;
25396 0 : err = fd_gossip_socket_addr_encode( &self->tvu_fwd, ctx );
25397 0 : if( FD_UNLIKELY( err ) ) return err;
25398 0 : err = fd_gossip_socket_addr_encode( &self->repair, ctx );
25399 0 : if( FD_UNLIKELY( err ) ) return err;
25400 0 : err = fd_gossip_socket_addr_encode( &self->tpu, ctx );
25401 0 : if( FD_UNLIKELY( err ) ) return err;
25402 0 : err = fd_gossip_socket_addr_encode( &self->tpu_fwd, ctx );
25403 0 : if( FD_UNLIKELY( err ) ) return err;
25404 0 : err = fd_gossip_socket_addr_encode( &self->tpu_vote, ctx );
25405 0 : if( FD_UNLIKELY( err ) ) return err;
25406 0 : err = fd_gossip_socket_addr_encode( &self->rpc, ctx );
25407 0 : if( FD_UNLIKELY( err ) ) return err;
25408 0 : err = fd_gossip_socket_addr_encode( &self->rpc_pubsub, ctx );
25409 0 : if( FD_UNLIKELY( err ) ) return err;
25410 0 : err = fd_gossip_socket_addr_encode( &self->serve_repair, ctx );
25411 0 : if( FD_UNLIKELY( err ) ) return err;
25412 0 : err = fd_bincode_uint64_encode( self->wallclock, ctx );
25413 0 : if( FD_UNLIKELY( err ) ) return err;
25414 0 : err = fd_bincode_uint16_encode( self->shred_version, ctx );
25415 0 : if( FD_UNLIKELY( err ) ) return err;
25416 0 : return FD_BINCODE_SUCCESS;
25417 0 : }
25418 0 : int fd_gossip_contact_info_v1_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
25419 0 : *total_sz += sizeof(fd_gossip_contact_info_v1_t);
25420 0 : void const * start_data = ctx->data;
25421 0 : int err = fd_gossip_contact_info_v1_decode_footprint_inner( ctx, total_sz );
25422 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
25423 0 : ctx->data = start_data;
25424 0 : return err;
25425 0 : }
25426 9 : int fd_gossip_contact_info_v1_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
25427 9 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
25428 9 : int err = 0;
25429 9 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
25430 9 : if( FD_UNLIKELY( err ) ) return err;
25431 9 : err = fd_gossip_socket_addr_decode_footprint_inner( ctx, total_sz );
25432 9 : if( FD_UNLIKELY( err ) ) return err;
25433 9 : err = fd_gossip_socket_addr_decode_footprint_inner( ctx, total_sz );
25434 9 : if( FD_UNLIKELY( err ) ) return err;
25435 9 : err = fd_gossip_socket_addr_decode_footprint_inner( ctx, total_sz );
25436 9 : if( FD_UNLIKELY( err ) ) return err;
25437 9 : err = fd_gossip_socket_addr_decode_footprint_inner( ctx, total_sz );
25438 9 : if( FD_UNLIKELY( err ) ) return err;
25439 9 : err = fd_gossip_socket_addr_decode_footprint_inner( ctx, total_sz );
25440 9 : if( FD_UNLIKELY( err ) ) return err;
25441 9 : err = fd_gossip_socket_addr_decode_footprint_inner( ctx, total_sz );
25442 9 : if( FD_UNLIKELY( err ) ) return err;
25443 9 : err = fd_gossip_socket_addr_decode_footprint_inner( ctx, total_sz );
25444 9 : if( FD_UNLIKELY( err ) ) return err;
25445 9 : err = fd_gossip_socket_addr_decode_footprint_inner( ctx, total_sz );
25446 9 : if( FD_UNLIKELY( err ) ) return err;
25447 9 : err = fd_gossip_socket_addr_decode_footprint_inner( ctx, total_sz );
25448 9 : if( FD_UNLIKELY( err ) ) return err;
25449 9 : err = fd_gossip_socket_addr_decode_footprint_inner( ctx, total_sz );
25450 9 : if( FD_UNLIKELY( err ) ) return err;
25451 9 : err = fd_bincode_uint64_decode_footprint( ctx );
25452 9 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25453 9 : err = fd_bincode_uint16_decode_footprint( ctx );
25454 9 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25455 9 : return 0;
25456 9 : }
25457 0 : void * fd_gossip_contact_info_v1_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
25458 0 : fd_gossip_contact_info_v1_t * self = (fd_gossip_contact_info_v1_t *)mem;
25459 0 : fd_gossip_contact_info_v1_new( self );
25460 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_contact_info_v1_t);
25461 0 : void * * alloc_mem = &alloc_region;
25462 0 : fd_gossip_contact_info_v1_decode_inner( mem, alloc_mem, ctx );
25463 0 : return self;
25464 0 : }
25465 9 : void fd_gossip_contact_info_v1_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
25466 9 : fd_gossip_contact_info_v1_t * self = (fd_gossip_contact_info_v1_t *)struct_mem;
25467 9 : fd_pubkey_decode_inner( &self->id, alloc_mem, ctx );
25468 9 : fd_gossip_socket_addr_decode_inner( &self->gossip, alloc_mem, ctx );
25469 9 : fd_gossip_socket_addr_decode_inner( &self->tvu, alloc_mem, ctx );
25470 9 : fd_gossip_socket_addr_decode_inner( &self->tvu_fwd, alloc_mem, ctx );
25471 9 : fd_gossip_socket_addr_decode_inner( &self->repair, alloc_mem, ctx );
25472 9 : fd_gossip_socket_addr_decode_inner( &self->tpu, alloc_mem, ctx );
25473 9 : fd_gossip_socket_addr_decode_inner( &self->tpu_fwd, alloc_mem, ctx );
25474 9 : fd_gossip_socket_addr_decode_inner( &self->tpu_vote, alloc_mem, ctx );
25475 9 : fd_gossip_socket_addr_decode_inner( &self->rpc, alloc_mem, ctx );
25476 9 : fd_gossip_socket_addr_decode_inner( &self->rpc_pubsub, alloc_mem, ctx );
25477 9 : fd_gossip_socket_addr_decode_inner( &self->serve_repair, alloc_mem, ctx );
25478 9 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
25479 9 : fd_bincode_uint16_decode_unsafe( &self->shred_version, ctx );
25480 9 : }
25481 0 : void * fd_gossip_contact_info_v1_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
25482 0 : fd_gossip_contact_info_v1_global_t * self = (fd_gossip_contact_info_v1_global_t *)mem;
25483 0 : fd_gossip_contact_info_v1_new( (fd_gossip_contact_info_v1_t *)self );
25484 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_contact_info_v1_global_t);
25485 0 : void * * alloc_mem = &alloc_region;
25486 0 : fd_gossip_contact_info_v1_decode_inner_global( mem, alloc_mem, ctx );
25487 0 : return self;
25488 0 : }
25489 0 : void fd_gossip_contact_info_v1_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
25490 0 : fd_gossip_contact_info_v1_global_t * self = (fd_gossip_contact_info_v1_global_t *)struct_mem;
25491 0 : fd_pubkey_decode_inner_global( &self->id, alloc_mem, ctx );
25492 0 : fd_gossip_socket_addr_decode_inner_global( &self->gossip, alloc_mem, ctx );
25493 0 : fd_gossip_socket_addr_decode_inner_global( &self->tvu, alloc_mem, ctx );
25494 0 : fd_gossip_socket_addr_decode_inner_global( &self->tvu_fwd, alloc_mem, ctx );
25495 0 : fd_gossip_socket_addr_decode_inner_global( &self->repair, alloc_mem, ctx );
25496 0 : fd_gossip_socket_addr_decode_inner_global( &self->tpu, alloc_mem, ctx );
25497 0 : fd_gossip_socket_addr_decode_inner_global( &self->tpu_fwd, alloc_mem, ctx );
25498 0 : fd_gossip_socket_addr_decode_inner_global( &self->tpu_vote, alloc_mem, ctx );
25499 0 : fd_gossip_socket_addr_decode_inner_global( &self->rpc, alloc_mem, ctx );
25500 0 : fd_gossip_socket_addr_decode_inner_global( &self->rpc_pubsub, alloc_mem, ctx );
25501 0 : fd_gossip_socket_addr_decode_inner_global( &self->serve_repair, alloc_mem, ctx );
25502 0 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
25503 0 : fd_bincode_uint16_decode_unsafe( &self->shred_version, ctx );
25504 0 : }
25505 0 : int fd_gossip_contact_info_v1_convert_global_to_local( void const * global_self, fd_gossip_contact_info_v1_t * self, fd_bincode_decode_ctx_t * ctx ) {
25506 0 : int err = 0;
25507 0 : fd_gossip_contact_info_v1_global_t const * mem = (fd_gossip_contact_info_v1_global_t const *)global_self;
25508 0 : err = fd_pubkey_convert_global_to_local( &mem->id, &self->id, ctx );
25509 0 : if( FD_UNLIKELY( err ) ) return err;
25510 0 : err = fd_gossip_socket_addr_convert_global_to_local( &mem->gossip, &self->gossip, ctx );
25511 0 : if( FD_UNLIKELY( err ) ) return err;
25512 0 : err = fd_gossip_socket_addr_convert_global_to_local( &mem->tvu, &self->tvu, ctx );
25513 0 : if( FD_UNLIKELY( err ) ) return err;
25514 0 : err = fd_gossip_socket_addr_convert_global_to_local( &mem->tvu_fwd, &self->tvu_fwd, ctx );
25515 0 : if( FD_UNLIKELY( err ) ) return err;
25516 0 : err = fd_gossip_socket_addr_convert_global_to_local( &mem->repair, &self->repair, ctx );
25517 0 : if( FD_UNLIKELY( err ) ) return err;
25518 0 : err = fd_gossip_socket_addr_convert_global_to_local( &mem->tpu, &self->tpu, ctx );
25519 0 : if( FD_UNLIKELY( err ) ) return err;
25520 0 : err = fd_gossip_socket_addr_convert_global_to_local( &mem->tpu_fwd, &self->tpu_fwd, ctx );
25521 0 : if( FD_UNLIKELY( err ) ) return err;
25522 0 : err = fd_gossip_socket_addr_convert_global_to_local( &mem->tpu_vote, &self->tpu_vote, ctx );
25523 0 : if( FD_UNLIKELY( err ) ) return err;
25524 0 : err = fd_gossip_socket_addr_convert_global_to_local( &mem->rpc, &self->rpc, ctx );
25525 0 : if( FD_UNLIKELY( err ) ) return err;
25526 0 : err = fd_gossip_socket_addr_convert_global_to_local( &mem->rpc_pubsub, &self->rpc_pubsub, ctx );
25527 0 : if( FD_UNLIKELY( err ) ) return err;
25528 0 : err = fd_gossip_socket_addr_convert_global_to_local( &mem->serve_repair, &self->serve_repair, ctx );
25529 0 : if( FD_UNLIKELY( err ) ) return err;
25530 0 : self->wallclock = mem->wallclock;
25531 0 : self->shred_version = mem->shred_version;
25532 0 : return FD_BINCODE_SUCCESS;
25533 0 : }
25534 0 : void fd_gossip_contact_info_v1_new(fd_gossip_contact_info_v1_t * self) {
25535 0 : fd_memset( self, 0, sizeof(fd_gossip_contact_info_v1_t) );
25536 0 : fd_pubkey_new( &self->id );
25537 0 : fd_gossip_socket_addr_new( &self->gossip );
25538 0 : fd_gossip_socket_addr_new( &self->tvu );
25539 0 : fd_gossip_socket_addr_new( &self->tvu_fwd );
25540 0 : fd_gossip_socket_addr_new( &self->repair );
25541 0 : fd_gossip_socket_addr_new( &self->tpu );
25542 0 : fd_gossip_socket_addr_new( &self->tpu_fwd );
25543 0 : fd_gossip_socket_addr_new( &self->tpu_vote );
25544 0 : fd_gossip_socket_addr_new( &self->rpc );
25545 0 : fd_gossip_socket_addr_new( &self->rpc_pubsub );
25546 0 : fd_gossip_socket_addr_new( &self->serve_repair );
25547 0 : }
25548 0 : void fd_gossip_contact_info_v1_destroy( fd_gossip_contact_info_v1_t * self ) {
25549 0 : fd_pubkey_destroy( &self->id );
25550 0 : fd_gossip_socket_addr_destroy( &self->gossip );
25551 0 : fd_gossip_socket_addr_destroy( &self->tvu );
25552 0 : fd_gossip_socket_addr_destroy( &self->tvu_fwd );
25553 0 : fd_gossip_socket_addr_destroy( &self->repair );
25554 0 : fd_gossip_socket_addr_destroy( &self->tpu );
25555 0 : fd_gossip_socket_addr_destroy( &self->tpu_fwd );
25556 0 : fd_gossip_socket_addr_destroy( &self->tpu_vote );
25557 0 : fd_gossip_socket_addr_destroy( &self->rpc );
25558 0 : fd_gossip_socket_addr_destroy( &self->rpc_pubsub );
25559 0 : fd_gossip_socket_addr_destroy( &self->serve_repair );
25560 0 : }
25561 :
25562 0 : ulong fd_gossip_contact_info_v1_footprint( void ){ return FD_GOSSIP_CONTACT_INFO_V1_FOOTPRINT; }
25563 0 : ulong fd_gossip_contact_info_v1_align( void ){ return FD_GOSSIP_CONTACT_INFO_V1_ALIGN; }
25564 :
25565 9 : void fd_gossip_contact_info_v1_walk( void * w, fd_gossip_contact_info_v1_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
25566 9 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_contact_info_v1", level++ );
25567 9 : fd_pubkey_walk( w, &self->id, fun, "id", level );
25568 9 : fd_gossip_socket_addr_walk( w, &self->gossip, fun, "gossip", level );
25569 9 : fd_gossip_socket_addr_walk( w, &self->tvu, fun, "tvu", level );
25570 9 : fd_gossip_socket_addr_walk( w, &self->tvu_fwd, fun, "tvu_fwd", level );
25571 9 : fd_gossip_socket_addr_walk( w, &self->repair, fun, "repair", level );
25572 9 : fd_gossip_socket_addr_walk( w, &self->tpu, fun, "tpu", level );
25573 9 : fd_gossip_socket_addr_walk( w, &self->tpu_fwd, fun, "tpu_fwd", level );
25574 9 : fd_gossip_socket_addr_walk( w, &self->tpu_vote, fun, "tpu_vote", level );
25575 9 : fd_gossip_socket_addr_walk( w, &self->rpc, fun, "rpc", level );
25576 9 : fd_gossip_socket_addr_walk( w, &self->rpc_pubsub, fun, "rpc_pubsub", level );
25577 9 : fd_gossip_socket_addr_walk( w, &self->serve_repair, fun, "serve_repair", level );
25578 9 : fun( w, &self->wallclock, "wallclock", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
25579 9 : fun( w, &self->shred_version, "shred_version", FD_FLAMENCO_TYPE_USHORT, "ushort", level );
25580 9 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_contact_info_v1", level-- );
25581 9 : }
25582 0 : ulong fd_gossip_contact_info_v1_size( fd_gossip_contact_info_v1_t const * self ) {
25583 0 : ulong size = 0;
25584 0 : size += fd_pubkey_size( &self->id );
25585 0 : size += fd_gossip_socket_addr_size( &self->gossip );
25586 0 : size += fd_gossip_socket_addr_size( &self->tvu );
25587 0 : size += fd_gossip_socket_addr_size( &self->tvu_fwd );
25588 0 : size += fd_gossip_socket_addr_size( &self->repair );
25589 0 : size += fd_gossip_socket_addr_size( &self->tpu );
25590 0 : size += fd_gossip_socket_addr_size( &self->tpu_fwd );
25591 0 : size += fd_gossip_socket_addr_size( &self->tpu_vote );
25592 0 : size += fd_gossip_socket_addr_size( &self->rpc );
25593 0 : size += fd_gossip_socket_addr_size( &self->rpc_pubsub );
25594 0 : size += fd_gossip_socket_addr_size( &self->serve_repair );
25595 0 : size += sizeof(ulong);
25596 0 : size += sizeof(ushort);
25597 0 : return size;
25598 0 : }
25599 :
25600 0 : int fd_gossip_vote_encode( fd_gossip_vote_t const * self, fd_bincode_encode_ctx_t * ctx ) {
25601 0 : int err;
25602 0 : err = fd_bincode_uint8_encode( (uchar)(self->index), ctx );
25603 0 : if( FD_UNLIKELY( err ) ) return err;
25604 0 : err = fd_pubkey_encode( &self->from, ctx );
25605 0 : if( FD_UNLIKELY( err ) ) return err;
25606 0 : err = fd_flamenco_txn_encode( &self->txn, ctx );
25607 0 : if( FD_UNLIKELY( err ) ) return err;
25608 0 : err = fd_bincode_uint64_encode( self->wallclock, ctx );
25609 0 : if( FD_UNLIKELY( err ) ) return err;
25610 0 : return FD_BINCODE_SUCCESS;
25611 0 : }
25612 0 : int fd_gossip_vote_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
25613 0 : *total_sz += sizeof(fd_gossip_vote_t);
25614 0 : void const * start_data = ctx->data;
25615 0 : int err = fd_gossip_vote_decode_footprint_inner( ctx, total_sz );
25616 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
25617 0 : ctx->data = start_data;
25618 0 : return err;
25619 0 : }
25620 6 : int fd_gossip_vote_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
25621 6 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
25622 6 : int err = 0;
25623 6 : err = fd_bincode_uint8_decode_footprint( ctx );
25624 6 : if( FD_UNLIKELY( err ) ) return err;
25625 6 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
25626 6 : if( FD_UNLIKELY( err ) ) return err;
25627 6 : err = fd_flamenco_txn_decode_footprint_inner( ctx, total_sz );
25628 6 : if( FD_UNLIKELY( err ) ) return err;
25629 6 : err = fd_bincode_uint64_decode_footprint( ctx );
25630 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25631 6 : return 0;
25632 6 : }
25633 0 : void * fd_gossip_vote_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
25634 0 : fd_gossip_vote_t * self = (fd_gossip_vote_t *)mem;
25635 0 : fd_gossip_vote_new( self );
25636 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_vote_t);
25637 0 : void * * alloc_mem = &alloc_region;
25638 0 : fd_gossip_vote_decode_inner( mem, alloc_mem, ctx );
25639 0 : return self;
25640 0 : }
25641 6 : void fd_gossip_vote_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
25642 6 : fd_gossip_vote_t * self = (fd_gossip_vote_t *)struct_mem;
25643 6 : fd_bincode_uint8_decode_unsafe( &self->index, ctx );
25644 6 : fd_pubkey_decode_inner( &self->from, alloc_mem, ctx );
25645 6 : fd_flamenco_txn_decode_inner( &self->txn, alloc_mem, ctx );
25646 6 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
25647 6 : }
25648 0 : void * fd_gossip_vote_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
25649 0 : fd_gossip_vote_global_t * self = (fd_gossip_vote_global_t *)mem;
25650 0 : fd_gossip_vote_new( (fd_gossip_vote_t *)self );
25651 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_vote_global_t);
25652 0 : void * * alloc_mem = &alloc_region;
25653 0 : fd_gossip_vote_decode_inner_global( mem, alloc_mem, ctx );
25654 0 : return self;
25655 0 : }
25656 0 : void fd_gossip_vote_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
25657 0 : fd_gossip_vote_global_t * self = (fd_gossip_vote_global_t *)struct_mem;
25658 0 : fd_bincode_uint8_decode_unsafe( &self->index, ctx );
25659 0 : fd_pubkey_decode_inner_global( &self->from, alloc_mem, ctx );
25660 0 : fd_flamenco_txn_decode_inner_global( &self->txn, alloc_mem, ctx );
25661 0 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
25662 0 : }
25663 0 : int fd_gossip_vote_convert_global_to_local( void const * global_self, fd_gossip_vote_t * self, fd_bincode_decode_ctx_t * ctx ) {
25664 0 : int err = 0;
25665 0 : fd_gossip_vote_global_t const * mem = (fd_gossip_vote_global_t const *)global_self;
25666 0 : self->index = mem->index;
25667 0 : err = fd_pubkey_convert_global_to_local( &mem->from, &self->from, ctx );
25668 0 : if( FD_UNLIKELY( err ) ) return err;
25669 0 : err = fd_flamenco_txn_convert_global_to_local( &mem->txn, &self->txn, ctx );
25670 0 : if( FD_UNLIKELY( err ) ) return err;
25671 0 : self->wallclock = mem->wallclock;
25672 0 : return FD_BINCODE_SUCCESS;
25673 0 : }
25674 0 : void fd_gossip_vote_new(fd_gossip_vote_t * self) {
25675 0 : fd_memset( self, 0, sizeof(fd_gossip_vote_t) );
25676 0 : fd_pubkey_new( &self->from );
25677 0 : fd_flamenco_txn_new( &self->txn );
25678 0 : }
25679 0 : void fd_gossip_vote_destroy( fd_gossip_vote_t * self ) {
25680 0 : fd_pubkey_destroy( &self->from );
25681 0 : fd_flamenco_txn_destroy( &self->txn );
25682 0 : }
25683 :
25684 0 : ulong fd_gossip_vote_footprint( void ){ return FD_GOSSIP_VOTE_FOOTPRINT; }
25685 0 : ulong fd_gossip_vote_align( void ){ return FD_GOSSIP_VOTE_ALIGN; }
25686 :
25687 6 : void fd_gossip_vote_walk( void * w, fd_gossip_vote_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
25688 6 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_vote", level++ );
25689 6 : fun( w, &self->index, "index", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
25690 6 : fd_pubkey_walk( w, &self->from, fun, "from", level );
25691 6 : fd_flamenco_txn_walk( w, &self->txn, fun, "txn", level );
25692 6 : fun( w, &self->wallclock, "wallclock", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
25693 6 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_vote", level-- );
25694 6 : }
25695 0 : ulong fd_gossip_vote_size( fd_gossip_vote_t const * self ) {
25696 0 : ulong size = 0;
25697 0 : size += sizeof(char);
25698 0 : size += fd_pubkey_size( &self->from );
25699 0 : size += fd_flamenco_txn_size( &self->txn );
25700 0 : size += sizeof(ulong);
25701 0 : return size;
25702 0 : }
25703 :
25704 0 : int fd_gossip_lowest_slot_encode( fd_gossip_lowest_slot_t const * self, fd_bincode_encode_ctx_t * ctx ) {
25705 0 : int err;
25706 0 : err = fd_bincode_uint8_encode( (uchar)(self->u8), ctx );
25707 0 : if( FD_UNLIKELY( err ) ) return err;
25708 0 : err = fd_pubkey_encode( &self->from, ctx );
25709 0 : if( FD_UNLIKELY( err ) ) return err;
25710 0 : err = fd_bincode_uint64_encode( self->root, ctx );
25711 0 : if( FD_UNLIKELY( err ) ) return err;
25712 0 : err = fd_bincode_uint64_encode( self->lowest, ctx );
25713 0 : if( FD_UNLIKELY( err ) ) return err;
25714 0 : err = fd_bincode_uint64_encode( self->slots_len, ctx );
25715 0 : if( FD_UNLIKELY(err) ) return err;
25716 0 : if( self->slots_len ) {
25717 0 : for( ulong i=0; i < self->slots_len; i++ ) {
25718 0 : err = fd_bincode_uint64_encode( self->slots[i], ctx );
25719 0 : }
25720 0 : }
25721 0 : err = fd_bincode_uint64_encode( self->i_dont_know, ctx );
25722 0 : if( FD_UNLIKELY( err ) ) return err;
25723 0 : err = fd_bincode_uint64_encode( self->wallclock, ctx );
25724 0 : if( FD_UNLIKELY( err ) ) return err;
25725 0 : return FD_BINCODE_SUCCESS;
25726 0 : }
25727 0 : int fd_gossip_lowest_slot_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
25728 0 : *total_sz += sizeof(fd_gossip_lowest_slot_t);
25729 0 : void const * start_data = ctx->data;
25730 0 : int err = fd_gossip_lowest_slot_decode_footprint_inner( ctx, total_sz );
25731 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
25732 0 : ctx->data = start_data;
25733 0 : return err;
25734 0 : }
25735 0 : int fd_gossip_lowest_slot_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
25736 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
25737 0 : int err = 0;
25738 0 : err = fd_bincode_uint8_decode_footprint( ctx );
25739 0 : if( FD_UNLIKELY( err ) ) return err;
25740 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
25741 0 : if( FD_UNLIKELY( err ) ) return err;
25742 0 : err = fd_bincode_uint64_decode_footprint( ctx );
25743 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25744 0 : err = fd_bincode_uint64_decode_footprint( ctx );
25745 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25746 0 : ulong slots_len;
25747 0 : err = fd_bincode_uint64_decode( &slots_len, ctx );
25748 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25749 0 : if( slots_len ) {
25750 0 : *total_sz += 8UL + sizeof(ulong)*slots_len;
25751 0 : for( ulong i=0; i < slots_len; i++ ) {
25752 0 : err = fd_bincode_uint64_decode_footprint( ctx );
25753 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25754 0 : }
25755 0 : }
25756 0 : err = fd_bincode_uint64_decode_footprint( ctx );
25757 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25758 0 : err = fd_bincode_uint64_decode_footprint( ctx );
25759 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25760 0 : return 0;
25761 0 : }
25762 0 : void * fd_gossip_lowest_slot_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
25763 0 : fd_gossip_lowest_slot_t * self = (fd_gossip_lowest_slot_t *)mem;
25764 0 : fd_gossip_lowest_slot_new( self );
25765 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_lowest_slot_t);
25766 0 : void * * alloc_mem = &alloc_region;
25767 0 : fd_gossip_lowest_slot_decode_inner( mem, alloc_mem, ctx );
25768 0 : return self;
25769 0 : }
25770 0 : void fd_gossip_lowest_slot_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
25771 0 : fd_gossip_lowest_slot_t * self = (fd_gossip_lowest_slot_t *)struct_mem;
25772 0 : fd_bincode_uint8_decode_unsafe( &self->u8, ctx );
25773 0 : fd_pubkey_decode_inner( &self->from, alloc_mem, ctx );
25774 0 : fd_bincode_uint64_decode_unsafe( &self->root, ctx );
25775 0 : fd_bincode_uint64_decode_unsafe( &self->lowest, ctx );
25776 0 : fd_bincode_uint64_decode_unsafe( &self->slots_len, ctx );
25777 0 : if( self->slots_len ) {
25778 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), 8UL );
25779 0 : self->slots = *alloc_mem;
25780 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(ulong)*self->slots_len;
25781 0 : for( ulong i=0; i < self->slots_len; i++ ) {
25782 0 : fd_bincode_uint64_decode_unsafe( self->slots + i, ctx );
25783 0 : }
25784 0 : } else
25785 0 : self->slots = NULL;
25786 0 : fd_bincode_uint64_decode_unsafe( &self->i_dont_know, ctx );
25787 0 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
25788 0 : }
25789 0 : void * fd_gossip_lowest_slot_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
25790 0 : fd_gossip_lowest_slot_global_t * self = (fd_gossip_lowest_slot_global_t *)mem;
25791 0 : fd_gossip_lowest_slot_new( (fd_gossip_lowest_slot_t *)self );
25792 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_lowest_slot_global_t);
25793 0 : void * * alloc_mem = &alloc_region;
25794 0 : fd_gossip_lowest_slot_decode_inner_global( mem, alloc_mem, ctx );
25795 0 : return self;
25796 0 : }
25797 0 : void fd_gossip_lowest_slot_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
25798 0 : fd_gossip_lowest_slot_global_t * self = (fd_gossip_lowest_slot_global_t *)struct_mem;
25799 0 : fd_bincode_uint8_decode_unsafe( &self->u8, ctx );
25800 0 : fd_pubkey_decode_inner_global( &self->from, alloc_mem, ctx );
25801 0 : fd_bincode_uint64_decode_unsafe( &self->root, ctx );
25802 0 : fd_bincode_uint64_decode_unsafe( &self->lowest, ctx );
25803 0 : fd_bincode_uint64_decode_unsafe( &self->slots_len, ctx );
25804 0 : if( self->slots_len ) {
25805 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), 8UL );
25806 0 : self->slots_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
25807 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
25808 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(ulong)*self->slots_len;
25809 0 : for( ulong i=0; i < self->slots_len; i++ ) {
25810 0 : fd_bincode_uint64_decode_unsafe( (ulong*)(cur_mem + sizeof(ulong) * i), ctx );
25811 0 : }
25812 0 : } else
25813 0 : self->slots_gaddr = 0UL;
25814 0 : fd_bincode_uint64_decode_unsafe( &self->i_dont_know, ctx );
25815 0 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
25816 0 : }
25817 0 : int fd_gossip_lowest_slot_convert_global_to_local( void const * global_self, fd_gossip_lowest_slot_t * self, fd_bincode_decode_ctx_t * ctx ) {
25818 0 : int err = 0;
25819 0 : fd_gossip_lowest_slot_global_t const * mem = (fd_gossip_lowest_slot_global_t const *)global_self;
25820 0 : self->u8 = mem->u8;
25821 0 : err = fd_pubkey_convert_global_to_local( &mem->from, &self->from, ctx );
25822 0 : if( FD_UNLIKELY( err ) ) return err;
25823 0 : self->root = mem->root;
25824 0 : self->lowest = mem->lowest;
25825 0 : self->slots_len = mem->slots_len;
25826 0 : self->slots = fd_wksp_laddr_fast( ctx->wksp, mem->slots_gaddr );
25827 0 : self->i_dont_know = mem->i_dont_know;
25828 0 : self->wallclock = mem->wallclock;
25829 0 : return FD_BINCODE_SUCCESS;
25830 0 : }
25831 0 : void fd_gossip_lowest_slot_new(fd_gossip_lowest_slot_t * self) {
25832 0 : fd_memset( self, 0, sizeof(fd_gossip_lowest_slot_t) );
25833 0 : fd_pubkey_new( &self->from );
25834 0 : }
25835 0 : void fd_gossip_lowest_slot_destroy( fd_gossip_lowest_slot_t * self ) {
25836 0 : fd_pubkey_destroy( &self->from );
25837 0 : if( self->slots ) {
25838 0 : self->slots = NULL;
25839 0 : }
25840 0 : }
25841 :
25842 0 : ulong fd_gossip_lowest_slot_footprint( void ){ return FD_GOSSIP_LOWEST_SLOT_FOOTPRINT; }
25843 0 : ulong fd_gossip_lowest_slot_align( void ){ return FD_GOSSIP_LOWEST_SLOT_ALIGN; }
25844 :
25845 0 : void fd_gossip_lowest_slot_walk( void * w, fd_gossip_lowest_slot_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
25846 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_lowest_slot", level++ );
25847 0 : fun( w, &self->u8, "u8", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
25848 0 : fd_pubkey_walk( w, &self->from, fun, "from", level );
25849 0 : fun( w, &self->root, "root", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
25850 0 : fun( w, &self->lowest, "lowest", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
25851 0 : if( self->slots_len ) {
25852 0 : fun( w, NULL, "slots", FD_FLAMENCO_TYPE_ARR, "array", level++ );
25853 0 : for( ulong i=0; i < self->slots_len; i++ )
25854 0 : fun( w, self->slots + i, "slots", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
25855 0 : fun( w, NULL, "slots", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
25856 0 : }
25857 0 : fun( w, &self->i_dont_know, "i_dont_know", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
25858 0 : fun( w, &self->wallclock, "wallclock", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
25859 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_lowest_slot", level-- );
25860 0 : }
25861 0 : ulong fd_gossip_lowest_slot_size( fd_gossip_lowest_slot_t const * self ) {
25862 0 : ulong size = 0;
25863 0 : size += sizeof(char);
25864 0 : size += fd_pubkey_size( &self->from );
25865 0 : size += sizeof(ulong);
25866 0 : size += sizeof(ulong);
25867 0 : do {
25868 0 : size += sizeof(ulong);
25869 0 : size += self->slots_len * sizeof(ulong);
25870 0 : } while(0);
25871 0 : size += sizeof(ulong);
25872 0 : size += sizeof(ulong);
25873 0 : return size;
25874 0 : }
25875 :
25876 0 : int fd_gossip_slot_hashes_encode( fd_gossip_slot_hashes_t const * self, fd_bincode_encode_ctx_t * ctx ) {
25877 0 : int err;
25878 0 : err = fd_pubkey_encode( &self->from, ctx );
25879 0 : if( FD_UNLIKELY( err ) ) return err;
25880 0 : err = fd_bincode_uint64_encode( self->hashes_len, ctx );
25881 0 : if( FD_UNLIKELY(err) ) return err;
25882 0 : if( self->hashes_len ) {
25883 0 : for( ulong i=0; i < self->hashes_len; i++ ) {
25884 0 : err = fd_slot_hash_encode( self->hashes + i, ctx );
25885 0 : if( FD_UNLIKELY( err ) ) return err;
25886 0 : }
25887 0 : }
25888 0 : err = fd_bincode_uint64_encode( self->wallclock, ctx );
25889 0 : if( FD_UNLIKELY( err ) ) return err;
25890 0 : return FD_BINCODE_SUCCESS;
25891 0 : }
25892 0 : int fd_gossip_slot_hashes_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
25893 0 : *total_sz += sizeof(fd_gossip_slot_hashes_t);
25894 0 : void const * start_data = ctx->data;
25895 0 : int err = fd_gossip_slot_hashes_decode_footprint_inner( ctx, total_sz );
25896 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
25897 0 : ctx->data = start_data;
25898 0 : return err;
25899 0 : }
25900 3 : int fd_gossip_slot_hashes_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
25901 3 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
25902 3 : int err = 0;
25903 3 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
25904 3 : if( FD_UNLIKELY( err ) ) return err;
25905 3 : ulong hashes_len;
25906 3 : err = fd_bincode_uint64_decode( &hashes_len, ctx );
25907 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25908 3 : if( hashes_len ) {
25909 3 : *total_sz += FD_SLOT_HASH_ALIGN + FD_SLOT_HASH_FOOTPRINT*hashes_len;
25910 6 : for( ulong i=0; i < hashes_len; i++ ) {
25911 3 : err = fd_slot_hash_decode_footprint_inner( ctx, total_sz );
25912 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25913 3 : }
25914 3 : }
25915 3 : err = fd_bincode_uint64_decode_footprint( ctx );
25916 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25917 3 : return 0;
25918 3 : }
25919 0 : void * fd_gossip_slot_hashes_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
25920 0 : fd_gossip_slot_hashes_t * self = (fd_gossip_slot_hashes_t *)mem;
25921 0 : fd_gossip_slot_hashes_new( self );
25922 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_slot_hashes_t);
25923 0 : void * * alloc_mem = &alloc_region;
25924 0 : fd_gossip_slot_hashes_decode_inner( mem, alloc_mem, ctx );
25925 0 : return self;
25926 0 : }
25927 3 : void fd_gossip_slot_hashes_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
25928 3 : fd_gossip_slot_hashes_t * self = (fd_gossip_slot_hashes_t *)struct_mem;
25929 3 : fd_pubkey_decode_inner( &self->from, alloc_mem, ctx );
25930 3 : fd_bincode_uint64_decode_unsafe( &self->hashes_len, ctx );
25931 3 : if( self->hashes_len ) {
25932 3 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_SLOT_HASH_ALIGN );
25933 3 : self->hashes = *alloc_mem;
25934 3 : *alloc_mem = (uchar *)(*alloc_mem) + FD_SLOT_HASH_FOOTPRINT*self->hashes_len;
25935 6 : for( ulong i=0; i < self->hashes_len; i++ ) {
25936 3 : fd_slot_hash_new( self->hashes + i );
25937 3 : fd_slot_hash_decode_inner( self->hashes + i, alloc_mem, ctx );
25938 3 : }
25939 3 : } else
25940 0 : self->hashes = NULL;
25941 3 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
25942 3 : }
25943 0 : void * fd_gossip_slot_hashes_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
25944 0 : fd_gossip_slot_hashes_global_t * self = (fd_gossip_slot_hashes_global_t *)mem;
25945 0 : fd_gossip_slot_hashes_new( (fd_gossip_slot_hashes_t *)self );
25946 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_slot_hashes_global_t);
25947 0 : void * * alloc_mem = &alloc_region;
25948 0 : fd_gossip_slot_hashes_decode_inner_global( mem, alloc_mem, ctx );
25949 0 : return self;
25950 0 : }
25951 0 : void fd_gossip_slot_hashes_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
25952 0 : fd_gossip_slot_hashes_global_t * self = (fd_gossip_slot_hashes_global_t *)struct_mem;
25953 0 : fd_pubkey_decode_inner_global( &self->from, alloc_mem, ctx );
25954 0 : fd_bincode_uint64_decode_unsafe( &self->hashes_len, ctx );
25955 0 : if( self->hashes_len ) {
25956 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_SLOT_HASH_ALIGN );
25957 0 : self->hashes_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
25958 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
25959 0 : *alloc_mem = (uchar *)(*alloc_mem) + FD_SLOT_HASH_FOOTPRINT*self->hashes_len;
25960 0 : for( ulong i=0; i < self->hashes_len; i++ ) {
25961 0 : fd_slot_hash_new( (fd_slot_hash_t *)(cur_mem + FD_SLOT_HASH_FOOTPRINT * i) );
25962 0 : fd_slot_hash_decode_inner_global( cur_mem + FD_SLOT_HASH_FOOTPRINT * i, alloc_mem, ctx );
25963 0 : }
25964 0 : } else
25965 0 : self->hashes_gaddr = 0UL;
25966 0 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
25967 0 : }
25968 0 : int fd_gossip_slot_hashes_convert_global_to_local( void const * global_self, fd_gossip_slot_hashes_t * self, fd_bincode_decode_ctx_t * ctx ) {
25969 0 : int err = 0;
25970 0 : fd_gossip_slot_hashes_global_t const * mem = (fd_gossip_slot_hashes_global_t const *)global_self;
25971 0 : err = fd_pubkey_convert_global_to_local( &mem->from, &self->from, ctx );
25972 0 : if( FD_UNLIKELY( err ) ) return err;
25973 0 : self->hashes_len = mem->hashes_len;
25974 0 : self->hashes = fd_wksp_laddr_fast( ctx->wksp, mem->hashes_gaddr );
25975 0 : self->wallclock = mem->wallclock;
25976 0 : return FD_BINCODE_SUCCESS;
25977 0 : }
25978 0 : void fd_gossip_slot_hashes_new(fd_gossip_slot_hashes_t * self) {
25979 0 : fd_memset( self, 0, sizeof(fd_gossip_slot_hashes_t) );
25980 0 : fd_pubkey_new( &self->from );
25981 0 : }
25982 0 : void fd_gossip_slot_hashes_destroy( fd_gossip_slot_hashes_t * self ) {
25983 0 : fd_pubkey_destroy( &self->from );
25984 0 : if( self->hashes ) {
25985 0 : for( ulong i=0; i < self->hashes_len; i++ )
25986 0 : fd_slot_hash_destroy( self->hashes + i );
25987 0 : self->hashes = NULL;
25988 0 : }
25989 0 : }
25990 :
25991 0 : ulong fd_gossip_slot_hashes_footprint( void ){ return FD_GOSSIP_SLOT_HASHES_FOOTPRINT; }
25992 0 : ulong fd_gossip_slot_hashes_align( void ){ return FD_GOSSIP_SLOT_HASHES_ALIGN; }
25993 :
25994 3 : void fd_gossip_slot_hashes_walk( void * w, fd_gossip_slot_hashes_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
25995 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_slot_hashes", level++ );
25996 3 : fd_pubkey_walk( w, &self->from, fun, "from", level );
25997 3 : if( self->hashes_len ) {
25998 3 : fun( w, NULL, "hashes", FD_FLAMENCO_TYPE_ARR, "array", level++ );
25999 6 : for( ulong i=0; i < self->hashes_len; i++ )
26000 3 : fd_slot_hash_walk(w, self->hashes + i, fun, "slot_hash", level );
26001 3 : fun( w, NULL, "hashes", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
26002 3 : }
26003 3 : fun( w, &self->wallclock, "wallclock", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
26004 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_slot_hashes", level-- );
26005 3 : }
26006 0 : ulong fd_gossip_slot_hashes_size( fd_gossip_slot_hashes_t const * self ) {
26007 0 : ulong size = 0;
26008 0 : size += fd_pubkey_size( &self->from );
26009 0 : do {
26010 0 : size += sizeof(ulong);
26011 0 : for( ulong i=0; i < self->hashes_len; i++ )
26012 0 : size += fd_slot_hash_size( self->hashes + i );
26013 0 : } while(0);
26014 0 : size += sizeof(ulong);
26015 0 : return size;
26016 0 : }
26017 :
26018 0 : int fd_gossip_slots_encode( fd_gossip_slots_t const * self, fd_bincode_encode_ctx_t * ctx ) {
26019 0 : int err;
26020 0 : err = fd_bincode_uint64_encode( self->first_slot, ctx );
26021 0 : if( FD_UNLIKELY( err ) ) return err;
26022 0 : err = fd_bincode_uint64_encode( self->num, ctx );
26023 0 : if( FD_UNLIKELY( err ) ) return err;
26024 0 : err = fd_gossip_bitvec_u8_encode( &self->slots, ctx );
26025 0 : if( FD_UNLIKELY( err ) ) return err;
26026 0 : return FD_BINCODE_SUCCESS;
26027 0 : }
26028 0 : int fd_gossip_slots_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
26029 0 : *total_sz += sizeof(fd_gossip_slots_t);
26030 0 : void const * start_data = ctx->data;
26031 0 : int err = fd_gossip_slots_decode_footprint_inner( ctx, total_sz );
26032 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
26033 0 : ctx->data = start_data;
26034 0 : return err;
26035 0 : }
26036 0 : int fd_gossip_slots_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
26037 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
26038 0 : int err = 0;
26039 0 : err = fd_bincode_uint64_decode_footprint( ctx );
26040 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26041 0 : err = fd_bincode_uint64_decode_footprint( ctx );
26042 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26043 0 : err = fd_gossip_bitvec_u8_decode_footprint_inner( ctx, total_sz );
26044 0 : if( FD_UNLIKELY( err ) ) return err;
26045 0 : return 0;
26046 0 : }
26047 0 : void * fd_gossip_slots_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
26048 0 : fd_gossip_slots_t * self = (fd_gossip_slots_t *)mem;
26049 0 : fd_gossip_slots_new( self );
26050 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_slots_t);
26051 0 : void * * alloc_mem = &alloc_region;
26052 0 : fd_gossip_slots_decode_inner( mem, alloc_mem, ctx );
26053 0 : return self;
26054 0 : }
26055 0 : void fd_gossip_slots_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
26056 0 : fd_gossip_slots_t * self = (fd_gossip_slots_t *)struct_mem;
26057 0 : fd_bincode_uint64_decode_unsafe( &self->first_slot, ctx );
26058 0 : fd_bincode_uint64_decode_unsafe( &self->num, ctx );
26059 0 : fd_gossip_bitvec_u8_decode_inner( &self->slots, alloc_mem, ctx );
26060 0 : }
26061 0 : void * fd_gossip_slots_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
26062 0 : fd_gossip_slots_global_t * self = (fd_gossip_slots_global_t *)mem;
26063 0 : fd_gossip_slots_new( (fd_gossip_slots_t *)self );
26064 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_slots_global_t);
26065 0 : void * * alloc_mem = &alloc_region;
26066 0 : fd_gossip_slots_decode_inner_global( mem, alloc_mem, ctx );
26067 0 : return self;
26068 0 : }
26069 0 : void fd_gossip_slots_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
26070 0 : fd_gossip_slots_global_t * self = (fd_gossip_slots_global_t *)struct_mem;
26071 0 : fd_bincode_uint64_decode_unsafe( &self->first_slot, ctx );
26072 0 : fd_bincode_uint64_decode_unsafe( &self->num, ctx );
26073 0 : fd_gossip_bitvec_u8_decode_inner_global( &self->slots, alloc_mem, ctx );
26074 0 : }
26075 0 : int fd_gossip_slots_convert_global_to_local( void const * global_self, fd_gossip_slots_t * self, fd_bincode_decode_ctx_t * ctx ) {
26076 0 : int err = 0;
26077 0 : fd_gossip_slots_global_t const * mem = (fd_gossip_slots_global_t const *)global_self;
26078 0 : self->first_slot = mem->first_slot;
26079 0 : self->num = mem->num;
26080 0 : err = fd_gossip_bitvec_u8_convert_global_to_local( &mem->slots, &self->slots, ctx );
26081 0 : if( FD_UNLIKELY( err ) ) return err;
26082 0 : return FD_BINCODE_SUCCESS;
26083 0 : }
26084 0 : void fd_gossip_slots_new(fd_gossip_slots_t * self) {
26085 0 : fd_memset( self, 0, sizeof(fd_gossip_slots_t) );
26086 0 : fd_gossip_bitvec_u8_new( &self->slots );
26087 0 : }
26088 0 : void fd_gossip_slots_destroy( fd_gossip_slots_t * self ) {
26089 0 : fd_gossip_bitvec_u8_destroy( &self->slots );
26090 0 : }
26091 :
26092 0 : ulong fd_gossip_slots_footprint( void ){ return FD_GOSSIP_SLOTS_FOOTPRINT; }
26093 0 : ulong fd_gossip_slots_align( void ){ return FD_GOSSIP_SLOTS_ALIGN; }
26094 :
26095 0 : void fd_gossip_slots_walk( void * w, fd_gossip_slots_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
26096 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_slots", level++ );
26097 0 : fun( w, &self->first_slot, "first_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
26098 0 : fun( w, &self->num, "num", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
26099 0 : fd_gossip_bitvec_u8_walk( w, &self->slots, fun, "slots", level );
26100 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_slots", level-- );
26101 0 : }
26102 0 : ulong fd_gossip_slots_size( fd_gossip_slots_t const * self ) {
26103 0 : ulong size = 0;
26104 0 : size += sizeof(ulong);
26105 0 : size += sizeof(ulong);
26106 0 : size += fd_gossip_bitvec_u8_size( &self->slots );
26107 0 : return size;
26108 0 : }
26109 :
26110 0 : int fd_gossip_flate2_slots_encode( fd_gossip_flate2_slots_t const * self, fd_bincode_encode_ctx_t * ctx ) {
26111 0 : int err;
26112 0 : err = fd_bincode_uint64_encode( self->first_slot, ctx );
26113 0 : if( FD_UNLIKELY( err ) ) return err;
26114 0 : err = fd_bincode_uint64_encode( self->num, ctx );
26115 0 : if( FD_UNLIKELY( err ) ) return err;
26116 0 : err = fd_bincode_uint64_encode( self->compressed_len, ctx );
26117 0 : if( FD_UNLIKELY(err) ) return err;
26118 0 : if( self->compressed_len ) {
26119 0 : err = fd_bincode_bytes_encode( self->compressed, self->compressed_len, ctx );
26120 0 : if( FD_UNLIKELY( err ) ) return err;
26121 0 : }
26122 0 : return FD_BINCODE_SUCCESS;
26123 0 : }
26124 0 : int fd_gossip_flate2_slots_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
26125 0 : *total_sz += sizeof(fd_gossip_flate2_slots_t);
26126 0 : void const * start_data = ctx->data;
26127 0 : int err = fd_gossip_flate2_slots_decode_footprint_inner( ctx, total_sz );
26128 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
26129 0 : ctx->data = start_data;
26130 0 : return err;
26131 0 : }
26132 0 : int fd_gossip_flate2_slots_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
26133 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
26134 0 : int err = 0;
26135 0 : err = fd_bincode_uint64_decode_footprint( ctx );
26136 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26137 0 : err = fd_bincode_uint64_decode_footprint( ctx );
26138 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26139 0 : ulong compressed_len;
26140 0 : err = fd_bincode_uint64_decode( &compressed_len, ctx );
26141 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26142 0 : if( compressed_len ) {
26143 0 : *total_sz += 8UL + compressed_len;
26144 0 : err = fd_bincode_bytes_decode_footprint( compressed_len, ctx );
26145 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26146 0 : }
26147 0 : return 0;
26148 0 : }
26149 0 : void * fd_gossip_flate2_slots_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
26150 0 : fd_gossip_flate2_slots_t * self = (fd_gossip_flate2_slots_t *)mem;
26151 0 : fd_gossip_flate2_slots_new( self );
26152 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_flate2_slots_t);
26153 0 : void * * alloc_mem = &alloc_region;
26154 0 : fd_gossip_flate2_slots_decode_inner( mem, alloc_mem, ctx );
26155 0 : return self;
26156 0 : }
26157 0 : void fd_gossip_flate2_slots_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
26158 0 : fd_gossip_flate2_slots_t * self = (fd_gossip_flate2_slots_t *)struct_mem;
26159 0 : fd_bincode_uint64_decode_unsafe( &self->first_slot, ctx );
26160 0 : fd_bincode_uint64_decode_unsafe( &self->num, ctx );
26161 0 : fd_bincode_uint64_decode_unsafe( &self->compressed_len, ctx );
26162 0 : if( self->compressed_len ) {
26163 0 : self->compressed = *alloc_mem;
26164 0 : fd_bincode_bytes_decode_unsafe( self->compressed, self->compressed_len, ctx );
26165 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->compressed_len;
26166 0 : } else
26167 0 : self->compressed = NULL;
26168 0 : }
26169 0 : void * fd_gossip_flate2_slots_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
26170 0 : fd_gossip_flate2_slots_global_t * self = (fd_gossip_flate2_slots_global_t *)mem;
26171 0 : fd_gossip_flate2_slots_new( (fd_gossip_flate2_slots_t *)self );
26172 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_flate2_slots_global_t);
26173 0 : void * * alloc_mem = &alloc_region;
26174 0 : fd_gossip_flate2_slots_decode_inner_global( mem, alloc_mem, ctx );
26175 0 : return self;
26176 0 : }
26177 0 : void fd_gossip_flate2_slots_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
26178 0 : fd_gossip_flate2_slots_global_t * self = (fd_gossip_flate2_slots_global_t *)struct_mem;
26179 0 : fd_bincode_uint64_decode_unsafe( &self->first_slot, ctx );
26180 0 : fd_bincode_uint64_decode_unsafe( &self->num, ctx );
26181 0 : fd_bincode_uint64_decode_unsafe( &self->compressed_len, ctx );
26182 0 : if( self->compressed_len ) {
26183 0 : self->compressed_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
26184 0 : fd_bincode_bytes_decode_unsafe( *alloc_mem, self->compressed_len, ctx );
26185 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->compressed_len;
26186 0 : } else
26187 0 : self->compressed_gaddr = 0UL;
26188 0 : }
26189 0 : int fd_gossip_flate2_slots_convert_global_to_local( void const * global_self, fd_gossip_flate2_slots_t * self, fd_bincode_decode_ctx_t * ctx ) {
26190 0 : int err = 0;
26191 0 : fd_gossip_flate2_slots_global_t const * mem = (fd_gossip_flate2_slots_global_t const *)global_self;
26192 0 : self->first_slot = mem->first_slot;
26193 0 : self->num = mem->num;
26194 0 : self->compressed_len = mem->compressed_len;
26195 0 : self->compressed = fd_wksp_laddr_fast( ctx->wksp, mem->compressed_gaddr );
26196 0 : return FD_BINCODE_SUCCESS;
26197 0 : }
26198 0 : void fd_gossip_flate2_slots_new(fd_gossip_flate2_slots_t * self) {
26199 0 : fd_memset( self, 0, sizeof(fd_gossip_flate2_slots_t) );
26200 0 : }
26201 0 : void fd_gossip_flate2_slots_destroy( fd_gossip_flate2_slots_t * self ) {
26202 0 : if( self->compressed ) {
26203 0 : self->compressed = NULL;
26204 0 : }
26205 0 : }
26206 :
26207 0 : ulong fd_gossip_flate2_slots_footprint( void ){ return FD_GOSSIP_FLATE2_SLOTS_FOOTPRINT; }
26208 0 : ulong fd_gossip_flate2_slots_align( void ){ return FD_GOSSIP_FLATE2_SLOTS_ALIGN; }
26209 :
26210 0 : void fd_gossip_flate2_slots_walk( void * w, fd_gossip_flate2_slots_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
26211 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_flate2_slots", level++ );
26212 0 : fun( w, &self->first_slot, "first_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
26213 0 : fun( w, &self->num, "num", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
26214 0 : fun(w, self->compressed, "compressed", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
26215 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_flate2_slots", level-- );
26216 0 : }
26217 0 : ulong fd_gossip_flate2_slots_size( fd_gossip_flate2_slots_t const * self ) {
26218 0 : ulong size = 0;
26219 0 : size += sizeof(ulong);
26220 0 : size += sizeof(ulong);
26221 0 : do {
26222 0 : size += sizeof(ulong);
26223 0 : size += self->compressed_len;
26224 0 : } while(0);
26225 0 : return size;
26226 0 : }
26227 :
26228 0 : FD_FN_PURE uchar fd_gossip_slots_enum_is_flate2(fd_gossip_slots_enum_t const * self) {
26229 0 : return self->discriminant == 0;
26230 0 : }
26231 0 : FD_FN_PURE uchar fd_gossip_slots_enum_is_uncompressed(fd_gossip_slots_enum_t const * self) {
26232 0 : return self->discriminant == 1;
26233 0 : }
26234 : void fd_gossip_slots_enum_inner_new( fd_gossip_slots_enum_inner_t * self, uint discriminant );
26235 0 : int fd_gossip_slots_enum_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
26236 0 : int err;
26237 0 : switch (discriminant) {
26238 0 : case 0: {
26239 0 : err = fd_gossip_flate2_slots_decode_footprint_inner( ctx, total_sz );
26240 0 : if( FD_UNLIKELY( err ) ) return err;
26241 0 : return FD_BINCODE_SUCCESS;
26242 0 : }
26243 0 : case 1: {
26244 0 : err = fd_gossip_slots_decode_footprint_inner( ctx, total_sz );
26245 0 : if( FD_UNLIKELY( err ) ) return err;
26246 0 : return FD_BINCODE_SUCCESS;
26247 0 : }
26248 0 : default: return FD_BINCODE_ERR_ENCODING;
26249 0 : }
26250 0 : }
26251 0 : int fd_gossip_slots_enum_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
26252 0 : *total_sz += sizeof(fd_gossip_slots_enum_t);
26253 0 : void const * start_data = ctx->data;
26254 0 : int err = fd_gossip_slots_enum_decode_footprint_inner( ctx, total_sz );
26255 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
26256 0 : ctx->data = start_data;
26257 0 : return err;
26258 0 : }
26259 0 : int fd_gossip_slots_enum_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
26260 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
26261 0 : uint discriminant = 0;
26262 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
26263 0 : if( FD_UNLIKELY( err ) ) return err;
26264 0 : return fd_gossip_slots_enum_inner_decode_footprint( discriminant, ctx, total_sz );
26265 0 : }
26266 0 : void fd_gossip_slots_enum_inner_decode_inner( fd_gossip_slots_enum_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
26267 0 : switch (discriminant) {
26268 0 : case 0: {
26269 0 : fd_gossip_flate2_slots_decode_inner( &self->flate2, alloc_mem, ctx );
26270 0 : break;
26271 0 : }
26272 0 : case 1: {
26273 0 : fd_gossip_slots_decode_inner( &self->uncompressed, alloc_mem, ctx );
26274 0 : break;
26275 0 : }
26276 0 : }
26277 0 : }
26278 0 : void fd_gossip_slots_enum_inner_decode_inner_global( fd_gossip_slots_enum_inner_global_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
26279 0 : switch (discriminant) {
26280 0 : case 0: {
26281 0 : fd_gossip_flate2_slots_decode_inner_global( &self->flate2, alloc_mem, ctx );
26282 0 : break;
26283 0 : }
26284 0 : case 1: {
26285 0 : fd_gossip_slots_decode_inner_global( &self->uncompressed, alloc_mem, ctx );
26286 0 : break;
26287 0 : }
26288 0 : }
26289 0 : }
26290 0 : int fd_gossip_slots_enum_convert_global_to_local_inner( fd_gossip_slots_enum_inner_global_t const * mem, fd_gossip_slots_enum_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
26291 0 : int err = 0;
26292 0 : switch( discriminant ) {
26293 0 : case 0: {
26294 0 : err = fd_gossip_flate2_slots_convert_global_to_local( &mem->flate2, &self->flate2, ctx );
26295 0 : if( FD_UNLIKELY( err ) ) return err;
26296 0 : break;
26297 0 : }
26298 0 : case 1: {
26299 0 : err = fd_gossip_slots_convert_global_to_local( &mem->uncompressed, &self->uncompressed, ctx );
26300 0 : if( FD_UNLIKELY( err ) ) return err;
26301 0 : break;
26302 0 : }
26303 0 : }
26304 0 : return FD_BINCODE_SUCCESS;
26305 0 : }
26306 0 : int fd_gossip_slots_enum_convert_global_to_local( void const * global_self, fd_gossip_slots_enum_t * self, fd_bincode_decode_ctx_t * ctx ) {
26307 0 : fd_gossip_slots_enum_global_t const * mem = (fd_gossip_slots_enum_global_t const *)global_self;
26308 0 : uint discriminant = mem->discriminant;
26309 0 : self->discriminant = mem->discriminant;
26310 0 : int err = fd_gossip_slots_enum_convert_global_to_local_inner( &mem->inner, &self->inner, discriminant, ctx );
26311 0 : return FD_BINCODE_SUCCESS;
26312 0 : }
26313 0 : void fd_gossip_slots_enum_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
26314 0 : fd_gossip_slots_enum_t * self = (fd_gossip_slots_enum_t *)struct_mem;
26315 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
26316 0 : fd_gossip_slots_enum_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
26317 0 : }
26318 0 : void * fd_gossip_slots_enum_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
26319 0 : fd_gossip_slots_enum_t * self = (fd_gossip_slots_enum_t *)mem;
26320 0 : fd_gossip_slots_enum_new( self );
26321 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_slots_enum_t);
26322 0 : void * * alloc_mem = &alloc_region;
26323 0 : fd_gossip_slots_enum_decode_inner( mem, alloc_mem, ctx );
26324 0 : return self;
26325 0 : }
26326 0 : void * fd_gossip_slots_enum_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
26327 0 : fd_gossip_slots_enum_t * self = (fd_gossip_slots_enum_t *)mem;
26328 0 : fd_gossip_slots_enum_new( self );
26329 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_slots_enum_t);
26330 0 : void * * alloc_mem = &alloc_region;
26331 0 : fd_gossip_slots_enum_decode_inner_global( mem, alloc_mem, ctx );
26332 0 : return self;
26333 0 : }
26334 0 : void fd_gossip_slots_enum_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
26335 0 : fd_gossip_slots_enum_global_t * self = (fd_gossip_slots_enum_global_t *)struct_mem;
26336 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
26337 0 : fd_gossip_slots_enum_inner_decode_inner_global( &self->inner, alloc_mem, self->discriminant, ctx );
26338 0 : }
26339 0 : void fd_gossip_slots_enum_inner_new( fd_gossip_slots_enum_inner_t * self, uint discriminant ) {
26340 0 : switch( discriminant ) {
26341 0 : case 0: {
26342 0 : fd_gossip_flate2_slots_new( &self->flate2 );
26343 0 : break;
26344 0 : }
26345 0 : case 1: {
26346 0 : fd_gossip_slots_new( &self->uncompressed );
26347 0 : break;
26348 0 : }
26349 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
26350 0 : }
26351 0 : }
26352 0 : void fd_gossip_slots_enum_new_disc( fd_gossip_slots_enum_t * self, uint discriminant ) {
26353 0 : self->discriminant = discriminant;
26354 0 : fd_gossip_slots_enum_inner_new( &self->inner, self->discriminant );
26355 0 : }
26356 0 : void fd_gossip_slots_enum_new( fd_gossip_slots_enum_t * self ) {
26357 0 : fd_memset( self, 0, sizeof(fd_gossip_slots_enum_t) );
26358 0 : fd_gossip_slots_enum_new_disc( self, UINT_MAX );
26359 0 : }
26360 0 : void fd_gossip_slots_enum_inner_destroy( fd_gossip_slots_enum_inner_t * self, uint discriminant ) {
26361 0 : switch( discriminant ) {
26362 0 : case 0: {
26363 0 : fd_gossip_flate2_slots_destroy( &self->flate2 );
26364 0 : break;
26365 0 : }
26366 0 : case 1: {
26367 0 : fd_gossip_slots_destroy( &self->uncompressed );
26368 0 : break;
26369 0 : }
26370 0 : default: break; // FD_LOG_ERR(( "unhandled type" ));
26371 0 : }
26372 0 : }
26373 0 : void fd_gossip_slots_enum_destroy( fd_gossip_slots_enum_t * self ) {
26374 0 : fd_gossip_slots_enum_inner_destroy( &self->inner, self->discriminant );
26375 0 : }
26376 :
26377 0 : ulong fd_gossip_slots_enum_footprint( void ){ return FD_GOSSIP_SLOTS_ENUM_FOOTPRINT; }
26378 0 : ulong fd_gossip_slots_enum_align( void ){ return FD_GOSSIP_SLOTS_ENUM_ALIGN; }
26379 :
26380 0 : void fd_gossip_slots_enum_walk( void * w, fd_gossip_slots_enum_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
26381 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_gossip_slots_enum", level++);
26382 0 : switch( self->discriminant ) {
26383 0 : case 0: {
26384 0 : fun( w, self, "flate2", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
26385 0 : fd_gossip_flate2_slots_walk( w, &self->inner.flate2, fun, "flate2", level );
26386 0 : break;
26387 0 : }
26388 0 : case 1: {
26389 0 : fun( w, self, "uncompressed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
26390 0 : fd_gossip_slots_walk( w, &self->inner.uncompressed, fun, "uncompressed", level );
26391 0 : break;
26392 0 : }
26393 0 : }
26394 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_gossip_slots_enum", level-- );
26395 0 : }
26396 0 : ulong fd_gossip_slots_enum_size( fd_gossip_slots_enum_t const * self ) {
26397 0 : ulong size = 0;
26398 0 : size += sizeof(uint);
26399 0 : switch (self->discriminant) {
26400 0 : case 0: {
26401 0 : size += fd_gossip_flate2_slots_size( &self->inner.flate2 );
26402 0 : break;
26403 0 : }
26404 0 : case 1: {
26405 0 : size += fd_gossip_slots_size( &self->inner.uncompressed );
26406 0 : break;
26407 0 : }
26408 0 : }
26409 0 : return size;
26410 0 : }
26411 :
26412 0 : int fd_gossip_slots_enum_inner_encode( fd_gossip_slots_enum_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
26413 0 : int err;
26414 0 : switch (discriminant) {
26415 0 : case 0: {
26416 0 : err = fd_gossip_flate2_slots_encode( &self->flate2, ctx );
26417 0 : if( FD_UNLIKELY( err ) ) return err;
26418 0 : break;
26419 0 : }
26420 0 : case 1: {
26421 0 : err = fd_gossip_slots_encode( &self->uncompressed, ctx );
26422 0 : if( FD_UNLIKELY( err ) ) return err;
26423 0 : break;
26424 0 : }
26425 0 : }
26426 0 : return FD_BINCODE_SUCCESS;
26427 0 : }
26428 0 : int fd_gossip_slots_enum_encode( fd_gossip_slots_enum_t const * self, fd_bincode_encode_ctx_t * ctx ) {
26429 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
26430 0 : if( FD_UNLIKELY( err ) ) return err;
26431 0 : return fd_gossip_slots_enum_inner_encode( &self->inner, self->discriminant, ctx );
26432 0 : }
26433 :
26434 0 : int fd_gossip_epoch_slots_encode( fd_gossip_epoch_slots_t const * self, fd_bincode_encode_ctx_t * ctx ) {
26435 0 : int err;
26436 0 : err = fd_bincode_uint8_encode( (uchar)(self->u8), ctx );
26437 0 : if( FD_UNLIKELY( err ) ) return err;
26438 0 : err = fd_pubkey_encode( &self->from, ctx );
26439 0 : if( FD_UNLIKELY( err ) ) return err;
26440 0 : err = fd_bincode_uint64_encode( self->slots_len, ctx );
26441 0 : if( FD_UNLIKELY(err) ) return err;
26442 0 : if( self->slots_len ) {
26443 0 : for( ulong i=0; i < self->slots_len; i++ ) {
26444 0 : err = fd_gossip_slots_enum_encode( self->slots + i, ctx );
26445 0 : if( FD_UNLIKELY( err ) ) return err;
26446 0 : }
26447 0 : }
26448 0 : err = fd_bincode_uint64_encode( self->wallclock, ctx );
26449 0 : if( FD_UNLIKELY( err ) ) return err;
26450 0 : return FD_BINCODE_SUCCESS;
26451 0 : }
26452 0 : int fd_gossip_epoch_slots_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
26453 0 : *total_sz += sizeof(fd_gossip_epoch_slots_t);
26454 0 : void const * start_data = ctx->data;
26455 0 : int err = fd_gossip_epoch_slots_decode_footprint_inner( ctx, total_sz );
26456 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
26457 0 : ctx->data = start_data;
26458 0 : return err;
26459 0 : }
26460 0 : int fd_gossip_epoch_slots_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
26461 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
26462 0 : int err = 0;
26463 0 : err = fd_bincode_uint8_decode_footprint( ctx );
26464 0 : if( FD_UNLIKELY( err ) ) return err;
26465 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
26466 0 : if( FD_UNLIKELY( err ) ) return err;
26467 0 : ulong slots_len;
26468 0 : err = fd_bincode_uint64_decode( &slots_len, ctx );
26469 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26470 0 : if( slots_len ) {
26471 0 : *total_sz += FD_GOSSIP_SLOTS_ENUM_ALIGN + FD_GOSSIP_SLOTS_ENUM_FOOTPRINT*slots_len;
26472 0 : for( ulong i=0; i < slots_len; i++ ) {
26473 0 : err = fd_gossip_slots_enum_decode_footprint_inner( ctx, total_sz );
26474 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26475 0 : }
26476 0 : }
26477 0 : err = fd_bincode_uint64_decode_footprint( ctx );
26478 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26479 0 : return 0;
26480 0 : }
26481 0 : void * fd_gossip_epoch_slots_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
26482 0 : fd_gossip_epoch_slots_t * self = (fd_gossip_epoch_slots_t *)mem;
26483 0 : fd_gossip_epoch_slots_new( self );
26484 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_epoch_slots_t);
26485 0 : void * * alloc_mem = &alloc_region;
26486 0 : fd_gossip_epoch_slots_decode_inner( mem, alloc_mem, ctx );
26487 0 : return self;
26488 0 : }
26489 0 : void fd_gossip_epoch_slots_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
26490 0 : fd_gossip_epoch_slots_t * self = (fd_gossip_epoch_slots_t *)struct_mem;
26491 0 : fd_bincode_uint8_decode_unsafe( &self->u8, ctx );
26492 0 : fd_pubkey_decode_inner( &self->from, alloc_mem, ctx );
26493 0 : fd_bincode_uint64_decode_unsafe( &self->slots_len, ctx );
26494 0 : if( self->slots_len ) {
26495 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_GOSSIP_SLOTS_ENUM_ALIGN );
26496 0 : self->slots = *alloc_mem;
26497 0 : *alloc_mem = (uchar *)(*alloc_mem) + FD_GOSSIP_SLOTS_ENUM_FOOTPRINT*self->slots_len;
26498 0 : for( ulong i=0; i < self->slots_len; i++ ) {
26499 0 : fd_gossip_slots_enum_new( self->slots + i );
26500 0 : fd_gossip_slots_enum_decode_inner( self->slots + i, alloc_mem, ctx );
26501 0 : }
26502 0 : } else
26503 0 : self->slots = NULL;
26504 0 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
26505 0 : }
26506 0 : void * fd_gossip_epoch_slots_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
26507 0 : fd_gossip_epoch_slots_global_t * self = (fd_gossip_epoch_slots_global_t *)mem;
26508 0 : fd_gossip_epoch_slots_new( (fd_gossip_epoch_slots_t *)self );
26509 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_epoch_slots_global_t);
26510 0 : void * * alloc_mem = &alloc_region;
26511 0 : fd_gossip_epoch_slots_decode_inner_global( mem, alloc_mem, ctx );
26512 0 : return self;
26513 0 : }
26514 0 : void fd_gossip_epoch_slots_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
26515 0 : fd_gossip_epoch_slots_global_t * self = (fd_gossip_epoch_slots_global_t *)struct_mem;
26516 0 : fd_bincode_uint8_decode_unsafe( &self->u8, ctx );
26517 0 : fd_pubkey_decode_inner_global( &self->from, alloc_mem, ctx );
26518 0 : fd_bincode_uint64_decode_unsafe( &self->slots_len, ctx );
26519 0 : if( self->slots_len ) {
26520 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_GOSSIP_SLOTS_ENUM_ALIGN );
26521 0 : self->slots_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
26522 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
26523 0 : *alloc_mem = (uchar *)(*alloc_mem) + FD_GOSSIP_SLOTS_ENUM_FOOTPRINT*self->slots_len;
26524 0 : for( ulong i=0; i < self->slots_len; i++ ) {
26525 0 : fd_gossip_slots_enum_new( (fd_gossip_slots_enum_t *)(cur_mem + FD_GOSSIP_SLOTS_ENUM_FOOTPRINT * i) );
26526 0 : fd_gossip_slots_enum_decode_inner_global( cur_mem + FD_GOSSIP_SLOTS_ENUM_FOOTPRINT * i, alloc_mem, ctx );
26527 0 : }
26528 0 : } else
26529 0 : self->slots_gaddr = 0UL;
26530 0 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
26531 0 : }
26532 0 : int fd_gossip_epoch_slots_convert_global_to_local( void const * global_self, fd_gossip_epoch_slots_t * self, fd_bincode_decode_ctx_t * ctx ) {
26533 0 : int err = 0;
26534 0 : fd_gossip_epoch_slots_global_t const * mem = (fd_gossip_epoch_slots_global_t const *)global_self;
26535 0 : self->u8 = mem->u8;
26536 0 : err = fd_pubkey_convert_global_to_local( &mem->from, &self->from, ctx );
26537 0 : if( FD_UNLIKELY( err ) ) return err;
26538 0 : self->slots_len = mem->slots_len;
26539 0 : self->slots = fd_wksp_laddr_fast( ctx->wksp, mem->slots_gaddr );
26540 0 : self->wallclock = mem->wallclock;
26541 0 : return FD_BINCODE_SUCCESS;
26542 0 : }
26543 0 : void fd_gossip_epoch_slots_new(fd_gossip_epoch_slots_t * self) {
26544 0 : fd_memset( self, 0, sizeof(fd_gossip_epoch_slots_t) );
26545 0 : fd_pubkey_new( &self->from );
26546 0 : }
26547 0 : void fd_gossip_epoch_slots_destroy( fd_gossip_epoch_slots_t * self ) {
26548 0 : fd_pubkey_destroy( &self->from );
26549 0 : if( self->slots ) {
26550 0 : for( ulong i=0; i < self->slots_len; i++ )
26551 0 : fd_gossip_slots_enum_destroy( self->slots + i );
26552 0 : self->slots = NULL;
26553 0 : }
26554 0 : }
26555 :
26556 0 : ulong fd_gossip_epoch_slots_footprint( void ){ return FD_GOSSIP_EPOCH_SLOTS_FOOTPRINT; }
26557 0 : ulong fd_gossip_epoch_slots_align( void ){ return FD_GOSSIP_EPOCH_SLOTS_ALIGN; }
26558 :
26559 0 : void fd_gossip_epoch_slots_walk( void * w, fd_gossip_epoch_slots_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
26560 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_epoch_slots", level++ );
26561 0 : fun( w, &self->u8, "u8", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
26562 0 : fd_pubkey_walk( w, &self->from, fun, "from", level );
26563 0 : if( self->slots_len ) {
26564 0 : fun( w, NULL, "slots", FD_FLAMENCO_TYPE_ARR, "array", level++ );
26565 0 : for( ulong i=0; i < self->slots_len; i++ )
26566 0 : fd_gossip_slots_enum_walk(w, self->slots + i, fun, "gossip_slots_enum", level );
26567 0 : fun( w, NULL, "slots", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
26568 0 : }
26569 0 : fun( w, &self->wallclock, "wallclock", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
26570 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_epoch_slots", level-- );
26571 0 : }
26572 0 : ulong fd_gossip_epoch_slots_size( fd_gossip_epoch_slots_t const * self ) {
26573 0 : ulong size = 0;
26574 0 : size += sizeof(char);
26575 0 : size += fd_pubkey_size( &self->from );
26576 0 : do {
26577 0 : size += sizeof(ulong);
26578 0 : for( ulong i=0; i < self->slots_len; i++ )
26579 0 : size += fd_gossip_slots_enum_size( self->slots + i );
26580 0 : } while(0);
26581 0 : size += sizeof(ulong);
26582 0 : return size;
26583 0 : }
26584 :
26585 0 : int fd_gossip_version_v1_encode( fd_gossip_version_v1_t const * self, fd_bincode_encode_ctx_t * ctx ) {
26586 0 : int err;
26587 0 : err = fd_pubkey_encode( &self->from, ctx );
26588 0 : if( FD_UNLIKELY( err ) ) return err;
26589 0 : err = fd_bincode_uint64_encode( self->wallclock, ctx );
26590 0 : if( FD_UNLIKELY( err ) ) return err;
26591 0 : err = fd_bincode_uint16_encode( self->major, ctx );
26592 0 : if( FD_UNLIKELY( err ) ) return err;
26593 0 : err = fd_bincode_uint16_encode( self->minor, ctx );
26594 0 : if( FD_UNLIKELY( err ) ) return err;
26595 0 : err = fd_bincode_uint16_encode( self->patch, ctx );
26596 0 : if( FD_UNLIKELY( err ) ) return err;
26597 0 : err = fd_bincode_bool_encode( self->has_commit, ctx );
26598 0 : if( FD_UNLIKELY( err ) ) return err;
26599 0 : if( self->has_commit ) {
26600 0 : err = fd_bincode_uint32_encode( self->commit, ctx );
26601 0 : if( FD_UNLIKELY( err ) ) return err;
26602 0 : }
26603 0 : return FD_BINCODE_SUCCESS;
26604 0 : }
26605 0 : int fd_gossip_version_v1_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
26606 0 : *total_sz += sizeof(fd_gossip_version_v1_t);
26607 0 : void const * start_data = ctx->data;
26608 0 : int err = fd_gossip_version_v1_decode_footprint_inner( ctx, total_sz );
26609 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
26610 0 : ctx->data = start_data;
26611 0 : return err;
26612 0 : }
26613 0 : int fd_gossip_version_v1_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
26614 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
26615 0 : int err = 0;
26616 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
26617 0 : if( FD_UNLIKELY( err ) ) return err;
26618 0 : err = fd_bincode_uint64_decode_footprint( ctx );
26619 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26620 0 : err = fd_bincode_uint16_decode_footprint( ctx );
26621 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26622 0 : err = fd_bincode_uint16_decode_footprint( ctx );
26623 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26624 0 : err = fd_bincode_uint16_decode_footprint( ctx );
26625 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26626 0 : {
26627 0 : uchar o;
26628 0 : err = fd_bincode_bool_decode( &o, ctx );
26629 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26630 0 : if( o ) {
26631 0 : err = fd_bincode_uint32_decode_footprint( ctx );
26632 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26633 0 : }
26634 0 : }
26635 0 : return 0;
26636 0 : }
26637 0 : void * fd_gossip_version_v1_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
26638 0 : fd_gossip_version_v1_t * self = (fd_gossip_version_v1_t *)mem;
26639 0 : fd_gossip_version_v1_new( self );
26640 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_version_v1_t);
26641 0 : void * * alloc_mem = &alloc_region;
26642 0 : fd_gossip_version_v1_decode_inner( mem, alloc_mem, ctx );
26643 0 : return self;
26644 0 : }
26645 0 : void fd_gossip_version_v1_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
26646 0 : fd_gossip_version_v1_t * self = (fd_gossip_version_v1_t *)struct_mem;
26647 0 : fd_pubkey_decode_inner( &self->from, alloc_mem, ctx );
26648 0 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
26649 0 : fd_bincode_uint16_decode_unsafe( &self->major, ctx );
26650 0 : fd_bincode_uint16_decode_unsafe( &self->minor, ctx );
26651 0 : fd_bincode_uint16_decode_unsafe( &self->patch, ctx );
26652 0 : {
26653 0 : uchar o;
26654 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
26655 0 : self->has_commit = !!o;
26656 0 : if( o ) {
26657 0 : fd_bincode_uint32_decode_unsafe( &self->commit, ctx );
26658 0 : }
26659 0 : }
26660 0 : }
26661 0 : void * fd_gossip_version_v1_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
26662 0 : fd_gossip_version_v1_global_t * self = (fd_gossip_version_v1_global_t *)mem;
26663 0 : fd_gossip_version_v1_new( (fd_gossip_version_v1_t *)self );
26664 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_version_v1_global_t);
26665 0 : void * * alloc_mem = &alloc_region;
26666 0 : fd_gossip_version_v1_decode_inner_global( mem, alloc_mem, ctx );
26667 0 : return self;
26668 0 : }
26669 0 : void fd_gossip_version_v1_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
26670 0 : fd_gossip_version_v1_global_t * self = (fd_gossip_version_v1_global_t *)struct_mem;
26671 0 : fd_pubkey_decode_inner_global( &self->from, alloc_mem, ctx );
26672 0 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
26673 0 : fd_bincode_uint16_decode_unsafe( &self->major, ctx );
26674 0 : fd_bincode_uint16_decode_unsafe( &self->minor, ctx );
26675 0 : fd_bincode_uint16_decode_unsafe( &self->patch, ctx );
26676 0 : {
26677 0 : uchar o;
26678 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
26679 0 : self->has_commit = !!o;
26680 0 : if( o ) {
26681 0 : fd_bincode_uint32_decode_unsafe( &self->commit, ctx );
26682 0 : }
26683 0 : }
26684 0 : }
26685 0 : int fd_gossip_version_v1_convert_global_to_local( void const * global_self, fd_gossip_version_v1_t * self, fd_bincode_decode_ctx_t * ctx ) {
26686 0 : int err = 0;
26687 0 : fd_gossip_version_v1_global_t const * mem = (fd_gossip_version_v1_global_t const *)global_self;
26688 0 : err = fd_pubkey_convert_global_to_local( &mem->from, &self->from, ctx );
26689 0 : if( FD_UNLIKELY( err ) ) return err;
26690 0 : self->wallclock = mem->wallclock;
26691 0 : self->major = mem->major;
26692 0 : self->minor = mem->minor;
26693 0 : self->patch = mem->patch;
26694 0 : self->commit = mem->commit;
26695 0 : self->has_commit = mem->has_commit;
26696 0 : return FD_BINCODE_SUCCESS;
26697 0 : }
26698 0 : void fd_gossip_version_v1_new(fd_gossip_version_v1_t * self) {
26699 0 : fd_memset( self, 0, sizeof(fd_gossip_version_v1_t) );
26700 0 : fd_pubkey_new( &self->from );
26701 0 : }
26702 0 : void fd_gossip_version_v1_destroy( fd_gossip_version_v1_t * self ) {
26703 0 : fd_pubkey_destroy( &self->from );
26704 0 : if( self->has_commit ) {
26705 0 : self->has_commit = 0;
26706 0 : }
26707 0 : }
26708 :
26709 0 : ulong fd_gossip_version_v1_footprint( void ){ return FD_GOSSIP_VERSION_V1_FOOTPRINT; }
26710 0 : ulong fd_gossip_version_v1_align( void ){ return FD_GOSSIP_VERSION_V1_ALIGN; }
26711 :
26712 0 : void fd_gossip_version_v1_walk( void * w, fd_gossip_version_v1_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
26713 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_version_v1", level++ );
26714 0 : fd_pubkey_walk( w, &self->from, fun, "from", level );
26715 0 : fun( w, &self->wallclock, "wallclock", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
26716 0 : fun( w, &self->major, "major", FD_FLAMENCO_TYPE_USHORT, "ushort", level );
26717 0 : fun( w, &self->minor, "minor", FD_FLAMENCO_TYPE_USHORT, "ushort", level );
26718 0 : fun( w, &self->patch, "patch", FD_FLAMENCO_TYPE_USHORT, "ushort", level );
26719 0 : if( !self->has_commit ) {
26720 0 : fun( w, NULL, "commit", FD_FLAMENCO_TYPE_NULL, "uint", level );
26721 0 : } else {
26722 0 : fun( w, &self->commit, "commit", FD_FLAMENCO_TYPE_UINT, "uint", level );
26723 0 : }
26724 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_version_v1", level-- );
26725 0 : }
26726 0 : ulong fd_gossip_version_v1_size( fd_gossip_version_v1_t const * self ) {
26727 0 : ulong size = 0;
26728 0 : size += fd_pubkey_size( &self->from );
26729 0 : size += sizeof(ulong);
26730 0 : size += sizeof(ushort);
26731 0 : size += sizeof(ushort);
26732 0 : size += sizeof(ushort);
26733 0 : size += sizeof(char);
26734 0 : if( self->has_commit ) {
26735 0 : size += sizeof(uint);
26736 0 : }
26737 0 : return size;
26738 0 : }
26739 :
26740 0 : int fd_gossip_version_v2_encode( fd_gossip_version_v2_t const * self, fd_bincode_encode_ctx_t * ctx ) {
26741 0 : int err;
26742 0 : err = fd_pubkey_encode( &self->from, ctx );
26743 0 : if( FD_UNLIKELY( err ) ) return err;
26744 0 : err = fd_bincode_uint64_encode( self->wallclock, ctx );
26745 0 : if( FD_UNLIKELY( err ) ) return err;
26746 0 : err = fd_bincode_uint16_encode( self->major, ctx );
26747 0 : if( FD_UNLIKELY( err ) ) return err;
26748 0 : err = fd_bincode_uint16_encode( self->minor, ctx );
26749 0 : if( FD_UNLIKELY( err ) ) return err;
26750 0 : err = fd_bincode_uint16_encode( self->patch, ctx );
26751 0 : if( FD_UNLIKELY( err ) ) return err;
26752 0 : err = fd_bincode_bool_encode( self->has_commit, ctx );
26753 0 : if( FD_UNLIKELY( err ) ) return err;
26754 0 : if( self->has_commit ) {
26755 0 : err = fd_bincode_uint32_encode( self->commit, ctx );
26756 0 : if( FD_UNLIKELY( err ) ) return err;
26757 0 : }
26758 0 : err = fd_bincode_uint32_encode( self->feature_set, ctx );
26759 0 : if( FD_UNLIKELY( err ) ) return err;
26760 0 : return FD_BINCODE_SUCCESS;
26761 0 : }
26762 0 : int fd_gossip_version_v2_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
26763 0 : *total_sz += sizeof(fd_gossip_version_v2_t);
26764 0 : void const * start_data = ctx->data;
26765 0 : int err = fd_gossip_version_v2_decode_footprint_inner( ctx, total_sz );
26766 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
26767 0 : ctx->data = start_data;
26768 0 : return err;
26769 0 : }
26770 3 : int fd_gossip_version_v2_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
26771 3 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
26772 3 : int err = 0;
26773 3 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
26774 3 : if( FD_UNLIKELY( err ) ) return err;
26775 3 : err = fd_bincode_uint64_decode_footprint( ctx );
26776 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26777 3 : err = fd_bincode_uint16_decode_footprint( ctx );
26778 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26779 3 : err = fd_bincode_uint16_decode_footprint( ctx );
26780 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26781 3 : err = fd_bincode_uint16_decode_footprint( ctx );
26782 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26783 3 : {
26784 3 : uchar o;
26785 3 : err = fd_bincode_bool_decode( &o, ctx );
26786 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26787 3 : if( o ) {
26788 0 : err = fd_bincode_uint32_decode_footprint( ctx );
26789 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26790 0 : }
26791 3 : }
26792 3 : err = fd_bincode_uint32_decode_footprint( ctx );
26793 3 : if( FD_UNLIKELY( err ) ) return err;
26794 3 : return 0;
26795 3 : }
26796 0 : void * fd_gossip_version_v2_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
26797 0 : fd_gossip_version_v2_t * self = (fd_gossip_version_v2_t *)mem;
26798 0 : fd_gossip_version_v2_new( self );
26799 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_version_v2_t);
26800 0 : void * * alloc_mem = &alloc_region;
26801 0 : fd_gossip_version_v2_decode_inner( mem, alloc_mem, ctx );
26802 0 : return self;
26803 0 : }
26804 3 : void fd_gossip_version_v2_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
26805 3 : fd_gossip_version_v2_t * self = (fd_gossip_version_v2_t *)struct_mem;
26806 3 : fd_pubkey_decode_inner( &self->from, alloc_mem, ctx );
26807 3 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
26808 3 : fd_bincode_uint16_decode_unsafe( &self->major, ctx );
26809 3 : fd_bincode_uint16_decode_unsafe( &self->minor, ctx );
26810 3 : fd_bincode_uint16_decode_unsafe( &self->patch, ctx );
26811 3 : {
26812 3 : uchar o;
26813 3 : fd_bincode_bool_decode_unsafe( &o, ctx );
26814 3 : self->has_commit = !!o;
26815 3 : if( o ) {
26816 0 : fd_bincode_uint32_decode_unsafe( &self->commit, ctx );
26817 0 : }
26818 3 : }
26819 3 : fd_bincode_uint32_decode_unsafe( &self->feature_set, ctx );
26820 3 : }
26821 0 : void * fd_gossip_version_v2_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
26822 0 : fd_gossip_version_v2_global_t * self = (fd_gossip_version_v2_global_t *)mem;
26823 0 : fd_gossip_version_v2_new( (fd_gossip_version_v2_t *)self );
26824 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_version_v2_global_t);
26825 0 : void * * alloc_mem = &alloc_region;
26826 0 : fd_gossip_version_v2_decode_inner_global( mem, alloc_mem, ctx );
26827 0 : return self;
26828 0 : }
26829 0 : void fd_gossip_version_v2_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
26830 0 : fd_gossip_version_v2_global_t * self = (fd_gossip_version_v2_global_t *)struct_mem;
26831 0 : fd_pubkey_decode_inner_global( &self->from, alloc_mem, ctx );
26832 0 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
26833 0 : fd_bincode_uint16_decode_unsafe( &self->major, ctx );
26834 0 : fd_bincode_uint16_decode_unsafe( &self->minor, ctx );
26835 0 : fd_bincode_uint16_decode_unsafe( &self->patch, ctx );
26836 0 : {
26837 0 : uchar o;
26838 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
26839 0 : self->has_commit = !!o;
26840 0 : if( o ) {
26841 0 : fd_bincode_uint32_decode_unsafe( &self->commit, ctx );
26842 0 : }
26843 0 : }
26844 0 : fd_bincode_uint32_decode_unsafe( &self->feature_set, ctx );
26845 0 : }
26846 0 : int fd_gossip_version_v2_convert_global_to_local( void const * global_self, fd_gossip_version_v2_t * self, fd_bincode_decode_ctx_t * ctx ) {
26847 0 : int err = 0;
26848 0 : fd_gossip_version_v2_global_t const * mem = (fd_gossip_version_v2_global_t const *)global_self;
26849 0 : err = fd_pubkey_convert_global_to_local( &mem->from, &self->from, ctx );
26850 0 : if( FD_UNLIKELY( err ) ) return err;
26851 0 : self->wallclock = mem->wallclock;
26852 0 : self->major = mem->major;
26853 0 : self->minor = mem->minor;
26854 0 : self->patch = mem->patch;
26855 0 : self->commit = mem->commit;
26856 0 : self->has_commit = mem->has_commit;
26857 0 : self->feature_set = mem->feature_set;
26858 0 : return FD_BINCODE_SUCCESS;
26859 0 : }
26860 0 : void fd_gossip_version_v2_new(fd_gossip_version_v2_t * self) {
26861 0 : fd_memset( self, 0, sizeof(fd_gossip_version_v2_t) );
26862 0 : fd_pubkey_new( &self->from );
26863 0 : }
26864 0 : void fd_gossip_version_v2_destroy( fd_gossip_version_v2_t * self ) {
26865 0 : fd_pubkey_destroy( &self->from );
26866 0 : if( self->has_commit ) {
26867 0 : self->has_commit = 0;
26868 0 : }
26869 0 : }
26870 :
26871 0 : ulong fd_gossip_version_v2_footprint( void ){ return FD_GOSSIP_VERSION_V2_FOOTPRINT; }
26872 0 : ulong fd_gossip_version_v2_align( void ){ return FD_GOSSIP_VERSION_V2_ALIGN; }
26873 :
26874 3 : void fd_gossip_version_v2_walk( void * w, fd_gossip_version_v2_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
26875 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_version_v2", level++ );
26876 3 : fd_pubkey_walk( w, &self->from, fun, "from", level );
26877 3 : fun( w, &self->wallclock, "wallclock", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
26878 3 : fun( w, &self->major, "major", FD_FLAMENCO_TYPE_USHORT, "ushort", level );
26879 3 : fun( w, &self->minor, "minor", FD_FLAMENCO_TYPE_USHORT, "ushort", level );
26880 3 : fun( w, &self->patch, "patch", FD_FLAMENCO_TYPE_USHORT, "ushort", level );
26881 3 : if( !self->has_commit ) {
26882 3 : fun( w, NULL, "commit", FD_FLAMENCO_TYPE_NULL, "uint", level );
26883 3 : } else {
26884 0 : fun( w, &self->commit, "commit", FD_FLAMENCO_TYPE_UINT, "uint", level );
26885 0 : }
26886 3 : fun( w, &self->feature_set, "feature_set", FD_FLAMENCO_TYPE_UINT, "uint", level );
26887 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_version_v2", level-- );
26888 3 : }
26889 0 : ulong fd_gossip_version_v2_size( fd_gossip_version_v2_t const * self ) {
26890 0 : ulong size = 0;
26891 0 : size += fd_pubkey_size( &self->from );
26892 0 : size += sizeof(ulong);
26893 0 : size += sizeof(ushort);
26894 0 : size += sizeof(ushort);
26895 0 : size += sizeof(ushort);
26896 0 : size += sizeof(char);
26897 0 : if( self->has_commit ) {
26898 0 : size += sizeof(uint);
26899 0 : }
26900 0 : size += sizeof(uint);
26901 0 : return size;
26902 0 : }
26903 :
26904 0 : int fd_gossip_version_v3_encode( fd_gossip_version_v3_t const * self, fd_bincode_encode_ctx_t * ctx ) {
26905 0 : int err;
26906 0 : err = fd_bincode_compact_u16_encode( &self->major, ctx );
26907 0 : if( FD_UNLIKELY( err ) ) return err;
26908 0 : err = fd_bincode_compact_u16_encode( &self->minor, ctx );
26909 0 : if( FD_UNLIKELY( err ) ) return err;
26910 0 : err = fd_bincode_compact_u16_encode( &self->patch, ctx );
26911 0 : if( FD_UNLIKELY( err ) ) return err;
26912 0 : err = fd_bincode_uint32_encode( self->commit, ctx );
26913 0 : if( FD_UNLIKELY( err ) ) return err;
26914 0 : err = fd_bincode_uint32_encode( self->feature_set, ctx );
26915 0 : if( FD_UNLIKELY( err ) ) return err;
26916 0 : err = fd_bincode_compact_u16_encode( &self->client, ctx );
26917 0 : if( FD_UNLIKELY( err ) ) return err;
26918 0 : return FD_BINCODE_SUCCESS;
26919 0 : }
26920 0 : int fd_gossip_version_v3_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
26921 0 : *total_sz += sizeof(fd_gossip_version_v3_t);
26922 0 : void const * start_data = ctx->data;
26923 0 : int err = fd_gossip_version_v3_decode_footprint_inner( ctx, total_sz );
26924 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
26925 0 : ctx->data = start_data;
26926 0 : return err;
26927 0 : }
26928 3 : int fd_gossip_version_v3_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
26929 3 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
26930 3 : int err = 0;
26931 3 : do { ushort _tmp; err = fd_bincode_compact_u16_decode( &_tmp, ctx ); } while(0);
26932 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26933 3 : do { ushort _tmp; err = fd_bincode_compact_u16_decode( &_tmp, ctx ); } while(0);
26934 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26935 3 : do { ushort _tmp; err = fd_bincode_compact_u16_decode( &_tmp, ctx ); } while(0);
26936 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26937 3 : err = fd_bincode_uint32_decode_footprint( ctx );
26938 3 : if( FD_UNLIKELY( err ) ) return err;
26939 3 : err = fd_bincode_uint32_decode_footprint( ctx );
26940 3 : if( FD_UNLIKELY( err ) ) return err;
26941 3 : do { ushort _tmp; err = fd_bincode_compact_u16_decode( &_tmp, ctx ); } while(0);
26942 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26943 3 : return 0;
26944 3 : }
26945 0 : void * fd_gossip_version_v3_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
26946 0 : fd_gossip_version_v3_t * self = (fd_gossip_version_v3_t *)mem;
26947 0 : fd_gossip_version_v3_new( self );
26948 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_version_v3_t);
26949 0 : void * * alloc_mem = &alloc_region;
26950 0 : fd_gossip_version_v3_decode_inner( mem, alloc_mem, ctx );
26951 0 : return self;
26952 0 : }
26953 3 : void fd_gossip_version_v3_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
26954 3 : fd_gossip_version_v3_t * self = (fd_gossip_version_v3_t *)struct_mem;
26955 3 : fd_bincode_compact_u16_decode_unsafe( &self->major, ctx );
26956 3 : fd_bincode_compact_u16_decode_unsafe( &self->minor, ctx );
26957 3 : fd_bincode_compact_u16_decode_unsafe( &self->patch, ctx );
26958 3 : fd_bincode_uint32_decode_unsafe( &self->commit, ctx );
26959 3 : fd_bincode_uint32_decode_unsafe( &self->feature_set, ctx );
26960 3 : fd_bincode_compact_u16_decode_unsafe( &self->client, ctx );
26961 3 : }
26962 0 : void * fd_gossip_version_v3_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
26963 0 : fd_gossip_version_v3_global_t * self = (fd_gossip_version_v3_global_t *)mem;
26964 0 : fd_gossip_version_v3_new( (fd_gossip_version_v3_t *)self );
26965 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_version_v3_global_t);
26966 0 : void * * alloc_mem = &alloc_region;
26967 0 : fd_gossip_version_v3_decode_inner_global( mem, alloc_mem, ctx );
26968 0 : return self;
26969 0 : }
26970 0 : void fd_gossip_version_v3_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
26971 0 : fd_gossip_version_v3_global_t * self = (fd_gossip_version_v3_global_t *)struct_mem;
26972 0 : fd_bincode_compact_u16_decode_unsafe( &self->major, ctx );
26973 0 : fd_bincode_compact_u16_decode_unsafe( &self->minor, ctx );
26974 0 : fd_bincode_compact_u16_decode_unsafe( &self->patch, ctx );
26975 0 : fd_bincode_uint32_decode_unsafe( &self->commit, ctx );
26976 0 : fd_bincode_uint32_decode_unsafe( &self->feature_set, ctx );
26977 0 : fd_bincode_compact_u16_decode_unsafe( &self->client, ctx );
26978 0 : }
26979 0 : int fd_gossip_version_v3_convert_global_to_local( void const * global_self, fd_gossip_version_v3_t * self, fd_bincode_decode_ctx_t * ctx ) {
26980 0 : int err = 0;
26981 0 : fd_gossip_version_v3_global_t const * mem = (fd_gossip_version_v3_global_t const *)global_self;
26982 0 : self->major = mem->major;
26983 0 : self->minor = mem->minor;
26984 0 : self->patch = mem->patch;
26985 0 : self->commit = mem->commit;
26986 0 : self->feature_set = mem->feature_set;
26987 0 : self->client = mem->client;
26988 0 : return FD_BINCODE_SUCCESS;
26989 0 : }
26990 0 : void fd_gossip_version_v3_new(fd_gossip_version_v3_t * self) {
26991 0 : fd_memset( self, 0, sizeof(fd_gossip_version_v3_t) );
26992 0 : }
26993 0 : void fd_gossip_version_v3_destroy( fd_gossip_version_v3_t * self ) {
26994 0 : }
26995 :
26996 0 : ulong fd_gossip_version_v3_footprint( void ){ return FD_GOSSIP_VERSION_V3_FOOTPRINT; }
26997 0 : ulong fd_gossip_version_v3_align( void ){ return FD_GOSSIP_VERSION_V3_ALIGN; }
26998 :
26999 3 : void fd_gossip_version_v3_walk( void * w, fd_gossip_version_v3_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
27000 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_version_v3", level++ );
27001 3 : fun( w, &self->major, "major", FD_FLAMENCO_TYPE_USHORT, "ushort", level );
27002 3 : fun( w, &self->minor, "minor", FD_FLAMENCO_TYPE_USHORT, "ushort", level );
27003 3 : fun( w, &self->patch, "patch", FD_FLAMENCO_TYPE_USHORT, "ushort", level );
27004 3 : fun( w, &self->commit, "commit", FD_FLAMENCO_TYPE_UINT, "uint", level );
27005 3 : fun( w, &self->feature_set, "feature_set", FD_FLAMENCO_TYPE_UINT, "uint", level );
27006 3 : fun( w, &self->client, "client", FD_FLAMENCO_TYPE_USHORT, "ushort", level );
27007 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_version_v3", level-- );
27008 3 : }
27009 0 : ulong fd_gossip_version_v3_size( fd_gossip_version_v3_t const * self ) {
27010 0 : ulong size = 0;
27011 0 : size += fd_bincode_compact_u16_size( &self->major );
27012 0 : size += fd_bincode_compact_u16_size( &self->minor );
27013 0 : size += fd_bincode_compact_u16_size( &self->patch );
27014 0 : size += sizeof(uint);
27015 0 : size += sizeof(uint);
27016 0 : size += fd_bincode_compact_u16_size( &self->client );
27017 0 : return size;
27018 0 : }
27019 :
27020 0 : int fd_gossip_node_instance_encode( fd_gossip_node_instance_t const * self, fd_bincode_encode_ctx_t * ctx ) {
27021 0 : int err;
27022 0 : err = fd_pubkey_encode( &self->from, ctx );
27023 0 : if( FD_UNLIKELY( err ) ) return err;
27024 0 : err = fd_bincode_uint64_encode( self->wallclock, ctx );
27025 0 : if( FD_UNLIKELY( err ) ) return err;
27026 0 : err = fd_bincode_uint64_encode( (ulong)self->timestamp, ctx );
27027 0 : if( FD_UNLIKELY( err ) ) return err;
27028 0 : err = fd_bincode_uint64_encode( self->token, ctx );
27029 0 : if( FD_UNLIKELY( err ) ) return err;
27030 0 : return FD_BINCODE_SUCCESS;
27031 0 : }
27032 0 : int fd_gossip_node_instance_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
27033 0 : *total_sz += sizeof(fd_gossip_node_instance_t);
27034 0 : void const * start_data = ctx->data;
27035 0 : int err = fd_gossip_node_instance_decode_footprint_inner( ctx, total_sz );
27036 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
27037 0 : ctx->data = start_data;
27038 0 : return err;
27039 0 : }
27040 6 : int fd_gossip_node_instance_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
27041 6 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
27042 6 : int err = 0;
27043 6 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
27044 6 : if( FD_UNLIKELY( err ) ) return err;
27045 6 : err = fd_bincode_uint64_decode_footprint( ctx );
27046 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27047 6 : err = fd_bincode_uint64_decode_footprint( ctx );
27048 6 : if( FD_UNLIKELY( err ) ) return err;
27049 6 : err = fd_bincode_uint64_decode_footprint( ctx );
27050 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27051 6 : return 0;
27052 6 : }
27053 0 : void * fd_gossip_node_instance_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
27054 0 : fd_gossip_node_instance_t * self = (fd_gossip_node_instance_t *)mem;
27055 0 : fd_gossip_node_instance_new( self );
27056 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_node_instance_t);
27057 0 : void * * alloc_mem = &alloc_region;
27058 0 : fd_gossip_node_instance_decode_inner( mem, alloc_mem, ctx );
27059 0 : return self;
27060 0 : }
27061 6 : void fd_gossip_node_instance_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
27062 6 : fd_gossip_node_instance_t * self = (fd_gossip_node_instance_t *)struct_mem;
27063 6 : fd_pubkey_decode_inner( &self->from, alloc_mem, ctx );
27064 6 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
27065 6 : fd_bincode_uint64_decode_unsafe( (ulong *) &self->timestamp, ctx );
27066 6 : fd_bincode_uint64_decode_unsafe( &self->token, ctx );
27067 6 : }
27068 0 : void * fd_gossip_node_instance_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
27069 0 : fd_gossip_node_instance_global_t * self = (fd_gossip_node_instance_global_t *)mem;
27070 0 : fd_gossip_node_instance_new( (fd_gossip_node_instance_t *)self );
27071 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_node_instance_global_t);
27072 0 : void * * alloc_mem = &alloc_region;
27073 0 : fd_gossip_node_instance_decode_inner_global( mem, alloc_mem, ctx );
27074 0 : return self;
27075 0 : }
27076 0 : void fd_gossip_node_instance_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
27077 0 : fd_gossip_node_instance_global_t * self = (fd_gossip_node_instance_global_t *)struct_mem;
27078 0 : fd_pubkey_decode_inner_global( &self->from, alloc_mem, ctx );
27079 0 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
27080 0 : fd_bincode_uint64_decode_unsafe( (ulong *) &self->timestamp, ctx );
27081 0 : fd_bincode_uint64_decode_unsafe( &self->token, ctx );
27082 0 : }
27083 0 : int fd_gossip_node_instance_convert_global_to_local( void const * global_self, fd_gossip_node_instance_t * self, fd_bincode_decode_ctx_t * ctx ) {
27084 0 : int err = 0;
27085 0 : fd_gossip_node_instance_global_t const * mem = (fd_gossip_node_instance_global_t const *)global_self;
27086 0 : err = fd_pubkey_convert_global_to_local( &mem->from, &self->from, ctx );
27087 0 : if( FD_UNLIKELY( err ) ) return err;
27088 0 : self->wallclock = mem->wallclock;
27089 0 : self->timestamp = mem->timestamp;
27090 0 : self->token = mem->token;
27091 0 : return FD_BINCODE_SUCCESS;
27092 0 : }
27093 0 : void fd_gossip_node_instance_new(fd_gossip_node_instance_t * self) {
27094 0 : fd_memset( self, 0, sizeof(fd_gossip_node_instance_t) );
27095 0 : fd_pubkey_new( &self->from );
27096 0 : }
27097 0 : void fd_gossip_node_instance_destroy( fd_gossip_node_instance_t * self ) {
27098 0 : fd_pubkey_destroy( &self->from );
27099 0 : }
27100 :
27101 0 : ulong fd_gossip_node_instance_footprint( void ){ return FD_GOSSIP_NODE_INSTANCE_FOOTPRINT; }
27102 0 : ulong fd_gossip_node_instance_align( void ){ return FD_GOSSIP_NODE_INSTANCE_ALIGN; }
27103 :
27104 6 : void fd_gossip_node_instance_walk( void * w, fd_gossip_node_instance_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
27105 6 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_node_instance", level++ );
27106 6 : fd_pubkey_walk( w, &self->from, fun, "from", level );
27107 6 : fun( w, &self->wallclock, "wallclock", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
27108 6 : fun( w, &self->timestamp, "timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level );
27109 6 : fun( w, &self->token, "token", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
27110 6 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_node_instance", level-- );
27111 6 : }
27112 0 : ulong fd_gossip_node_instance_size( fd_gossip_node_instance_t const * self ) {
27113 0 : ulong size = 0;
27114 0 : size += fd_pubkey_size( &self->from );
27115 0 : size += sizeof(ulong);
27116 0 : size += sizeof(long);
27117 0 : size += sizeof(ulong);
27118 0 : return size;
27119 0 : }
27120 :
27121 0 : int fd_gossip_duplicate_shred_encode( fd_gossip_duplicate_shred_t const * self, fd_bincode_encode_ctx_t * ctx ) {
27122 0 : int err;
27123 0 : err = fd_bincode_uint16_encode( self->duplicate_shred_index, ctx );
27124 0 : if( FD_UNLIKELY( err ) ) return err;
27125 0 : err = fd_pubkey_encode( &self->from, ctx );
27126 0 : if( FD_UNLIKELY( err ) ) return err;
27127 0 : err = fd_bincode_uint64_encode( self->wallclock, ctx );
27128 0 : if( FD_UNLIKELY( err ) ) return err;
27129 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
27130 0 : if( FD_UNLIKELY( err ) ) return err;
27131 0 : err = fd_bincode_uint32_encode( self->_unused, ctx );
27132 0 : if( FD_UNLIKELY( err ) ) return err;
27133 0 : err = fd_bincode_uint8_encode( (uchar)(self->_unused_shred_type), ctx );
27134 0 : if( FD_UNLIKELY( err ) ) return err;
27135 0 : err = fd_bincode_uint8_encode( (uchar)(self->num_chunks), ctx );
27136 0 : if( FD_UNLIKELY( err ) ) return err;
27137 0 : err = fd_bincode_uint8_encode( (uchar)(self->chunk_index), ctx );
27138 0 : if( FD_UNLIKELY( err ) ) return err;
27139 0 : err = fd_bincode_uint64_encode( self->chunk_len, ctx );
27140 0 : if( FD_UNLIKELY(err) ) return err;
27141 0 : if( self->chunk_len ) {
27142 0 : err = fd_bincode_bytes_encode( self->chunk, self->chunk_len, ctx );
27143 0 : if( FD_UNLIKELY( err ) ) return err;
27144 0 : }
27145 0 : return FD_BINCODE_SUCCESS;
27146 0 : }
27147 0 : int fd_gossip_duplicate_shred_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
27148 0 : *total_sz += sizeof(fd_gossip_duplicate_shred_t);
27149 0 : void const * start_data = ctx->data;
27150 0 : int err = fd_gossip_duplicate_shred_decode_footprint_inner( ctx, total_sz );
27151 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
27152 0 : ctx->data = start_data;
27153 0 : return err;
27154 0 : }
27155 0 : int fd_gossip_duplicate_shred_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
27156 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
27157 0 : int err = 0;
27158 0 : err = fd_bincode_uint16_decode_footprint( ctx );
27159 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27160 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
27161 0 : if( FD_UNLIKELY( err ) ) return err;
27162 0 : err = fd_bincode_uint64_decode_footprint( ctx );
27163 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27164 0 : err = fd_bincode_uint64_decode_footprint( ctx );
27165 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27166 0 : err = fd_bincode_uint32_decode_footprint( ctx );
27167 0 : if( FD_UNLIKELY( err ) ) return err;
27168 0 : err = fd_bincode_uint8_decode_footprint( ctx );
27169 0 : if( FD_UNLIKELY( err ) ) return err;
27170 0 : err = fd_bincode_uint8_decode_footprint( ctx );
27171 0 : if( FD_UNLIKELY( err ) ) return err;
27172 0 : err = fd_bincode_uint8_decode_footprint( ctx );
27173 0 : if( FD_UNLIKELY( err ) ) return err;
27174 0 : ulong chunk_len;
27175 0 : err = fd_bincode_uint64_decode( &chunk_len, ctx );
27176 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27177 0 : if( chunk_len ) {
27178 0 : *total_sz += 8UL + chunk_len;
27179 0 : err = fd_bincode_bytes_decode_footprint( chunk_len, ctx );
27180 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27181 0 : }
27182 0 : return 0;
27183 0 : }
27184 0 : void * fd_gossip_duplicate_shred_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
27185 0 : fd_gossip_duplicate_shred_t * self = (fd_gossip_duplicate_shred_t *)mem;
27186 0 : fd_gossip_duplicate_shred_new( self );
27187 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_duplicate_shred_t);
27188 0 : void * * alloc_mem = &alloc_region;
27189 0 : fd_gossip_duplicate_shred_decode_inner( mem, alloc_mem, ctx );
27190 0 : return self;
27191 0 : }
27192 0 : void fd_gossip_duplicate_shred_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
27193 0 : fd_gossip_duplicate_shred_t * self = (fd_gossip_duplicate_shred_t *)struct_mem;
27194 0 : fd_bincode_uint16_decode_unsafe( &self->duplicate_shred_index, ctx );
27195 0 : fd_pubkey_decode_inner( &self->from, alloc_mem, ctx );
27196 0 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
27197 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
27198 0 : fd_bincode_uint32_decode_unsafe( &self->_unused, ctx );
27199 0 : fd_bincode_uint8_decode_unsafe( &self->_unused_shred_type, ctx );
27200 0 : fd_bincode_uint8_decode_unsafe( &self->num_chunks, ctx );
27201 0 : fd_bincode_uint8_decode_unsafe( &self->chunk_index, ctx );
27202 0 : fd_bincode_uint64_decode_unsafe( &self->chunk_len, ctx );
27203 0 : if( self->chunk_len ) {
27204 0 : self->chunk = *alloc_mem;
27205 0 : fd_bincode_bytes_decode_unsafe( self->chunk, self->chunk_len, ctx );
27206 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->chunk_len;
27207 0 : } else
27208 0 : self->chunk = NULL;
27209 0 : }
27210 0 : void * fd_gossip_duplicate_shred_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
27211 0 : fd_gossip_duplicate_shred_global_t * self = (fd_gossip_duplicate_shred_global_t *)mem;
27212 0 : fd_gossip_duplicate_shred_new( (fd_gossip_duplicate_shred_t *)self );
27213 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_duplicate_shred_global_t);
27214 0 : void * * alloc_mem = &alloc_region;
27215 0 : fd_gossip_duplicate_shred_decode_inner_global( mem, alloc_mem, ctx );
27216 0 : return self;
27217 0 : }
27218 0 : void fd_gossip_duplicate_shred_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
27219 0 : fd_gossip_duplicate_shred_global_t * self = (fd_gossip_duplicate_shred_global_t *)struct_mem;
27220 0 : fd_bincode_uint16_decode_unsafe( &self->duplicate_shred_index, ctx );
27221 0 : fd_pubkey_decode_inner_global( &self->from, alloc_mem, ctx );
27222 0 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
27223 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
27224 0 : fd_bincode_uint32_decode_unsafe( &self->_unused, ctx );
27225 0 : fd_bincode_uint8_decode_unsafe( &self->_unused_shred_type, ctx );
27226 0 : fd_bincode_uint8_decode_unsafe( &self->num_chunks, ctx );
27227 0 : fd_bincode_uint8_decode_unsafe( &self->chunk_index, ctx );
27228 0 : fd_bincode_uint64_decode_unsafe( &self->chunk_len, ctx );
27229 0 : if( self->chunk_len ) {
27230 0 : self->chunk_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
27231 0 : fd_bincode_bytes_decode_unsafe( *alloc_mem, self->chunk_len, ctx );
27232 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->chunk_len;
27233 0 : } else
27234 0 : self->chunk_gaddr = 0UL;
27235 0 : }
27236 0 : int fd_gossip_duplicate_shred_convert_global_to_local( void const * global_self, fd_gossip_duplicate_shred_t * self, fd_bincode_decode_ctx_t * ctx ) {
27237 0 : int err = 0;
27238 0 : fd_gossip_duplicate_shred_global_t const * mem = (fd_gossip_duplicate_shred_global_t const *)global_self;
27239 0 : self->duplicate_shred_index = mem->duplicate_shred_index;
27240 0 : err = fd_pubkey_convert_global_to_local( &mem->from, &self->from, ctx );
27241 0 : if( FD_UNLIKELY( err ) ) return err;
27242 0 : self->wallclock = mem->wallclock;
27243 0 : self->slot = mem->slot;
27244 0 : self->_unused = mem->_unused;
27245 0 : self->_unused_shred_type = mem->_unused_shred_type;
27246 0 : self->num_chunks = mem->num_chunks;
27247 0 : self->chunk_index = mem->chunk_index;
27248 0 : self->chunk_len = mem->chunk_len;
27249 0 : self->chunk = fd_wksp_laddr_fast( ctx->wksp, mem->chunk_gaddr );
27250 0 : return FD_BINCODE_SUCCESS;
27251 0 : }
27252 0 : void fd_gossip_duplicate_shred_new(fd_gossip_duplicate_shred_t * self) {
27253 0 : fd_memset( self, 0, sizeof(fd_gossip_duplicate_shred_t) );
27254 0 : fd_pubkey_new( &self->from );
27255 0 : }
27256 0 : void fd_gossip_duplicate_shred_destroy( fd_gossip_duplicate_shred_t * self ) {
27257 0 : fd_pubkey_destroy( &self->from );
27258 0 : if( self->chunk ) {
27259 0 : self->chunk = NULL;
27260 0 : }
27261 0 : }
27262 :
27263 0 : ulong fd_gossip_duplicate_shred_footprint( void ){ return FD_GOSSIP_DUPLICATE_SHRED_FOOTPRINT; }
27264 0 : ulong fd_gossip_duplicate_shred_align( void ){ return FD_GOSSIP_DUPLICATE_SHRED_ALIGN; }
27265 :
27266 0 : void fd_gossip_duplicate_shred_walk( void * w, fd_gossip_duplicate_shred_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
27267 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_duplicate_shred", level++ );
27268 0 : fun( w, &self->duplicate_shred_index, "duplicate_shred_index", FD_FLAMENCO_TYPE_USHORT, "ushort", level );
27269 0 : fd_pubkey_walk( w, &self->from, fun, "from", level );
27270 0 : fun( w, &self->wallclock, "wallclock", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
27271 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
27272 0 : fun( w, &self->_unused, "_unused", FD_FLAMENCO_TYPE_UINT, "uint", level );
27273 0 : fun( w, &self->_unused_shred_type, "_unused_shred_type", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
27274 0 : fun( w, &self->num_chunks, "num_chunks", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
27275 0 : fun( w, &self->chunk_index, "chunk_index", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
27276 0 : fun(w, self->chunk, "chunk", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
27277 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_duplicate_shred", level-- );
27278 0 : }
27279 0 : ulong fd_gossip_duplicate_shred_size( fd_gossip_duplicate_shred_t const * self ) {
27280 0 : ulong size = 0;
27281 0 : size += sizeof(ushort);
27282 0 : size += fd_pubkey_size( &self->from );
27283 0 : size += sizeof(ulong);
27284 0 : size += sizeof(ulong);
27285 0 : size += sizeof(uint);
27286 0 : size += sizeof(char);
27287 0 : size += sizeof(char);
27288 0 : size += sizeof(char);
27289 0 : do {
27290 0 : size += sizeof(ulong);
27291 0 : size += self->chunk_len;
27292 0 : } while(0);
27293 0 : return size;
27294 0 : }
27295 :
27296 0 : int fd_gossip_incremental_snapshot_hashes_encode( fd_gossip_incremental_snapshot_hashes_t const * self, fd_bincode_encode_ctx_t * ctx ) {
27297 0 : int err;
27298 0 : err = fd_pubkey_encode( &self->from, ctx );
27299 0 : if( FD_UNLIKELY( err ) ) return err;
27300 0 : err = fd_slot_hash_encode( &self->base_hash, ctx );
27301 0 : if( FD_UNLIKELY( err ) ) return err;
27302 0 : err = fd_bincode_uint64_encode( self->hashes_len, ctx );
27303 0 : if( FD_UNLIKELY(err) ) return err;
27304 0 : if( self->hashes_len ) {
27305 0 : for( ulong i=0; i < self->hashes_len; i++ ) {
27306 0 : err = fd_slot_hash_encode( self->hashes + i, ctx );
27307 0 : if( FD_UNLIKELY( err ) ) return err;
27308 0 : }
27309 0 : }
27310 0 : err = fd_bincode_uint64_encode( self->wallclock, ctx );
27311 0 : if( FD_UNLIKELY( err ) ) return err;
27312 0 : return FD_BINCODE_SUCCESS;
27313 0 : }
27314 0 : int fd_gossip_incremental_snapshot_hashes_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
27315 0 : *total_sz += sizeof(fd_gossip_incremental_snapshot_hashes_t);
27316 0 : void const * start_data = ctx->data;
27317 0 : int err = fd_gossip_incremental_snapshot_hashes_decode_footprint_inner( ctx, total_sz );
27318 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
27319 0 : ctx->data = start_data;
27320 0 : return err;
27321 0 : }
27322 0 : int fd_gossip_incremental_snapshot_hashes_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
27323 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
27324 0 : int err = 0;
27325 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
27326 0 : if( FD_UNLIKELY( err ) ) return err;
27327 0 : err = fd_slot_hash_decode_footprint_inner( ctx, total_sz );
27328 0 : if( FD_UNLIKELY( err ) ) return err;
27329 0 : ulong hashes_len;
27330 0 : err = fd_bincode_uint64_decode( &hashes_len, ctx );
27331 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27332 0 : if( hashes_len ) {
27333 0 : *total_sz += FD_SLOT_HASH_ALIGN + FD_SLOT_HASH_FOOTPRINT*hashes_len;
27334 0 : for( ulong i=0; i < hashes_len; i++ ) {
27335 0 : err = fd_slot_hash_decode_footprint_inner( ctx, total_sz );
27336 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27337 0 : }
27338 0 : }
27339 0 : err = fd_bincode_uint64_decode_footprint( ctx );
27340 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27341 0 : return 0;
27342 0 : }
27343 0 : void * fd_gossip_incremental_snapshot_hashes_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
27344 0 : fd_gossip_incremental_snapshot_hashes_t * self = (fd_gossip_incremental_snapshot_hashes_t *)mem;
27345 0 : fd_gossip_incremental_snapshot_hashes_new( self );
27346 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_incremental_snapshot_hashes_t);
27347 0 : void * * alloc_mem = &alloc_region;
27348 0 : fd_gossip_incremental_snapshot_hashes_decode_inner( mem, alloc_mem, ctx );
27349 0 : return self;
27350 0 : }
27351 0 : void fd_gossip_incremental_snapshot_hashes_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
27352 0 : fd_gossip_incremental_snapshot_hashes_t * self = (fd_gossip_incremental_snapshot_hashes_t *)struct_mem;
27353 0 : fd_pubkey_decode_inner( &self->from, alloc_mem, ctx );
27354 0 : fd_slot_hash_decode_inner( &self->base_hash, alloc_mem, ctx );
27355 0 : fd_bincode_uint64_decode_unsafe( &self->hashes_len, ctx );
27356 0 : if( self->hashes_len ) {
27357 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_SLOT_HASH_ALIGN );
27358 0 : self->hashes = *alloc_mem;
27359 0 : *alloc_mem = (uchar *)(*alloc_mem) + FD_SLOT_HASH_FOOTPRINT*self->hashes_len;
27360 0 : for( ulong i=0; i < self->hashes_len; i++ ) {
27361 0 : fd_slot_hash_new( self->hashes + i );
27362 0 : fd_slot_hash_decode_inner( self->hashes + i, alloc_mem, ctx );
27363 0 : }
27364 0 : } else
27365 0 : self->hashes = NULL;
27366 0 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
27367 0 : }
27368 0 : void * fd_gossip_incremental_snapshot_hashes_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
27369 0 : fd_gossip_incremental_snapshot_hashes_global_t * self = (fd_gossip_incremental_snapshot_hashes_global_t *)mem;
27370 0 : fd_gossip_incremental_snapshot_hashes_new( (fd_gossip_incremental_snapshot_hashes_t *)self );
27371 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_incremental_snapshot_hashes_global_t);
27372 0 : void * * alloc_mem = &alloc_region;
27373 0 : fd_gossip_incremental_snapshot_hashes_decode_inner_global( mem, alloc_mem, ctx );
27374 0 : return self;
27375 0 : }
27376 0 : void fd_gossip_incremental_snapshot_hashes_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
27377 0 : fd_gossip_incremental_snapshot_hashes_global_t * self = (fd_gossip_incremental_snapshot_hashes_global_t *)struct_mem;
27378 0 : fd_pubkey_decode_inner_global( &self->from, alloc_mem, ctx );
27379 0 : fd_slot_hash_decode_inner_global( &self->base_hash, alloc_mem, ctx );
27380 0 : fd_bincode_uint64_decode_unsafe( &self->hashes_len, ctx );
27381 0 : if( self->hashes_len ) {
27382 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_SLOT_HASH_ALIGN );
27383 0 : self->hashes_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
27384 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
27385 0 : *alloc_mem = (uchar *)(*alloc_mem) + FD_SLOT_HASH_FOOTPRINT*self->hashes_len;
27386 0 : for( ulong i=0; i < self->hashes_len; i++ ) {
27387 0 : fd_slot_hash_new( (fd_slot_hash_t *)(cur_mem + FD_SLOT_HASH_FOOTPRINT * i) );
27388 0 : fd_slot_hash_decode_inner_global( cur_mem + FD_SLOT_HASH_FOOTPRINT * i, alloc_mem, ctx );
27389 0 : }
27390 0 : } else
27391 0 : self->hashes_gaddr = 0UL;
27392 0 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
27393 0 : }
27394 0 : int fd_gossip_incremental_snapshot_hashes_convert_global_to_local( void const * global_self, fd_gossip_incremental_snapshot_hashes_t * self, fd_bincode_decode_ctx_t * ctx ) {
27395 0 : int err = 0;
27396 0 : fd_gossip_incremental_snapshot_hashes_global_t const * mem = (fd_gossip_incremental_snapshot_hashes_global_t const *)global_self;
27397 0 : err = fd_pubkey_convert_global_to_local( &mem->from, &self->from, ctx );
27398 0 : if( FD_UNLIKELY( err ) ) return err;
27399 0 : err = fd_slot_hash_convert_global_to_local( &mem->base_hash, &self->base_hash, ctx );
27400 0 : if( FD_UNLIKELY( err ) ) return err;
27401 0 : self->hashes_len = mem->hashes_len;
27402 0 : self->hashes = fd_wksp_laddr_fast( ctx->wksp, mem->hashes_gaddr );
27403 0 : self->wallclock = mem->wallclock;
27404 0 : return FD_BINCODE_SUCCESS;
27405 0 : }
27406 0 : void fd_gossip_incremental_snapshot_hashes_new(fd_gossip_incremental_snapshot_hashes_t * self) {
27407 0 : fd_memset( self, 0, sizeof(fd_gossip_incremental_snapshot_hashes_t) );
27408 0 : fd_pubkey_new( &self->from );
27409 0 : fd_slot_hash_new( &self->base_hash );
27410 0 : }
27411 0 : void fd_gossip_incremental_snapshot_hashes_destroy( fd_gossip_incremental_snapshot_hashes_t * self ) {
27412 0 : fd_pubkey_destroy( &self->from );
27413 0 : fd_slot_hash_destroy( &self->base_hash );
27414 0 : if( self->hashes ) {
27415 0 : for( ulong i=0; i < self->hashes_len; i++ )
27416 0 : fd_slot_hash_destroy( self->hashes + i );
27417 0 : self->hashes = NULL;
27418 0 : }
27419 0 : }
27420 :
27421 0 : ulong fd_gossip_incremental_snapshot_hashes_footprint( void ){ return FD_GOSSIP_INCREMENTAL_SNAPSHOT_HASHES_FOOTPRINT; }
27422 0 : ulong fd_gossip_incremental_snapshot_hashes_align( void ){ return FD_GOSSIP_INCREMENTAL_SNAPSHOT_HASHES_ALIGN; }
27423 :
27424 0 : void fd_gossip_incremental_snapshot_hashes_walk( void * w, fd_gossip_incremental_snapshot_hashes_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
27425 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_incremental_snapshot_hashes", level++ );
27426 0 : fd_pubkey_walk( w, &self->from, fun, "from", level );
27427 0 : fd_slot_hash_walk( w, &self->base_hash, fun, "base_hash", level );
27428 0 : if( self->hashes_len ) {
27429 0 : fun( w, NULL, "hashes", FD_FLAMENCO_TYPE_ARR, "array", level++ );
27430 0 : for( ulong i=0; i < self->hashes_len; i++ )
27431 0 : fd_slot_hash_walk(w, self->hashes + i, fun, "slot_hash", level );
27432 0 : fun( w, NULL, "hashes", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
27433 0 : }
27434 0 : fun( w, &self->wallclock, "wallclock", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
27435 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_incremental_snapshot_hashes", level-- );
27436 0 : }
27437 0 : ulong fd_gossip_incremental_snapshot_hashes_size( fd_gossip_incremental_snapshot_hashes_t const * self ) {
27438 0 : ulong size = 0;
27439 0 : size += fd_pubkey_size( &self->from );
27440 0 : size += fd_slot_hash_size( &self->base_hash );
27441 0 : do {
27442 0 : size += sizeof(ulong);
27443 0 : for( ulong i=0; i < self->hashes_len; i++ )
27444 0 : size += fd_slot_hash_size( self->hashes + i );
27445 0 : } while(0);
27446 0 : size += sizeof(ulong);
27447 0 : return size;
27448 0 : }
27449 :
27450 0 : int fd_gossip_socket_entry_encode( fd_gossip_socket_entry_t const * self, fd_bincode_encode_ctx_t * ctx ) {
27451 0 : int err;
27452 0 : err = fd_bincode_uint8_encode( (uchar)(self->key), ctx );
27453 0 : if( FD_UNLIKELY( err ) ) return err;
27454 0 : err = fd_bincode_uint8_encode( (uchar)(self->index), ctx );
27455 0 : if( FD_UNLIKELY( err ) ) return err;
27456 0 : err = fd_bincode_compact_u16_encode( &self->offset, ctx );
27457 0 : if( FD_UNLIKELY( err ) ) return err;
27458 0 : return FD_BINCODE_SUCCESS;
27459 0 : }
27460 0 : int fd_gossip_socket_entry_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
27461 0 : *total_sz += sizeof(fd_gossip_socket_entry_t);
27462 0 : void const * start_data = ctx->data;
27463 0 : int err = fd_gossip_socket_entry_decode_footprint_inner( ctx, total_sz );
27464 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
27465 0 : ctx->data = start_data;
27466 0 : return err;
27467 0 : }
27468 36 : int fd_gossip_socket_entry_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
27469 36 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
27470 36 : int err = 0;
27471 36 : err = fd_bincode_uint8_decode_footprint( ctx );
27472 36 : if( FD_UNLIKELY( err ) ) return err;
27473 36 : err = fd_bincode_uint8_decode_footprint( ctx );
27474 36 : if( FD_UNLIKELY( err ) ) return err;
27475 36 : do { ushort _tmp; err = fd_bincode_compact_u16_decode( &_tmp, ctx ); } while(0);
27476 36 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27477 36 : return 0;
27478 36 : }
27479 0 : void * fd_gossip_socket_entry_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
27480 0 : fd_gossip_socket_entry_t * self = (fd_gossip_socket_entry_t *)mem;
27481 0 : fd_gossip_socket_entry_new( self );
27482 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_socket_entry_t);
27483 0 : void * * alloc_mem = &alloc_region;
27484 0 : fd_gossip_socket_entry_decode_inner( mem, alloc_mem, ctx );
27485 0 : return self;
27486 0 : }
27487 36 : void fd_gossip_socket_entry_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
27488 36 : fd_gossip_socket_entry_t * self = (fd_gossip_socket_entry_t *)struct_mem;
27489 36 : fd_bincode_uint8_decode_unsafe( &self->key, ctx );
27490 36 : fd_bincode_uint8_decode_unsafe( &self->index, ctx );
27491 36 : fd_bincode_compact_u16_decode_unsafe( &self->offset, ctx );
27492 36 : }
27493 0 : void * fd_gossip_socket_entry_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
27494 0 : fd_gossip_socket_entry_global_t * self = (fd_gossip_socket_entry_global_t *)mem;
27495 0 : fd_gossip_socket_entry_new( (fd_gossip_socket_entry_t *)self );
27496 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_socket_entry_global_t);
27497 0 : void * * alloc_mem = &alloc_region;
27498 0 : fd_gossip_socket_entry_decode_inner_global( mem, alloc_mem, ctx );
27499 0 : return self;
27500 0 : }
27501 0 : void fd_gossip_socket_entry_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
27502 0 : fd_gossip_socket_entry_global_t * self = (fd_gossip_socket_entry_global_t *)struct_mem;
27503 0 : fd_bincode_uint8_decode_unsafe( &self->key, ctx );
27504 0 : fd_bincode_uint8_decode_unsafe( &self->index, ctx );
27505 0 : fd_bincode_compact_u16_decode_unsafe( &self->offset, ctx );
27506 0 : }
27507 0 : int fd_gossip_socket_entry_convert_global_to_local( void const * global_self, fd_gossip_socket_entry_t * self, fd_bincode_decode_ctx_t * ctx ) {
27508 0 : int err = 0;
27509 0 : fd_gossip_socket_entry_global_t const * mem = (fd_gossip_socket_entry_global_t const *)global_self;
27510 0 : self->key = mem->key;
27511 0 : self->index = mem->index;
27512 0 : self->offset = mem->offset;
27513 0 : return FD_BINCODE_SUCCESS;
27514 0 : }
27515 36 : void fd_gossip_socket_entry_new(fd_gossip_socket_entry_t * self) {
27516 36 : fd_memset( self, 0, sizeof(fd_gossip_socket_entry_t) );
27517 36 : }
27518 0 : void fd_gossip_socket_entry_destroy( fd_gossip_socket_entry_t * self ) {
27519 0 : }
27520 :
27521 0 : ulong fd_gossip_socket_entry_footprint( void ){ return FD_GOSSIP_SOCKET_ENTRY_FOOTPRINT; }
27522 0 : ulong fd_gossip_socket_entry_align( void ){ return FD_GOSSIP_SOCKET_ENTRY_ALIGN; }
27523 :
27524 36 : void fd_gossip_socket_entry_walk( void * w, fd_gossip_socket_entry_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
27525 36 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_socket_entry", level++ );
27526 36 : fun( w, &self->key, "key", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
27527 36 : fun( w, &self->index, "index", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
27528 36 : fun( w, &self->offset, "offset", FD_FLAMENCO_TYPE_USHORT, "ushort", level );
27529 36 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_socket_entry", level-- );
27530 36 : }
27531 0 : ulong fd_gossip_socket_entry_size( fd_gossip_socket_entry_t const * self ) {
27532 0 : ulong size = 0;
27533 0 : size += sizeof(char);
27534 0 : size += sizeof(char);
27535 0 : size += fd_bincode_compact_u16_size( &self->offset );
27536 0 : return size;
27537 0 : }
27538 :
27539 0 : int fd_gossip_contact_info_v2_encode( fd_gossip_contact_info_v2_t const * self, fd_bincode_encode_ctx_t * ctx ) {
27540 0 : int err;
27541 0 : err = fd_pubkey_encode( &self->from, ctx );
27542 0 : if( FD_UNLIKELY( err ) ) return err;
27543 0 : err = fd_bincode_varint_encode( self->wallclock, ctx );
27544 0 : if( FD_UNLIKELY( err ) ) return err;
27545 0 : err = fd_bincode_uint64_encode( self->outset, ctx );
27546 0 : if( FD_UNLIKELY( err ) ) return err;
27547 0 : err = fd_bincode_uint16_encode( self->shred_version, ctx );
27548 0 : if( FD_UNLIKELY( err ) ) return err;
27549 0 : err = fd_gossip_version_v3_encode( &self->version, ctx );
27550 0 : if( FD_UNLIKELY( err ) ) return err;
27551 0 : err = fd_bincode_compact_u16_encode( &self->addrs_len, ctx );
27552 0 : if( FD_UNLIKELY(err) ) return err;
27553 0 : if( self->addrs_len ) {
27554 0 : for( ulong i=0; i < self->addrs_len; i++ ) {
27555 0 : err = fd_gossip_ip_addr_encode( self->addrs + i, ctx );
27556 0 : if( FD_UNLIKELY( err ) ) return err;
27557 0 : }
27558 0 : }
27559 0 : err = fd_bincode_compact_u16_encode( &self->sockets_len, ctx );
27560 0 : if( FD_UNLIKELY(err) ) return err;
27561 0 : if( self->sockets_len ) {
27562 0 : for( ulong i=0; i < self->sockets_len; i++ ) {
27563 0 : err = fd_gossip_socket_entry_encode( self->sockets + i, ctx );
27564 0 : if( FD_UNLIKELY( err ) ) return err;
27565 0 : }
27566 0 : }
27567 0 : err = fd_bincode_compact_u16_encode( &self->extensions_len, ctx );
27568 0 : if( FD_UNLIKELY(err) ) return err;
27569 0 : if( self->extensions_len ) {
27570 0 : for( ulong i=0; i < self->extensions_len; i++ ) {
27571 0 : err = fd_bincode_uint32_encode( self->extensions[i], ctx );
27572 0 : }
27573 0 : }
27574 0 : return FD_BINCODE_SUCCESS;
27575 0 : }
27576 0 : int fd_gossip_contact_info_v2_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
27577 0 : *total_sz += sizeof(fd_gossip_contact_info_v2_t);
27578 0 : void const * start_data = ctx->data;
27579 0 : int err = fd_gossip_contact_info_v2_decode_footprint_inner( ctx, total_sz );
27580 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
27581 0 : ctx->data = start_data;
27582 0 : return err;
27583 0 : }
27584 3 : int fd_gossip_contact_info_v2_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
27585 3 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
27586 3 : int err = 0;
27587 3 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
27588 3 : if( FD_UNLIKELY( err ) ) return err;
27589 3 : err = fd_bincode_varint_decode_footprint( ctx );
27590 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27591 3 : err = fd_bincode_uint64_decode_footprint( ctx );
27592 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27593 3 : err = fd_bincode_uint16_decode_footprint( ctx );
27594 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27595 3 : err = fd_gossip_version_v3_decode_footprint_inner( ctx, total_sz );
27596 3 : if( FD_UNLIKELY( err ) ) return err;
27597 3 : ushort addrs_len;
27598 3 : err = fd_bincode_compact_u16_decode( &addrs_len, ctx );
27599 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27600 3 : if( addrs_len ) {
27601 3 : *total_sz += FD_GOSSIP_IP_ADDR_ALIGN + FD_GOSSIP_IP_ADDR_FOOTPRINT*addrs_len;
27602 6 : for( ulong i=0; i < addrs_len; i++ ) {
27603 3 : err = fd_gossip_ip_addr_decode_footprint_inner( ctx, total_sz );
27604 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27605 3 : }
27606 3 : }
27607 3 : ushort sockets_len;
27608 3 : err = fd_bincode_compact_u16_decode( &sockets_len, ctx );
27609 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27610 3 : if( sockets_len ) {
27611 3 : *total_sz += FD_GOSSIP_SOCKET_ENTRY_ALIGN + FD_GOSSIP_SOCKET_ENTRY_FOOTPRINT*sockets_len;
27612 39 : for( ulong i=0; i < sockets_len; i++ ) {
27613 36 : err = fd_gossip_socket_entry_decode_footprint_inner( ctx, total_sz );
27614 36 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27615 36 : }
27616 3 : }
27617 3 : ushort extensions_len;
27618 3 : err = fd_bincode_compact_u16_decode( &extensions_len, ctx );
27619 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27620 3 : if( extensions_len ) {
27621 0 : *total_sz += 8UL + sizeof(uint)*extensions_len;
27622 0 : for( ulong i=0; i < extensions_len; i++ ) {
27623 0 : err = fd_bincode_uint32_decode_footprint( ctx );
27624 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27625 0 : }
27626 0 : }
27627 3 : return 0;
27628 3 : }
27629 0 : void * fd_gossip_contact_info_v2_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
27630 0 : fd_gossip_contact_info_v2_t * self = (fd_gossip_contact_info_v2_t *)mem;
27631 0 : fd_gossip_contact_info_v2_new( self );
27632 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_contact_info_v2_t);
27633 0 : void * * alloc_mem = &alloc_region;
27634 0 : fd_gossip_contact_info_v2_decode_inner( mem, alloc_mem, ctx );
27635 0 : return self;
27636 0 : }
27637 3 : void fd_gossip_contact_info_v2_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
27638 3 : fd_gossip_contact_info_v2_t * self = (fd_gossip_contact_info_v2_t *)struct_mem;
27639 3 : fd_pubkey_decode_inner( &self->from, alloc_mem, ctx );
27640 3 : fd_bincode_varint_decode_unsafe( &self->wallclock, ctx );
27641 3 : fd_bincode_uint64_decode_unsafe( &self->outset, ctx );
27642 3 : fd_bincode_uint16_decode_unsafe( &self->shred_version, ctx );
27643 3 : fd_gossip_version_v3_decode_inner( &self->version, alloc_mem, ctx );
27644 3 : fd_bincode_compact_u16_decode_unsafe( &self->addrs_len, ctx );
27645 3 : if( self->addrs_len ) {
27646 3 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_GOSSIP_IP_ADDR_ALIGN );
27647 3 : self->addrs = *alloc_mem;
27648 3 : *alloc_mem = (uchar *)(*alloc_mem) + FD_GOSSIP_IP_ADDR_FOOTPRINT*self->addrs_len;
27649 6 : for( ulong i=0; i < self->addrs_len; i++ ) {
27650 3 : fd_gossip_ip_addr_new( self->addrs + i );
27651 3 : fd_gossip_ip_addr_decode_inner( self->addrs + i, alloc_mem, ctx );
27652 3 : }
27653 3 : } else
27654 0 : self->addrs = NULL;
27655 3 : fd_bincode_compact_u16_decode_unsafe( &self->sockets_len, ctx );
27656 3 : if( self->sockets_len ) {
27657 3 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_GOSSIP_SOCKET_ENTRY_ALIGN );
27658 3 : self->sockets = *alloc_mem;
27659 3 : *alloc_mem = (uchar *)(*alloc_mem) + FD_GOSSIP_SOCKET_ENTRY_FOOTPRINT*self->sockets_len;
27660 39 : for( ulong i=0; i < self->sockets_len; i++ ) {
27661 36 : fd_gossip_socket_entry_new( self->sockets + i );
27662 36 : fd_gossip_socket_entry_decode_inner( self->sockets + i, alloc_mem, ctx );
27663 36 : }
27664 3 : } else
27665 0 : self->sockets = NULL;
27666 3 : fd_bincode_compact_u16_decode_unsafe( &self->extensions_len, ctx );
27667 3 : if( self->extensions_len ) {
27668 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), 8UL );
27669 0 : self->extensions = *alloc_mem;
27670 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(uint)*self->extensions_len;
27671 0 : for( ulong i=0; i < self->extensions_len; i++ ) {
27672 0 : fd_bincode_uint32_decode_unsafe( self->extensions + i, ctx );
27673 0 : }
27674 0 : } else
27675 3 : self->extensions = NULL;
27676 3 : }
27677 0 : void * fd_gossip_contact_info_v2_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
27678 0 : fd_gossip_contact_info_v2_global_t * self = (fd_gossip_contact_info_v2_global_t *)mem;
27679 0 : fd_gossip_contact_info_v2_new( (fd_gossip_contact_info_v2_t *)self );
27680 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_contact_info_v2_global_t);
27681 0 : void * * alloc_mem = &alloc_region;
27682 0 : fd_gossip_contact_info_v2_decode_inner_global( mem, alloc_mem, ctx );
27683 0 : return self;
27684 0 : }
27685 0 : void fd_gossip_contact_info_v2_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
27686 0 : fd_gossip_contact_info_v2_global_t * self = (fd_gossip_contact_info_v2_global_t *)struct_mem;
27687 0 : fd_pubkey_decode_inner_global( &self->from, alloc_mem, ctx );
27688 0 : fd_bincode_varint_decode_unsafe( &self->wallclock, ctx );
27689 0 : fd_bincode_uint64_decode_unsafe( &self->outset, ctx );
27690 0 : fd_bincode_uint16_decode_unsafe( &self->shred_version, ctx );
27691 0 : fd_gossip_version_v3_decode_inner_global( &self->version, alloc_mem, ctx );
27692 0 : fd_bincode_compact_u16_decode_unsafe( &self->addrs_len, ctx );
27693 0 : if( self->addrs_len ) {
27694 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_GOSSIP_IP_ADDR_ALIGN );
27695 0 : self->addrs_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
27696 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
27697 0 : *alloc_mem = (uchar *)(*alloc_mem) + FD_GOSSIP_IP_ADDR_FOOTPRINT*self->addrs_len;
27698 0 : for( ulong i=0; i < self->addrs_len; i++ ) {
27699 0 : fd_gossip_ip_addr_new( (fd_gossip_ip_addr_t *)(cur_mem + FD_GOSSIP_IP_ADDR_FOOTPRINT * i) );
27700 0 : fd_gossip_ip_addr_decode_inner_global( cur_mem + FD_GOSSIP_IP_ADDR_FOOTPRINT * i, alloc_mem, ctx );
27701 0 : }
27702 0 : } else
27703 0 : self->addrs_gaddr = 0UL;
27704 0 : fd_bincode_compact_u16_decode_unsafe( &self->sockets_len, ctx );
27705 0 : if( self->sockets_len ) {
27706 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_GOSSIP_SOCKET_ENTRY_ALIGN );
27707 0 : self->sockets_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
27708 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
27709 0 : *alloc_mem = (uchar *)(*alloc_mem) + FD_GOSSIP_SOCKET_ENTRY_FOOTPRINT*self->sockets_len;
27710 0 : for( ulong i=0; i < self->sockets_len; i++ ) {
27711 0 : fd_gossip_socket_entry_new( (fd_gossip_socket_entry_t *)(cur_mem + FD_GOSSIP_SOCKET_ENTRY_FOOTPRINT * i) );
27712 0 : fd_gossip_socket_entry_decode_inner_global( cur_mem + FD_GOSSIP_SOCKET_ENTRY_FOOTPRINT * i, alloc_mem, ctx );
27713 0 : }
27714 0 : } else
27715 0 : self->sockets_gaddr = 0UL;
27716 0 : fd_bincode_compact_u16_decode_unsafe( &self->extensions_len, ctx );
27717 0 : if( self->extensions_len ) {
27718 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), 8UL );
27719 0 : self->extensions_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
27720 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
27721 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(uint)*self->extensions_len;
27722 0 : for( ulong i=0; i < self->extensions_len; i++ ) {
27723 0 : fd_bincode_uint32_decode_unsafe( (uint*)(cur_mem + sizeof(uint) * i), ctx );
27724 0 : }
27725 0 : } else
27726 0 : self->extensions_gaddr = 0UL;
27727 0 : }
27728 0 : int fd_gossip_contact_info_v2_convert_global_to_local( void const * global_self, fd_gossip_contact_info_v2_t * self, fd_bincode_decode_ctx_t * ctx ) {
27729 0 : int err = 0;
27730 0 : fd_gossip_contact_info_v2_global_t const * mem = (fd_gossip_contact_info_v2_global_t const *)global_self;
27731 0 : err = fd_pubkey_convert_global_to_local( &mem->from, &self->from, ctx );
27732 0 : if( FD_UNLIKELY( err ) ) return err;
27733 0 : self->wallclock = mem->wallclock;
27734 0 : self->outset = mem->outset;
27735 0 : self->shred_version = mem->shred_version;
27736 0 : err = fd_gossip_version_v3_convert_global_to_local( &mem->version, &self->version, ctx );
27737 0 : if( FD_UNLIKELY( err ) ) return err;
27738 0 : self->addrs_len = mem->addrs_len;
27739 0 : self->addrs = fd_wksp_laddr_fast( ctx->wksp, mem->addrs_gaddr );
27740 0 : self->sockets_len = mem->sockets_len;
27741 0 : self->sockets = fd_wksp_laddr_fast( ctx->wksp, mem->sockets_gaddr );
27742 0 : self->extensions_len = mem->extensions_len;
27743 0 : self->extensions = fd_wksp_laddr_fast( ctx->wksp, mem->extensions_gaddr );
27744 0 : return FD_BINCODE_SUCCESS;
27745 0 : }
27746 0 : void fd_gossip_contact_info_v2_new(fd_gossip_contact_info_v2_t * self) {
27747 0 : fd_memset( self, 0, sizeof(fd_gossip_contact_info_v2_t) );
27748 0 : fd_pubkey_new( &self->from );
27749 0 : fd_gossip_version_v3_new( &self->version );
27750 0 : }
27751 0 : void fd_gossip_contact_info_v2_destroy( fd_gossip_contact_info_v2_t * self ) {
27752 0 : fd_pubkey_destroy( &self->from );
27753 0 : fd_gossip_version_v3_destroy( &self->version );
27754 0 : if( self->addrs ) {
27755 0 : for( ulong i=0; i < self->addrs_len; i++ )
27756 0 : fd_gossip_ip_addr_destroy( self->addrs + i );
27757 0 : self->addrs = NULL;
27758 0 : }
27759 0 : if( self->sockets ) {
27760 0 : for( ulong i=0; i < self->sockets_len; i++ )
27761 0 : fd_gossip_socket_entry_destroy( self->sockets + i );
27762 0 : self->sockets = NULL;
27763 0 : }
27764 0 : if( self->extensions ) {
27765 0 : self->extensions = NULL;
27766 0 : }
27767 0 : }
27768 :
27769 0 : ulong fd_gossip_contact_info_v2_footprint( void ){ return FD_GOSSIP_CONTACT_INFO_V2_FOOTPRINT; }
27770 0 : ulong fd_gossip_contact_info_v2_align( void ){ return FD_GOSSIP_CONTACT_INFO_V2_ALIGN; }
27771 :
27772 3 : void fd_gossip_contact_info_v2_walk( void * w, fd_gossip_contact_info_v2_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
27773 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_contact_info_v2", level++ );
27774 3 : fd_pubkey_walk( w, &self->from, fun, "from", level );
27775 3 : fun( w, &self->wallclock, "wallclock", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
27776 3 : fun( w, &self->outset, "outset", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
27777 3 : fun( w, &self->shred_version, "shred_version", FD_FLAMENCO_TYPE_USHORT, "ushort", level );
27778 3 : fd_gossip_version_v3_walk( w, &self->version, fun, "version", level );
27779 3 : if( self->addrs_len ) {
27780 3 : fun( w, NULL, "addrs", FD_FLAMENCO_TYPE_ARR, "array", level++ );
27781 6 : for( ulong i=0; i < self->addrs_len; i++ )
27782 3 : fd_gossip_ip_addr_walk(w, self->addrs + i, fun, "gossip_ip_addr", level );
27783 3 : fun( w, NULL, "addrs", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
27784 3 : }
27785 3 : if( self->sockets_len ) {
27786 3 : fun( w, NULL, "sockets", FD_FLAMENCO_TYPE_ARR, "array", level++ );
27787 39 : for( ulong i=0; i < self->sockets_len; i++ )
27788 36 : fd_gossip_socket_entry_walk(w, self->sockets + i, fun, "gossip_socket_entry", level );
27789 3 : fun( w, NULL, "sockets", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
27790 3 : }
27791 3 : if( self->extensions_len ) {
27792 0 : fun( w, NULL, "extensions", FD_FLAMENCO_TYPE_ARR, "array", level++ );
27793 0 : for( ulong i=0; i < self->extensions_len; i++ )
27794 0 : fun( w, self->extensions + i, "extensions", FD_FLAMENCO_TYPE_UINT, "uint", level );
27795 0 : fun( w, NULL, "extensions", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
27796 0 : }
27797 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_contact_info_v2", level-- );
27798 3 : }
27799 0 : ulong fd_gossip_contact_info_v2_size( fd_gossip_contact_info_v2_t const * self ) {
27800 0 : ulong size = 0;
27801 0 : size += fd_pubkey_size( &self->from );
27802 0 : size += fd_bincode_varint_size( self->wallclock );
27803 0 : size += sizeof(ulong);
27804 0 : size += sizeof(ushort);
27805 0 : size += fd_gossip_version_v3_size( &self->version );
27806 0 : do {
27807 0 : ushort tmp = (ushort)self->addrs_len;
27808 0 : size += fd_bincode_compact_u16_size( &tmp );
27809 0 : for( ulong i=0; i < self->addrs_len; i++ )
27810 0 : size += fd_gossip_ip_addr_size( self->addrs + i );
27811 0 : } while(0);
27812 0 : do {
27813 0 : ushort tmp = (ushort)self->sockets_len;
27814 0 : size += fd_bincode_compact_u16_size( &tmp );
27815 0 : for( ulong i=0; i < self->sockets_len; i++ )
27816 0 : size += fd_gossip_socket_entry_size( self->sockets + i );
27817 0 : } while(0);
27818 0 : do {
27819 0 : ushort tmp = (ushort)self->extensions_len;
27820 0 : size += fd_bincode_compact_u16_size( &tmp );
27821 0 : size += self->extensions_len * sizeof(uint);
27822 0 : } while(0);
27823 0 : return size;
27824 0 : }
27825 :
27826 0 : int fd_restart_run_length_encoding_inner_encode( fd_restart_run_length_encoding_inner_t const * self, fd_bincode_encode_ctx_t * ctx ) {
27827 0 : int err;
27828 0 : err = fd_bincode_compact_u16_encode( &self->bits, ctx );
27829 0 : if( FD_UNLIKELY( err ) ) return err;
27830 0 : return FD_BINCODE_SUCCESS;
27831 0 : }
27832 0 : int fd_restart_run_length_encoding_inner_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
27833 0 : *total_sz += sizeof(fd_restart_run_length_encoding_inner_t);
27834 0 : void const * start_data = ctx->data;
27835 0 : int err = fd_restart_run_length_encoding_inner_decode_footprint_inner( ctx, total_sz );
27836 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
27837 0 : ctx->data = start_data;
27838 0 : return err;
27839 0 : }
27840 0 : int fd_restart_run_length_encoding_inner_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
27841 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
27842 0 : int err = 0;
27843 0 : do { ushort _tmp; err = fd_bincode_compact_u16_decode( &_tmp, ctx ); } while(0);
27844 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27845 0 : return 0;
27846 0 : }
27847 0 : void * fd_restart_run_length_encoding_inner_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
27848 0 : fd_restart_run_length_encoding_inner_t * self = (fd_restart_run_length_encoding_inner_t *)mem;
27849 0 : fd_restart_run_length_encoding_inner_new( self );
27850 0 : void * alloc_region = (uchar *)mem + sizeof(fd_restart_run_length_encoding_inner_t);
27851 0 : void * * alloc_mem = &alloc_region;
27852 0 : fd_restart_run_length_encoding_inner_decode_inner( mem, alloc_mem, ctx );
27853 0 : return self;
27854 0 : }
27855 0 : void fd_restart_run_length_encoding_inner_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
27856 0 : fd_restart_run_length_encoding_inner_t * self = (fd_restart_run_length_encoding_inner_t *)struct_mem;
27857 0 : fd_bincode_compact_u16_decode_unsafe( &self->bits, ctx );
27858 0 : }
27859 0 : void * fd_restart_run_length_encoding_inner_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
27860 0 : fd_restart_run_length_encoding_inner_global_t * self = (fd_restart_run_length_encoding_inner_global_t *)mem;
27861 0 : fd_restart_run_length_encoding_inner_new( (fd_restart_run_length_encoding_inner_t *)self );
27862 0 : void * alloc_region = (uchar *)mem + sizeof(fd_restart_run_length_encoding_inner_global_t);
27863 0 : void * * alloc_mem = &alloc_region;
27864 0 : fd_restart_run_length_encoding_inner_decode_inner_global( mem, alloc_mem, ctx );
27865 0 : return self;
27866 0 : }
27867 0 : void fd_restart_run_length_encoding_inner_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
27868 0 : fd_restart_run_length_encoding_inner_global_t * self = (fd_restart_run_length_encoding_inner_global_t *)struct_mem;
27869 0 : fd_bincode_compact_u16_decode_unsafe( &self->bits, ctx );
27870 0 : }
27871 0 : int fd_restart_run_length_encoding_inner_convert_global_to_local( void const * global_self, fd_restart_run_length_encoding_inner_t * self, fd_bincode_decode_ctx_t * ctx ) {
27872 0 : int err = 0;
27873 0 : fd_restart_run_length_encoding_inner_global_t const * mem = (fd_restart_run_length_encoding_inner_global_t const *)global_self;
27874 0 : self->bits = mem->bits;
27875 0 : return FD_BINCODE_SUCCESS;
27876 0 : }
27877 0 : void fd_restart_run_length_encoding_inner_new(fd_restart_run_length_encoding_inner_t * self) {
27878 0 : fd_memset( self, 0, sizeof(fd_restart_run_length_encoding_inner_t) );
27879 0 : }
27880 0 : void fd_restart_run_length_encoding_inner_destroy( fd_restart_run_length_encoding_inner_t * self ) {
27881 0 : }
27882 :
27883 0 : ulong fd_restart_run_length_encoding_inner_footprint( void ){ return FD_RESTART_RUN_LENGTH_ENCODING_INNER_FOOTPRINT; }
27884 0 : ulong fd_restart_run_length_encoding_inner_align( void ){ return FD_RESTART_RUN_LENGTH_ENCODING_INNER_ALIGN; }
27885 :
27886 0 : void fd_restart_run_length_encoding_inner_walk( void * w, fd_restart_run_length_encoding_inner_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
27887 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_restart_run_length_encoding_inner", level++ );
27888 0 : fun( w, &self->bits, "bits", FD_FLAMENCO_TYPE_USHORT, "ushort", level );
27889 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_restart_run_length_encoding_inner", level-- );
27890 0 : }
27891 0 : ulong fd_restart_run_length_encoding_inner_size( fd_restart_run_length_encoding_inner_t const * self ) {
27892 0 : ulong size = 0;
27893 0 : size += fd_bincode_compact_u16_size( &self->bits );
27894 0 : return size;
27895 0 : }
27896 :
27897 0 : int fd_restart_run_length_encoding_encode( fd_restart_run_length_encoding_t const * self, fd_bincode_encode_ctx_t * ctx ) {
27898 0 : int err;
27899 0 : err = fd_bincode_uint64_encode( self->offsets_len, ctx );
27900 0 : if( FD_UNLIKELY(err) ) return err;
27901 0 : if( self->offsets_len ) {
27902 0 : for( ulong i=0; i < self->offsets_len; i++ ) {
27903 0 : err = fd_restart_run_length_encoding_inner_encode( self->offsets + i, ctx );
27904 0 : if( FD_UNLIKELY( err ) ) return err;
27905 0 : }
27906 0 : }
27907 0 : return FD_BINCODE_SUCCESS;
27908 0 : }
27909 0 : int fd_restart_run_length_encoding_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
27910 0 : *total_sz += sizeof(fd_restart_run_length_encoding_t);
27911 0 : void const * start_data = ctx->data;
27912 0 : int err = fd_restart_run_length_encoding_decode_footprint_inner( ctx, total_sz );
27913 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
27914 0 : ctx->data = start_data;
27915 0 : return err;
27916 0 : }
27917 0 : int fd_restart_run_length_encoding_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
27918 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
27919 0 : int err = 0;
27920 0 : ulong offsets_len;
27921 0 : err = fd_bincode_uint64_decode( &offsets_len, ctx );
27922 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27923 0 : if( offsets_len ) {
27924 0 : *total_sz += FD_RESTART_RUN_LENGTH_ENCODING_INNER_ALIGN + FD_RESTART_RUN_LENGTH_ENCODING_INNER_FOOTPRINT*offsets_len;
27925 0 : for( ulong i=0; i < offsets_len; i++ ) {
27926 0 : err = fd_restart_run_length_encoding_inner_decode_footprint_inner( ctx, total_sz );
27927 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27928 0 : }
27929 0 : }
27930 0 : return 0;
27931 0 : }
27932 0 : void * fd_restart_run_length_encoding_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
27933 0 : fd_restart_run_length_encoding_t * self = (fd_restart_run_length_encoding_t *)mem;
27934 0 : fd_restart_run_length_encoding_new( self );
27935 0 : void * alloc_region = (uchar *)mem + sizeof(fd_restart_run_length_encoding_t);
27936 0 : void * * alloc_mem = &alloc_region;
27937 0 : fd_restart_run_length_encoding_decode_inner( mem, alloc_mem, ctx );
27938 0 : return self;
27939 0 : }
27940 0 : void fd_restart_run_length_encoding_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
27941 0 : fd_restart_run_length_encoding_t * self = (fd_restart_run_length_encoding_t *)struct_mem;
27942 0 : fd_bincode_uint64_decode_unsafe( &self->offsets_len, ctx );
27943 0 : if( self->offsets_len ) {
27944 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_RESTART_RUN_LENGTH_ENCODING_INNER_ALIGN );
27945 0 : self->offsets = *alloc_mem;
27946 0 : *alloc_mem = (uchar *)(*alloc_mem) + FD_RESTART_RUN_LENGTH_ENCODING_INNER_FOOTPRINT*self->offsets_len;
27947 0 : for( ulong i=0; i < self->offsets_len; i++ ) {
27948 0 : fd_restart_run_length_encoding_inner_new( self->offsets + i );
27949 0 : fd_restart_run_length_encoding_inner_decode_inner( self->offsets + i, alloc_mem, ctx );
27950 0 : }
27951 0 : } else
27952 0 : self->offsets = NULL;
27953 0 : }
27954 0 : void * fd_restart_run_length_encoding_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
27955 0 : fd_restart_run_length_encoding_global_t * self = (fd_restart_run_length_encoding_global_t *)mem;
27956 0 : fd_restart_run_length_encoding_new( (fd_restart_run_length_encoding_t *)self );
27957 0 : void * alloc_region = (uchar *)mem + sizeof(fd_restart_run_length_encoding_global_t);
27958 0 : void * * alloc_mem = &alloc_region;
27959 0 : fd_restart_run_length_encoding_decode_inner_global( mem, alloc_mem, ctx );
27960 0 : return self;
27961 0 : }
27962 0 : void fd_restart_run_length_encoding_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
27963 0 : fd_restart_run_length_encoding_global_t * self = (fd_restart_run_length_encoding_global_t *)struct_mem;
27964 0 : fd_bincode_uint64_decode_unsafe( &self->offsets_len, ctx );
27965 0 : if( self->offsets_len ) {
27966 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_RESTART_RUN_LENGTH_ENCODING_INNER_ALIGN );
27967 0 : self->offsets_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
27968 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
27969 0 : *alloc_mem = (uchar *)(*alloc_mem) + FD_RESTART_RUN_LENGTH_ENCODING_INNER_FOOTPRINT*self->offsets_len;
27970 0 : for( ulong i=0; i < self->offsets_len; i++ ) {
27971 0 : fd_restart_run_length_encoding_inner_new( (fd_restart_run_length_encoding_inner_t *)(cur_mem + FD_RESTART_RUN_LENGTH_ENCODING_INNER_FOOTPRINT * i) );
27972 0 : fd_restart_run_length_encoding_inner_decode_inner_global( cur_mem + FD_RESTART_RUN_LENGTH_ENCODING_INNER_FOOTPRINT * i, alloc_mem, ctx );
27973 0 : }
27974 0 : } else
27975 0 : self->offsets_gaddr = 0UL;
27976 0 : }
27977 0 : int fd_restart_run_length_encoding_convert_global_to_local( void const * global_self, fd_restart_run_length_encoding_t * self, fd_bincode_decode_ctx_t * ctx ) {
27978 0 : int err = 0;
27979 0 : fd_restart_run_length_encoding_global_t const * mem = (fd_restart_run_length_encoding_global_t const *)global_self;
27980 0 : self->offsets_len = mem->offsets_len;
27981 0 : self->offsets = fd_wksp_laddr_fast( ctx->wksp, mem->offsets_gaddr );
27982 0 : return FD_BINCODE_SUCCESS;
27983 0 : }
27984 0 : void fd_restart_run_length_encoding_new(fd_restart_run_length_encoding_t * self) {
27985 0 : fd_memset( self, 0, sizeof(fd_restart_run_length_encoding_t) );
27986 0 : }
27987 0 : void fd_restart_run_length_encoding_destroy( fd_restart_run_length_encoding_t * self ) {
27988 0 : if( self->offsets ) {
27989 0 : for( ulong i=0; i < self->offsets_len; i++ )
27990 0 : fd_restart_run_length_encoding_inner_destroy( self->offsets + i );
27991 0 : self->offsets = NULL;
27992 0 : }
27993 0 : }
27994 :
27995 0 : ulong fd_restart_run_length_encoding_footprint( void ){ return FD_RESTART_RUN_LENGTH_ENCODING_FOOTPRINT; }
27996 0 : ulong fd_restart_run_length_encoding_align( void ){ return FD_RESTART_RUN_LENGTH_ENCODING_ALIGN; }
27997 :
27998 0 : void fd_restart_run_length_encoding_walk( void * w, fd_restart_run_length_encoding_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
27999 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_restart_run_length_encoding", level++ );
28000 0 : if( self->offsets_len ) {
28001 0 : fun( w, NULL, "offsets", FD_FLAMENCO_TYPE_ARR, "array", level++ );
28002 0 : for( ulong i=0; i < self->offsets_len; i++ )
28003 0 : fd_restart_run_length_encoding_inner_walk(w, self->offsets + i, fun, "restart_run_length_encoding_inner", level );
28004 0 : fun( w, NULL, "offsets", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
28005 0 : }
28006 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_restart_run_length_encoding", level-- );
28007 0 : }
28008 0 : ulong fd_restart_run_length_encoding_size( fd_restart_run_length_encoding_t const * self ) {
28009 0 : ulong size = 0;
28010 0 : do {
28011 0 : size += sizeof(ulong);
28012 0 : for( ulong i=0; i < self->offsets_len; i++ )
28013 0 : size += fd_restart_run_length_encoding_inner_size( self->offsets + i );
28014 0 : } while(0);
28015 0 : return size;
28016 0 : }
28017 :
28018 0 : int fd_restart_raw_offsets_bitvec_u8_inner_encode( fd_restart_raw_offsets_bitvec_u8_inner_t const * self, fd_bincode_encode_ctx_t * ctx ) {
28019 0 : int err;
28020 0 : err = fd_bincode_uint64_encode( self->bits_len, ctx );
28021 0 : if( FD_UNLIKELY(err) ) return err;
28022 0 : if( self->bits_len ) {
28023 0 : err = fd_bincode_bytes_encode( self->bits, self->bits_len, ctx );
28024 0 : if( FD_UNLIKELY( err ) ) return err;
28025 0 : }
28026 0 : return FD_BINCODE_SUCCESS;
28027 0 : }
28028 0 : int fd_restart_raw_offsets_bitvec_u8_inner_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
28029 0 : *total_sz += sizeof(fd_restart_raw_offsets_bitvec_u8_inner_t);
28030 0 : void const * start_data = ctx->data;
28031 0 : int err = fd_restart_raw_offsets_bitvec_u8_inner_decode_footprint_inner( ctx, total_sz );
28032 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
28033 0 : ctx->data = start_data;
28034 0 : return err;
28035 0 : }
28036 0 : int fd_restart_raw_offsets_bitvec_u8_inner_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
28037 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
28038 0 : int err = 0;
28039 0 : ulong bits_len;
28040 0 : err = fd_bincode_uint64_decode( &bits_len, ctx );
28041 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
28042 0 : if( bits_len ) {
28043 0 : *total_sz += 8UL + bits_len;
28044 0 : err = fd_bincode_bytes_decode_footprint( bits_len, ctx );
28045 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
28046 0 : }
28047 0 : return 0;
28048 0 : }
28049 0 : void * fd_restart_raw_offsets_bitvec_u8_inner_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
28050 0 : fd_restart_raw_offsets_bitvec_u8_inner_t * self = (fd_restart_raw_offsets_bitvec_u8_inner_t *)mem;
28051 0 : fd_restart_raw_offsets_bitvec_u8_inner_new( self );
28052 0 : void * alloc_region = (uchar *)mem + sizeof(fd_restart_raw_offsets_bitvec_u8_inner_t);
28053 0 : void * * alloc_mem = &alloc_region;
28054 0 : fd_restart_raw_offsets_bitvec_u8_inner_decode_inner( mem, alloc_mem, ctx );
28055 0 : return self;
28056 0 : }
28057 0 : void fd_restart_raw_offsets_bitvec_u8_inner_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
28058 0 : fd_restart_raw_offsets_bitvec_u8_inner_t * self = (fd_restart_raw_offsets_bitvec_u8_inner_t *)struct_mem;
28059 0 : fd_bincode_uint64_decode_unsafe( &self->bits_len, ctx );
28060 0 : if( self->bits_len ) {
28061 0 : self->bits = *alloc_mem;
28062 0 : fd_bincode_bytes_decode_unsafe( self->bits, self->bits_len, ctx );
28063 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->bits_len;
28064 0 : } else
28065 0 : self->bits = NULL;
28066 0 : }
28067 0 : void * fd_restart_raw_offsets_bitvec_u8_inner_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
28068 0 : fd_restart_raw_offsets_bitvec_u8_inner_global_t * self = (fd_restart_raw_offsets_bitvec_u8_inner_global_t *)mem;
28069 0 : fd_restart_raw_offsets_bitvec_u8_inner_new( (fd_restart_raw_offsets_bitvec_u8_inner_t *)self );
28070 0 : void * alloc_region = (uchar *)mem + sizeof(fd_restart_raw_offsets_bitvec_u8_inner_global_t);
28071 0 : void * * alloc_mem = &alloc_region;
28072 0 : fd_restart_raw_offsets_bitvec_u8_inner_decode_inner_global( mem, alloc_mem, ctx );
28073 0 : return self;
28074 0 : }
28075 0 : void fd_restart_raw_offsets_bitvec_u8_inner_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
28076 0 : fd_restart_raw_offsets_bitvec_u8_inner_global_t * self = (fd_restart_raw_offsets_bitvec_u8_inner_global_t *)struct_mem;
28077 0 : fd_bincode_uint64_decode_unsafe( &self->bits_len, ctx );
28078 0 : if( self->bits_len ) {
28079 0 : self->bits_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
28080 0 : fd_bincode_bytes_decode_unsafe( *alloc_mem, self->bits_len, ctx );
28081 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->bits_len;
28082 0 : } else
28083 0 : self->bits_gaddr = 0UL;
28084 0 : }
28085 0 : int fd_restart_raw_offsets_bitvec_u8_inner_convert_global_to_local( void const * global_self, fd_restart_raw_offsets_bitvec_u8_inner_t * self, fd_bincode_decode_ctx_t * ctx ) {
28086 0 : int err = 0;
28087 0 : fd_restart_raw_offsets_bitvec_u8_inner_global_t const * mem = (fd_restart_raw_offsets_bitvec_u8_inner_global_t const *)global_self;
28088 0 : self->bits_len = mem->bits_len;
28089 0 : self->bits = fd_wksp_laddr_fast( ctx->wksp, mem->bits_gaddr );
28090 0 : return FD_BINCODE_SUCCESS;
28091 0 : }
28092 0 : void fd_restart_raw_offsets_bitvec_u8_inner_new(fd_restart_raw_offsets_bitvec_u8_inner_t * self) {
28093 0 : fd_memset( self, 0, sizeof(fd_restart_raw_offsets_bitvec_u8_inner_t) );
28094 0 : }
28095 0 : void fd_restart_raw_offsets_bitvec_u8_inner_destroy( fd_restart_raw_offsets_bitvec_u8_inner_t * self ) {
28096 0 : if( self->bits ) {
28097 0 : self->bits = NULL;
28098 0 : }
28099 0 : }
28100 :
28101 0 : ulong fd_restart_raw_offsets_bitvec_u8_inner_footprint( void ){ return FD_RESTART_RAW_OFFSETS_BITVEC_U8_INNER_FOOTPRINT; }
28102 0 : ulong fd_restart_raw_offsets_bitvec_u8_inner_align( void ){ return FD_RESTART_RAW_OFFSETS_BITVEC_U8_INNER_ALIGN; }
28103 :
28104 0 : void fd_restart_raw_offsets_bitvec_u8_inner_walk( void * w, fd_restart_raw_offsets_bitvec_u8_inner_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
28105 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_restart_raw_offsets_bitvec_u8_inner", level++ );
28106 0 : fun(w, self->bits, "bits", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
28107 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_restart_raw_offsets_bitvec_u8_inner", level-- );
28108 0 : }
28109 0 : ulong fd_restart_raw_offsets_bitvec_u8_inner_size( fd_restart_raw_offsets_bitvec_u8_inner_t const * self ) {
28110 0 : ulong size = 0;
28111 0 : do {
28112 0 : size += sizeof(ulong);
28113 0 : size += self->bits_len;
28114 0 : } while(0);
28115 0 : return size;
28116 0 : }
28117 :
28118 0 : int fd_restart_raw_offsets_bitvec_encode( fd_restart_raw_offsets_bitvec_t const * self, fd_bincode_encode_ctx_t * ctx ) {
28119 0 : int err;
28120 0 : err = fd_bincode_bool_encode( self->has_bits, ctx );
28121 0 : if( FD_UNLIKELY( err ) ) return err;
28122 0 : if( self->has_bits ) {
28123 0 : err = fd_restart_raw_offsets_bitvec_u8_inner_encode( &self->bits, ctx );
28124 0 : if( FD_UNLIKELY( err ) ) return err;
28125 0 : }
28126 0 : err = fd_bincode_uint64_encode( self->len, ctx );
28127 0 : if( FD_UNLIKELY( err ) ) return err;
28128 0 : return FD_BINCODE_SUCCESS;
28129 0 : }
28130 0 : int fd_restart_raw_offsets_bitvec_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
28131 0 : *total_sz += sizeof(fd_restart_raw_offsets_bitvec_t);
28132 0 : void const * start_data = ctx->data;
28133 0 : int err = fd_restart_raw_offsets_bitvec_decode_footprint_inner( ctx, total_sz );
28134 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
28135 0 : ctx->data = start_data;
28136 0 : return err;
28137 0 : }
28138 0 : int fd_restart_raw_offsets_bitvec_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
28139 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
28140 0 : int err = 0;
28141 0 : {
28142 0 : uchar o;
28143 0 : err = fd_bincode_bool_decode( &o, ctx );
28144 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
28145 0 : if( o ) {
28146 0 : err = fd_restart_raw_offsets_bitvec_u8_inner_decode_footprint_inner( ctx, total_sz );
28147 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
28148 0 : }
28149 0 : }
28150 0 : err = fd_bincode_uint64_decode_footprint( ctx );
28151 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
28152 0 : return 0;
28153 0 : }
28154 0 : void * fd_restart_raw_offsets_bitvec_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
28155 0 : fd_restart_raw_offsets_bitvec_t * self = (fd_restart_raw_offsets_bitvec_t *)mem;
28156 0 : fd_restart_raw_offsets_bitvec_new( self );
28157 0 : void * alloc_region = (uchar *)mem + sizeof(fd_restart_raw_offsets_bitvec_t);
28158 0 : void * * alloc_mem = &alloc_region;
28159 0 : fd_restart_raw_offsets_bitvec_decode_inner( mem, alloc_mem, ctx );
28160 0 : return self;
28161 0 : }
28162 0 : void fd_restart_raw_offsets_bitvec_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
28163 0 : fd_restart_raw_offsets_bitvec_t * self = (fd_restart_raw_offsets_bitvec_t *)struct_mem;
28164 0 : {
28165 0 : uchar o;
28166 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
28167 0 : self->has_bits = !!o;
28168 0 : if( o ) {
28169 0 : fd_restart_raw_offsets_bitvec_u8_inner_new( &self->bits );
28170 0 : fd_restart_raw_offsets_bitvec_u8_inner_decode_inner( &self->bits, alloc_mem, ctx );
28171 0 : }
28172 0 : }
28173 0 : fd_bincode_uint64_decode_unsafe( &self->len, ctx );
28174 0 : }
28175 0 : void * fd_restart_raw_offsets_bitvec_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
28176 0 : fd_restart_raw_offsets_bitvec_global_t * self = (fd_restart_raw_offsets_bitvec_global_t *)mem;
28177 0 : fd_restart_raw_offsets_bitvec_new( (fd_restart_raw_offsets_bitvec_t *)self );
28178 0 : void * alloc_region = (uchar *)mem + sizeof(fd_restart_raw_offsets_bitvec_global_t);
28179 0 : void * * alloc_mem = &alloc_region;
28180 0 : fd_restart_raw_offsets_bitvec_decode_inner_global( mem, alloc_mem, ctx );
28181 0 : return self;
28182 0 : }
28183 0 : void fd_restart_raw_offsets_bitvec_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
28184 0 : fd_restart_raw_offsets_bitvec_global_t * self = (fd_restart_raw_offsets_bitvec_global_t *)struct_mem;
28185 0 : {
28186 0 : uchar o;
28187 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
28188 0 : self->has_bits = !!o;
28189 0 : if( o ) {
28190 0 : fd_restart_raw_offsets_bitvec_u8_inner_new( &self->bits );
28191 0 : fd_restart_raw_offsets_bitvec_u8_inner_decode_inner_global( &self->bits, alloc_mem, ctx );
28192 0 : }
28193 0 : }
28194 0 : fd_bincode_uint64_decode_unsafe( &self->len, ctx );
28195 0 : }
28196 0 : int fd_restart_raw_offsets_bitvec_convert_global_to_local( void const * global_self, fd_restart_raw_offsets_bitvec_t * self, fd_bincode_decode_ctx_t * ctx ) {
28197 0 : int err = 0;
28198 0 : fd_restart_raw_offsets_bitvec_global_t const * mem = (fd_restart_raw_offsets_bitvec_global_t const *)global_self;
28199 0 : self->bits = mem->bits;
28200 0 : self->has_bits = mem->has_bits;
28201 0 : self->len = mem->len;
28202 0 : return FD_BINCODE_SUCCESS;
28203 0 : }
28204 0 : void fd_restart_raw_offsets_bitvec_new(fd_restart_raw_offsets_bitvec_t * self) {
28205 0 : fd_memset( self, 0, sizeof(fd_restart_raw_offsets_bitvec_t) );
28206 0 : }
28207 0 : void fd_restart_raw_offsets_bitvec_destroy( fd_restart_raw_offsets_bitvec_t * self ) {
28208 0 : if( self->has_bits ) {
28209 0 : fd_restart_raw_offsets_bitvec_u8_inner_destroy( &self->bits );
28210 0 : self->has_bits = 0;
28211 0 : }
28212 0 : }
28213 :
28214 0 : ulong fd_restart_raw_offsets_bitvec_footprint( void ){ return FD_RESTART_RAW_OFFSETS_BITVEC_FOOTPRINT; }
28215 0 : ulong fd_restart_raw_offsets_bitvec_align( void ){ return FD_RESTART_RAW_OFFSETS_BITVEC_ALIGN; }
28216 :
28217 0 : void fd_restart_raw_offsets_bitvec_walk( void * w, fd_restart_raw_offsets_bitvec_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
28218 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_restart_raw_offsets_bitvec", level++ );
28219 0 : if( !self->has_bits ) {
28220 0 : fun( w, NULL, "bits", FD_FLAMENCO_TYPE_NULL, "restart_raw_offsets_bitvec_u8_inner", level );
28221 0 : } else {
28222 0 : fd_restart_raw_offsets_bitvec_u8_inner_walk( w, &self->bits, fun, "bits", level );
28223 0 : }
28224 0 : fun( w, &self->len, "len", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
28225 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_restart_raw_offsets_bitvec", level-- );
28226 0 : }
28227 0 : ulong fd_restart_raw_offsets_bitvec_size( fd_restart_raw_offsets_bitvec_t const * self ) {
28228 0 : ulong size = 0;
28229 0 : size += sizeof(char);
28230 0 : if( self->has_bits ) {
28231 0 : size += fd_restart_raw_offsets_bitvec_u8_inner_size( &self->bits );
28232 0 : }
28233 0 : size += sizeof(ulong);
28234 0 : return size;
28235 0 : }
28236 :
28237 0 : int fd_restart_raw_offsets_encode( fd_restart_raw_offsets_t const * self, fd_bincode_encode_ctx_t * ctx ) {
28238 0 : int err;
28239 0 : err = fd_restart_raw_offsets_bitvec_encode( &self->offsets, ctx );
28240 0 : if( FD_UNLIKELY( err ) ) return err;
28241 0 : return FD_BINCODE_SUCCESS;
28242 0 : }
28243 0 : int fd_restart_raw_offsets_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
28244 0 : *total_sz += sizeof(fd_restart_raw_offsets_t);
28245 0 : void const * start_data = ctx->data;
28246 0 : int err = fd_restart_raw_offsets_decode_footprint_inner( ctx, total_sz );
28247 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
28248 0 : ctx->data = start_data;
28249 0 : return err;
28250 0 : }
28251 0 : int fd_restart_raw_offsets_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
28252 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
28253 0 : int err = 0;
28254 0 : err = fd_restart_raw_offsets_bitvec_decode_footprint_inner( ctx, total_sz );
28255 0 : if( FD_UNLIKELY( err ) ) return err;
28256 0 : return 0;
28257 0 : }
28258 0 : void * fd_restart_raw_offsets_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
28259 0 : fd_restart_raw_offsets_t * self = (fd_restart_raw_offsets_t *)mem;
28260 0 : fd_restart_raw_offsets_new( self );
28261 0 : void * alloc_region = (uchar *)mem + sizeof(fd_restart_raw_offsets_t);
28262 0 : void * * alloc_mem = &alloc_region;
28263 0 : fd_restart_raw_offsets_decode_inner( mem, alloc_mem, ctx );
28264 0 : return self;
28265 0 : }
28266 0 : void fd_restart_raw_offsets_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
28267 0 : fd_restart_raw_offsets_t * self = (fd_restart_raw_offsets_t *)struct_mem;
28268 0 : fd_restart_raw_offsets_bitvec_decode_inner( &self->offsets, alloc_mem, ctx );
28269 0 : }
28270 0 : void * fd_restart_raw_offsets_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
28271 0 : fd_restart_raw_offsets_global_t * self = (fd_restart_raw_offsets_global_t *)mem;
28272 0 : fd_restart_raw_offsets_new( (fd_restart_raw_offsets_t *)self );
28273 0 : void * alloc_region = (uchar *)mem + sizeof(fd_restart_raw_offsets_global_t);
28274 0 : void * * alloc_mem = &alloc_region;
28275 0 : fd_restart_raw_offsets_decode_inner_global( mem, alloc_mem, ctx );
28276 0 : return self;
28277 0 : }
28278 0 : void fd_restart_raw_offsets_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
28279 0 : fd_restart_raw_offsets_global_t * self = (fd_restart_raw_offsets_global_t *)struct_mem;
28280 0 : fd_restart_raw_offsets_bitvec_decode_inner_global( &self->offsets, alloc_mem, ctx );
28281 0 : }
28282 0 : int fd_restart_raw_offsets_convert_global_to_local( void const * global_self, fd_restart_raw_offsets_t * self, fd_bincode_decode_ctx_t * ctx ) {
28283 0 : int err = 0;
28284 0 : fd_restart_raw_offsets_global_t const * mem = (fd_restart_raw_offsets_global_t const *)global_self;
28285 0 : err = fd_restart_raw_offsets_bitvec_convert_global_to_local( &mem->offsets, &self->offsets, ctx );
28286 0 : if( FD_UNLIKELY( err ) ) return err;
28287 0 : return FD_BINCODE_SUCCESS;
28288 0 : }
28289 0 : void fd_restart_raw_offsets_new(fd_restart_raw_offsets_t * self) {
28290 0 : fd_memset( self, 0, sizeof(fd_restart_raw_offsets_t) );
28291 0 : fd_restart_raw_offsets_bitvec_new( &self->offsets );
28292 0 : }
28293 0 : void fd_restart_raw_offsets_destroy( fd_restart_raw_offsets_t * self ) {
28294 0 : fd_restart_raw_offsets_bitvec_destroy( &self->offsets );
28295 0 : }
28296 :
28297 0 : ulong fd_restart_raw_offsets_footprint( void ){ return FD_RESTART_RAW_OFFSETS_FOOTPRINT; }
28298 0 : ulong fd_restart_raw_offsets_align( void ){ return FD_RESTART_RAW_OFFSETS_ALIGN; }
28299 :
28300 0 : void fd_restart_raw_offsets_walk( void * w, fd_restart_raw_offsets_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
28301 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_restart_raw_offsets", level++ );
28302 0 : fd_restart_raw_offsets_bitvec_walk( w, &self->offsets, fun, "offsets", level );
28303 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_restart_raw_offsets", level-- );
28304 0 : }
28305 0 : ulong fd_restart_raw_offsets_size( fd_restart_raw_offsets_t const * self ) {
28306 0 : ulong size = 0;
28307 0 : size += fd_restart_raw_offsets_bitvec_size( &self->offsets );
28308 0 : return size;
28309 0 : }
28310 :
28311 0 : FD_FN_PURE uchar fd_restart_slots_offsets_is_run_length_encoding(fd_restart_slots_offsets_t const * self) {
28312 0 : return self->discriminant == 0;
28313 0 : }
28314 0 : FD_FN_PURE uchar fd_restart_slots_offsets_is_raw_offsets(fd_restart_slots_offsets_t const * self) {
28315 0 : return self->discriminant == 1;
28316 0 : }
28317 : void fd_restart_slots_offsets_inner_new( fd_restart_slots_offsets_inner_t * self, uint discriminant );
28318 0 : int fd_restart_slots_offsets_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
28319 0 : int err;
28320 0 : switch (discriminant) {
28321 0 : case 0: {
28322 0 : err = fd_restart_run_length_encoding_decode_footprint_inner( ctx, total_sz );
28323 0 : if( FD_UNLIKELY( err ) ) return err;
28324 0 : return FD_BINCODE_SUCCESS;
28325 0 : }
28326 0 : case 1: {
28327 0 : err = fd_restart_raw_offsets_decode_footprint_inner( ctx, total_sz );
28328 0 : if( FD_UNLIKELY( err ) ) return err;
28329 0 : return FD_BINCODE_SUCCESS;
28330 0 : }
28331 0 : default: return FD_BINCODE_ERR_ENCODING;
28332 0 : }
28333 0 : }
28334 0 : int fd_restart_slots_offsets_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
28335 0 : *total_sz += sizeof(fd_restart_slots_offsets_t);
28336 0 : void const * start_data = ctx->data;
28337 0 : int err = fd_restart_slots_offsets_decode_footprint_inner( ctx, total_sz );
28338 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
28339 0 : ctx->data = start_data;
28340 0 : return err;
28341 0 : }
28342 0 : int fd_restart_slots_offsets_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
28343 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
28344 0 : uint discriminant = 0;
28345 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
28346 0 : if( FD_UNLIKELY( err ) ) return err;
28347 0 : return fd_restart_slots_offsets_inner_decode_footprint( discriminant, ctx, total_sz );
28348 0 : }
28349 0 : void fd_restart_slots_offsets_inner_decode_inner( fd_restart_slots_offsets_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
28350 0 : switch (discriminant) {
28351 0 : case 0: {
28352 0 : fd_restart_run_length_encoding_decode_inner( &self->run_length_encoding, alloc_mem, ctx );
28353 0 : break;
28354 0 : }
28355 0 : case 1: {
28356 0 : fd_restart_raw_offsets_decode_inner( &self->raw_offsets, alloc_mem, ctx );
28357 0 : break;
28358 0 : }
28359 0 : }
28360 0 : }
28361 0 : void fd_restart_slots_offsets_inner_decode_inner_global( fd_restart_slots_offsets_inner_global_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
28362 0 : switch (discriminant) {
28363 0 : case 0: {
28364 0 : fd_restart_run_length_encoding_decode_inner_global( &self->run_length_encoding, alloc_mem, ctx );
28365 0 : break;
28366 0 : }
28367 0 : case 1: {
28368 0 : fd_restart_raw_offsets_decode_inner_global( &self->raw_offsets, alloc_mem, ctx );
28369 0 : break;
28370 0 : }
28371 0 : }
28372 0 : }
28373 0 : int fd_restart_slots_offsets_convert_global_to_local_inner( fd_restart_slots_offsets_inner_global_t const * mem, fd_restart_slots_offsets_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
28374 0 : int err = 0;
28375 0 : switch( discriminant ) {
28376 0 : case 0: {
28377 0 : err = fd_restart_run_length_encoding_convert_global_to_local( &mem->run_length_encoding, &self->run_length_encoding, ctx );
28378 0 : if( FD_UNLIKELY( err ) ) return err;
28379 0 : break;
28380 0 : }
28381 0 : case 1: {
28382 0 : err = fd_restart_raw_offsets_convert_global_to_local( &mem->raw_offsets, &self->raw_offsets, ctx );
28383 0 : if( FD_UNLIKELY( err ) ) return err;
28384 0 : break;
28385 0 : }
28386 0 : }
28387 0 : return FD_BINCODE_SUCCESS;
28388 0 : }
28389 0 : int fd_restart_slots_offsets_convert_global_to_local( void const * global_self, fd_restart_slots_offsets_t * self, fd_bincode_decode_ctx_t * ctx ) {
28390 0 : fd_restart_slots_offsets_global_t const * mem = (fd_restart_slots_offsets_global_t const *)global_self;
28391 0 : uint discriminant = mem->discriminant;
28392 0 : self->discriminant = mem->discriminant;
28393 0 : int err = fd_restart_slots_offsets_convert_global_to_local_inner( &mem->inner, &self->inner, discriminant, ctx );
28394 0 : return FD_BINCODE_SUCCESS;
28395 0 : }
28396 0 : void fd_restart_slots_offsets_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
28397 0 : fd_restart_slots_offsets_t * self = (fd_restart_slots_offsets_t *)struct_mem;
28398 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
28399 0 : fd_restart_slots_offsets_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
28400 0 : }
28401 0 : void * fd_restart_slots_offsets_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
28402 0 : fd_restart_slots_offsets_t * self = (fd_restart_slots_offsets_t *)mem;
28403 0 : fd_restart_slots_offsets_new( self );
28404 0 : void * alloc_region = (uchar *)mem + sizeof(fd_restart_slots_offsets_t);
28405 0 : void * * alloc_mem = &alloc_region;
28406 0 : fd_restart_slots_offsets_decode_inner( mem, alloc_mem, ctx );
28407 0 : return self;
28408 0 : }
28409 0 : void * fd_restart_slots_offsets_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
28410 0 : fd_restart_slots_offsets_t * self = (fd_restart_slots_offsets_t *)mem;
28411 0 : fd_restart_slots_offsets_new( self );
28412 0 : void * alloc_region = (uchar *)mem + sizeof(fd_restart_slots_offsets_t);
28413 0 : void * * alloc_mem = &alloc_region;
28414 0 : fd_restart_slots_offsets_decode_inner_global( mem, alloc_mem, ctx );
28415 0 : return self;
28416 0 : }
28417 0 : void fd_restart_slots_offsets_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
28418 0 : fd_restart_slots_offsets_global_t * self = (fd_restart_slots_offsets_global_t *)struct_mem;
28419 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
28420 0 : fd_restart_slots_offsets_inner_decode_inner_global( &self->inner, alloc_mem, self->discriminant, ctx );
28421 0 : }
28422 0 : void fd_restart_slots_offsets_inner_new( fd_restart_slots_offsets_inner_t * self, uint discriminant ) {
28423 0 : switch( discriminant ) {
28424 0 : case 0: {
28425 0 : fd_restart_run_length_encoding_new( &self->run_length_encoding );
28426 0 : break;
28427 0 : }
28428 0 : case 1: {
28429 0 : fd_restart_raw_offsets_new( &self->raw_offsets );
28430 0 : break;
28431 0 : }
28432 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
28433 0 : }
28434 0 : }
28435 0 : void fd_restart_slots_offsets_new_disc( fd_restart_slots_offsets_t * self, uint discriminant ) {
28436 0 : self->discriminant = discriminant;
28437 0 : fd_restart_slots_offsets_inner_new( &self->inner, self->discriminant );
28438 0 : }
28439 0 : void fd_restart_slots_offsets_new( fd_restart_slots_offsets_t * self ) {
28440 0 : fd_memset( self, 0, sizeof(fd_restart_slots_offsets_t) );
28441 0 : fd_restart_slots_offsets_new_disc( self, UINT_MAX );
28442 0 : }
28443 0 : void fd_restart_slots_offsets_inner_destroy( fd_restart_slots_offsets_inner_t * self, uint discriminant ) {
28444 0 : switch( discriminant ) {
28445 0 : case 0: {
28446 0 : fd_restart_run_length_encoding_destroy( &self->run_length_encoding );
28447 0 : break;
28448 0 : }
28449 0 : case 1: {
28450 0 : fd_restart_raw_offsets_destroy( &self->raw_offsets );
28451 0 : break;
28452 0 : }
28453 0 : default: break; // FD_LOG_ERR(( "unhandled type" ));
28454 0 : }
28455 0 : }
28456 0 : void fd_restart_slots_offsets_destroy( fd_restart_slots_offsets_t * self ) {
28457 0 : fd_restart_slots_offsets_inner_destroy( &self->inner, self->discriminant );
28458 0 : }
28459 :
28460 0 : ulong fd_restart_slots_offsets_footprint( void ){ return FD_RESTART_SLOTS_OFFSETS_FOOTPRINT; }
28461 0 : ulong fd_restart_slots_offsets_align( void ){ return FD_RESTART_SLOTS_OFFSETS_ALIGN; }
28462 :
28463 0 : void fd_restart_slots_offsets_walk( void * w, fd_restart_slots_offsets_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
28464 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_restart_slots_offsets", level++);
28465 0 : switch( self->discriminant ) {
28466 0 : case 0: {
28467 0 : fun( w, self, "run_length_encoding", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
28468 0 : fd_restart_run_length_encoding_walk( w, &self->inner.run_length_encoding, fun, "run_length_encoding", level );
28469 0 : break;
28470 0 : }
28471 0 : case 1: {
28472 0 : fun( w, self, "raw_offsets", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
28473 0 : fd_restart_raw_offsets_walk( w, &self->inner.raw_offsets, fun, "raw_offsets", level );
28474 0 : break;
28475 0 : }
28476 0 : }
28477 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_restart_slots_offsets", level-- );
28478 0 : }
28479 0 : ulong fd_restart_slots_offsets_size( fd_restart_slots_offsets_t const * self ) {
28480 0 : ulong size = 0;
28481 0 : size += sizeof(uint);
28482 0 : switch (self->discriminant) {
28483 0 : case 0: {
28484 0 : size += fd_restart_run_length_encoding_size( &self->inner.run_length_encoding );
28485 0 : break;
28486 0 : }
28487 0 : case 1: {
28488 0 : size += fd_restart_raw_offsets_size( &self->inner.raw_offsets );
28489 0 : break;
28490 0 : }
28491 0 : }
28492 0 : return size;
28493 0 : }
28494 :
28495 0 : int fd_restart_slots_offsets_inner_encode( fd_restart_slots_offsets_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
28496 0 : int err;
28497 0 : switch (discriminant) {
28498 0 : case 0: {
28499 0 : err = fd_restart_run_length_encoding_encode( &self->run_length_encoding, ctx );
28500 0 : if( FD_UNLIKELY( err ) ) return err;
28501 0 : break;
28502 0 : }
28503 0 : case 1: {
28504 0 : err = fd_restart_raw_offsets_encode( &self->raw_offsets, ctx );
28505 0 : if( FD_UNLIKELY( err ) ) return err;
28506 0 : break;
28507 0 : }
28508 0 : }
28509 0 : return FD_BINCODE_SUCCESS;
28510 0 : }
28511 0 : int fd_restart_slots_offsets_encode( fd_restart_slots_offsets_t const * self, fd_bincode_encode_ctx_t * ctx ) {
28512 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
28513 0 : if( FD_UNLIKELY( err ) ) return err;
28514 0 : return fd_restart_slots_offsets_inner_encode( &self->inner, self->discriminant, ctx );
28515 0 : }
28516 :
28517 0 : int fd_gossip_restart_last_voted_fork_slots_encode( fd_gossip_restart_last_voted_fork_slots_t const * self, fd_bincode_encode_ctx_t * ctx ) {
28518 0 : int err;
28519 0 : err = fd_pubkey_encode( &self->from, ctx );
28520 0 : if( FD_UNLIKELY( err ) ) return err;
28521 0 : err = fd_bincode_uint64_encode( self->wallclock, ctx );
28522 0 : if( FD_UNLIKELY( err ) ) return err;
28523 0 : err = fd_restart_slots_offsets_encode( &self->offsets, ctx );
28524 0 : if( FD_UNLIKELY( err ) ) return err;
28525 0 : err = fd_bincode_uint64_encode( self->last_voted_slot, ctx );
28526 0 : if( FD_UNLIKELY( err ) ) return err;
28527 0 : err = fd_hash_encode( &self->last_voted_hash, ctx );
28528 0 : if( FD_UNLIKELY( err ) ) return err;
28529 0 : err = fd_bincode_uint16_encode( self->shred_version, ctx );
28530 0 : if( FD_UNLIKELY( err ) ) return err;
28531 0 : return FD_BINCODE_SUCCESS;
28532 0 : }
28533 0 : int fd_gossip_restart_last_voted_fork_slots_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
28534 0 : *total_sz += sizeof(fd_gossip_restart_last_voted_fork_slots_t);
28535 0 : void const * start_data = ctx->data;
28536 0 : int err = fd_gossip_restart_last_voted_fork_slots_decode_footprint_inner( ctx, total_sz );
28537 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
28538 0 : ctx->data = start_data;
28539 0 : return err;
28540 0 : }
28541 0 : int fd_gossip_restart_last_voted_fork_slots_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
28542 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
28543 0 : int err = 0;
28544 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
28545 0 : if( FD_UNLIKELY( err ) ) return err;
28546 0 : err = fd_bincode_uint64_decode_footprint( ctx );
28547 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
28548 0 : err = fd_restart_slots_offsets_decode_footprint_inner( ctx, total_sz );
28549 0 : if( FD_UNLIKELY( err ) ) return err;
28550 0 : err = fd_bincode_uint64_decode_footprint( ctx );
28551 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
28552 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
28553 0 : if( FD_UNLIKELY( err ) ) return err;
28554 0 : err = fd_bincode_uint16_decode_footprint( ctx );
28555 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
28556 0 : return 0;
28557 0 : }
28558 0 : void * fd_gossip_restart_last_voted_fork_slots_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
28559 0 : fd_gossip_restart_last_voted_fork_slots_t * self = (fd_gossip_restart_last_voted_fork_slots_t *)mem;
28560 0 : fd_gossip_restart_last_voted_fork_slots_new( self );
28561 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_restart_last_voted_fork_slots_t);
28562 0 : void * * alloc_mem = &alloc_region;
28563 0 : fd_gossip_restart_last_voted_fork_slots_decode_inner( mem, alloc_mem, ctx );
28564 0 : return self;
28565 0 : }
28566 0 : void fd_gossip_restart_last_voted_fork_slots_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
28567 0 : fd_gossip_restart_last_voted_fork_slots_t * self = (fd_gossip_restart_last_voted_fork_slots_t *)struct_mem;
28568 0 : fd_pubkey_decode_inner( &self->from, alloc_mem, ctx );
28569 0 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
28570 0 : fd_restart_slots_offsets_decode_inner( &self->offsets, alloc_mem, ctx );
28571 0 : fd_bincode_uint64_decode_unsafe( &self->last_voted_slot, ctx );
28572 0 : fd_hash_decode_inner( &self->last_voted_hash, alloc_mem, ctx );
28573 0 : fd_bincode_uint16_decode_unsafe( &self->shred_version, ctx );
28574 0 : }
28575 0 : void * fd_gossip_restart_last_voted_fork_slots_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
28576 0 : fd_gossip_restart_last_voted_fork_slots_global_t * self = (fd_gossip_restart_last_voted_fork_slots_global_t *)mem;
28577 0 : fd_gossip_restart_last_voted_fork_slots_new( (fd_gossip_restart_last_voted_fork_slots_t *)self );
28578 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_restart_last_voted_fork_slots_global_t);
28579 0 : void * * alloc_mem = &alloc_region;
28580 0 : fd_gossip_restart_last_voted_fork_slots_decode_inner_global( mem, alloc_mem, ctx );
28581 0 : return self;
28582 0 : }
28583 0 : void fd_gossip_restart_last_voted_fork_slots_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
28584 0 : fd_gossip_restart_last_voted_fork_slots_global_t * self = (fd_gossip_restart_last_voted_fork_slots_global_t *)struct_mem;
28585 0 : fd_pubkey_decode_inner_global( &self->from, alloc_mem, ctx );
28586 0 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
28587 0 : fd_restart_slots_offsets_decode_inner_global( &self->offsets, alloc_mem, ctx );
28588 0 : fd_bincode_uint64_decode_unsafe( &self->last_voted_slot, ctx );
28589 0 : fd_hash_decode_inner_global( &self->last_voted_hash, alloc_mem, ctx );
28590 0 : fd_bincode_uint16_decode_unsafe( &self->shred_version, ctx );
28591 0 : }
28592 0 : int fd_gossip_restart_last_voted_fork_slots_convert_global_to_local( void const * global_self, fd_gossip_restart_last_voted_fork_slots_t * self, fd_bincode_decode_ctx_t * ctx ) {
28593 0 : int err = 0;
28594 0 : fd_gossip_restart_last_voted_fork_slots_global_t const * mem = (fd_gossip_restart_last_voted_fork_slots_global_t const *)global_self;
28595 0 : err = fd_pubkey_convert_global_to_local( &mem->from, &self->from, ctx );
28596 0 : if( FD_UNLIKELY( err ) ) return err;
28597 0 : self->wallclock = mem->wallclock;
28598 0 : err = fd_restart_slots_offsets_convert_global_to_local( &mem->offsets, &self->offsets, ctx );
28599 0 : if( FD_UNLIKELY( err ) ) return err;
28600 0 : self->last_voted_slot = mem->last_voted_slot;
28601 0 : err = fd_hash_convert_global_to_local( &mem->last_voted_hash, &self->last_voted_hash, ctx );
28602 0 : if( FD_UNLIKELY( err ) ) return err;
28603 0 : self->shred_version = mem->shred_version;
28604 0 : return FD_BINCODE_SUCCESS;
28605 0 : }
28606 0 : void fd_gossip_restart_last_voted_fork_slots_new(fd_gossip_restart_last_voted_fork_slots_t * self) {
28607 0 : fd_memset( self, 0, sizeof(fd_gossip_restart_last_voted_fork_slots_t) );
28608 0 : fd_pubkey_new( &self->from );
28609 0 : fd_restart_slots_offsets_new( &self->offsets );
28610 0 : fd_hash_new( &self->last_voted_hash );
28611 0 : }
28612 0 : void fd_gossip_restart_last_voted_fork_slots_destroy( fd_gossip_restart_last_voted_fork_slots_t * self ) {
28613 0 : fd_pubkey_destroy( &self->from );
28614 0 : fd_restart_slots_offsets_destroy( &self->offsets );
28615 0 : fd_hash_destroy( &self->last_voted_hash );
28616 0 : }
28617 :
28618 0 : ulong fd_gossip_restart_last_voted_fork_slots_footprint( void ){ return FD_GOSSIP_RESTART_LAST_VOTED_FORK_SLOTS_FOOTPRINT; }
28619 0 : ulong fd_gossip_restart_last_voted_fork_slots_align( void ){ return FD_GOSSIP_RESTART_LAST_VOTED_FORK_SLOTS_ALIGN; }
28620 :
28621 0 : void fd_gossip_restart_last_voted_fork_slots_walk( void * w, fd_gossip_restart_last_voted_fork_slots_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
28622 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_restart_last_voted_fork_slots", level++ );
28623 0 : fd_pubkey_walk( w, &self->from, fun, "from", level );
28624 0 : fun( w, &self->wallclock, "wallclock", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
28625 0 : fd_restart_slots_offsets_walk( w, &self->offsets, fun, "offsets", level );
28626 0 : fun( w, &self->last_voted_slot, "last_voted_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
28627 0 : fd_hash_walk( w, &self->last_voted_hash, fun, "last_voted_hash", level );
28628 0 : fun( w, &self->shred_version, "shred_version", FD_FLAMENCO_TYPE_USHORT, "ushort", level );
28629 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_restart_last_voted_fork_slots", level-- );
28630 0 : }
28631 0 : ulong fd_gossip_restart_last_voted_fork_slots_size( fd_gossip_restart_last_voted_fork_slots_t const * self ) {
28632 0 : ulong size = 0;
28633 0 : size += fd_pubkey_size( &self->from );
28634 0 : size += sizeof(ulong);
28635 0 : size += fd_restart_slots_offsets_size( &self->offsets );
28636 0 : size += sizeof(ulong);
28637 0 : size += fd_hash_size( &self->last_voted_hash );
28638 0 : size += sizeof(ushort);
28639 0 : return size;
28640 0 : }
28641 :
28642 0 : int fd_gossip_restart_heaviest_fork_encode( fd_gossip_restart_heaviest_fork_t const * self, fd_bincode_encode_ctx_t * ctx ) {
28643 0 : int err;
28644 0 : err = fd_pubkey_encode( &self->from, ctx );
28645 0 : if( FD_UNLIKELY( err ) ) return err;
28646 0 : err = fd_bincode_uint64_encode( self->wallclock, ctx );
28647 0 : if( FD_UNLIKELY( err ) ) return err;
28648 0 : err = fd_bincode_uint64_encode( self->last_slot, ctx );
28649 0 : if( FD_UNLIKELY( err ) ) return err;
28650 0 : err = fd_hash_encode( &self->last_slot_hash, ctx );
28651 0 : if( FD_UNLIKELY( err ) ) return err;
28652 0 : err = fd_bincode_uint64_encode( self->observed_stake, ctx );
28653 0 : if( FD_UNLIKELY( err ) ) return err;
28654 0 : err = fd_bincode_uint16_encode( self->shred_version, ctx );
28655 0 : if( FD_UNLIKELY( err ) ) return err;
28656 0 : return FD_BINCODE_SUCCESS;
28657 0 : }
28658 0 : int fd_gossip_restart_heaviest_fork_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
28659 0 : *total_sz += sizeof(fd_gossip_restart_heaviest_fork_t);
28660 0 : void const * start_data = ctx->data;
28661 0 : int err = fd_gossip_restart_heaviest_fork_decode_footprint_inner( ctx, total_sz );
28662 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
28663 0 : ctx->data = start_data;
28664 0 : return err;
28665 0 : }
28666 0 : int fd_gossip_restart_heaviest_fork_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
28667 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
28668 0 : int err = 0;
28669 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
28670 0 : if( FD_UNLIKELY( err ) ) return err;
28671 0 : err = fd_bincode_uint64_decode_footprint( ctx );
28672 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
28673 0 : err = fd_bincode_uint64_decode_footprint( ctx );
28674 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
28675 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
28676 0 : if( FD_UNLIKELY( err ) ) return err;
28677 0 : err = fd_bincode_uint64_decode_footprint( ctx );
28678 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
28679 0 : err = fd_bincode_uint16_decode_footprint( ctx );
28680 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
28681 0 : return 0;
28682 0 : }
28683 0 : void * fd_gossip_restart_heaviest_fork_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
28684 0 : fd_gossip_restart_heaviest_fork_t * self = (fd_gossip_restart_heaviest_fork_t *)mem;
28685 0 : fd_gossip_restart_heaviest_fork_new( self );
28686 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_restart_heaviest_fork_t);
28687 0 : void * * alloc_mem = &alloc_region;
28688 0 : fd_gossip_restart_heaviest_fork_decode_inner( mem, alloc_mem, ctx );
28689 0 : return self;
28690 0 : }
28691 0 : void fd_gossip_restart_heaviest_fork_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
28692 0 : fd_gossip_restart_heaviest_fork_t * self = (fd_gossip_restart_heaviest_fork_t *)struct_mem;
28693 0 : fd_pubkey_decode_inner( &self->from, alloc_mem, ctx );
28694 0 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
28695 0 : fd_bincode_uint64_decode_unsafe( &self->last_slot, ctx );
28696 0 : fd_hash_decode_inner( &self->last_slot_hash, alloc_mem, ctx );
28697 0 : fd_bincode_uint64_decode_unsafe( &self->observed_stake, ctx );
28698 0 : fd_bincode_uint16_decode_unsafe( &self->shred_version, ctx );
28699 0 : }
28700 0 : void * fd_gossip_restart_heaviest_fork_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
28701 0 : fd_gossip_restart_heaviest_fork_global_t * self = (fd_gossip_restart_heaviest_fork_global_t *)mem;
28702 0 : fd_gossip_restart_heaviest_fork_new( (fd_gossip_restart_heaviest_fork_t *)self );
28703 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_restart_heaviest_fork_global_t);
28704 0 : void * * alloc_mem = &alloc_region;
28705 0 : fd_gossip_restart_heaviest_fork_decode_inner_global( mem, alloc_mem, ctx );
28706 0 : return self;
28707 0 : }
28708 0 : void fd_gossip_restart_heaviest_fork_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
28709 0 : fd_gossip_restart_heaviest_fork_global_t * self = (fd_gossip_restart_heaviest_fork_global_t *)struct_mem;
28710 0 : fd_pubkey_decode_inner_global( &self->from, alloc_mem, ctx );
28711 0 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
28712 0 : fd_bincode_uint64_decode_unsafe( &self->last_slot, ctx );
28713 0 : fd_hash_decode_inner_global( &self->last_slot_hash, alloc_mem, ctx );
28714 0 : fd_bincode_uint64_decode_unsafe( &self->observed_stake, ctx );
28715 0 : fd_bincode_uint16_decode_unsafe( &self->shred_version, ctx );
28716 0 : }
28717 0 : int fd_gossip_restart_heaviest_fork_convert_global_to_local( void const * global_self, fd_gossip_restart_heaviest_fork_t * self, fd_bincode_decode_ctx_t * ctx ) {
28718 0 : int err = 0;
28719 0 : fd_gossip_restart_heaviest_fork_global_t const * mem = (fd_gossip_restart_heaviest_fork_global_t const *)global_self;
28720 0 : err = fd_pubkey_convert_global_to_local( &mem->from, &self->from, ctx );
28721 0 : if( FD_UNLIKELY( err ) ) return err;
28722 0 : self->wallclock = mem->wallclock;
28723 0 : self->last_slot = mem->last_slot;
28724 0 : err = fd_hash_convert_global_to_local( &mem->last_slot_hash, &self->last_slot_hash, ctx );
28725 0 : if( FD_UNLIKELY( err ) ) return err;
28726 0 : self->observed_stake = mem->observed_stake;
28727 0 : self->shred_version = mem->shred_version;
28728 0 : return FD_BINCODE_SUCCESS;
28729 0 : }
28730 0 : void fd_gossip_restart_heaviest_fork_new(fd_gossip_restart_heaviest_fork_t * self) {
28731 0 : fd_memset( self, 0, sizeof(fd_gossip_restart_heaviest_fork_t) );
28732 0 : fd_pubkey_new( &self->from );
28733 0 : fd_hash_new( &self->last_slot_hash );
28734 0 : }
28735 0 : void fd_gossip_restart_heaviest_fork_destroy( fd_gossip_restart_heaviest_fork_t * self ) {
28736 0 : fd_pubkey_destroy( &self->from );
28737 0 : fd_hash_destroy( &self->last_slot_hash );
28738 0 : }
28739 :
28740 0 : ulong fd_gossip_restart_heaviest_fork_footprint( void ){ return FD_GOSSIP_RESTART_HEAVIEST_FORK_FOOTPRINT; }
28741 0 : ulong fd_gossip_restart_heaviest_fork_align( void ){ return FD_GOSSIP_RESTART_HEAVIEST_FORK_ALIGN; }
28742 :
28743 0 : void fd_gossip_restart_heaviest_fork_walk( void * w, fd_gossip_restart_heaviest_fork_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
28744 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_restart_heaviest_fork", level++ );
28745 0 : fd_pubkey_walk( w, &self->from, fun, "from", level );
28746 0 : fun( w, &self->wallclock, "wallclock", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
28747 0 : fun( w, &self->last_slot, "last_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
28748 0 : fd_hash_walk( w, &self->last_slot_hash, fun, "last_slot_hash", level );
28749 0 : fun( w, &self->observed_stake, "observed_stake", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
28750 0 : fun( w, &self->shred_version, "shred_version", FD_FLAMENCO_TYPE_USHORT, "ushort", level );
28751 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_restart_heaviest_fork", level-- );
28752 0 : }
28753 0 : ulong fd_gossip_restart_heaviest_fork_size( fd_gossip_restart_heaviest_fork_t const * self ) {
28754 0 : ulong size = 0;
28755 0 : size += fd_pubkey_size( &self->from );
28756 0 : size += sizeof(ulong);
28757 0 : size += sizeof(ulong);
28758 0 : size += fd_hash_size( &self->last_slot_hash );
28759 0 : size += sizeof(ulong);
28760 0 : size += sizeof(ushort);
28761 0 : return size;
28762 0 : }
28763 :
28764 0 : FD_FN_PURE uchar fd_crds_data_is_contact_info_v1(fd_crds_data_t const * self) {
28765 0 : return self->discriminant == 0;
28766 0 : }
28767 0 : FD_FN_PURE uchar fd_crds_data_is_vote(fd_crds_data_t const * self) {
28768 0 : return self->discriminant == 1;
28769 0 : }
28770 0 : FD_FN_PURE uchar fd_crds_data_is_lowest_slot(fd_crds_data_t const * self) {
28771 0 : return self->discriminant == 2;
28772 0 : }
28773 0 : FD_FN_PURE uchar fd_crds_data_is_snapshot_hashes(fd_crds_data_t const * self) {
28774 0 : return self->discriminant == 3;
28775 0 : }
28776 0 : FD_FN_PURE uchar fd_crds_data_is_accounts_hashes(fd_crds_data_t const * self) {
28777 0 : return self->discriminant == 4;
28778 0 : }
28779 0 : FD_FN_PURE uchar fd_crds_data_is_epoch_slots(fd_crds_data_t const * self) {
28780 0 : return self->discriminant == 5;
28781 0 : }
28782 0 : FD_FN_PURE uchar fd_crds_data_is_version_v1(fd_crds_data_t const * self) {
28783 0 : return self->discriminant == 6;
28784 0 : }
28785 0 : FD_FN_PURE uchar fd_crds_data_is_version_v2(fd_crds_data_t const * self) {
28786 0 : return self->discriminant == 7;
28787 0 : }
28788 0 : FD_FN_PURE uchar fd_crds_data_is_node_instance(fd_crds_data_t const * self) {
28789 0 : return self->discriminant == 8;
28790 0 : }
28791 0 : FD_FN_PURE uchar fd_crds_data_is_duplicate_shred(fd_crds_data_t const * self) {
28792 0 : return self->discriminant == 9;
28793 0 : }
28794 0 : FD_FN_PURE uchar fd_crds_data_is_incremental_snapshot_hashes(fd_crds_data_t const * self) {
28795 0 : return self->discriminant == 10;
28796 0 : }
28797 0 : FD_FN_PURE uchar fd_crds_data_is_contact_info_v2(fd_crds_data_t const * self) {
28798 0 : return self->discriminant == 11;
28799 0 : }
28800 0 : FD_FN_PURE uchar fd_crds_data_is_restart_last_voted_fork_slots(fd_crds_data_t const * self) {
28801 0 : return self->discriminant == 12;
28802 0 : }
28803 0 : FD_FN_PURE uchar fd_crds_data_is_restart_heaviest_fork(fd_crds_data_t const * self) {
28804 0 : return self->discriminant == 13;
28805 0 : }
28806 : void fd_crds_data_inner_new( fd_crds_data_inner_t * self, uint discriminant );
28807 30 : int fd_crds_data_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
28808 30 : int err;
28809 30 : switch (discriminant) {
28810 9 : case 0: {
28811 9 : err = fd_gossip_contact_info_v1_decode_footprint_inner( ctx, total_sz );
28812 9 : if( FD_UNLIKELY( err ) ) return err;
28813 9 : return FD_BINCODE_SUCCESS;
28814 9 : }
28815 6 : case 1: {
28816 6 : err = fd_gossip_vote_decode_footprint_inner( ctx, total_sz );
28817 6 : if( FD_UNLIKELY( err ) ) return err;
28818 6 : return FD_BINCODE_SUCCESS;
28819 6 : }
28820 0 : case 2: {
28821 0 : err = fd_gossip_lowest_slot_decode_footprint_inner( ctx, total_sz );
28822 0 : if( FD_UNLIKELY( err ) ) return err;
28823 0 : return FD_BINCODE_SUCCESS;
28824 0 : }
28825 3 : case 3: {
28826 3 : err = fd_gossip_slot_hashes_decode_footprint_inner( ctx, total_sz );
28827 3 : if( FD_UNLIKELY( err ) ) return err;
28828 3 : return FD_BINCODE_SUCCESS;
28829 3 : }
28830 0 : case 4: {
28831 0 : err = fd_gossip_slot_hashes_decode_footprint_inner( ctx, total_sz );
28832 0 : if( FD_UNLIKELY( err ) ) return err;
28833 0 : return FD_BINCODE_SUCCESS;
28834 0 : }
28835 0 : case 5: {
28836 0 : err = fd_gossip_epoch_slots_decode_footprint_inner( ctx, total_sz );
28837 0 : if( FD_UNLIKELY( err ) ) return err;
28838 0 : return FD_BINCODE_SUCCESS;
28839 0 : }
28840 0 : case 6: {
28841 0 : err = fd_gossip_version_v1_decode_footprint_inner( ctx, total_sz );
28842 0 : if( FD_UNLIKELY( err ) ) return err;
28843 0 : return FD_BINCODE_SUCCESS;
28844 0 : }
28845 3 : case 7: {
28846 3 : err = fd_gossip_version_v2_decode_footprint_inner( ctx, total_sz );
28847 3 : if( FD_UNLIKELY( err ) ) return err;
28848 3 : return FD_BINCODE_SUCCESS;
28849 3 : }
28850 6 : case 8: {
28851 6 : err = fd_gossip_node_instance_decode_footprint_inner( ctx, total_sz );
28852 6 : if( FD_UNLIKELY( err ) ) return err;
28853 6 : return FD_BINCODE_SUCCESS;
28854 6 : }
28855 0 : case 9: {
28856 0 : err = fd_gossip_duplicate_shred_decode_footprint_inner( ctx, total_sz );
28857 0 : if( FD_UNLIKELY( err ) ) return err;
28858 0 : return FD_BINCODE_SUCCESS;
28859 0 : }
28860 0 : case 10: {
28861 0 : err = fd_gossip_incremental_snapshot_hashes_decode_footprint_inner( ctx, total_sz );
28862 0 : if( FD_UNLIKELY( err ) ) return err;
28863 0 : return FD_BINCODE_SUCCESS;
28864 0 : }
28865 3 : case 11: {
28866 3 : err = fd_gossip_contact_info_v2_decode_footprint_inner( ctx, total_sz );
28867 3 : if( FD_UNLIKELY( err ) ) return err;
28868 3 : return FD_BINCODE_SUCCESS;
28869 3 : }
28870 0 : case 12: {
28871 0 : err = fd_gossip_restart_last_voted_fork_slots_decode_footprint_inner( ctx, total_sz );
28872 0 : if( FD_UNLIKELY( err ) ) return err;
28873 0 : return FD_BINCODE_SUCCESS;
28874 0 : }
28875 0 : case 13: {
28876 0 : err = fd_gossip_restart_heaviest_fork_decode_footprint_inner( ctx, total_sz );
28877 0 : if( FD_UNLIKELY( err ) ) return err;
28878 0 : return FD_BINCODE_SUCCESS;
28879 0 : }
28880 0 : default: return FD_BINCODE_ERR_ENCODING;
28881 30 : }
28882 30 : }
28883 0 : int fd_crds_data_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
28884 0 : *total_sz += sizeof(fd_crds_data_t);
28885 0 : void const * start_data = ctx->data;
28886 0 : int err = fd_crds_data_decode_footprint_inner( ctx, total_sz );
28887 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
28888 0 : ctx->data = start_data;
28889 0 : return err;
28890 0 : }
28891 30 : int fd_crds_data_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
28892 30 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
28893 30 : uint discriminant = 0;
28894 30 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
28895 30 : if( FD_UNLIKELY( err ) ) return err;
28896 30 : return fd_crds_data_inner_decode_footprint( discriminant, ctx, total_sz );
28897 30 : }
28898 30 : void fd_crds_data_inner_decode_inner( fd_crds_data_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
28899 30 : switch (discriminant) {
28900 9 : case 0: {
28901 9 : fd_gossip_contact_info_v1_decode_inner( &self->contact_info_v1, alloc_mem, ctx );
28902 9 : break;
28903 0 : }
28904 6 : case 1: {
28905 6 : fd_gossip_vote_decode_inner( &self->vote, alloc_mem, ctx );
28906 6 : break;
28907 0 : }
28908 0 : case 2: {
28909 0 : fd_gossip_lowest_slot_decode_inner( &self->lowest_slot, alloc_mem, ctx );
28910 0 : break;
28911 0 : }
28912 3 : case 3: {
28913 3 : fd_gossip_slot_hashes_decode_inner( &self->snapshot_hashes, alloc_mem, ctx );
28914 3 : break;
28915 0 : }
28916 0 : case 4: {
28917 0 : fd_gossip_slot_hashes_decode_inner( &self->accounts_hashes, alloc_mem, ctx );
28918 0 : break;
28919 0 : }
28920 0 : case 5: {
28921 0 : fd_gossip_epoch_slots_decode_inner( &self->epoch_slots, alloc_mem, ctx );
28922 0 : break;
28923 0 : }
28924 0 : case 6: {
28925 0 : fd_gossip_version_v1_decode_inner( &self->version_v1, alloc_mem, ctx );
28926 0 : break;
28927 0 : }
28928 3 : case 7: {
28929 3 : fd_gossip_version_v2_decode_inner( &self->version_v2, alloc_mem, ctx );
28930 3 : break;
28931 0 : }
28932 6 : case 8: {
28933 6 : fd_gossip_node_instance_decode_inner( &self->node_instance, alloc_mem, ctx );
28934 6 : break;
28935 0 : }
28936 0 : case 9: {
28937 0 : fd_gossip_duplicate_shred_decode_inner( &self->duplicate_shred, alloc_mem, ctx );
28938 0 : break;
28939 0 : }
28940 0 : case 10: {
28941 0 : fd_gossip_incremental_snapshot_hashes_decode_inner( &self->incremental_snapshot_hashes, alloc_mem, ctx );
28942 0 : break;
28943 0 : }
28944 3 : case 11: {
28945 3 : fd_gossip_contact_info_v2_decode_inner( &self->contact_info_v2, alloc_mem, ctx );
28946 3 : break;
28947 0 : }
28948 0 : case 12: {
28949 0 : fd_gossip_restart_last_voted_fork_slots_decode_inner( &self->restart_last_voted_fork_slots, alloc_mem, ctx );
28950 0 : break;
28951 0 : }
28952 0 : case 13: {
28953 0 : fd_gossip_restart_heaviest_fork_decode_inner( &self->restart_heaviest_fork, alloc_mem, ctx );
28954 0 : break;
28955 0 : }
28956 30 : }
28957 30 : }
28958 0 : void fd_crds_data_inner_decode_inner_global( fd_crds_data_inner_global_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
28959 0 : switch (discriminant) {
28960 0 : case 0: {
28961 0 : fd_gossip_contact_info_v1_decode_inner_global( &self->contact_info_v1, alloc_mem, ctx );
28962 0 : break;
28963 0 : }
28964 0 : case 1: {
28965 0 : fd_gossip_vote_decode_inner_global( &self->vote, alloc_mem, ctx );
28966 0 : break;
28967 0 : }
28968 0 : case 2: {
28969 0 : fd_gossip_lowest_slot_decode_inner_global( &self->lowest_slot, alloc_mem, ctx );
28970 0 : break;
28971 0 : }
28972 0 : case 3: {
28973 0 : fd_gossip_slot_hashes_decode_inner_global( &self->snapshot_hashes, alloc_mem, ctx );
28974 0 : break;
28975 0 : }
28976 0 : case 4: {
28977 0 : fd_gossip_slot_hashes_decode_inner_global( &self->accounts_hashes, alloc_mem, ctx );
28978 0 : break;
28979 0 : }
28980 0 : case 5: {
28981 0 : fd_gossip_epoch_slots_decode_inner_global( &self->epoch_slots, alloc_mem, ctx );
28982 0 : break;
28983 0 : }
28984 0 : case 6: {
28985 0 : fd_gossip_version_v1_decode_inner_global( &self->version_v1, alloc_mem, ctx );
28986 0 : break;
28987 0 : }
28988 0 : case 7: {
28989 0 : fd_gossip_version_v2_decode_inner_global( &self->version_v2, alloc_mem, ctx );
28990 0 : break;
28991 0 : }
28992 0 : case 8: {
28993 0 : fd_gossip_node_instance_decode_inner_global( &self->node_instance, alloc_mem, ctx );
28994 0 : break;
28995 0 : }
28996 0 : case 9: {
28997 0 : fd_gossip_duplicate_shred_decode_inner_global( &self->duplicate_shred, alloc_mem, ctx );
28998 0 : break;
28999 0 : }
29000 0 : case 10: {
29001 0 : fd_gossip_incremental_snapshot_hashes_decode_inner_global( &self->incremental_snapshot_hashes, alloc_mem, ctx );
29002 0 : break;
29003 0 : }
29004 0 : case 11: {
29005 0 : fd_gossip_contact_info_v2_decode_inner_global( &self->contact_info_v2, alloc_mem, ctx );
29006 0 : break;
29007 0 : }
29008 0 : case 12: {
29009 0 : fd_gossip_restart_last_voted_fork_slots_decode_inner_global( &self->restart_last_voted_fork_slots, alloc_mem, ctx );
29010 0 : break;
29011 0 : }
29012 0 : case 13: {
29013 0 : fd_gossip_restart_heaviest_fork_decode_inner_global( &self->restart_heaviest_fork, alloc_mem, ctx );
29014 0 : break;
29015 0 : }
29016 0 : }
29017 0 : }
29018 0 : int fd_crds_data_convert_global_to_local_inner( fd_crds_data_inner_global_t const * mem, fd_crds_data_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
29019 0 : int err = 0;
29020 0 : switch( discriminant ) {
29021 0 : case 0: {
29022 0 : err = fd_gossip_contact_info_v1_convert_global_to_local( &mem->contact_info_v1, &self->contact_info_v1, ctx );
29023 0 : if( FD_UNLIKELY( err ) ) return err;
29024 0 : break;
29025 0 : }
29026 0 : case 1: {
29027 0 : err = fd_gossip_vote_convert_global_to_local( &mem->vote, &self->vote, ctx );
29028 0 : if( FD_UNLIKELY( err ) ) return err;
29029 0 : break;
29030 0 : }
29031 0 : case 2: {
29032 0 : err = fd_gossip_lowest_slot_convert_global_to_local( &mem->lowest_slot, &self->lowest_slot, ctx );
29033 0 : if( FD_UNLIKELY( err ) ) return err;
29034 0 : break;
29035 0 : }
29036 0 : case 3: {
29037 0 : err = fd_gossip_slot_hashes_convert_global_to_local( &mem->snapshot_hashes, &self->snapshot_hashes, ctx );
29038 0 : if( FD_UNLIKELY( err ) ) return err;
29039 0 : break;
29040 0 : }
29041 0 : case 4: {
29042 0 : err = fd_gossip_slot_hashes_convert_global_to_local( &mem->accounts_hashes, &self->accounts_hashes, ctx );
29043 0 : if( FD_UNLIKELY( err ) ) return err;
29044 0 : break;
29045 0 : }
29046 0 : case 5: {
29047 0 : err = fd_gossip_epoch_slots_convert_global_to_local( &mem->epoch_slots, &self->epoch_slots, ctx );
29048 0 : if( FD_UNLIKELY( err ) ) return err;
29049 0 : break;
29050 0 : }
29051 0 : case 6: {
29052 0 : err = fd_gossip_version_v1_convert_global_to_local( &mem->version_v1, &self->version_v1, ctx );
29053 0 : if( FD_UNLIKELY( err ) ) return err;
29054 0 : break;
29055 0 : }
29056 0 : case 7: {
29057 0 : err = fd_gossip_version_v2_convert_global_to_local( &mem->version_v2, &self->version_v2, ctx );
29058 0 : if( FD_UNLIKELY( err ) ) return err;
29059 0 : break;
29060 0 : }
29061 0 : case 8: {
29062 0 : err = fd_gossip_node_instance_convert_global_to_local( &mem->node_instance, &self->node_instance, ctx );
29063 0 : if( FD_UNLIKELY( err ) ) return err;
29064 0 : break;
29065 0 : }
29066 0 : case 9: {
29067 0 : err = fd_gossip_duplicate_shred_convert_global_to_local( &mem->duplicate_shred, &self->duplicate_shred, ctx );
29068 0 : if( FD_UNLIKELY( err ) ) return err;
29069 0 : break;
29070 0 : }
29071 0 : case 10: {
29072 0 : err = fd_gossip_incremental_snapshot_hashes_convert_global_to_local( &mem->incremental_snapshot_hashes, &self->incremental_snapshot_hashes, ctx );
29073 0 : if( FD_UNLIKELY( err ) ) return err;
29074 0 : break;
29075 0 : }
29076 0 : case 11: {
29077 0 : err = fd_gossip_contact_info_v2_convert_global_to_local( &mem->contact_info_v2, &self->contact_info_v2, ctx );
29078 0 : if( FD_UNLIKELY( err ) ) return err;
29079 0 : break;
29080 0 : }
29081 0 : case 12: {
29082 0 : err = fd_gossip_restart_last_voted_fork_slots_convert_global_to_local( &mem->restart_last_voted_fork_slots, &self->restart_last_voted_fork_slots, ctx );
29083 0 : if( FD_UNLIKELY( err ) ) return err;
29084 0 : break;
29085 0 : }
29086 0 : case 13: {
29087 0 : err = fd_gossip_restart_heaviest_fork_convert_global_to_local( &mem->restart_heaviest_fork, &self->restart_heaviest_fork, ctx );
29088 0 : if( FD_UNLIKELY( err ) ) return err;
29089 0 : break;
29090 0 : }
29091 0 : }
29092 0 : return FD_BINCODE_SUCCESS;
29093 0 : }
29094 0 : int fd_crds_data_convert_global_to_local( void const * global_self, fd_crds_data_t * self, fd_bincode_decode_ctx_t * ctx ) {
29095 0 : fd_crds_data_global_t const * mem = (fd_crds_data_global_t const *)global_self;
29096 0 : uint discriminant = mem->discriminant;
29097 0 : self->discriminant = mem->discriminant;
29098 0 : int err = fd_crds_data_convert_global_to_local_inner( &mem->inner, &self->inner, discriminant, ctx );
29099 0 : return FD_BINCODE_SUCCESS;
29100 0 : }
29101 30 : void fd_crds_data_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
29102 30 : fd_crds_data_t * self = (fd_crds_data_t *)struct_mem;
29103 30 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
29104 30 : fd_crds_data_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
29105 30 : }
29106 0 : void * fd_crds_data_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
29107 0 : fd_crds_data_t * self = (fd_crds_data_t *)mem;
29108 0 : fd_crds_data_new( self );
29109 0 : void * alloc_region = (uchar *)mem + sizeof(fd_crds_data_t);
29110 0 : void * * alloc_mem = &alloc_region;
29111 0 : fd_crds_data_decode_inner( mem, alloc_mem, ctx );
29112 0 : return self;
29113 0 : }
29114 0 : void * fd_crds_data_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
29115 0 : fd_crds_data_t * self = (fd_crds_data_t *)mem;
29116 0 : fd_crds_data_new( self );
29117 0 : void * alloc_region = (uchar *)mem + sizeof(fd_crds_data_t);
29118 0 : void * * alloc_mem = &alloc_region;
29119 0 : fd_crds_data_decode_inner_global( mem, alloc_mem, ctx );
29120 0 : return self;
29121 0 : }
29122 0 : void fd_crds_data_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
29123 0 : fd_crds_data_global_t * self = (fd_crds_data_global_t *)struct_mem;
29124 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
29125 0 : fd_crds_data_inner_decode_inner_global( &self->inner, alloc_mem, self->discriminant, ctx );
29126 0 : }
29127 27 : void fd_crds_data_inner_new( fd_crds_data_inner_t * self, uint discriminant ) {
29128 27 : switch( discriminant ) {
29129 0 : case 0: {
29130 0 : fd_gossip_contact_info_v1_new( &self->contact_info_v1 );
29131 0 : break;
29132 0 : }
29133 0 : case 1: {
29134 0 : fd_gossip_vote_new( &self->vote );
29135 0 : break;
29136 0 : }
29137 0 : case 2: {
29138 0 : fd_gossip_lowest_slot_new( &self->lowest_slot );
29139 0 : break;
29140 0 : }
29141 0 : case 3: {
29142 0 : fd_gossip_slot_hashes_new( &self->snapshot_hashes );
29143 0 : break;
29144 0 : }
29145 0 : case 4: {
29146 0 : fd_gossip_slot_hashes_new( &self->accounts_hashes );
29147 0 : break;
29148 0 : }
29149 0 : case 5: {
29150 0 : fd_gossip_epoch_slots_new( &self->epoch_slots );
29151 0 : break;
29152 0 : }
29153 0 : case 6: {
29154 0 : fd_gossip_version_v1_new( &self->version_v1 );
29155 0 : break;
29156 0 : }
29157 0 : case 7: {
29158 0 : fd_gossip_version_v2_new( &self->version_v2 );
29159 0 : break;
29160 0 : }
29161 0 : case 8: {
29162 0 : fd_gossip_node_instance_new( &self->node_instance );
29163 0 : break;
29164 0 : }
29165 0 : case 9: {
29166 0 : fd_gossip_duplicate_shred_new( &self->duplicate_shred );
29167 0 : break;
29168 0 : }
29169 0 : case 10: {
29170 0 : fd_gossip_incremental_snapshot_hashes_new( &self->incremental_snapshot_hashes );
29171 0 : break;
29172 0 : }
29173 0 : case 11: {
29174 0 : fd_gossip_contact_info_v2_new( &self->contact_info_v2 );
29175 0 : break;
29176 0 : }
29177 0 : case 12: {
29178 0 : fd_gossip_restart_last_voted_fork_slots_new( &self->restart_last_voted_fork_slots );
29179 0 : break;
29180 0 : }
29181 0 : case 13: {
29182 0 : fd_gossip_restart_heaviest_fork_new( &self->restart_heaviest_fork );
29183 0 : break;
29184 0 : }
29185 27 : default: break; // FD_LOG_ERR(( "unhandled type"));
29186 27 : }
29187 27 : }
29188 27 : void fd_crds_data_new_disc( fd_crds_data_t * self, uint discriminant ) {
29189 27 : self->discriminant = discriminant;
29190 27 : fd_crds_data_inner_new( &self->inner, self->discriminant );
29191 27 : }
29192 27 : void fd_crds_data_new( fd_crds_data_t * self ) {
29193 27 : fd_memset( self, 0, sizeof(fd_crds_data_t) );
29194 27 : fd_crds_data_new_disc( self, UINT_MAX );
29195 27 : }
29196 0 : void fd_crds_data_inner_destroy( fd_crds_data_inner_t * self, uint discriminant ) {
29197 0 : switch( discriminant ) {
29198 0 : case 0: {
29199 0 : fd_gossip_contact_info_v1_destroy( &self->contact_info_v1 );
29200 0 : break;
29201 0 : }
29202 0 : case 1: {
29203 0 : fd_gossip_vote_destroy( &self->vote );
29204 0 : break;
29205 0 : }
29206 0 : case 2: {
29207 0 : fd_gossip_lowest_slot_destroy( &self->lowest_slot );
29208 0 : break;
29209 0 : }
29210 0 : case 3: {
29211 0 : fd_gossip_slot_hashes_destroy( &self->snapshot_hashes );
29212 0 : break;
29213 0 : }
29214 0 : case 4: {
29215 0 : fd_gossip_slot_hashes_destroy( &self->accounts_hashes );
29216 0 : break;
29217 0 : }
29218 0 : case 5: {
29219 0 : fd_gossip_epoch_slots_destroy( &self->epoch_slots );
29220 0 : break;
29221 0 : }
29222 0 : case 6: {
29223 0 : fd_gossip_version_v1_destroy( &self->version_v1 );
29224 0 : break;
29225 0 : }
29226 0 : case 7: {
29227 0 : fd_gossip_version_v2_destroy( &self->version_v2 );
29228 0 : break;
29229 0 : }
29230 0 : case 8: {
29231 0 : fd_gossip_node_instance_destroy( &self->node_instance );
29232 0 : break;
29233 0 : }
29234 0 : case 9: {
29235 0 : fd_gossip_duplicate_shred_destroy( &self->duplicate_shred );
29236 0 : break;
29237 0 : }
29238 0 : case 10: {
29239 0 : fd_gossip_incremental_snapshot_hashes_destroy( &self->incremental_snapshot_hashes );
29240 0 : break;
29241 0 : }
29242 0 : case 11: {
29243 0 : fd_gossip_contact_info_v2_destroy( &self->contact_info_v2 );
29244 0 : break;
29245 0 : }
29246 0 : case 12: {
29247 0 : fd_gossip_restart_last_voted_fork_slots_destroy( &self->restart_last_voted_fork_slots );
29248 0 : break;
29249 0 : }
29250 0 : case 13: {
29251 0 : fd_gossip_restart_heaviest_fork_destroy( &self->restart_heaviest_fork );
29252 0 : break;
29253 0 : }
29254 0 : default: break; // FD_LOG_ERR(( "unhandled type" ));
29255 0 : }
29256 0 : }
29257 0 : void fd_crds_data_destroy( fd_crds_data_t * self ) {
29258 0 : fd_crds_data_inner_destroy( &self->inner, self->discriminant );
29259 0 : }
29260 :
29261 0 : ulong fd_crds_data_footprint( void ){ return FD_CRDS_DATA_FOOTPRINT; }
29262 0 : ulong fd_crds_data_align( void ){ return FD_CRDS_DATA_ALIGN; }
29263 :
29264 30 : void fd_crds_data_walk( void * w, fd_crds_data_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
29265 30 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_crds_data", level++);
29266 30 : switch( self->discriminant ) {
29267 9 : case 0: {
29268 9 : fun( w, self, "contact_info_v1", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
29269 9 : fd_gossip_contact_info_v1_walk( w, &self->inner.contact_info_v1, fun, "contact_info_v1", level );
29270 9 : break;
29271 0 : }
29272 6 : case 1: {
29273 6 : fun( w, self, "vote", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
29274 6 : fd_gossip_vote_walk( w, &self->inner.vote, fun, "vote", level );
29275 6 : break;
29276 0 : }
29277 0 : case 2: {
29278 0 : fun( w, self, "lowest_slot", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
29279 0 : fd_gossip_lowest_slot_walk( w, &self->inner.lowest_slot, fun, "lowest_slot", level );
29280 0 : break;
29281 0 : }
29282 3 : case 3: {
29283 3 : fun( w, self, "snapshot_hashes", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
29284 3 : fd_gossip_slot_hashes_walk( w, &self->inner.snapshot_hashes, fun, "snapshot_hashes", level );
29285 3 : break;
29286 0 : }
29287 0 : case 4: {
29288 0 : fun( w, self, "accounts_hashes", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
29289 0 : fd_gossip_slot_hashes_walk( w, &self->inner.accounts_hashes, fun, "accounts_hashes", level );
29290 0 : break;
29291 0 : }
29292 0 : case 5: {
29293 0 : fun( w, self, "epoch_slots", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
29294 0 : fd_gossip_epoch_slots_walk( w, &self->inner.epoch_slots, fun, "epoch_slots", level );
29295 0 : break;
29296 0 : }
29297 0 : case 6: {
29298 0 : fun( w, self, "version_v1", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
29299 0 : fd_gossip_version_v1_walk( w, &self->inner.version_v1, fun, "version_v1", level );
29300 0 : break;
29301 0 : }
29302 3 : case 7: {
29303 3 : fun( w, self, "version_v2", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
29304 3 : fd_gossip_version_v2_walk( w, &self->inner.version_v2, fun, "version_v2", level );
29305 3 : break;
29306 0 : }
29307 6 : case 8: {
29308 6 : fun( w, self, "node_instance", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
29309 6 : fd_gossip_node_instance_walk( w, &self->inner.node_instance, fun, "node_instance", level );
29310 6 : break;
29311 0 : }
29312 0 : case 9: {
29313 0 : fun( w, self, "duplicate_shred", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
29314 0 : fd_gossip_duplicate_shred_walk( w, &self->inner.duplicate_shred, fun, "duplicate_shred", level );
29315 0 : break;
29316 0 : }
29317 0 : case 10: {
29318 0 : fun( w, self, "incremental_snapshot_hashes", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
29319 0 : fd_gossip_incremental_snapshot_hashes_walk( w, &self->inner.incremental_snapshot_hashes, fun, "incremental_snapshot_hashes", level );
29320 0 : break;
29321 0 : }
29322 3 : case 11: {
29323 3 : fun( w, self, "contact_info_v2", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
29324 3 : fd_gossip_contact_info_v2_walk( w, &self->inner.contact_info_v2, fun, "contact_info_v2", level );
29325 3 : break;
29326 0 : }
29327 0 : case 12: {
29328 0 : fun( w, self, "restart_last_voted_fork_slots", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
29329 0 : fd_gossip_restart_last_voted_fork_slots_walk( w, &self->inner.restart_last_voted_fork_slots, fun, "restart_last_voted_fork_slots", level );
29330 0 : break;
29331 0 : }
29332 0 : case 13: {
29333 0 : fun( w, self, "restart_heaviest_fork", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
29334 0 : fd_gossip_restart_heaviest_fork_walk( w, &self->inner.restart_heaviest_fork, fun, "restart_heaviest_fork", level );
29335 0 : break;
29336 0 : }
29337 30 : }
29338 30 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_crds_data", level-- );
29339 30 : }
29340 0 : ulong fd_crds_data_size( fd_crds_data_t const * self ) {
29341 0 : ulong size = 0;
29342 0 : size += sizeof(uint);
29343 0 : switch (self->discriminant) {
29344 0 : case 0: {
29345 0 : size += fd_gossip_contact_info_v1_size( &self->inner.contact_info_v1 );
29346 0 : break;
29347 0 : }
29348 0 : case 1: {
29349 0 : size += fd_gossip_vote_size( &self->inner.vote );
29350 0 : break;
29351 0 : }
29352 0 : case 2: {
29353 0 : size += fd_gossip_lowest_slot_size( &self->inner.lowest_slot );
29354 0 : break;
29355 0 : }
29356 0 : case 3: {
29357 0 : size += fd_gossip_slot_hashes_size( &self->inner.snapshot_hashes );
29358 0 : break;
29359 0 : }
29360 0 : case 4: {
29361 0 : size += fd_gossip_slot_hashes_size( &self->inner.accounts_hashes );
29362 0 : break;
29363 0 : }
29364 0 : case 5: {
29365 0 : size += fd_gossip_epoch_slots_size( &self->inner.epoch_slots );
29366 0 : break;
29367 0 : }
29368 0 : case 6: {
29369 0 : size += fd_gossip_version_v1_size( &self->inner.version_v1 );
29370 0 : break;
29371 0 : }
29372 0 : case 7: {
29373 0 : size += fd_gossip_version_v2_size( &self->inner.version_v2 );
29374 0 : break;
29375 0 : }
29376 0 : case 8: {
29377 0 : size += fd_gossip_node_instance_size( &self->inner.node_instance );
29378 0 : break;
29379 0 : }
29380 0 : case 9: {
29381 0 : size += fd_gossip_duplicate_shred_size( &self->inner.duplicate_shred );
29382 0 : break;
29383 0 : }
29384 0 : case 10: {
29385 0 : size += fd_gossip_incremental_snapshot_hashes_size( &self->inner.incremental_snapshot_hashes );
29386 0 : break;
29387 0 : }
29388 0 : case 11: {
29389 0 : size += fd_gossip_contact_info_v2_size( &self->inner.contact_info_v2 );
29390 0 : break;
29391 0 : }
29392 0 : case 12: {
29393 0 : size += fd_gossip_restart_last_voted_fork_slots_size( &self->inner.restart_last_voted_fork_slots );
29394 0 : break;
29395 0 : }
29396 0 : case 13: {
29397 0 : size += fd_gossip_restart_heaviest_fork_size( &self->inner.restart_heaviest_fork );
29398 0 : break;
29399 0 : }
29400 0 : }
29401 0 : return size;
29402 0 : }
29403 :
29404 0 : int fd_crds_data_inner_encode( fd_crds_data_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
29405 0 : int err;
29406 0 : switch (discriminant) {
29407 0 : case 0: {
29408 0 : err = fd_gossip_contact_info_v1_encode( &self->contact_info_v1, ctx );
29409 0 : if( FD_UNLIKELY( err ) ) return err;
29410 0 : break;
29411 0 : }
29412 0 : case 1: {
29413 0 : err = fd_gossip_vote_encode( &self->vote, ctx );
29414 0 : if( FD_UNLIKELY( err ) ) return err;
29415 0 : break;
29416 0 : }
29417 0 : case 2: {
29418 0 : err = fd_gossip_lowest_slot_encode( &self->lowest_slot, ctx );
29419 0 : if( FD_UNLIKELY( err ) ) return err;
29420 0 : break;
29421 0 : }
29422 0 : case 3: {
29423 0 : err = fd_gossip_slot_hashes_encode( &self->snapshot_hashes, ctx );
29424 0 : if( FD_UNLIKELY( err ) ) return err;
29425 0 : break;
29426 0 : }
29427 0 : case 4: {
29428 0 : err = fd_gossip_slot_hashes_encode( &self->accounts_hashes, ctx );
29429 0 : if( FD_UNLIKELY( err ) ) return err;
29430 0 : break;
29431 0 : }
29432 0 : case 5: {
29433 0 : err = fd_gossip_epoch_slots_encode( &self->epoch_slots, ctx );
29434 0 : if( FD_UNLIKELY( err ) ) return err;
29435 0 : break;
29436 0 : }
29437 0 : case 6: {
29438 0 : err = fd_gossip_version_v1_encode( &self->version_v1, ctx );
29439 0 : if( FD_UNLIKELY( err ) ) return err;
29440 0 : break;
29441 0 : }
29442 0 : case 7: {
29443 0 : err = fd_gossip_version_v2_encode( &self->version_v2, ctx );
29444 0 : if( FD_UNLIKELY( err ) ) return err;
29445 0 : break;
29446 0 : }
29447 0 : case 8: {
29448 0 : err = fd_gossip_node_instance_encode( &self->node_instance, ctx );
29449 0 : if( FD_UNLIKELY( err ) ) return err;
29450 0 : break;
29451 0 : }
29452 0 : case 9: {
29453 0 : err = fd_gossip_duplicate_shred_encode( &self->duplicate_shred, ctx );
29454 0 : if( FD_UNLIKELY( err ) ) return err;
29455 0 : break;
29456 0 : }
29457 0 : case 10: {
29458 0 : err = fd_gossip_incremental_snapshot_hashes_encode( &self->incremental_snapshot_hashes, ctx );
29459 0 : if( FD_UNLIKELY( err ) ) return err;
29460 0 : break;
29461 0 : }
29462 0 : case 11: {
29463 0 : err = fd_gossip_contact_info_v2_encode( &self->contact_info_v2, ctx );
29464 0 : if( FD_UNLIKELY( err ) ) return err;
29465 0 : break;
29466 0 : }
29467 0 : case 12: {
29468 0 : err = fd_gossip_restart_last_voted_fork_slots_encode( &self->restart_last_voted_fork_slots, ctx );
29469 0 : if( FD_UNLIKELY( err ) ) return err;
29470 0 : break;
29471 0 : }
29472 0 : case 13: {
29473 0 : err = fd_gossip_restart_heaviest_fork_encode( &self->restart_heaviest_fork, ctx );
29474 0 : if( FD_UNLIKELY( err ) ) return err;
29475 0 : break;
29476 0 : }
29477 0 : }
29478 0 : return FD_BINCODE_SUCCESS;
29479 0 : }
29480 0 : int fd_crds_data_encode( fd_crds_data_t const * self, fd_bincode_encode_ctx_t * ctx ) {
29481 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
29482 0 : if( FD_UNLIKELY( err ) ) return err;
29483 0 : return fd_crds_data_inner_encode( &self->inner, self->discriminant, ctx );
29484 0 : }
29485 :
29486 0 : int fd_crds_bloom_encode( fd_crds_bloom_t const * self, fd_bincode_encode_ctx_t * ctx ) {
29487 0 : int err;
29488 0 : err = fd_bincode_uint64_encode( self->keys_len, ctx );
29489 0 : if( FD_UNLIKELY(err) ) return err;
29490 0 : if( self->keys_len ) {
29491 0 : for( ulong i=0; i < self->keys_len; i++ ) {
29492 0 : err = fd_bincode_uint64_encode( self->keys[i], ctx );
29493 0 : }
29494 0 : }
29495 0 : err = fd_gossip_bitvec_u64_encode( &self->bits, ctx );
29496 0 : if( FD_UNLIKELY( err ) ) return err;
29497 0 : err = fd_bincode_uint64_encode( self->num_bits_set, ctx );
29498 0 : if( FD_UNLIKELY( err ) ) return err;
29499 0 : return FD_BINCODE_SUCCESS;
29500 0 : }
29501 0 : int fd_crds_bloom_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
29502 0 : *total_sz += sizeof(fd_crds_bloom_t);
29503 0 : void const * start_data = ctx->data;
29504 0 : int err = fd_crds_bloom_decode_footprint_inner( ctx, total_sz );
29505 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
29506 0 : ctx->data = start_data;
29507 0 : return err;
29508 0 : }
29509 3 : int fd_crds_bloom_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
29510 3 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
29511 3 : int err = 0;
29512 3 : ulong keys_len;
29513 3 : err = fd_bincode_uint64_decode( &keys_len, ctx );
29514 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
29515 3 : if( keys_len ) {
29516 3 : *total_sz += 8UL + sizeof(ulong)*keys_len;
29517 12 : for( ulong i=0; i < keys_len; i++ ) {
29518 9 : err = fd_bincode_uint64_decode_footprint( ctx );
29519 9 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
29520 9 : }
29521 3 : }
29522 3 : err = fd_gossip_bitvec_u64_decode_footprint_inner( ctx, total_sz );
29523 3 : if( FD_UNLIKELY( err ) ) return err;
29524 3 : err = fd_bincode_uint64_decode_footprint( ctx );
29525 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
29526 3 : return 0;
29527 3 : }
29528 0 : void * fd_crds_bloom_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
29529 0 : fd_crds_bloom_t * self = (fd_crds_bloom_t *)mem;
29530 0 : fd_crds_bloom_new( self );
29531 0 : void * alloc_region = (uchar *)mem + sizeof(fd_crds_bloom_t);
29532 0 : void * * alloc_mem = &alloc_region;
29533 0 : fd_crds_bloom_decode_inner( mem, alloc_mem, ctx );
29534 0 : return self;
29535 0 : }
29536 3 : void fd_crds_bloom_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
29537 3 : fd_crds_bloom_t * self = (fd_crds_bloom_t *)struct_mem;
29538 3 : fd_bincode_uint64_decode_unsafe( &self->keys_len, ctx );
29539 3 : if( self->keys_len ) {
29540 3 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), 8UL );
29541 3 : self->keys = *alloc_mem;
29542 3 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(ulong)*self->keys_len;
29543 12 : for( ulong i=0; i < self->keys_len; i++ ) {
29544 9 : fd_bincode_uint64_decode_unsafe( self->keys + i, ctx );
29545 9 : }
29546 3 : } else
29547 0 : self->keys = NULL;
29548 3 : fd_gossip_bitvec_u64_decode_inner( &self->bits, alloc_mem, ctx );
29549 3 : fd_bincode_uint64_decode_unsafe( &self->num_bits_set, ctx );
29550 3 : }
29551 0 : void * fd_crds_bloom_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
29552 0 : fd_crds_bloom_global_t * self = (fd_crds_bloom_global_t *)mem;
29553 0 : fd_crds_bloom_new( (fd_crds_bloom_t *)self );
29554 0 : void * alloc_region = (uchar *)mem + sizeof(fd_crds_bloom_global_t);
29555 0 : void * * alloc_mem = &alloc_region;
29556 0 : fd_crds_bloom_decode_inner_global( mem, alloc_mem, ctx );
29557 0 : return self;
29558 0 : }
29559 0 : void fd_crds_bloom_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
29560 0 : fd_crds_bloom_global_t * self = (fd_crds_bloom_global_t *)struct_mem;
29561 0 : fd_bincode_uint64_decode_unsafe( &self->keys_len, ctx );
29562 0 : if( self->keys_len ) {
29563 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), 8UL );
29564 0 : self->keys_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
29565 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
29566 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(ulong)*self->keys_len;
29567 0 : for( ulong i=0; i < self->keys_len; i++ ) {
29568 0 : fd_bincode_uint64_decode_unsafe( (ulong*)(cur_mem + sizeof(ulong) * i), ctx );
29569 0 : }
29570 0 : } else
29571 0 : self->keys_gaddr = 0UL;
29572 0 : fd_gossip_bitvec_u64_decode_inner_global( &self->bits, alloc_mem, ctx );
29573 0 : fd_bincode_uint64_decode_unsafe( &self->num_bits_set, ctx );
29574 0 : }
29575 0 : int fd_crds_bloom_convert_global_to_local( void const * global_self, fd_crds_bloom_t * self, fd_bincode_decode_ctx_t * ctx ) {
29576 0 : int err = 0;
29577 0 : fd_crds_bloom_global_t const * mem = (fd_crds_bloom_global_t const *)global_self;
29578 0 : self->keys_len = mem->keys_len;
29579 0 : self->keys = fd_wksp_laddr_fast( ctx->wksp, mem->keys_gaddr );
29580 0 : err = fd_gossip_bitvec_u64_convert_global_to_local( &mem->bits, &self->bits, ctx );
29581 0 : if( FD_UNLIKELY( err ) ) return err;
29582 0 : self->num_bits_set = mem->num_bits_set;
29583 0 : return FD_BINCODE_SUCCESS;
29584 0 : }
29585 0 : void fd_crds_bloom_new(fd_crds_bloom_t * self) {
29586 0 : fd_memset( self, 0, sizeof(fd_crds_bloom_t) );
29587 0 : fd_gossip_bitvec_u64_new( &self->bits );
29588 0 : }
29589 0 : void fd_crds_bloom_destroy( fd_crds_bloom_t * self ) {
29590 0 : if( self->keys ) {
29591 0 : self->keys = NULL;
29592 0 : }
29593 0 : fd_gossip_bitvec_u64_destroy( &self->bits );
29594 0 : }
29595 :
29596 0 : ulong fd_crds_bloom_footprint( void ){ return FD_CRDS_BLOOM_FOOTPRINT; }
29597 0 : ulong fd_crds_bloom_align( void ){ return FD_CRDS_BLOOM_ALIGN; }
29598 :
29599 3 : void fd_crds_bloom_walk( void * w, fd_crds_bloom_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
29600 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_crds_bloom", level++ );
29601 3 : if( self->keys_len ) {
29602 3 : fun( w, NULL, "keys", FD_FLAMENCO_TYPE_ARR, "array", level++ );
29603 12 : for( ulong i=0; i < self->keys_len; i++ )
29604 9 : fun( w, self->keys + i, "keys", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
29605 3 : fun( w, NULL, "keys", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
29606 3 : }
29607 3 : fd_gossip_bitvec_u64_walk( w, &self->bits, fun, "bits", level );
29608 3 : fun( w, &self->num_bits_set, "num_bits_set", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
29609 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_crds_bloom", level-- );
29610 3 : }
29611 0 : ulong fd_crds_bloom_size( fd_crds_bloom_t const * self ) {
29612 0 : ulong size = 0;
29613 0 : do {
29614 0 : size += sizeof(ulong);
29615 0 : size += self->keys_len * sizeof(ulong);
29616 0 : } while(0);
29617 0 : size += fd_gossip_bitvec_u64_size( &self->bits );
29618 0 : size += sizeof(ulong);
29619 0 : return size;
29620 0 : }
29621 :
29622 0 : int fd_crds_filter_encode( fd_crds_filter_t const * self, fd_bincode_encode_ctx_t * ctx ) {
29623 0 : int err;
29624 0 : err = fd_crds_bloom_encode( &self->filter, ctx );
29625 0 : if( FD_UNLIKELY( err ) ) return err;
29626 0 : err = fd_bincode_uint64_encode( self->mask, ctx );
29627 0 : if( FD_UNLIKELY( err ) ) return err;
29628 0 : err = fd_bincode_uint32_encode( self->mask_bits, ctx );
29629 0 : if( FD_UNLIKELY( err ) ) return err;
29630 0 : return FD_BINCODE_SUCCESS;
29631 0 : }
29632 0 : int fd_crds_filter_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
29633 0 : *total_sz += sizeof(fd_crds_filter_t);
29634 0 : void const * start_data = ctx->data;
29635 0 : int err = fd_crds_filter_decode_footprint_inner( ctx, total_sz );
29636 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
29637 0 : ctx->data = start_data;
29638 0 : return err;
29639 0 : }
29640 3 : int fd_crds_filter_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
29641 3 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
29642 3 : int err = 0;
29643 3 : err = fd_crds_bloom_decode_footprint_inner( ctx, total_sz );
29644 3 : if( FD_UNLIKELY( err ) ) return err;
29645 3 : err = fd_bincode_uint64_decode_footprint( ctx );
29646 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
29647 3 : err = fd_bincode_uint32_decode_footprint( ctx );
29648 3 : if( FD_UNLIKELY( err ) ) return err;
29649 3 : return 0;
29650 3 : }
29651 0 : void * fd_crds_filter_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
29652 0 : fd_crds_filter_t * self = (fd_crds_filter_t *)mem;
29653 0 : fd_crds_filter_new( self );
29654 0 : void * alloc_region = (uchar *)mem + sizeof(fd_crds_filter_t);
29655 0 : void * * alloc_mem = &alloc_region;
29656 0 : fd_crds_filter_decode_inner( mem, alloc_mem, ctx );
29657 0 : return self;
29658 0 : }
29659 3 : void fd_crds_filter_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
29660 3 : fd_crds_filter_t * self = (fd_crds_filter_t *)struct_mem;
29661 3 : fd_crds_bloom_decode_inner( &self->filter, alloc_mem, ctx );
29662 3 : fd_bincode_uint64_decode_unsafe( &self->mask, ctx );
29663 3 : fd_bincode_uint32_decode_unsafe( &self->mask_bits, ctx );
29664 3 : }
29665 0 : void * fd_crds_filter_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
29666 0 : fd_crds_filter_global_t * self = (fd_crds_filter_global_t *)mem;
29667 0 : fd_crds_filter_new( (fd_crds_filter_t *)self );
29668 0 : void * alloc_region = (uchar *)mem + sizeof(fd_crds_filter_global_t);
29669 0 : void * * alloc_mem = &alloc_region;
29670 0 : fd_crds_filter_decode_inner_global( mem, alloc_mem, ctx );
29671 0 : return self;
29672 0 : }
29673 0 : void fd_crds_filter_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
29674 0 : fd_crds_filter_global_t * self = (fd_crds_filter_global_t *)struct_mem;
29675 0 : fd_crds_bloom_decode_inner_global( &self->filter, alloc_mem, ctx );
29676 0 : fd_bincode_uint64_decode_unsafe( &self->mask, ctx );
29677 0 : fd_bincode_uint32_decode_unsafe( &self->mask_bits, ctx );
29678 0 : }
29679 0 : int fd_crds_filter_convert_global_to_local( void const * global_self, fd_crds_filter_t * self, fd_bincode_decode_ctx_t * ctx ) {
29680 0 : int err = 0;
29681 0 : fd_crds_filter_global_t const * mem = (fd_crds_filter_global_t const *)global_self;
29682 0 : err = fd_crds_bloom_convert_global_to_local( &mem->filter, &self->filter, ctx );
29683 0 : if( FD_UNLIKELY( err ) ) return err;
29684 0 : self->mask = mem->mask;
29685 0 : self->mask_bits = mem->mask_bits;
29686 0 : return FD_BINCODE_SUCCESS;
29687 0 : }
29688 0 : void fd_crds_filter_new(fd_crds_filter_t * self) {
29689 0 : fd_memset( self, 0, sizeof(fd_crds_filter_t) );
29690 0 : fd_crds_bloom_new( &self->filter );
29691 0 : }
29692 0 : void fd_crds_filter_destroy( fd_crds_filter_t * self ) {
29693 0 : fd_crds_bloom_destroy( &self->filter );
29694 0 : }
29695 :
29696 0 : ulong fd_crds_filter_footprint( void ){ return FD_CRDS_FILTER_FOOTPRINT; }
29697 0 : ulong fd_crds_filter_align( void ){ return FD_CRDS_FILTER_ALIGN; }
29698 :
29699 3 : void fd_crds_filter_walk( void * w, fd_crds_filter_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
29700 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_crds_filter", level++ );
29701 3 : fd_crds_bloom_walk( w, &self->filter, fun, "filter", level );
29702 3 : fun( w, &self->mask, "mask", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
29703 3 : fun( w, &self->mask_bits, "mask_bits", FD_FLAMENCO_TYPE_UINT, "uint", level );
29704 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_crds_filter", level-- );
29705 3 : }
29706 0 : ulong fd_crds_filter_size( fd_crds_filter_t const * self ) {
29707 0 : ulong size = 0;
29708 0 : size += fd_crds_bloom_size( &self->filter );
29709 0 : size += sizeof(ulong);
29710 0 : size += sizeof(uint);
29711 0 : return size;
29712 0 : }
29713 :
29714 0 : int fd_crds_value_encode( fd_crds_value_t const * self, fd_bincode_encode_ctx_t * ctx ) {
29715 0 : int err;
29716 0 : err = fd_signature_encode( &self->signature, ctx );
29717 0 : if( FD_UNLIKELY( err ) ) return err;
29718 0 : err = fd_crds_data_encode( &self->data, ctx );
29719 0 : if( FD_UNLIKELY( err ) ) return err;
29720 0 : return FD_BINCODE_SUCCESS;
29721 0 : }
29722 0 : int fd_crds_value_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
29723 0 : *total_sz += sizeof(fd_crds_value_t);
29724 0 : void const * start_data = ctx->data;
29725 0 : int err = fd_crds_value_decode_footprint_inner( ctx, total_sz );
29726 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
29727 0 : ctx->data = start_data;
29728 0 : return err;
29729 0 : }
29730 30 : int fd_crds_value_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
29731 30 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
29732 30 : int err = 0;
29733 30 : err = fd_signature_decode_footprint_inner( ctx, total_sz );
29734 30 : if( FD_UNLIKELY( err ) ) return err;
29735 30 : err = fd_crds_data_decode_footprint_inner( ctx, total_sz );
29736 30 : if( FD_UNLIKELY( err ) ) return err;
29737 30 : return 0;
29738 30 : }
29739 0 : void * fd_crds_value_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
29740 0 : fd_crds_value_t * self = (fd_crds_value_t *)mem;
29741 0 : fd_crds_value_new( self );
29742 0 : void * alloc_region = (uchar *)mem + sizeof(fd_crds_value_t);
29743 0 : void * * alloc_mem = &alloc_region;
29744 0 : fd_crds_value_decode_inner( mem, alloc_mem, ctx );
29745 0 : return self;
29746 0 : }
29747 30 : void fd_crds_value_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
29748 30 : fd_crds_value_t * self = (fd_crds_value_t *)struct_mem;
29749 30 : fd_signature_decode_inner( &self->signature, alloc_mem, ctx );
29750 30 : fd_crds_data_decode_inner( &self->data, alloc_mem, ctx );
29751 30 : }
29752 0 : void * fd_crds_value_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
29753 0 : fd_crds_value_global_t * self = (fd_crds_value_global_t *)mem;
29754 0 : fd_crds_value_new( (fd_crds_value_t *)self );
29755 0 : void * alloc_region = (uchar *)mem + sizeof(fd_crds_value_global_t);
29756 0 : void * * alloc_mem = &alloc_region;
29757 0 : fd_crds_value_decode_inner_global( mem, alloc_mem, ctx );
29758 0 : return self;
29759 0 : }
29760 0 : void fd_crds_value_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
29761 0 : fd_crds_value_global_t * self = (fd_crds_value_global_t *)struct_mem;
29762 0 : fd_signature_decode_inner_global( &self->signature, alloc_mem, ctx );
29763 0 : fd_crds_data_decode_inner_global( &self->data, alloc_mem, ctx );
29764 0 : }
29765 0 : int fd_crds_value_convert_global_to_local( void const * global_self, fd_crds_value_t * self, fd_bincode_decode_ctx_t * ctx ) {
29766 0 : int err = 0;
29767 0 : fd_crds_value_global_t const * mem = (fd_crds_value_global_t const *)global_self;
29768 0 : err = fd_signature_convert_global_to_local( &mem->signature, &self->signature, ctx );
29769 0 : if( FD_UNLIKELY( err ) ) return err;
29770 0 : err = fd_crds_data_convert_global_to_local( &mem->data, &self->data, ctx );
29771 0 : if( FD_UNLIKELY( err ) ) return err;
29772 0 : return FD_BINCODE_SUCCESS;
29773 0 : }
29774 27 : void fd_crds_value_new(fd_crds_value_t * self) {
29775 27 : fd_memset( self, 0, sizeof(fd_crds_value_t) );
29776 27 : fd_signature_new( &self->signature );
29777 27 : fd_crds_data_new( &self->data );
29778 27 : }
29779 0 : void fd_crds_value_destroy( fd_crds_value_t * self ) {
29780 0 : fd_signature_destroy( &self->signature );
29781 0 : fd_crds_data_destroy( &self->data );
29782 0 : }
29783 :
29784 0 : ulong fd_crds_value_footprint( void ){ return FD_CRDS_VALUE_FOOTPRINT; }
29785 0 : ulong fd_crds_value_align( void ){ return FD_CRDS_VALUE_ALIGN; }
29786 :
29787 30 : void fd_crds_value_walk( void * w, fd_crds_value_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
29788 30 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_crds_value", level++ );
29789 30 : fd_signature_walk( w, &self->signature, fun, "signature", level );
29790 30 : fd_crds_data_walk( w, &self->data, fun, "data", level );
29791 30 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_crds_value", level-- );
29792 30 : }
29793 0 : ulong fd_crds_value_size( fd_crds_value_t const * self ) {
29794 0 : ulong size = 0;
29795 0 : size += fd_signature_size( &self->signature );
29796 0 : size += fd_crds_data_size( &self->data );
29797 0 : return size;
29798 0 : }
29799 :
29800 0 : int fd_gossip_pull_req_encode( fd_gossip_pull_req_t const * self, fd_bincode_encode_ctx_t * ctx ) {
29801 0 : int err;
29802 0 : err = fd_crds_filter_encode( &self->filter, ctx );
29803 0 : if( FD_UNLIKELY( err ) ) return err;
29804 0 : err = fd_crds_value_encode( &self->value, ctx );
29805 0 : if( FD_UNLIKELY( err ) ) return err;
29806 0 : return FD_BINCODE_SUCCESS;
29807 0 : }
29808 0 : int fd_gossip_pull_req_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
29809 0 : *total_sz += sizeof(fd_gossip_pull_req_t);
29810 0 : void const * start_data = ctx->data;
29811 0 : int err = fd_gossip_pull_req_decode_footprint_inner( ctx, total_sz );
29812 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
29813 0 : ctx->data = start_data;
29814 0 : return err;
29815 0 : }
29816 3 : int fd_gossip_pull_req_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
29817 3 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
29818 3 : int err = 0;
29819 3 : err = fd_crds_filter_decode_footprint_inner( ctx, total_sz );
29820 3 : if( FD_UNLIKELY( err ) ) return err;
29821 3 : err = fd_crds_value_decode_footprint_inner( ctx, total_sz );
29822 3 : if( FD_UNLIKELY( err ) ) return err;
29823 3 : return 0;
29824 3 : }
29825 0 : void * fd_gossip_pull_req_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
29826 0 : fd_gossip_pull_req_t * self = (fd_gossip_pull_req_t *)mem;
29827 0 : fd_gossip_pull_req_new( self );
29828 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_pull_req_t);
29829 0 : void * * alloc_mem = &alloc_region;
29830 0 : fd_gossip_pull_req_decode_inner( mem, alloc_mem, ctx );
29831 0 : return self;
29832 0 : }
29833 3 : void fd_gossip_pull_req_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
29834 3 : fd_gossip_pull_req_t * self = (fd_gossip_pull_req_t *)struct_mem;
29835 3 : fd_crds_filter_decode_inner( &self->filter, alloc_mem, ctx );
29836 3 : fd_crds_value_decode_inner( &self->value, alloc_mem, ctx );
29837 3 : }
29838 0 : void * fd_gossip_pull_req_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
29839 0 : fd_gossip_pull_req_global_t * self = (fd_gossip_pull_req_global_t *)mem;
29840 0 : fd_gossip_pull_req_new( (fd_gossip_pull_req_t *)self );
29841 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_pull_req_global_t);
29842 0 : void * * alloc_mem = &alloc_region;
29843 0 : fd_gossip_pull_req_decode_inner_global( mem, alloc_mem, ctx );
29844 0 : return self;
29845 0 : }
29846 0 : void fd_gossip_pull_req_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
29847 0 : fd_gossip_pull_req_global_t * self = (fd_gossip_pull_req_global_t *)struct_mem;
29848 0 : fd_crds_filter_decode_inner_global( &self->filter, alloc_mem, ctx );
29849 0 : fd_crds_value_decode_inner_global( &self->value, alloc_mem, ctx );
29850 0 : }
29851 0 : int fd_gossip_pull_req_convert_global_to_local( void const * global_self, fd_gossip_pull_req_t * self, fd_bincode_decode_ctx_t * ctx ) {
29852 0 : int err = 0;
29853 0 : fd_gossip_pull_req_global_t const * mem = (fd_gossip_pull_req_global_t const *)global_self;
29854 0 : err = fd_crds_filter_convert_global_to_local( &mem->filter, &self->filter, ctx );
29855 0 : if( FD_UNLIKELY( err ) ) return err;
29856 0 : err = fd_crds_value_convert_global_to_local( &mem->value, &self->value, ctx );
29857 0 : if( FD_UNLIKELY( err ) ) return err;
29858 0 : return FD_BINCODE_SUCCESS;
29859 0 : }
29860 0 : void fd_gossip_pull_req_new(fd_gossip_pull_req_t * self) {
29861 0 : fd_memset( self, 0, sizeof(fd_gossip_pull_req_t) );
29862 0 : fd_crds_filter_new( &self->filter );
29863 0 : fd_crds_value_new( &self->value );
29864 0 : }
29865 0 : void fd_gossip_pull_req_destroy( fd_gossip_pull_req_t * self ) {
29866 0 : fd_crds_filter_destroy( &self->filter );
29867 0 : fd_crds_value_destroy( &self->value );
29868 0 : }
29869 :
29870 0 : ulong fd_gossip_pull_req_footprint( void ){ return FD_GOSSIP_PULL_REQ_FOOTPRINT; }
29871 0 : ulong fd_gossip_pull_req_align( void ){ return FD_GOSSIP_PULL_REQ_ALIGN; }
29872 :
29873 3 : void fd_gossip_pull_req_walk( void * w, fd_gossip_pull_req_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
29874 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_pull_req", level++ );
29875 3 : fd_crds_filter_walk( w, &self->filter, fun, "filter", level );
29876 3 : fd_crds_value_walk( w, &self->value, fun, "value", level );
29877 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_pull_req", level-- );
29878 3 : }
29879 0 : ulong fd_gossip_pull_req_size( fd_gossip_pull_req_t const * self ) {
29880 0 : ulong size = 0;
29881 0 : size += fd_crds_filter_size( &self->filter );
29882 0 : size += fd_crds_value_size( &self->value );
29883 0 : return size;
29884 0 : }
29885 :
29886 0 : int fd_gossip_pull_resp_encode( fd_gossip_pull_resp_t const * self, fd_bincode_encode_ctx_t * ctx ) {
29887 0 : int err;
29888 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
29889 0 : if( FD_UNLIKELY( err ) ) return err;
29890 0 : err = fd_bincode_uint64_encode( self->crds_len, ctx );
29891 0 : if( FD_UNLIKELY(err) ) return err;
29892 0 : if( self->crds_len ) {
29893 0 : for( ulong i=0; i < self->crds_len; i++ ) {
29894 0 : err = fd_crds_value_encode( self->crds + i, ctx );
29895 0 : if( FD_UNLIKELY( err ) ) return err;
29896 0 : }
29897 0 : }
29898 0 : return FD_BINCODE_SUCCESS;
29899 0 : }
29900 0 : int fd_gossip_pull_resp_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
29901 0 : *total_sz += sizeof(fd_gossip_pull_resp_t);
29902 0 : void const * start_data = ctx->data;
29903 0 : int err = fd_gossip_pull_resp_decode_footprint_inner( ctx, total_sz );
29904 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
29905 0 : ctx->data = start_data;
29906 0 : return err;
29907 0 : }
29908 12 : int fd_gossip_pull_resp_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
29909 12 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
29910 12 : int err = 0;
29911 12 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
29912 12 : if( FD_UNLIKELY( err ) ) return err;
29913 12 : ulong crds_len;
29914 12 : err = fd_bincode_uint64_decode( &crds_len, ctx );
29915 12 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
29916 12 : if( crds_len ) {
29917 12 : *total_sz += FD_CRDS_VALUE_ALIGN + FD_CRDS_VALUE_FOOTPRINT*crds_len;
29918 24 : for( ulong i=0; i < crds_len; i++ ) {
29919 12 : err = fd_crds_value_decode_footprint_inner( ctx, total_sz );
29920 12 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
29921 12 : }
29922 12 : }
29923 12 : return 0;
29924 12 : }
29925 0 : void * fd_gossip_pull_resp_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
29926 0 : fd_gossip_pull_resp_t * self = (fd_gossip_pull_resp_t *)mem;
29927 0 : fd_gossip_pull_resp_new( self );
29928 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_pull_resp_t);
29929 0 : void * * alloc_mem = &alloc_region;
29930 0 : fd_gossip_pull_resp_decode_inner( mem, alloc_mem, ctx );
29931 0 : return self;
29932 0 : }
29933 12 : void fd_gossip_pull_resp_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
29934 12 : fd_gossip_pull_resp_t * self = (fd_gossip_pull_resp_t *)struct_mem;
29935 12 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
29936 12 : fd_bincode_uint64_decode_unsafe( &self->crds_len, ctx );
29937 12 : if( self->crds_len ) {
29938 12 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_CRDS_VALUE_ALIGN );
29939 12 : self->crds = *alloc_mem;
29940 12 : *alloc_mem = (uchar *)(*alloc_mem) + FD_CRDS_VALUE_FOOTPRINT*self->crds_len;
29941 24 : for( ulong i=0; i < self->crds_len; i++ ) {
29942 12 : fd_crds_value_new( self->crds + i );
29943 12 : fd_crds_value_decode_inner( self->crds + i, alloc_mem, ctx );
29944 12 : }
29945 12 : } else
29946 0 : self->crds = NULL;
29947 12 : }
29948 0 : void * fd_gossip_pull_resp_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
29949 0 : fd_gossip_pull_resp_global_t * self = (fd_gossip_pull_resp_global_t *)mem;
29950 0 : fd_gossip_pull_resp_new( (fd_gossip_pull_resp_t *)self );
29951 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_pull_resp_global_t);
29952 0 : void * * alloc_mem = &alloc_region;
29953 0 : fd_gossip_pull_resp_decode_inner_global( mem, alloc_mem, ctx );
29954 0 : return self;
29955 0 : }
29956 0 : void fd_gossip_pull_resp_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
29957 0 : fd_gossip_pull_resp_global_t * self = (fd_gossip_pull_resp_global_t *)struct_mem;
29958 0 : fd_pubkey_decode_inner_global( &self->pubkey, alloc_mem, ctx );
29959 0 : fd_bincode_uint64_decode_unsafe( &self->crds_len, ctx );
29960 0 : if( self->crds_len ) {
29961 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_CRDS_VALUE_ALIGN );
29962 0 : self->crds_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
29963 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
29964 0 : *alloc_mem = (uchar *)(*alloc_mem) + FD_CRDS_VALUE_FOOTPRINT*self->crds_len;
29965 0 : for( ulong i=0; i < self->crds_len; i++ ) {
29966 0 : fd_crds_value_new( (fd_crds_value_t *)(cur_mem + FD_CRDS_VALUE_FOOTPRINT * i) );
29967 0 : fd_crds_value_decode_inner_global( cur_mem + FD_CRDS_VALUE_FOOTPRINT * i, alloc_mem, ctx );
29968 0 : }
29969 0 : } else
29970 0 : self->crds_gaddr = 0UL;
29971 0 : }
29972 0 : int fd_gossip_pull_resp_convert_global_to_local( void const * global_self, fd_gossip_pull_resp_t * self, fd_bincode_decode_ctx_t * ctx ) {
29973 0 : int err = 0;
29974 0 : fd_gossip_pull_resp_global_t const * mem = (fd_gossip_pull_resp_global_t const *)global_self;
29975 0 : err = fd_pubkey_convert_global_to_local( &mem->pubkey, &self->pubkey, ctx );
29976 0 : if( FD_UNLIKELY( err ) ) return err;
29977 0 : self->crds_len = mem->crds_len;
29978 0 : self->crds = fd_wksp_laddr_fast( ctx->wksp, mem->crds_gaddr );
29979 0 : return FD_BINCODE_SUCCESS;
29980 0 : }
29981 0 : void fd_gossip_pull_resp_new(fd_gossip_pull_resp_t * self) {
29982 0 : fd_memset( self, 0, sizeof(fd_gossip_pull_resp_t) );
29983 0 : fd_pubkey_new( &self->pubkey );
29984 0 : }
29985 0 : void fd_gossip_pull_resp_destroy( fd_gossip_pull_resp_t * self ) {
29986 0 : fd_pubkey_destroy( &self->pubkey );
29987 0 : if( self->crds ) {
29988 0 : for( ulong i=0; i < self->crds_len; i++ )
29989 0 : fd_crds_value_destroy( self->crds + i );
29990 0 : self->crds = NULL;
29991 0 : }
29992 0 : }
29993 :
29994 0 : ulong fd_gossip_pull_resp_footprint( void ){ return FD_GOSSIP_PULL_RESP_FOOTPRINT; }
29995 0 : ulong fd_gossip_pull_resp_align( void ){ return FD_GOSSIP_PULL_RESP_ALIGN; }
29996 :
29997 12 : void fd_gossip_pull_resp_walk( void * w, fd_gossip_pull_resp_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
29998 12 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_pull_resp", level++ );
29999 12 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level );
30000 12 : if( self->crds_len ) {
30001 12 : fun( w, NULL, "crds", FD_FLAMENCO_TYPE_ARR, "array", level++ );
30002 24 : for( ulong i=0; i < self->crds_len; i++ )
30003 12 : fd_crds_value_walk(w, self->crds + i, fun, "crds_value", level );
30004 12 : fun( w, NULL, "crds", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
30005 12 : }
30006 12 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_pull_resp", level-- );
30007 12 : }
30008 0 : ulong fd_gossip_pull_resp_size( fd_gossip_pull_resp_t const * self ) {
30009 0 : ulong size = 0;
30010 0 : size += fd_pubkey_size( &self->pubkey );
30011 0 : do {
30012 0 : size += sizeof(ulong);
30013 0 : for( ulong i=0; i < self->crds_len; i++ )
30014 0 : size += fd_crds_value_size( self->crds + i );
30015 0 : } while(0);
30016 0 : return size;
30017 0 : }
30018 :
30019 0 : int fd_gossip_push_msg_encode( fd_gossip_push_msg_t const * self, fd_bincode_encode_ctx_t * ctx ) {
30020 0 : int err;
30021 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
30022 0 : if( FD_UNLIKELY( err ) ) return err;
30023 0 : err = fd_bincode_uint64_encode( self->crds_len, ctx );
30024 0 : if( FD_UNLIKELY(err) ) return err;
30025 0 : if( self->crds_len ) {
30026 0 : for( ulong i=0; i < self->crds_len; i++ ) {
30027 0 : err = fd_crds_value_encode( self->crds + i, ctx );
30028 0 : if( FD_UNLIKELY( err ) ) return err;
30029 0 : }
30030 0 : }
30031 0 : return FD_BINCODE_SUCCESS;
30032 0 : }
30033 0 : int fd_gossip_push_msg_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
30034 0 : *total_sz += sizeof(fd_gossip_push_msg_t);
30035 0 : void const * start_data = ctx->data;
30036 0 : int err = fd_gossip_push_msg_decode_footprint_inner( ctx, total_sz );
30037 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
30038 0 : ctx->data = start_data;
30039 0 : return err;
30040 0 : }
30041 6 : int fd_gossip_push_msg_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
30042 6 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
30043 6 : int err = 0;
30044 6 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
30045 6 : if( FD_UNLIKELY( err ) ) return err;
30046 6 : ulong crds_len;
30047 6 : err = fd_bincode_uint64_decode( &crds_len, ctx );
30048 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
30049 6 : if( crds_len ) {
30050 6 : *total_sz += FD_CRDS_VALUE_ALIGN + FD_CRDS_VALUE_FOOTPRINT*crds_len;
30051 21 : for( ulong i=0; i < crds_len; i++ ) {
30052 15 : err = fd_crds_value_decode_footprint_inner( ctx, total_sz );
30053 15 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
30054 15 : }
30055 6 : }
30056 6 : return 0;
30057 6 : }
30058 0 : void * fd_gossip_push_msg_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
30059 0 : fd_gossip_push_msg_t * self = (fd_gossip_push_msg_t *)mem;
30060 0 : fd_gossip_push_msg_new( self );
30061 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_push_msg_t);
30062 0 : void * * alloc_mem = &alloc_region;
30063 0 : fd_gossip_push_msg_decode_inner( mem, alloc_mem, ctx );
30064 0 : return self;
30065 0 : }
30066 6 : void fd_gossip_push_msg_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
30067 6 : fd_gossip_push_msg_t * self = (fd_gossip_push_msg_t *)struct_mem;
30068 6 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
30069 6 : fd_bincode_uint64_decode_unsafe( &self->crds_len, ctx );
30070 6 : if( self->crds_len ) {
30071 6 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_CRDS_VALUE_ALIGN );
30072 6 : self->crds = *alloc_mem;
30073 6 : *alloc_mem = (uchar *)(*alloc_mem) + FD_CRDS_VALUE_FOOTPRINT*self->crds_len;
30074 21 : for( ulong i=0; i < self->crds_len; i++ ) {
30075 15 : fd_crds_value_new( self->crds + i );
30076 15 : fd_crds_value_decode_inner( self->crds + i, alloc_mem, ctx );
30077 15 : }
30078 6 : } else
30079 0 : self->crds = NULL;
30080 6 : }
30081 0 : void * fd_gossip_push_msg_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
30082 0 : fd_gossip_push_msg_global_t * self = (fd_gossip_push_msg_global_t *)mem;
30083 0 : fd_gossip_push_msg_new( (fd_gossip_push_msg_t *)self );
30084 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_push_msg_global_t);
30085 0 : void * * alloc_mem = &alloc_region;
30086 0 : fd_gossip_push_msg_decode_inner_global( mem, alloc_mem, ctx );
30087 0 : return self;
30088 0 : }
30089 0 : void fd_gossip_push_msg_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
30090 0 : fd_gossip_push_msg_global_t * self = (fd_gossip_push_msg_global_t *)struct_mem;
30091 0 : fd_pubkey_decode_inner_global( &self->pubkey, alloc_mem, ctx );
30092 0 : fd_bincode_uint64_decode_unsafe( &self->crds_len, ctx );
30093 0 : if( self->crds_len ) {
30094 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_CRDS_VALUE_ALIGN );
30095 0 : self->crds_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
30096 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
30097 0 : *alloc_mem = (uchar *)(*alloc_mem) + FD_CRDS_VALUE_FOOTPRINT*self->crds_len;
30098 0 : for( ulong i=0; i < self->crds_len; i++ ) {
30099 0 : fd_crds_value_new( (fd_crds_value_t *)(cur_mem + FD_CRDS_VALUE_FOOTPRINT * i) );
30100 0 : fd_crds_value_decode_inner_global( cur_mem + FD_CRDS_VALUE_FOOTPRINT * i, alloc_mem, ctx );
30101 0 : }
30102 0 : } else
30103 0 : self->crds_gaddr = 0UL;
30104 0 : }
30105 0 : int fd_gossip_push_msg_convert_global_to_local( void const * global_self, fd_gossip_push_msg_t * self, fd_bincode_decode_ctx_t * ctx ) {
30106 0 : int err = 0;
30107 0 : fd_gossip_push_msg_global_t const * mem = (fd_gossip_push_msg_global_t const *)global_self;
30108 0 : err = fd_pubkey_convert_global_to_local( &mem->pubkey, &self->pubkey, ctx );
30109 0 : if( FD_UNLIKELY( err ) ) return err;
30110 0 : self->crds_len = mem->crds_len;
30111 0 : self->crds = fd_wksp_laddr_fast( ctx->wksp, mem->crds_gaddr );
30112 0 : return FD_BINCODE_SUCCESS;
30113 0 : }
30114 0 : void fd_gossip_push_msg_new(fd_gossip_push_msg_t * self) {
30115 0 : fd_memset( self, 0, sizeof(fd_gossip_push_msg_t) );
30116 0 : fd_pubkey_new( &self->pubkey );
30117 0 : }
30118 0 : void fd_gossip_push_msg_destroy( fd_gossip_push_msg_t * self ) {
30119 0 : fd_pubkey_destroy( &self->pubkey );
30120 0 : if( self->crds ) {
30121 0 : for( ulong i=0; i < self->crds_len; i++ )
30122 0 : fd_crds_value_destroy( self->crds + i );
30123 0 : self->crds = NULL;
30124 0 : }
30125 0 : }
30126 :
30127 0 : ulong fd_gossip_push_msg_footprint( void ){ return FD_GOSSIP_PUSH_MSG_FOOTPRINT; }
30128 0 : ulong fd_gossip_push_msg_align( void ){ return FD_GOSSIP_PUSH_MSG_ALIGN; }
30129 :
30130 6 : void fd_gossip_push_msg_walk( void * w, fd_gossip_push_msg_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
30131 6 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_push_msg", level++ );
30132 6 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level );
30133 6 : if( self->crds_len ) {
30134 6 : fun( w, NULL, "crds", FD_FLAMENCO_TYPE_ARR, "array", level++ );
30135 21 : for( ulong i=0; i < self->crds_len; i++ )
30136 15 : fd_crds_value_walk(w, self->crds + i, fun, "crds_value", level );
30137 6 : fun( w, NULL, "crds", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
30138 6 : }
30139 6 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_push_msg", level-- );
30140 6 : }
30141 0 : ulong fd_gossip_push_msg_size( fd_gossip_push_msg_t const * self ) {
30142 0 : ulong size = 0;
30143 0 : size += fd_pubkey_size( &self->pubkey );
30144 0 : do {
30145 0 : size += sizeof(ulong);
30146 0 : for( ulong i=0; i < self->crds_len; i++ )
30147 0 : size += fd_crds_value_size( self->crds + i );
30148 0 : } while(0);
30149 0 : return size;
30150 0 : }
30151 :
30152 0 : int fd_gossip_prune_msg_encode( fd_gossip_prune_msg_t const * self, fd_bincode_encode_ctx_t * ctx ) {
30153 0 : int err;
30154 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
30155 0 : if( FD_UNLIKELY( err ) ) return err;
30156 0 : err = fd_gossip_prune_data_encode( &self->data, ctx );
30157 0 : if( FD_UNLIKELY( err ) ) return err;
30158 0 : return FD_BINCODE_SUCCESS;
30159 0 : }
30160 0 : int fd_gossip_prune_msg_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
30161 0 : *total_sz += sizeof(fd_gossip_prune_msg_t);
30162 0 : void const * start_data = ctx->data;
30163 0 : int err = fd_gossip_prune_msg_decode_footprint_inner( ctx, total_sz );
30164 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
30165 0 : ctx->data = start_data;
30166 0 : return err;
30167 0 : }
30168 0 : int fd_gossip_prune_msg_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
30169 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
30170 0 : int err = 0;
30171 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
30172 0 : if( FD_UNLIKELY( err ) ) return err;
30173 0 : err = fd_gossip_prune_data_decode_footprint_inner( ctx, total_sz );
30174 0 : if( FD_UNLIKELY( err ) ) return err;
30175 0 : return 0;
30176 0 : }
30177 0 : void * fd_gossip_prune_msg_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
30178 0 : fd_gossip_prune_msg_t * self = (fd_gossip_prune_msg_t *)mem;
30179 0 : fd_gossip_prune_msg_new( self );
30180 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_prune_msg_t);
30181 0 : void * * alloc_mem = &alloc_region;
30182 0 : fd_gossip_prune_msg_decode_inner( mem, alloc_mem, ctx );
30183 0 : return self;
30184 0 : }
30185 0 : void fd_gossip_prune_msg_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
30186 0 : fd_gossip_prune_msg_t * self = (fd_gossip_prune_msg_t *)struct_mem;
30187 0 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
30188 0 : fd_gossip_prune_data_decode_inner( &self->data, alloc_mem, ctx );
30189 0 : }
30190 0 : void * fd_gossip_prune_msg_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
30191 0 : fd_gossip_prune_msg_global_t * self = (fd_gossip_prune_msg_global_t *)mem;
30192 0 : fd_gossip_prune_msg_new( (fd_gossip_prune_msg_t *)self );
30193 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_prune_msg_global_t);
30194 0 : void * * alloc_mem = &alloc_region;
30195 0 : fd_gossip_prune_msg_decode_inner_global( mem, alloc_mem, ctx );
30196 0 : return self;
30197 0 : }
30198 0 : void fd_gossip_prune_msg_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
30199 0 : fd_gossip_prune_msg_global_t * self = (fd_gossip_prune_msg_global_t *)struct_mem;
30200 0 : fd_pubkey_decode_inner_global( &self->pubkey, alloc_mem, ctx );
30201 0 : fd_gossip_prune_data_decode_inner_global( &self->data, alloc_mem, ctx );
30202 0 : }
30203 0 : int fd_gossip_prune_msg_convert_global_to_local( void const * global_self, fd_gossip_prune_msg_t * self, fd_bincode_decode_ctx_t * ctx ) {
30204 0 : int err = 0;
30205 0 : fd_gossip_prune_msg_global_t const * mem = (fd_gossip_prune_msg_global_t const *)global_self;
30206 0 : err = fd_pubkey_convert_global_to_local( &mem->pubkey, &self->pubkey, ctx );
30207 0 : if( FD_UNLIKELY( err ) ) return err;
30208 0 : err = fd_gossip_prune_data_convert_global_to_local( &mem->data, &self->data, ctx );
30209 0 : if( FD_UNLIKELY( err ) ) return err;
30210 0 : return FD_BINCODE_SUCCESS;
30211 0 : }
30212 0 : void fd_gossip_prune_msg_new(fd_gossip_prune_msg_t * self) {
30213 0 : fd_memset( self, 0, sizeof(fd_gossip_prune_msg_t) );
30214 0 : fd_pubkey_new( &self->pubkey );
30215 0 : fd_gossip_prune_data_new( &self->data );
30216 0 : }
30217 0 : void fd_gossip_prune_msg_destroy( fd_gossip_prune_msg_t * self ) {
30218 0 : fd_pubkey_destroy( &self->pubkey );
30219 0 : fd_gossip_prune_data_destroy( &self->data );
30220 0 : }
30221 :
30222 0 : ulong fd_gossip_prune_msg_footprint( void ){ return FD_GOSSIP_PRUNE_MSG_FOOTPRINT; }
30223 0 : ulong fd_gossip_prune_msg_align( void ){ return FD_GOSSIP_PRUNE_MSG_ALIGN; }
30224 :
30225 0 : void fd_gossip_prune_msg_walk( void * w, fd_gossip_prune_msg_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
30226 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_prune_msg", level++ );
30227 0 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level );
30228 0 : fd_gossip_prune_data_walk( w, &self->data, fun, "data", level );
30229 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_prune_msg", level-- );
30230 0 : }
30231 0 : ulong fd_gossip_prune_msg_size( fd_gossip_prune_msg_t const * self ) {
30232 0 : ulong size = 0;
30233 0 : size += fd_pubkey_size( &self->pubkey );
30234 0 : size += fd_gossip_prune_data_size( &self->data );
30235 0 : return size;
30236 0 : }
30237 :
30238 0 : FD_FN_PURE uchar fd_gossip_msg_is_pull_req(fd_gossip_msg_t const * self) {
30239 0 : return self->discriminant == 0;
30240 0 : }
30241 0 : FD_FN_PURE uchar fd_gossip_msg_is_pull_resp(fd_gossip_msg_t const * self) {
30242 0 : return self->discriminant == 1;
30243 0 : }
30244 0 : FD_FN_PURE uchar fd_gossip_msg_is_push_msg(fd_gossip_msg_t const * self) {
30245 0 : return self->discriminant == 2;
30246 0 : }
30247 0 : FD_FN_PURE uchar fd_gossip_msg_is_prune_msg(fd_gossip_msg_t const * self) {
30248 0 : return self->discriminant == 3;
30249 0 : }
30250 0 : FD_FN_PURE uchar fd_gossip_msg_is_ping(fd_gossip_msg_t const * self) {
30251 0 : return self->discriminant == 4;
30252 0 : }
30253 0 : FD_FN_PURE uchar fd_gossip_msg_is_pong(fd_gossip_msg_t const * self) {
30254 0 : return self->discriminant == 5;
30255 0 : }
30256 : void fd_gossip_msg_inner_new( fd_gossip_msg_inner_t * self, uint discriminant );
30257 21 : int fd_gossip_msg_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
30258 21 : int err;
30259 21 : switch (discriminant) {
30260 3 : case 0: {
30261 3 : err = fd_gossip_pull_req_decode_footprint_inner( ctx, total_sz );
30262 3 : if( FD_UNLIKELY( err ) ) return err;
30263 3 : return FD_BINCODE_SUCCESS;
30264 3 : }
30265 12 : case 1: {
30266 12 : err = fd_gossip_pull_resp_decode_footprint_inner( ctx, total_sz );
30267 12 : if( FD_UNLIKELY( err ) ) return err;
30268 12 : return FD_BINCODE_SUCCESS;
30269 12 : }
30270 6 : case 2: {
30271 6 : err = fd_gossip_push_msg_decode_footprint_inner( ctx, total_sz );
30272 6 : if( FD_UNLIKELY( err ) ) return err;
30273 6 : return FD_BINCODE_SUCCESS;
30274 6 : }
30275 0 : case 3: {
30276 0 : err = fd_gossip_prune_msg_decode_footprint_inner( ctx, total_sz );
30277 0 : if( FD_UNLIKELY( err ) ) return err;
30278 0 : return FD_BINCODE_SUCCESS;
30279 0 : }
30280 0 : case 4: {
30281 0 : err = fd_gossip_ping_decode_footprint_inner( ctx, total_sz );
30282 0 : if( FD_UNLIKELY( err ) ) return err;
30283 0 : return FD_BINCODE_SUCCESS;
30284 0 : }
30285 0 : case 5: {
30286 0 : err = fd_gossip_ping_decode_footprint_inner( ctx, total_sz );
30287 0 : if( FD_UNLIKELY( err ) ) return err;
30288 0 : return FD_BINCODE_SUCCESS;
30289 0 : }
30290 0 : default: return FD_BINCODE_ERR_ENCODING;
30291 21 : }
30292 21 : }
30293 21 : int fd_gossip_msg_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
30294 21 : *total_sz += sizeof(fd_gossip_msg_t);
30295 21 : void const * start_data = ctx->data;
30296 21 : int err = fd_gossip_msg_decode_footprint_inner( ctx, total_sz );
30297 21 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
30298 21 : ctx->data = start_data;
30299 21 : return err;
30300 21 : }
30301 21 : int fd_gossip_msg_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
30302 21 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
30303 21 : uint discriminant = 0;
30304 21 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
30305 21 : if( FD_UNLIKELY( err ) ) return err;
30306 21 : return fd_gossip_msg_inner_decode_footprint( discriminant, ctx, total_sz );
30307 21 : }
30308 21 : void fd_gossip_msg_inner_decode_inner( fd_gossip_msg_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
30309 21 : switch (discriminant) {
30310 3 : case 0: {
30311 3 : fd_gossip_pull_req_decode_inner( &self->pull_req, alloc_mem, ctx );
30312 3 : break;
30313 0 : }
30314 12 : case 1: {
30315 12 : fd_gossip_pull_resp_decode_inner( &self->pull_resp, alloc_mem, ctx );
30316 12 : break;
30317 0 : }
30318 6 : case 2: {
30319 6 : fd_gossip_push_msg_decode_inner( &self->push_msg, alloc_mem, ctx );
30320 6 : break;
30321 0 : }
30322 0 : case 3: {
30323 0 : fd_gossip_prune_msg_decode_inner( &self->prune_msg, alloc_mem, ctx );
30324 0 : break;
30325 0 : }
30326 0 : case 4: {
30327 0 : fd_gossip_ping_decode_inner( &self->ping, alloc_mem, ctx );
30328 0 : break;
30329 0 : }
30330 0 : case 5: {
30331 0 : fd_gossip_ping_decode_inner( &self->pong, alloc_mem, ctx );
30332 0 : break;
30333 0 : }
30334 21 : }
30335 21 : }
30336 0 : void fd_gossip_msg_inner_decode_inner_global( fd_gossip_msg_inner_global_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
30337 0 : switch (discriminant) {
30338 0 : case 0: {
30339 0 : fd_gossip_pull_req_decode_inner_global( &self->pull_req, alloc_mem, ctx );
30340 0 : break;
30341 0 : }
30342 0 : case 1: {
30343 0 : fd_gossip_pull_resp_decode_inner_global( &self->pull_resp, alloc_mem, ctx );
30344 0 : break;
30345 0 : }
30346 0 : case 2: {
30347 0 : fd_gossip_push_msg_decode_inner_global( &self->push_msg, alloc_mem, ctx );
30348 0 : break;
30349 0 : }
30350 0 : case 3: {
30351 0 : fd_gossip_prune_msg_decode_inner_global( &self->prune_msg, alloc_mem, ctx );
30352 0 : break;
30353 0 : }
30354 0 : case 4: {
30355 0 : fd_gossip_ping_decode_inner_global( &self->ping, alloc_mem, ctx );
30356 0 : break;
30357 0 : }
30358 0 : case 5: {
30359 0 : fd_gossip_ping_decode_inner_global( &self->pong, alloc_mem, ctx );
30360 0 : break;
30361 0 : }
30362 0 : }
30363 0 : }
30364 0 : int fd_gossip_msg_convert_global_to_local_inner( fd_gossip_msg_inner_global_t const * mem, fd_gossip_msg_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
30365 0 : int err = 0;
30366 0 : switch( discriminant ) {
30367 0 : case 0: {
30368 0 : err = fd_gossip_pull_req_convert_global_to_local( &mem->pull_req, &self->pull_req, ctx );
30369 0 : if( FD_UNLIKELY( err ) ) return err;
30370 0 : break;
30371 0 : }
30372 0 : case 1: {
30373 0 : err = fd_gossip_pull_resp_convert_global_to_local( &mem->pull_resp, &self->pull_resp, ctx );
30374 0 : if( FD_UNLIKELY( err ) ) return err;
30375 0 : break;
30376 0 : }
30377 0 : case 2: {
30378 0 : err = fd_gossip_push_msg_convert_global_to_local( &mem->push_msg, &self->push_msg, ctx );
30379 0 : if( FD_UNLIKELY( err ) ) return err;
30380 0 : break;
30381 0 : }
30382 0 : case 3: {
30383 0 : err = fd_gossip_prune_msg_convert_global_to_local( &mem->prune_msg, &self->prune_msg, ctx );
30384 0 : if( FD_UNLIKELY( err ) ) return err;
30385 0 : break;
30386 0 : }
30387 0 : case 4: {
30388 0 : err = fd_gossip_ping_convert_global_to_local( &mem->ping, &self->ping, ctx );
30389 0 : if( FD_UNLIKELY( err ) ) return err;
30390 0 : break;
30391 0 : }
30392 0 : case 5: {
30393 0 : err = fd_gossip_ping_convert_global_to_local( &mem->pong, &self->pong, ctx );
30394 0 : if( FD_UNLIKELY( err ) ) return err;
30395 0 : break;
30396 0 : }
30397 0 : }
30398 0 : return FD_BINCODE_SUCCESS;
30399 0 : }
30400 0 : int fd_gossip_msg_convert_global_to_local( void const * global_self, fd_gossip_msg_t * self, fd_bincode_decode_ctx_t * ctx ) {
30401 0 : fd_gossip_msg_global_t const * mem = (fd_gossip_msg_global_t const *)global_self;
30402 0 : uint discriminant = mem->discriminant;
30403 0 : self->discriminant = mem->discriminant;
30404 0 : int err = fd_gossip_msg_convert_global_to_local_inner( &mem->inner, &self->inner, discriminant, ctx );
30405 0 : return FD_BINCODE_SUCCESS;
30406 0 : }
30407 21 : void fd_gossip_msg_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
30408 21 : fd_gossip_msg_t * self = (fd_gossip_msg_t *)struct_mem;
30409 21 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
30410 21 : fd_gossip_msg_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
30411 21 : }
30412 21 : void * fd_gossip_msg_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
30413 21 : fd_gossip_msg_t * self = (fd_gossip_msg_t *)mem;
30414 21 : fd_gossip_msg_new( self );
30415 21 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_msg_t);
30416 21 : void * * alloc_mem = &alloc_region;
30417 21 : fd_gossip_msg_decode_inner( mem, alloc_mem, ctx );
30418 21 : return self;
30419 21 : }
30420 0 : void * fd_gossip_msg_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
30421 0 : fd_gossip_msg_t * self = (fd_gossip_msg_t *)mem;
30422 0 : fd_gossip_msg_new( self );
30423 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_msg_t);
30424 0 : void * * alloc_mem = &alloc_region;
30425 0 : fd_gossip_msg_decode_inner_global( mem, alloc_mem, ctx );
30426 0 : return self;
30427 0 : }
30428 0 : void fd_gossip_msg_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
30429 0 : fd_gossip_msg_global_t * self = (fd_gossip_msg_global_t *)struct_mem;
30430 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
30431 0 : fd_gossip_msg_inner_decode_inner_global( &self->inner, alloc_mem, self->discriminant, ctx );
30432 0 : }
30433 21 : void fd_gossip_msg_inner_new( fd_gossip_msg_inner_t * self, uint discriminant ) {
30434 21 : switch( discriminant ) {
30435 0 : case 0: {
30436 0 : fd_gossip_pull_req_new( &self->pull_req );
30437 0 : break;
30438 0 : }
30439 0 : case 1: {
30440 0 : fd_gossip_pull_resp_new( &self->pull_resp );
30441 0 : break;
30442 0 : }
30443 0 : case 2: {
30444 0 : fd_gossip_push_msg_new( &self->push_msg );
30445 0 : break;
30446 0 : }
30447 0 : case 3: {
30448 0 : fd_gossip_prune_msg_new( &self->prune_msg );
30449 0 : break;
30450 0 : }
30451 0 : case 4: {
30452 0 : fd_gossip_ping_new( &self->ping );
30453 0 : break;
30454 0 : }
30455 0 : case 5: {
30456 0 : fd_gossip_ping_new( &self->pong );
30457 0 : break;
30458 0 : }
30459 21 : default: break; // FD_LOG_ERR(( "unhandled type"));
30460 21 : }
30461 21 : }
30462 21 : void fd_gossip_msg_new_disc( fd_gossip_msg_t * self, uint discriminant ) {
30463 21 : self->discriminant = discriminant;
30464 21 : fd_gossip_msg_inner_new( &self->inner, self->discriminant );
30465 21 : }
30466 21 : void fd_gossip_msg_new( fd_gossip_msg_t * self ) {
30467 21 : fd_memset( self, 0, sizeof(fd_gossip_msg_t) );
30468 21 : fd_gossip_msg_new_disc( self, UINT_MAX );
30469 21 : }
30470 0 : void fd_gossip_msg_inner_destroy( fd_gossip_msg_inner_t * self, uint discriminant ) {
30471 0 : switch( discriminant ) {
30472 0 : case 0: {
30473 0 : fd_gossip_pull_req_destroy( &self->pull_req );
30474 0 : break;
30475 0 : }
30476 0 : case 1: {
30477 0 : fd_gossip_pull_resp_destroy( &self->pull_resp );
30478 0 : break;
30479 0 : }
30480 0 : case 2: {
30481 0 : fd_gossip_push_msg_destroy( &self->push_msg );
30482 0 : break;
30483 0 : }
30484 0 : case 3: {
30485 0 : fd_gossip_prune_msg_destroy( &self->prune_msg );
30486 0 : break;
30487 0 : }
30488 0 : case 4: {
30489 0 : fd_gossip_ping_destroy( &self->ping );
30490 0 : break;
30491 0 : }
30492 0 : case 5: {
30493 0 : fd_gossip_ping_destroy( &self->pong );
30494 0 : break;
30495 0 : }
30496 0 : default: break; // FD_LOG_ERR(( "unhandled type" ));
30497 0 : }
30498 0 : }
30499 0 : void fd_gossip_msg_destroy( fd_gossip_msg_t * self ) {
30500 0 : fd_gossip_msg_inner_destroy( &self->inner, self->discriminant );
30501 0 : }
30502 :
30503 0 : ulong fd_gossip_msg_footprint( void ){ return FD_GOSSIP_MSG_FOOTPRINT; }
30504 21 : ulong fd_gossip_msg_align( void ){ return FD_GOSSIP_MSG_ALIGN; }
30505 :
30506 21 : void fd_gossip_msg_walk( void * w, fd_gossip_msg_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
30507 21 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_gossip_msg", level++);
30508 21 : switch( self->discriminant ) {
30509 3 : case 0: {
30510 3 : fun( w, self, "pull_req", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
30511 3 : fd_gossip_pull_req_walk( w, &self->inner.pull_req, fun, "pull_req", level );
30512 3 : break;
30513 0 : }
30514 12 : case 1: {
30515 12 : fun( w, self, "pull_resp", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
30516 12 : fd_gossip_pull_resp_walk( w, &self->inner.pull_resp, fun, "pull_resp", level );
30517 12 : break;
30518 0 : }
30519 6 : case 2: {
30520 6 : fun( w, self, "push_msg", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
30521 6 : fd_gossip_push_msg_walk( w, &self->inner.push_msg, fun, "push_msg", level );
30522 6 : break;
30523 0 : }
30524 0 : case 3: {
30525 0 : fun( w, self, "prune_msg", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
30526 0 : fd_gossip_prune_msg_walk( w, &self->inner.prune_msg, fun, "prune_msg", level );
30527 0 : break;
30528 0 : }
30529 0 : case 4: {
30530 0 : fun( w, self, "ping", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
30531 0 : fd_gossip_ping_walk( w, &self->inner.ping, fun, "ping", level );
30532 0 : break;
30533 0 : }
30534 0 : case 5: {
30535 0 : fun( w, self, "pong", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
30536 0 : fd_gossip_ping_walk( w, &self->inner.pong, fun, "pong", level );
30537 0 : break;
30538 0 : }
30539 21 : }
30540 21 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_gossip_msg", level-- );
30541 21 : }
30542 0 : ulong fd_gossip_msg_size( fd_gossip_msg_t const * self ) {
30543 0 : ulong size = 0;
30544 0 : size += sizeof(uint);
30545 0 : switch (self->discriminant) {
30546 0 : case 0: {
30547 0 : size += fd_gossip_pull_req_size( &self->inner.pull_req );
30548 0 : break;
30549 0 : }
30550 0 : case 1: {
30551 0 : size += fd_gossip_pull_resp_size( &self->inner.pull_resp );
30552 0 : break;
30553 0 : }
30554 0 : case 2: {
30555 0 : size += fd_gossip_push_msg_size( &self->inner.push_msg );
30556 0 : break;
30557 0 : }
30558 0 : case 3: {
30559 0 : size += fd_gossip_prune_msg_size( &self->inner.prune_msg );
30560 0 : break;
30561 0 : }
30562 0 : case 4: {
30563 0 : size += fd_gossip_ping_size( &self->inner.ping );
30564 0 : break;
30565 0 : }
30566 0 : case 5: {
30567 0 : size += fd_gossip_ping_size( &self->inner.pong );
30568 0 : break;
30569 0 : }
30570 0 : }
30571 0 : return size;
30572 0 : }
30573 :
30574 0 : int fd_gossip_msg_inner_encode( fd_gossip_msg_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
30575 0 : int err;
30576 0 : switch (discriminant) {
30577 0 : case 0: {
30578 0 : err = fd_gossip_pull_req_encode( &self->pull_req, ctx );
30579 0 : if( FD_UNLIKELY( err ) ) return err;
30580 0 : break;
30581 0 : }
30582 0 : case 1: {
30583 0 : err = fd_gossip_pull_resp_encode( &self->pull_resp, ctx );
30584 0 : if( FD_UNLIKELY( err ) ) return err;
30585 0 : break;
30586 0 : }
30587 0 : case 2: {
30588 0 : err = fd_gossip_push_msg_encode( &self->push_msg, ctx );
30589 0 : if( FD_UNLIKELY( err ) ) return err;
30590 0 : break;
30591 0 : }
30592 0 : case 3: {
30593 0 : err = fd_gossip_prune_msg_encode( &self->prune_msg, ctx );
30594 0 : if( FD_UNLIKELY( err ) ) return err;
30595 0 : break;
30596 0 : }
30597 0 : case 4: {
30598 0 : err = fd_gossip_ping_encode( &self->ping, ctx );
30599 0 : if( FD_UNLIKELY( err ) ) return err;
30600 0 : break;
30601 0 : }
30602 0 : case 5: {
30603 0 : err = fd_gossip_ping_encode( &self->pong, ctx );
30604 0 : if( FD_UNLIKELY( err ) ) return err;
30605 0 : break;
30606 0 : }
30607 0 : }
30608 0 : return FD_BINCODE_SUCCESS;
30609 0 : }
30610 0 : int fd_gossip_msg_encode( fd_gossip_msg_t const * self, fd_bincode_encode_ctx_t * ctx ) {
30611 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
30612 0 : if( FD_UNLIKELY( err ) ) return err;
30613 0 : return fd_gossip_msg_inner_encode( &self->inner, self->discriminant, ctx );
30614 0 : }
30615 :
30616 0 : int fd_addrlut_create_encode( fd_addrlut_create_t const * self, fd_bincode_encode_ctx_t * ctx ) {
30617 0 : int err;
30618 0 : err = fd_bincode_uint64_encode( self->recent_slot, ctx );
30619 0 : if( FD_UNLIKELY( err ) ) return err;
30620 0 : err = fd_bincode_uint8_encode( (uchar)(self->bump_seed), ctx );
30621 0 : if( FD_UNLIKELY( err ) ) return err;
30622 0 : return FD_BINCODE_SUCCESS;
30623 0 : }
30624 0 : int fd_addrlut_create_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
30625 0 : *total_sz += sizeof(fd_addrlut_create_t);
30626 0 : void const * start_data = ctx->data;
30627 0 : int err = fd_addrlut_create_decode_footprint_inner( ctx, total_sz );
30628 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
30629 0 : ctx->data = start_data;
30630 0 : return err;
30631 0 : }
30632 0 : int fd_addrlut_create_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
30633 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
30634 0 : int err = 0;
30635 0 : err = fd_bincode_uint64_decode_footprint( ctx );
30636 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
30637 0 : err = fd_bincode_uint8_decode_footprint( ctx );
30638 0 : if( FD_UNLIKELY( err ) ) return err;
30639 0 : return 0;
30640 0 : }
30641 0 : void * fd_addrlut_create_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
30642 0 : fd_addrlut_create_t * self = (fd_addrlut_create_t *)mem;
30643 0 : fd_addrlut_create_new( self );
30644 0 : void * alloc_region = (uchar *)mem + sizeof(fd_addrlut_create_t);
30645 0 : void * * alloc_mem = &alloc_region;
30646 0 : fd_addrlut_create_decode_inner( mem, alloc_mem, ctx );
30647 0 : return self;
30648 0 : }
30649 0 : void fd_addrlut_create_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
30650 0 : fd_addrlut_create_t * self = (fd_addrlut_create_t *)struct_mem;
30651 0 : fd_bincode_uint64_decode_unsafe( &self->recent_slot, ctx );
30652 0 : fd_bincode_uint8_decode_unsafe( &self->bump_seed, ctx );
30653 0 : }
30654 0 : void * fd_addrlut_create_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
30655 0 : fd_addrlut_create_global_t * self = (fd_addrlut_create_global_t *)mem;
30656 0 : fd_addrlut_create_new( (fd_addrlut_create_t *)self );
30657 0 : void * alloc_region = (uchar *)mem + sizeof(fd_addrlut_create_global_t);
30658 0 : void * * alloc_mem = &alloc_region;
30659 0 : fd_addrlut_create_decode_inner_global( mem, alloc_mem, ctx );
30660 0 : return self;
30661 0 : }
30662 0 : void fd_addrlut_create_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
30663 0 : fd_addrlut_create_global_t * self = (fd_addrlut_create_global_t *)struct_mem;
30664 0 : fd_bincode_uint64_decode_unsafe( &self->recent_slot, ctx );
30665 0 : fd_bincode_uint8_decode_unsafe( &self->bump_seed, ctx );
30666 0 : }
30667 0 : int fd_addrlut_create_convert_global_to_local( void const * global_self, fd_addrlut_create_t * self, fd_bincode_decode_ctx_t * ctx ) {
30668 0 : int err = 0;
30669 0 : fd_addrlut_create_global_t const * mem = (fd_addrlut_create_global_t const *)global_self;
30670 0 : self->recent_slot = mem->recent_slot;
30671 0 : self->bump_seed = mem->bump_seed;
30672 0 : return FD_BINCODE_SUCCESS;
30673 0 : }
30674 0 : void fd_addrlut_create_new(fd_addrlut_create_t * self) {
30675 0 : fd_memset( self, 0, sizeof(fd_addrlut_create_t) );
30676 0 : }
30677 0 : void fd_addrlut_create_destroy( fd_addrlut_create_t * self ) {
30678 0 : }
30679 :
30680 0 : ulong fd_addrlut_create_footprint( void ){ return FD_ADDRLUT_CREATE_FOOTPRINT; }
30681 0 : ulong fd_addrlut_create_align( void ){ return FD_ADDRLUT_CREATE_ALIGN; }
30682 :
30683 0 : void fd_addrlut_create_walk( void * w, fd_addrlut_create_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
30684 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_addrlut_create", level++ );
30685 0 : fun( w, &self->recent_slot, "recent_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
30686 0 : fun( w, &self->bump_seed, "bump_seed", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
30687 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_addrlut_create", level-- );
30688 0 : }
30689 0 : ulong fd_addrlut_create_size( fd_addrlut_create_t const * self ) {
30690 0 : ulong size = 0;
30691 0 : size += sizeof(ulong);
30692 0 : size += sizeof(char);
30693 0 : return size;
30694 0 : }
30695 :
30696 0 : int fd_addrlut_extend_encode( fd_addrlut_extend_t const * self, fd_bincode_encode_ctx_t * ctx ) {
30697 0 : int err;
30698 0 : err = fd_bincode_uint64_encode( self->new_addrs_len, ctx );
30699 0 : if( FD_UNLIKELY(err) ) return err;
30700 0 : if( self->new_addrs_len ) {
30701 0 : for( ulong i=0; i < self->new_addrs_len; i++ ) {
30702 0 : err = fd_pubkey_encode( self->new_addrs + i, ctx );
30703 0 : if( FD_UNLIKELY( err ) ) return err;
30704 0 : }
30705 0 : }
30706 0 : return FD_BINCODE_SUCCESS;
30707 0 : }
30708 0 : int fd_addrlut_extend_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
30709 0 : *total_sz += sizeof(fd_addrlut_extend_t);
30710 0 : void const * start_data = ctx->data;
30711 0 : int err = fd_addrlut_extend_decode_footprint_inner( ctx, total_sz );
30712 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
30713 0 : ctx->data = start_data;
30714 0 : return err;
30715 0 : }
30716 0 : int fd_addrlut_extend_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
30717 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
30718 0 : int err = 0;
30719 0 : ulong new_addrs_len;
30720 0 : err = fd_bincode_uint64_decode( &new_addrs_len, ctx );
30721 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
30722 0 : if( new_addrs_len ) {
30723 0 : *total_sz += FD_PUBKEY_ALIGN + FD_PUBKEY_FOOTPRINT*new_addrs_len;
30724 0 : for( ulong i=0; i < new_addrs_len; i++ ) {
30725 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
30726 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
30727 0 : }
30728 0 : }
30729 0 : return 0;
30730 0 : }
30731 0 : void * fd_addrlut_extend_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
30732 0 : fd_addrlut_extend_t * self = (fd_addrlut_extend_t *)mem;
30733 0 : fd_addrlut_extend_new( self );
30734 0 : void * alloc_region = (uchar *)mem + sizeof(fd_addrlut_extend_t);
30735 0 : void * * alloc_mem = &alloc_region;
30736 0 : fd_addrlut_extend_decode_inner( mem, alloc_mem, ctx );
30737 0 : return self;
30738 0 : }
30739 0 : void fd_addrlut_extend_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
30740 0 : fd_addrlut_extend_t * self = (fd_addrlut_extend_t *)struct_mem;
30741 0 : fd_bincode_uint64_decode_unsafe( &self->new_addrs_len, ctx );
30742 0 : if( self->new_addrs_len ) {
30743 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_ALIGN );
30744 0 : self->new_addrs = *alloc_mem;
30745 0 : *alloc_mem = (uchar *)(*alloc_mem) + FD_PUBKEY_FOOTPRINT*self->new_addrs_len;
30746 0 : for( ulong i=0; i < self->new_addrs_len; i++ ) {
30747 0 : fd_pubkey_new( self->new_addrs + i );
30748 0 : fd_pubkey_decode_inner( self->new_addrs + i, alloc_mem, ctx );
30749 0 : }
30750 0 : } else
30751 0 : self->new_addrs = NULL;
30752 0 : }
30753 0 : void * fd_addrlut_extend_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
30754 0 : fd_addrlut_extend_global_t * self = (fd_addrlut_extend_global_t *)mem;
30755 0 : fd_addrlut_extend_new( (fd_addrlut_extend_t *)self );
30756 0 : void * alloc_region = (uchar *)mem + sizeof(fd_addrlut_extend_global_t);
30757 0 : void * * alloc_mem = &alloc_region;
30758 0 : fd_addrlut_extend_decode_inner_global( mem, alloc_mem, ctx );
30759 0 : return self;
30760 0 : }
30761 0 : void fd_addrlut_extend_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
30762 0 : fd_addrlut_extend_global_t * self = (fd_addrlut_extend_global_t *)struct_mem;
30763 0 : fd_bincode_uint64_decode_unsafe( &self->new_addrs_len, ctx );
30764 0 : if( self->new_addrs_len ) {
30765 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_ALIGN );
30766 0 : self->new_addrs_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
30767 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
30768 0 : *alloc_mem = (uchar *)(*alloc_mem) + FD_PUBKEY_FOOTPRINT*self->new_addrs_len;
30769 0 : for( ulong i=0; i < self->new_addrs_len; i++ ) {
30770 0 : fd_pubkey_new( (fd_pubkey_t *)(cur_mem + FD_PUBKEY_FOOTPRINT * i) );
30771 0 : fd_pubkey_decode_inner_global( cur_mem + FD_PUBKEY_FOOTPRINT * i, alloc_mem, ctx );
30772 0 : }
30773 0 : } else
30774 0 : self->new_addrs_gaddr = 0UL;
30775 0 : }
30776 0 : int fd_addrlut_extend_convert_global_to_local( void const * global_self, fd_addrlut_extend_t * self, fd_bincode_decode_ctx_t * ctx ) {
30777 0 : int err = 0;
30778 0 : fd_addrlut_extend_global_t const * mem = (fd_addrlut_extend_global_t const *)global_self;
30779 0 : self->new_addrs_len = mem->new_addrs_len;
30780 0 : self->new_addrs = fd_wksp_laddr_fast( ctx->wksp, mem->new_addrs_gaddr );
30781 0 : return FD_BINCODE_SUCCESS;
30782 0 : }
30783 0 : void fd_addrlut_extend_new(fd_addrlut_extend_t * self) {
30784 0 : fd_memset( self, 0, sizeof(fd_addrlut_extend_t) );
30785 0 : }
30786 0 : void fd_addrlut_extend_destroy( fd_addrlut_extend_t * self ) {
30787 0 : if( self->new_addrs ) {
30788 0 : for( ulong i=0; i < self->new_addrs_len; i++ )
30789 0 : fd_pubkey_destroy( self->new_addrs + i );
30790 0 : self->new_addrs = NULL;
30791 0 : }
30792 0 : }
30793 :
30794 0 : ulong fd_addrlut_extend_footprint( void ){ return FD_ADDRLUT_EXTEND_FOOTPRINT; }
30795 0 : ulong fd_addrlut_extend_align( void ){ return FD_ADDRLUT_EXTEND_ALIGN; }
30796 :
30797 0 : void fd_addrlut_extend_walk( void * w, fd_addrlut_extend_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
30798 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_addrlut_extend", level++ );
30799 0 : if( self->new_addrs_len ) {
30800 0 : fun( w, NULL, "new_addrs", FD_FLAMENCO_TYPE_ARR, "array", level++ );
30801 0 : for( ulong i=0; i < self->new_addrs_len; i++ )
30802 0 : fd_pubkey_walk(w, self->new_addrs + i, fun, "pubkey", level );
30803 0 : fun( w, NULL, "new_addrs", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
30804 0 : }
30805 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_addrlut_extend", level-- );
30806 0 : }
30807 0 : ulong fd_addrlut_extend_size( fd_addrlut_extend_t const * self ) {
30808 0 : ulong size = 0;
30809 0 : do {
30810 0 : size += sizeof(ulong);
30811 0 : for( ulong i=0; i < self->new_addrs_len; i++ )
30812 0 : size += fd_pubkey_size( self->new_addrs + i );
30813 0 : } while(0);
30814 0 : return size;
30815 0 : }
30816 :
30817 0 : FD_FN_PURE uchar fd_addrlut_instruction_is_create_lut(fd_addrlut_instruction_t const * self) {
30818 0 : return self->discriminant == 0;
30819 0 : }
30820 0 : FD_FN_PURE uchar fd_addrlut_instruction_is_freeze_lut(fd_addrlut_instruction_t const * self) {
30821 0 : return self->discriminant == 1;
30822 0 : }
30823 0 : FD_FN_PURE uchar fd_addrlut_instruction_is_extend_lut(fd_addrlut_instruction_t const * self) {
30824 0 : return self->discriminant == 2;
30825 0 : }
30826 0 : FD_FN_PURE uchar fd_addrlut_instruction_is_deactivate_lut(fd_addrlut_instruction_t const * self) {
30827 0 : return self->discriminant == 3;
30828 0 : }
30829 0 : FD_FN_PURE uchar fd_addrlut_instruction_is_close_lut(fd_addrlut_instruction_t const * self) {
30830 0 : return self->discriminant == 4;
30831 0 : }
30832 : void fd_addrlut_instruction_inner_new( fd_addrlut_instruction_inner_t * self, uint discriminant );
30833 0 : int fd_addrlut_instruction_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
30834 0 : int err;
30835 0 : switch (discriminant) {
30836 0 : case 0: {
30837 0 : err = fd_addrlut_create_decode_footprint_inner( ctx, total_sz );
30838 0 : if( FD_UNLIKELY( err ) ) return err;
30839 0 : return FD_BINCODE_SUCCESS;
30840 0 : }
30841 0 : case 1: {
30842 0 : return FD_BINCODE_SUCCESS;
30843 0 : }
30844 0 : case 2: {
30845 0 : err = fd_addrlut_extend_decode_footprint_inner( ctx, total_sz );
30846 0 : if( FD_UNLIKELY( err ) ) return err;
30847 0 : return FD_BINCODE_SUCCESS;
30848 0 : }
30849 0 : case 3: {
30850 0 : return FD_BINCODE_SUCCESS;
30851 0 : }
30852 0 : case 4: {
30853 0 : return FD_BINCODE_SUCCESS;
30854 0 : }
30855 0 : default: return FD_BINCODE_ERR_ENCODING;
30856 0 : }
30857 0 : }
30858 0 : int fd_addrlut_instruction_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
30859 0 : *total_sz += sizeof(fd_addrlut_instruction_t);
30860 0 : void const * start_data = ctx->data;
30861 0 : int err = fd_addrlut_instruction_decode_footprint_inner( ctx, total_sz );
30862 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
30863 0 : ctx->data = start_data;
30864 0 : return err;
30865 0 : }
30866 0 : int fd_addrlut_instruction_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
30867 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
30868 0 : uint discriminant = 0;
30869 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
30870 0 : if( FD_UNLIKELY( err ) ) return err;
30871 0 : return fd_addrlut_instruction_inner_decode_footprint( discriminant, ctx, total_sz );
30872 0 : }
30873 0 : void fd_addrlut_instruction_inner_decode_inner( fd_addrlut_instruction_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
30874 0 : switch (discriminant) {
30875 0 : case 0: {
30876 0 : fd_addrlut_create_decode_inner( &self->create_lut, alloc_mem, ctx );
30877 0 : break;
30878 0 : }
30879 0 : case 1: {
30880 0 : break;
30881 0 : }
30882 0 : case 2: {
30883 0 : fd_addrlut_extend_decode_inner( &self->extend_lut, alloc_mem, ctx );
30884 0 : break;
30885 0 : }
30886 0 : case 3: {
30887 0 : break;
30888 0 : }
30889 0 : case 4: {
30890 0 : break;
30891 0 : }
30892 0 : }
30893 0 : }
30894 0 : void fd_addrlut_instruction_inner_decode_inner_global( fd_addrlut_instruction_inner_global_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
30895 0 : switch (discriminant) {
30896 0 : case 0: {
30897 0 : fd_addrlut_create_decode_inner_global( &self->create_lut, alloc_mem, ctx );
30898 0 : break;
30899 0 : }
30900 0 : case 1: {
30901 0 : break;
30902 0 : }
30903 0 : case 2: {
30904 0 : fd_addrlut_extend_decode_inner_global( &self->extend_lut, alloc_mem, ctx );
30905 0 : break;
30906 0 : }
30907 0 : case 3: {
30908 0 : break;
30909 0 : }
30910 0 : case 4: {
30911 0 : break;
30912 0 : }
30913 0 : }
30914 0 : }
30915 0 : int fd_addrlut_instruction_convert_global_to_local_inner( fd_addrlut_instruction_inner_global_t const * mem, fd_addrlut_instruction_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
30916 0 : int err = 0;
30917 0 : switch( discriminant ) {
30918 0 : case 0: {
30919 0 : err = fd_addrlut_create_convert_global_to_local( &mem->create_lut, &self->create_lut, ctx );
30920 0 : if( FD_UNLIKELY( err ) ) return err;
30921 0 : break;
30922 0 : }
30923 0 : case 1: {
30924 0 : break;
30925 0 : }
30926 0 : case 2: {
30927 0 : err = fd_addrlut_extend_convert_global_to_local( &mem->extend_lut, &self->extend_lut, ctx );
30928 0 : if( FD_UNLIKELY( err ) ) return err;
30929 0 : break;
30930 0 : }
30931 0 : case 3: {
30932 0 : break;
30933 0 : }
30934 0 : case 4: {
30935 0 : break;
30936 0 : }
30937 0 : }
30938 0 : return FD_BINCODE_SUCCESS;
30939 0 : }
30940 0 : int fd_addrlut_instruction_convert_global_to_local( void const * global_self, fd_addrlut_instruction_t * self, fd_bincode_decode_ctx_t * ctx ) {
30941 0 : fd_addrlut_instruction_global_t const * mem = (fd_addrlut_instruction_global_t const *)global_self;
30942 0 : uint discriminant = mem->discriminant;
30943 0 : self->discriminant = mem->discriminant;
30944 0 : int err = fd_addrlut_instruction_convert_global_to_local_inner( &mem->inner, &self->inner, discriminant, ctx );
30945 0 : return FD_BINCODE_SUCCESS;
30946 0 : }
30947 0 : void fd_addrlut_instruction_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
30948 0 : fd_addrlut_instruction_t * self = (fd_addrlut_instruction_t *)struct_mem;
30949 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
30950 0 : fd_addrlut_instruction_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
30951 0 : }
30952 0 : void * fd_addrlut_instruction_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
30953 0 : fd_addrlut_instruction_t * self = (fd_addrlut_instruction_t *)mem;
30954 0 : fd_addrlut_instruction_new( self );
30955 0 : void * alloc_region = (uchar *)mem + sizeof(fd_addrlut_instruction_t);
30956 0 : void * * alloc_mem = &alloc_region;
30957 0 : fd_addrlut_instruction_decode_inner( mem, alloc_mem, ctx );
30958 0 : return self;
30959 0 : }
30960 0 : void * fd_addrlut_instruction_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
30961 0 : fd_addrlut_instruction_t * self = (fd_addrlut_instruction_t *)mem;
30962 0 : fd_addrlut_instruction_new( self );
30963 0 : void * alloc_region = (uchar *)mem + sizeof(fd_addrlut_instruction_t);
30964 0 : void * * alloc_mem = &alloc_region;
30965 0 : fd_addrlut_instruction_decode_inner_global( mem, alloc_mem, ctx );
30966 0 : return self;
30967 0 : }
30968 0 : void fd_addrlut_instruction_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
30969 0 : fd_addrlut_instruction_global_t * self = (fd_addrlut_instruction_global_t *)struct_mem;
30970 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
30971 0 : fd_addrlut_instruction_inner_decode_inner_global( &self->inner, alloc_mem, self->discriminant, ctx );
30972 0 : }
30973 0 : void fd_addrlut_instruction_inner_new( fd_addrlut_instruction_inner_t * self, uint discriminant ) {
30974 0 : switch( discriminant ) {
30975 0 : case 0: {
30976 0 : fd_addrlut_create_new( &self->create_lut );
30977 0 : break;
30978 0 : }
30979 0 : case 1: {
30980 0 : break;
30981 0 : }
30982 0 : case 2: {
30983 0 : fd_addrlut_extend_new( &self->extend_lut );
30984 0 : break;
30985 0 : }
30986 0 : case 3: {
30987 0 : break;
30988 0 : }
30989 0 : case 4: {
30990 0 : break;
30991 0 : }
30992 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
30993 0 : }
30994 0 : }
30995 0 : void fd_addrlut_instruction_new_disc( fd_addrlut_instruction_t * self, uint discriminant ) {
30996 0 : self->discriminant = discriminant;
30997 0 : fd_addrlut_instruction_inner_new( &self->inner, self->discriminant );
30998 0 : }
30999 0 : void fd_addrlut_instruction_new( fd_addrlut_instruction_t * self ) {
31000 0 : fd_memset( self, 0, sizeof(fd_addrlut_instruction_t) );
31001 0 : fd_addrlut_instruction_new_disc( self, UINT_MAX );
31002 0 : }
31003 0 : void fd_addrlut_instruction_inner_destroy( fd_addrlut_instruction_inner_t * self, uint discriminant ) {
31004 0 : switch( discriminant ) {
31005 0 : case 0: {
31006 0 : fd_addrlut_create_destroy( &self->create_lut );
31007 0 : break;
31008 0 : }
31009 0 : case 2: {
31010 0 : fd_addrlut_extend_destroy( &self->extend_lut );
31011 0 : break;
31012 0 : }
31013 0 : default: break; // FD_LOG_ERR(( "unhandled type" ));
31014 0 : }
31015 0 : }
31016 0 : void fd_addrlut_instruction_destroy( fd_addrlut_instruction_t * self ) {
31017 0 : fd_addrlut_instruction_inner_destroy( &self->inner, self->discriminant );
31018 0 : }
31019 :
31020 0 : ulong fd_addrlut_instruction_footprint( void ){ return FD_ADDRLUT_INSTRUCTION_FOOTPRINT; }
31021 0 : ulong fd_addrlut_instruction_align( void ){ return FD_ADDRLUT_INSTRUCTION_ALIGN; }
31022 :
31023 0 : void fd_addrlut_instruction_walk( void * w, fd_addrlut_instruction_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
31024 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_addrlut_instruction", level++);
31025 0 : switch( self->discriminant ) {
31026 0 : case 0: {
31027 0 : fun( w, self, "create_lut", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31028 0 : fd_addrlut_create_walk( w, &self->inner.create_lut, fun, "create_lut", level );
31029 0 : break;
31030 0 : }
31031 0 : case 1: {
31032 0 : fun( w, self, "freeze_lut", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31033 0 : break;
31034 0 : }
31035 0 : case 2: {
31036 0 : fun( w, self, "extend_lut", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31037 0 : fd_addrlut_extend_walk( w, &self->inner.extend_lut, fun, "extend_lut", level );
31038 0 : break;
31039 0 : }
31040 0 : case 3: {
31041 0 : fun( w, self, "deactivate_lut", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31042 0 : break;
31043 0 : }
31044 0 : case 4: {
31045 0 : fun( w, self, "close_lut", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31046 0 : break;
31047 0 : }
31048 0 : }
31049 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_addrlut_instruction", level-- );
31050 0 : }
31051 0 : ulong fd_addrlut_instruction_size( fd_addrlut_instruction_t const * self ) {
31052 0 : ulong size = 0;
31053 0 : size += sizeof(uint);
31054 0 : switch (self->discriminant) {
31055 0 : case 0: {
31056 0 : size += fd_addrlut_create_size( &self->inner.create_lut );
31057 0 : break;
31058 0 : }
31059 0 : case 2: {
31060 0 : size += fd_addrlut_extend_size( &self->inner.extend_lut );
31061 0 : break;
31062 0 : }
31063 0 : }
31064 0 : return size;
31065 0 : }
31066 :
31067 0 : int fd_addrlut_instruction_inner_encode( fd_addrlut_instruction_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
31068 0 : int err;
31069 0 : switch (discriminant) {
31070 0 : case 0: {
31071 0 : err = fd_addrlut_create_encode( &self->create_lut, ctx );
31072 0 : if( FD_UNLIKELY( err ) ) return err;
31073 0 : break;
31074 0 : }
31075 0 : case 2: {
31076 0 : err = fd_addrlut_extend_encode( &self->extend_lut, ctx );
31077 0 : if( FD_UNLIKELY( err ) ) return err;
31078 0 : break;
31079 0 : }
31080 0 : }
31081 0 : return FD_BINCODE_SUCCESS;
31082 0 : }
31083 0 : int fd_addrlut_instruction_encode( fd_addrlut_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
31084 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
31085 0 : if( FD_UNLIKELY( err ) ) return err;
31086 0 : return fd_addrlut_instruction_inner_encode( &self->inner, self->discriminant, ctx );
31087 0 : }
31088 :
31089 0 : int fd_repair_request_header_encode( fd_repair_request_header_t const * self, fd_bincode_encode_ctx_t * ctx ) {
31090 0 : int err;
31091 0 : err = fd_signature_encode( &self->signature, ctx );
31092 0 : if( FD_UNLIKELY( err ) ) return err;
31093 0 : err = fd_pubkey_encode( &self->sender, ctx );
31094 0 : if( FD_UNLIKELY( err ) ) return err;
31095 0 : err = fd_pubkey_encode( &self->recipient, ctx );
31096 0 : if( FD_UNLIKELY( err ) ) return err;
31097 0 : err = fd_bincode_uint64_encode( (ulong)self->timestamp, ctx );
31098 0 : if( FD_UNLIKELY( err ) ) return err;
31099 0 : err = fd_bincode_uint32_encode( self->nonce, ctx );
31100 0 : if( FD_UNLIKELY( err ) ) return err;
31101 0 : return FD_BINCODE_SUCCESS;
31102 0 : }
31103 0 : int fd_repair_request_header_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
31104 0 : *total_sz += sizeof(fd_repair_request_header_t);
31105 0 : void const * start_data = ctx->data;
31106 0 : int err = fd_repair_request_header_decode_footprint_inner( ctx, total_sz );
31107 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
31108 0 : ctx->data = start_data;
31109 0 : return err;
31110 0 : }
31111 0 : int fd_repair_request_header_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
31112 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
31113 0 : int err = 0;
31114 0 : err = fd_signature_decode_footprint_inner( ctx, total_sz );
31115 0 : if( FD_UNLIKELY( err ) ) return err;
31116 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
31117 0 : if( FD_UNLIKELY( err ) ) return err;
31118 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
31119 0 : if( FD_UNLIKELY( err ) ) return err;
31120 0 : err = fd_bincode_uint64_decode_footprint( ctx );
31121 0 : if( FD_UNLIKELY( err ) ) return err;
31122 0 : err = fd_bincode_uint32_decode_footprint( ctx );
31123 0 : if( FD_UNLIKELY( err ) ) return err;
31124 0 : return 0;
31125 0 : }
31126 0 : void * fd_repair_request_header_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
31127 0 : fd_repair_request_header_t * self = (fd_repair_request_header_t *)mem;
31128 0 : fd_repair_request_header_new( self );
31129 0 : void * alloc_region = (uchar *)mem + sizeof(fd_repair_request_header_t);
31130 0 : void * * alloc_mem = &alloc_region;
31131 0 : fd_repair_request_header_decode_inner( mem, alloc_mem, ctx );
31132 0 : return self;
31133 0 : }
31134 0 : void fd_repair_request_header_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
31135 0 : fd_repair_request_header_t * self = (fd_repair_request_header_t *)struct_mem;
31136 0 : fd_signature_decode_inner( &self->signature, alloc_mem, ctx );
31137 0 : fd_pubkey_decode_inner( &self->sender, alloc_mem, ctx );
31138 0 : fd_pubkey_decode_inner( &self->recipient, alloc_mem, ctx );
31139 0 : fd_bincode_uint64_decode_unsafe( (ulong *) &self->timestamp, ctx );
31140 0 : fd_bincode_uint32_decode_unsafe( &self->nonce, ctx );
31141 0 : }
31142 0 : void * fd_repair_request_header_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
31143 0 : fd_repair_request_header_global_t * self = (fd_repair_request_header_global_t *)mem;
31144 0 : fd_repair_request_header_new( (fd_repair_request_header_t *)self );
31145 0 : void * alloc_region = (uchar *)mem + sizeof(fd_repair_request_header_global_t);
31146 0 : void * * alloc_mem = &alloc_region;
31147 0 : fd_repair_request_header_decode_inner_global( mem, alloc_mem, ctx );
31148 0 : return self;
31149 0 : }
31150 0 : void fd_repair_request_header_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
31151 0 : fd_repair_request_header_global_t * self = (fd_repair_request_header_global_t *)struct_mem;
31152 0 : fd_signature_decode_inner_global( &self->signature, alloc_mem, ctx );
31153 0 : fd_pubkey_decode_inner_global( &self->sender, alloc_mem, ctx );
31154 0 : fd_pubkey_decode_inner_global( &self->recipient, alloc_mem, ctx );
31155 0 : fd_bincode_uint64_decode_unsafe( (ulong *) &self->timestamp, ctx );
31156 0 : fd_bincode_uint32_decode_unsafe( &self->nonce, ctx );
31157 0 : }
31158 0 : int fd_repair_request_header_convert_global_to_local( void const * global_self, fd_repair_request_header_t * self, fd_bincode_decode_ctx_t * ctx ) {
31159 0 : int err = 0;
31160 0 : fd_repair_request_header_global_t const * mem = (fd_repair_request_header_global_t const *)global_self;
31161 0 : err = fd_signature_convert_global_to_local( &mem->signature, &self->signature, ctx );
31162 0 : if( FD_UNLIKELY( err ) ) return err;
31163 0 : err = fd_pubkey_convert_global_to_local( &mem->sender, &self->sender, ctx );
31164 0 : if( FD_UNLIKELY( err ) ) return err;
31165 0 : err = fd_pubkey_convert_global_to_local( &mem->recipient, &self->recipient, ctx );
31166 0 : if( FD_UNLIKELY( err ) ) return err;
31167 0 : self->timestamp = mem->timestamp;
31168 0 : self->nonce = mem->nonce;
31169 0 : return FD_BINCODE_SUCCESS;
31170 0 : }
31171 0 : void fd_repair_request_header_new(fd_repair_request_header_t * self) {
31172 0 : fd_memset( self, 0, sizeof(fd_repair_request_header_t) );
31173 0 : fd_signature_new( &self->signature );
31174 0 : fd_pubkey_new( &self->sender );
31175 0 : fd_pubkey_new( &self->recipient );
31176 0 : }
31177 0 : void fd_repair_request_header_destroy( fd_repair_request_header_t * self ) {
31178 0 : fd_signature_destroy( &self->signature );
31179 0 : fd_pubkey_destroy( &self->sender );
31180 0 : fd_pubkey_destroy( &self->recipient );
31181 0 : }
31182 :
31183 0 : ulong fd_repair_request_header_footprint( void ){ return FD_REPAIR_REQUEST_HEADER_FOOTPRINT; }
31184 0 : ulong fd_repair_request_header_align( void ){ return FD_REPAIR_REQUEST_HEADER_ALIGN; }
31185 :
31186 0 : void fd_repair_request_header_walk( void * w, fd_repair_request_header_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
31187 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_repair_request_header", level++ );
31188 0 : fd_signature_walk( w, &self->signature, fun, "signature", level );
31189 0 : fd_pubkey_walk( w, &self->sender, fun, "sender", level );
31190 0 : fd_pubkey_walk( w, &self->recipient, fun, "recipient", level );
31191 0 : fun( w, &self->timestamp, "timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level );
31192 0 : fun( w, &self->nonce, "nonce", FD_FLAMENCO_TYPE_UINT, "uint", level );
31193 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_repair_request_header", level-- );
31194 0 : }
31195 0 : ulong fd_repair_request_header_size( fd_repair_request_header_t const * self ) {
31196 0 : ulong size = 0;
31197 0 : size += fd_signature_size( &self->signature );
31198 0 : size += fd_pubkey_size( &self->sender );
31199 0 : size += fd_pubkey_size( &self->recipient );
31200 0 : size += sizeof(long);
31201 0 : size += sizeof(uint);
31202 0 : return size;
31203 0 : }
31204 :
31205 0 : int fd_repair_window_index_encode( fd_repair_window_index_t const * self, fd_bincode_encode_ctx_t * ctx ) {
31206 0 : int err;
31207 0 : err = fd_repair_request_header_encode( &self->header, ctx );
31208 0 : if( FD_UNLIKELY( err ) ) return err;
31209 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
31210 0 : if( FD_UNLIKELY( err ) ) return err;
31211 0 : err = fd_bincode_uint64_encode( self->shred_index, ctx );
31212 0 : if( FD_UNLIKELY( err ) ) return err;
31213 0 : return FD_BINCODE_SUCCESS;
31214 0 : }
31215 0 : int fd_repair_window_index_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
31216 0 : *total_sz += sizeof(fd_repair_window_index_t);
31217 0 : void const * start_data = ctx->data;
31218 0 : int err = fd_repair_window_index_decode_footprint_inner( ctx, total_sz );
31219 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
31220 0 : ctx->data = start_data;
31221 0 : return err;
31222 0 : }
31223 0 : int fd_repair_window_index_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
31224 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
31225 0 : int err = 0;
31226 0 : err = fd_repair_request_header_decode_footprint_inner( ctx, total_sz );
31227 0 : if( FD_UNLIKELY( err ) ) return err;
31228 0 : err = fd_bincode_uint64_decode_footprint( ctx );
31229 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
31230 0 : err = fd_bincode_uint64_decode_footprint( ctx );
31231 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
31232 0 : return 0;
31233 0 : }
31234 0 : void * fd_repair_window_index_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
31235 0 : fd_repair_window_index_t * self = (fd_repair_window_index_t *)mem;
31236 0 : fd_repair_window_index_new( self );
31237 0 : void * alloc_region = (uchar *)mem + sizeof(fd_repair_window_index_t);
31238 0 : void * * alloc_mem = &alloc_region;
31239 0 : fd_repair_window_index_decode_inner( mem, alloc_mem, ctx );
31240 0 : return self;
31241 0 : }
31242 0 : void fd_repair_window_index_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
31243 0 : fd_repair_window_index_t * self = (fd_repair_window_index_t *)struct_mem;
31244 0 : fd_repair_request_header_decode_inner( &self->header, alloc_mem, ctx );
31245 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
31246 0 : fd_bincode_uint64_decode_unsafe( &self->shred_index, ctx );
31247 0 : }
31248 0 : void * fd_repair_window_index_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
31249 0 : fd_repair_window_index_global_t * self = (fd_repair_window_index_global_t *)mem;
31250 0 : fd_repair_window_index_new( (fd_repair_window_index_t *)self );
31251 0 : void * alloc_region = (uchar *)mem + sizeof(fd_repair_window_index_global_t);
31252 0 : void * * alloc_mem = &alloc_region;
31253 0 : fd_repair_window_index_decode_inner_global( mem, alloc_mem, ctx );
31254 0 : return self;
31255 0 : }
31256 0 : void fd_repair_window_index_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
31257 0 : fd_repair_window_index_global_t * self = (fd_repair_window_index_global_t *)struct_mem;
31258 0 : fd_repair_request_header_decode_inner_global( &self->header, alloc_mem, ctx );
31259 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
31260 0 : fd_bincode_uint64_decode_unsafe( &self->shred_index, ctx );
31261 0 : }
31262 0 : int fd_repair_window_index_convert_global_to_local( void const * global_self, fd_repair_window_index_t * self, fd_bincode_decode_ctx_t * ctx ) {
31263 0 : int err = 0;
31264 0 : fd_repair_window_index_global_t const * mem = (fd_repair_window_index_global_t const *)global_self;
31265 0 : err = fd_repair_request_header_convert_global_to_local( &mem->header, &self->header, ctx );
31266 0 : if( FD_UNLIKELY( err ) ) return err;
31267 0 : self->slot = mem->slot;
31268 0 : self->shred_index = mem->shred_index;
31269 0 : return FD_BINCODE_SUCCESS;
31270 0 : }
31271 0 : void fd_repair_window_index_new(fd_repair_window_index_t * self) {
31272 0 : fd_memset( self, 0, sizeof(fd_repair_window_index_t) );
31273 0 : fd_repair_request_header_new( &self->header );
31274 0 : }
31275 0 : void fd_repair_window_index_destroy( fd_repair_window_index_t * self ) {
31276 0 : fd_repair_request_header_destroy( &self->header );
31277 0 : }
31278 :
31279 0 : ulong fd_repair_window_index_footprint( void ){ return FD_REPAIR_WINDOW_INDEX_FOOTPRINT; }
31280 0 : ulong fd_repair_window_index_align( void ){ return FD_REPAIR_WINDOW_INDEX_ALIGN; }
31281 :
31282 0 : void fd_repair_window_index_walk( void * w, fd_repair_window_index_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
31283 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_repair_window_index", level++ );
31284 0 : fd_repair_request_header_walk( w, &self->header, fun, "header", level );
31285 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
31286 0 : fun( w, &self->shred_index, "shred_index", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
31287 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_repair_window_index", level-- );
31288 0 : }
31289 0 : ulong fd_repair_window_index_size( fd_repair_window_index_t const * self ) {
31290 0 : ulong size = 0;
31291 0 : size += fd_repair_request_header_size( &self->header );
31292 0 : size += sizeof(ulong);
31293 0 : size += sizeof(ulong);
31294 0 : return size;
31295 0 : }
31296 :
31297 0 : int fd_repair_highest_window_index_encode( fd_repair_highest_window_index_t const * self, fd_bincode_encode_ctx_t * ctx ) {
31298 0 : int err;
31299 0 : err = fd_repair_request_header_encode( &self->header, ctx );
31300 0 : if( FD_UNLIKELY( err ) ) return err;
31301 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
31302 0 : if( FD_UNLIKELY( err ) ) return err;
31303 0 : err = fd_bincode_uint64_encode( self->shred_index, ctx );
31304 0 : if( FD_UNLIKELY( err ) ) return err;
31305 0 : return FD_BINCODE_SUCCESS;
31306 0 : }
31307 0 : int fd_repair_highest_window_index_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
31308 0 : *total_sz += sizeof(fd_repair_highest_window_index_t);
31309 0 : void const * start_data = ctx->data;
31310 0 : int err = fd_repair_highest_window_index_decode_footprint_inner( ctx, total_sz );
31311 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
31312 0 : ctx->data = start_data;
31313 0 : return err;
31314 0 : }
31315 0 : int fd_repair_highest_window_index_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
31316 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
31317 0 : int err = 0;
31318 0 : err = fd_repair_request_header_decode_footprint_inner( ctx, total_sz );
31319 0 : if( FD_UNLIKELY( err ) ) return err;
31320 0 : err = fd_bincode_uint64_decode_footprint( ctx );
31321 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
31322 0 : err = fd_bincode_uint64_decode_footprint( ctx );
31323 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
31324 0 : return 0;
31325 0 : }
31326 0 : void * fd_repair_highest_window_index_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
31327 0 : fd_repair_highest_window_index_t * self = (fd_repair_highest_window_index_t *)mem;
31328 0 : fd_repair_highest_window_index_new( self );
31329 0 : void * alloc_region = (uchar *)mem + sizeof(fd_repair_highest_window_index_t);
31330 0 : void * * alloc_mem = &alloc_region;
31331 0 : fd_repair_highest_window_index_decode_inner( mem, alloc_mem, ctx );
31332 0 : return self;
31333 0 : }
31334 0 : void fd_repair_highest_window_index_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
31335 0 : fd_repair_highest_window_index_t * self = (fd_repair_highest_window_index_t *)struct_mem;
31336 0 : fd_repair_request_header_decode_inner( &self->header, alloc_mem, ctx );
31337 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
31338 0 : fd_bincode_uint64_decode_unsafe( &self->shred_index, ctx );
31339 0 : }
31340 0 : void * fd_repair_highest_window_index_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
31341 0 : fd_repair_highest_window_index_global_t * self = (fd_repair_highest_window_index_global_t *)mem;
31342 0 : fd_repair_highest_window_index_new( (fd_repair_highest_window_index_t *)self );
31343 0 : void * alloc_region = (uchar *)mem + sizeof(fd_repair_highest_window_index_global_t);
31344 0 : void * * alloc_mem = &alloc_region;
31345 0 : fd_repair_highest_window_index_decode_inner_global( mem, alloc_mem, ctx );
31346 0 : return self;
31347 0 : }
31348 0 : void fd_repair_highest_window_index_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
31349 0 : fd_repair_highest_window_index_global_t * self = (fd_repair_highest_window_index_global_t *)struct_mem;
31350 0 : fd_repair_request_header_decode_inner_global( &self->header, alloc_mem, ctx );
31351 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
31352 0 : fd_bincode_uint64_decode_unsafe( &self->shred_index, ctx );
31353 0 : }
31354 0 : int fd_repair_highest_window_index_convert_global_to_local( void const * global_self, fd_repair_highest_window_index_t * self, fd_bincode_decode_ctx_t * ctx ) {
31355 0 : int err = 0;
31356 0 : fd_repair_highest_window_index_global_t const * mem = (fd_repair_highest_window_index_global_t const *)global_self;
31357 0 : err = fd_repair_request_header_convert_global_to_local( &mem->header, &self->header, ctx );
31358 0 : if( FD_UNLIKELY( err ) ) return err;
31359 0 : self->slot = mem->slot;
31360 0 : self->shred_index = mem->shred_index;
31361 0 : return FD_BINCODE_SUCCESS;
31362 0 : }
31363 0 : void fd_repair_highest_window_index_new(fd_repair_highest_window_index_t * self) {
31364 0 : fd_memset( self, 0, sizeof(fd_repair_highest_window_index_t) );
31365 0 : fd_repair_request_header_new( &self->header );
31366 0 : }
31367 0 : void fd_repair_highest_window_index_destroy( fd_repair_highest_window_index_t * self ) {
31368 0 : fd_repair_request_header_destroy( &self->header );
31369 0 : }
31370 :
31371 0 : ulong fd_repair_highest_window_index_footprint( void ){ return FD_REPAIR_HIGHEST_WINDOW_INDEX_FOOTPRINT; }
31372 0 : ulong fd_repair_highest_window_index_align( void ){ return FD_REPAIR_HIGHEST_WINDOW_INDEX_ALIGN; }
31373 :
31374 0 : void fd_repair_highest_window_index_walk( void * w, fd_repair_highest_window_index_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
31375 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_repair_highest_window_index", level++ );
31376 0 : fd_repair_request_header_walk( w, &self->header, fun, "header", level );
31377 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
31378 0 : fun( w, &self->shred_index, "shred_index", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
31379 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_repair_highest_window_index", level-- );
31380 0 : }
31381 0 : ulong fd_repair_highest_window_index_size( fd_repair_highest_window_index_t const * self ) {
31382 0 : ulong size = 0;
31383 0 : size += fd_repair_request_header_size( &self->header );
31384 0 : size += sizeof(ulong);
31385 0 : size += sizeof(ulong);
31386 0 : return size;
31387 0 : }
31388 :
31389 0 : int fd_repair_orphan_encode( fd_repair_orphan_t const * self, fd_bincode_encode_ctx_t * ctx ) {
31390 0 : int err;
31391 0 : err = fd_repair_request_header_encode( &self->header, ctx );
31392 0 : if( FD_UNLIKELY( err ) ) return err;
31393 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
31394 0 : if( FD_UNLIKELY( err ) ) return err;
31395 0 : return FD_BINCODE_SUCCESS;
31396 0 : }
31397 0 : int fd_repair_orphan_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
31398 0 : *total_sz += sizeof(fd_repair_orphan_t);
31399 0 : void const * start_data = ctx->data;
31400 0 : int err = fd_repair_orphan_decode_footprint_inner( ctx, total_sz );
31401 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
31402 0 : ctx->data = start_data;
31403 0 : return err;
31404 0 : }
31405 0 : int fd_repair_orphan_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
31406 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
31407 0 : int err = 0;
31408 0 : err = fd_repair_request_header_decode_footprint_inner( ctx, total_sz );
31409 0 : if( FD_UNLIKELY( err ) ) return err;
31410 0 : err = fd_bincode_uint64_decode_footprint( ctx );
31411 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
31412 0 : return 0;
31413 0 : }
31414 0 : void * fd_repair_orphan_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
31415 0 : fd_repair_orphan_t * self = (fd_repair_orphan_t *)mem;
31416 0 : fd_repair_orphan_new( self );
31417 0 : void * alloc_region = (uchar *)mem + sizeof(fd_repair_orphan_t);
31418 0 : void * * alloc_mem = &alloc_region;
31419 0 : fd_repair_orphan_decode_inner( mem, alloc_mem, ctx );
31420 0 : return self;
31421 0 : }
31422 0 : void fd_repair_orphan_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
31423 0 : fd_repair_orphan_t * self = (fd_repair_orphan_t *)struct_mem;
31424 0 : fd_repair_request_header_decode_inner( &self->header, alloc_mem, ctx );
31425 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
31426 0 : }
31427 0 : void * fd_repair_orphan_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
31428 0 : fd_repair_orphan_global_t * self = (fd_repair_orphan_global_t *)mem;
31429 0 : fd_repair_orphan_new( (fd_repair_orphan_t *)self );
31430 0 : void * alloc_region = (uchar *)mem + sizeof(fd_repair_orphan_global_t);
31431 0 : void * * alloc_mem = &alloc_region;
31432 0 : fd_repair_orphan_decode_inner_global( mem, alloc_mem, ctx );
31433 0 : return self;
31434 0 : }
31435 0 : void fd_repair_orphan_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
31436 0 : fd_repair_orphan_global_t * self = (fd_repair_orphan_global_t *)struct_mem;
31437 0 : fd_repair_request_header_decode_inner_global( &self->header, alloc_mem, ctx );
31438 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
31439 0 : }
31440 0 : int fd_repair_orphan_convert_global_to_local( void const * global_self, fd_repair_orphan_t * self, fd_bincode_decode_ctx_t * ctx ) {
31441 0 : int err = 0;
31442 0 : fd_repair_orphan_global_t const * mem = (fd_repair_orphan_global_t const *)global_self;
31443 0 : err = fd_repair_request_header_convert_global_to_local( &mem->header, &self->header, ctx );
31444 0 : if( FD_UNLIKELY( err ) ) return err;
31445 0 : self->slot = mem->slot;
31446 0 : return FD_BINCODE_SUCCESS;
31447 0 : }
31448 0 : void fd_repair_orphan_new(fd_repair_orphan_t * self) {
31449 0 : fd_memset( self, 0, sizeof(fd_repair_orphan_t) );
31450 0 : fd_repair_request_header_new( &self->header );
31451 0 : }
31452 0 : void fd_repair_orphan_destroy( fd_repair_orphan_t * self ) {
31453 0 : fd_repair_request_header_destroy( &self->header );
31454 0 : }
31455 :
31456 0 : ulong fd_repair_orphan_footprint( void ){ return FD_REPAIR_ORPHAN_FOOTPRINT; }
31457 0 : ulong fd_repair_orphan_align( void ){ return FD_REPAIR_ORPHAN_ALIGN; }
31458 :
31459 0 : void fd_repair_orphan_walk( void * w, fd_repair_orphan_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
31460 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_repair_orphan", level++ );
31461 0 : fd_repair_request_header_walk( w, &self->header, fun, "header", level );
31462 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
31463 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_repair_orphan", level-- );
31464 0 : }
31465 0 : ulong fd_repair_orphan_size( fd_repair_orphan_t const * self ) {
31466 0 : ulong size = 0;
31467 0 : size += fd_repair_request_header_size( &self->header );
31468 0 : size += sizeof(ulong);
31469 0 : return size;
31470 0 : }
31471 :
31472 0 : int fd_repair_ancestor_hashes_encode( fd_repair_ancestor_hashes_t const * self, fd_bincode_encode_ctx_t * ctx ) {
31473 0 : int err;
31474 0 : err = fd_repair_request_header_encode( &self->header, ctx );
31475 0 : if( FD_UNLIKELY( err ) ) return err;
31476 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
31477 0 : if( FD_UNLIKELY( err ) ) return err;
31478 0 : return FD_BINCODE_SUCCESS;
31479 0 : }
31480 0 : int fd_repair_ancestor_hashes_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
31481 0 : *total_sz += sizeof(fd_repair_ancestor_hashes_t);
31482 0 : void const * start_data = ctx->data;
31483 0 : int err = fd_repair_ancestor_hashes_decode_footprint_inner( ctx, total_sz );
31484 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
31485 0 : ctx->data = start_data;
31486 0 : return err;
31487 0 : }
31488 0 : int fd_repair_ancestor_hashes_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
31489 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
31490 0 : int err = 0;
31491 0 : err = fd_repair_request_header_decode_footprint_inner( ctx, total_sz );
31492 0 : if( FD_UNLIKELY( err ) ) return err;
31493 0 : err = fd_bincode_uint64_decode_footprint( ctx );
31494 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
31495 0 : return 0;
31496 0 : }
31497 0 : void * fd_repair_ancestor_hashes_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
31498 0 : fd_repair_ancestor_hashes_t * self = (fd_repair_ancestor_hashes_t *)mem;
31499 0 : fd_repair_ancestor_hashes_new( self );
31500 0 : void * alloc_region = (uchar *)mem + sizeof(fd_repair_ancestor_hashes_t);
31501 0 : void * * alloc_mem = &alloc_region;
31502 0 : fd_repair_ancestor_hashes_decode_inner( mem, alloc_mem, ctx );
31503 0 : return self;
31504 0 : }
31505 0 : void fd_repair_ancestor_hashes_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
31506 0 : fd_repair_ancestor_hashes_t * self = (fd_repair_ancestor_hashes_t *)struct_mem;
31507 0 : fd_repair_request_header_decode_inner( &self->header, alloc_mem, ctx );
31508 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
31509 0 : }
31510 0 : void * fd_repair_ancestor_hashes_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
31511 0 : fd_repair_ancestor_hashes_global_t * self = (fd_repair_ancestor_hashes_global_t *)mem;
31512 0 : fd_repair_ancestor_hashes_new( (fd_repair_ancestor_hashes_t *)self );
31513 0 : void * alloc_region = (uchar *)mem + sizeof(fd_repair_ancestor_hashes_global_t);
31514 0 : void * * alloc_mem = &alloc_region;
31515 0 : fd_repair_ancestor_hashes_decode_inner_global( mem, alloc_mem, ctx );
31516 0 : return self;
31517 0 : }
31518 0 : void fd_repair_ancestor_hashes_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
31519 0 : fd_repair_ancestor_hashes_global_t * self = (fd_repair_ancestor_hashes_global_t *)struct_mem;
31520 0 : fd_repair_request_header_decode_inner_global( &self->header, alloc_mem, ctx );
31521 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
31522 0 : }
31523 0 : int fd_repair_ancestor_hashes_convert_global_to_local( void const * global_self, fd_repair_ancestor_hashes_t * self, fd_bincode_decode_ctx_t * ctx ) {
31524 0 : int err = 0;
31525 0 : fd_repair_ancestor_hashes_global_t const * mem = (fd_repair_ancestor_hashes_global_t const *)global_self;
31526 0 : err = fd_repair_request_header_convert_global_to_local( &mem->header, &self->header, ctx );
31527 0 : if( FD_UNLIKELY( err ) ) return err;
31528 0 : self->slot = mem->slot;
31529 0 : return FD_BINCODE_SUCCESS;
31530 0 : }
31531 0 : void fd_repair_ancestor_hashes_new(fd_repair_ancestor_hashes_t * self) {
31532 0 : fd_memset( self, 0, sizeof(fd_repair_ancestor_hashes_t) );
31533 0 : fd_repair_request_header_new( &self->header );
31534 0 : }
31535 0 : void fd_repair_ancestor_hashes_destroy( fd_repair_ancestor_hashes_t * self ) {
31536 0 : fd_repair_request_header_destroy( &self->header );
31537 0 : }
31538 :
31539 0 : ulong fd_repair_ancestor_hashes_footprint( void ){ return FD_REPAIR_ANCESTOR_HASHES_FOOTPRINT; }
31540 0 : ulong fd_repair_ancestor_hashes_align( void ){ return FD_REPAIR_ANCESTOR_HASHES_ALIGN; }
31541 :
31542 0 : void fd_repair_ancestor_hashes_walk( void * w, fd_repair_ancestor_hashes_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
31543 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_repair_ancestor_hashes", level++ );
31544 0 : fd_repair_request_header_walk( w, &self->header, fun, "header", level );
31545 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
31546 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_repair_ancestor_hashes", level-- );
31547 0 : }
31548 0 : ulong fd_repair_ancestor_hashes_size( fd_repair_ancestor_hashes_t const * self ) {
31549 0 : ulong size = 0;
31550 0 : size += fd_repair_request_header_size( &self->header );
31551 0 : size += sizeof(ulong);
31552 0 : return size;
31553 0 : }
31554 :
31555 0 : FD_FN_PURE uchar fd_repair_protocol_is_LegacyWindowIndex(fd_repair_protocol_t const * self) {
31556 0 : return self->discriminant == 0;
31557 0 : }
31558 0 : FD_FN_PURE uchar fd_repair_protocol_is_LegacyHighestWindowIndex(fd_repair_protocol_t const * self) {
31559 0 : return self->discriminant == 1;
31560 0 : }
31561 0 : FD_FN_PURE uchar fd_repair_protocol_is_LegacyOrphan(fd_repair_protocol_t const * self) {
31562 0 : return self->discriminant == 2;
31563 0 : }
31564 0 : FD_FN_PURE uchar fd_repair_protocol_is_LegacyWindowIndexWithNonce(fd_repair_protocol_t const * self) {
31565 0 : return self->discriminant == 3;
31566 0 : }
31567 0 : FD_FN_PURE uchar fd_repair_protocol_is_LegacyHighestWindowIndexWithNonce(fd_repair_protocol_t const * self) {
31568 0 : return self->discriminant == 4;
31569 0 : }
31570 0 : FD_FN_PURE uchar fd_repair_protocol_is_LegacyOrphanWithNonce(fd_repair_protocol_t const * self) {
31571 0 : return self->discriminant == 5;
31572 0 : }
31573 0 : FD_FN_PURE uchar fd_repair_protocol_is_LegacyAncestorHashes(fd_repair_protocol_t const * self) {
31574 0 : return self->discriminant == 6;
31575 0 : }
31576 0 : FD_FN_PURE uchar fd_repair_protocol_is_pong(fd_repair_protocol_t const * self) {
31577 0 : return self->discriminant == 7;
31578 0 : }
31579 0 : FD_FN_PURE uchar fd_repair_protocol_is_window_index(fd_repair_protocol_t const * self) {
31580 0 : return self->discriminant == 8;
31581 0 : }
31582 0 : FD_FN_PURE uchar fd_repair_protocol_is_highest_window_index(fd_repair_protocol_t const * self) {
31583 0 : return self->discriminant == 9;
31584 0 : }
31585 0 : FD_FN_PURE uchar fd_repair_protocol_is_orphan(fd_repair_protocol_t const * self) {
31586 0 : return self->discriminant == 10;
31587 0 : }
31588 0 : FD_FN_PURE uchar fd_repair_protocol_is_ancestor_hashes(fd_repair_protocol_t const * self) {
31589 0 : return self->discriminant == 11;
31590 0 : }
31591 : void fd_repair_protocol_inner_new( fd_repair_protocol_inner_t * self, uint discriminant );
31592 0 : int fd_repair_protocol_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
31593 0 : int err;
31594 0 : switch (discriminant) {
31595 0 : case 0: {
31596 0 : return FD_BINCODE_SUCCESS;
31597 0 : }
31598 0 : case 1: {
31599 0 : return FD_BINCODE_SUCCESS;
31600 0 : }
31601 0 : case 2: {
31602 0 : return FD_BINCODE_SUCCESS;
31603 0 : }
31604 0 : case 3: {
31605 0 : return FD_BINCODE_SUCCESS;
31606 0 : }
31607 0 : case 4: {
31608 0 : return FD_BINCODE_SUCCESS;
31609 0 : }
31610 0 : case 5: {
31611 0 : return FD_BINCODE_SUCCESS;
31612 0 : }
31613 0 : case 6: {
31614 0 : return FD_BINCODE_SUCCESS;
31615 0 : }
31616 0 : case 7: {
31617 0 : err = fd_gossip_ping_decode_footprint_inner( ctx, total_sz );
31618 0 : if( FD_UNLIKELY( err ) ) return err;
31619 0 : return FD_BINCODE_SUCCESS;
31620 0 : }
31621 0 : case 8: {
31622 0 : err = fd_repair_window_index_decode_footprint_inner( ctx, total_sz );
31623 0 : if( FD_UNLIKELY( err ) ) return err;
31624 0 : return FD_BINCODE_SUCCESS;
31625 0 : }
31626 0 : case 9: {
31627 0 : err = fd_repair_highest_window_index_decode_footprint_inner( ctx, total_sz );
31628 0 : if( FD_UNLIKELY( err ) ) return err;
31629 0 : return FD_BINCODE_SUCCESS;
31630 0 : }
31631 0 : case 10: {
31632 0 : err = fd_repair_orphan_decode_footprint_inner( ctx, total_sz );
31633 0 : if( FD_UNLIKELY( err ) ) return err;
31634 0 : return FD_BINCODE_SUCCESS;
31635 0 : }
31636 0 : case 11: {
31637 0 : err = fd_repair_ancestor_hashes_decode_footprint_inner( ctx, total_sz );
31638 0 : if( FD_UNLIKELY( err ) ) return err;
31639 0 : return FD_BINCODE_SUCCESS;
31640 0 : }
31641 0 : default: return FD_BINCODE_ERR_ENCODING;
31642 0 : }
31643 0 : }
31644 0 : int fd_repair_protocol_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
31645 0 : *total_sz += sizeof(fd_repair_protocol_t);
31646 0 : void const * start_data = ctx->data;
31647 0 : int err = fd_repair_protocol_decode_footprint_inner( ctx, total_sz );
31648 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
31649 0 : ctx->data = start_data;
31650 0 : return err;
31651 0 : }
31652 0 : int fd_repair_protocol_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
31653 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
31654 0 : uint discriminant = 0;
31655 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
31656 0 : if( FD_UNLIKELY( err ) ) return err;
31657 0 : return fd_repair_protocol_inner_decode_footprint( discriminant, ctx, total_sz );
31658 0 : }
31659 0 : void fd_repair_protocol_inner_decode_inner( fd_repair_protocol_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
31660 0 : switch (discriminant) {
31661 0 : case 0: {
31662 0 : break;
31663 0 : }
31664 0 : case 1: {
31665 0 : break;
31666 0 : }
31667 0 : case 2: {
31668 0 : break;
31669 0 : }
31670 0 : case 3: {
31671 0 : break;
31672 0 : }
31673 0 : case 4: {
31674 0 : break;
31675 0 : }
31676 0 : case 5: {
31677 0 : break;
31678 0 : }
31679 0 : case 6: {
31680 0 : break;
31681 0 : }
31682 0 : case 7: {
31683 0 : fd_gossip_ping_decode_inner( &self->pong, alloc_mem, ctx );
31684 0 : break;
31685 0 : }
31686 0 : case 8: {
31687 0 : fd_repair_window_index_decode_inner( &self->window_index, alloc_mem, ctx );
31688 0 : break;
31689 0 : }
31690 0 : case 9: {
31691 0 : fd_repair_highest_window_index_decode_inner( &self->highest_window_index, alloc_mem, ctx );
31692 0 : break;
31693 0 : }
31694 0 : case 10: {
31695 0 : fd_repair_orphan_decode_inner( &self->orphan, alloc_mem, ctx );
31696 0 : break;
31697 0 : }
31698 0 : case 11: {
31699 0 : fd_repair_ancestor_hashes_decode_inner( &self->ancestor_hashes, alloc_mem, ctx );
31700 0 : break;
31701 0 : }
31702 0 : }
31703 0 : }
31704 0 : void fd_repair_protocol_inner_decode_inner_global( fd_repair_protocol_inner_global_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
31705 0 : switch (discriminant) {
31706 0 : case 0: {
31707 0 : break;
31708 0 : }
31709 0 : case 1: {
31710 0 : break;
31711 0 : }
31712 0 : case 2: {
31713 0 : break;
31714 0 : }
31715 0 : case 3: {
31716 0 : break;
31717 0 : }
31718 0 : case 4: {
31719 0 : break;
31720 0 : }
31721 0 : case 5: {
31722 0 : break;
31723 0 : }
31724 0 : case 6: {
31725 0 : break;
31726 0 : }
31727 0 : case 7: {
31728 0 : fd_gossip_ping_decode_inner_global( &self->pong, alloc_mem, ctx );
31729 0 : break;
31730 0 : }
31731 0 : case 8: {
31732 0 : fd_repair_window_index_decode_inner_global( &self->window_index, alloc_mem, ctx );
31733 0 : break;
31734 0 : }
31735 0 : case 9: {
31736 0 : fd_repair_highest_window_index_decode_inner_global( &self->highest_window_index, alloc_mem, ctx );
31737 0 : break;
31738 0 : }
31739 0 : case 10: {
31740 0 : fd_repair_orphan_decode_inner_global( &self->orphan, alloc_mem, ctx );
31741 0 : break;
31742 0 : }
31743 0 : case 11: {
31744 0 : fd_repair_ancestor_hashes_decode_inner_global( &self->ancestor_hashes, alloc_mem, ctx );
31745 0 : break;
31746 0 : }
31747 0 : }
31748 0 : }
31749 0 : int fd_repair_protocol_convert_global_to_local_inner( fd_repair_protocol_inner_global_t const * mem, fd_repair_protocol_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
31750 0 : int err = 0;
31751 0 : switch( discriminant ) {
31752 0 : case 0: {
31753 0 : break;
31754 0 : }
31755 0 : case 1: {
31756 0 : break;
31757 0 : }
31758 0 : case 2: {
31759 0 : break;
31760 0 : }
31761 0 : case 3: {
31762 0 : break;
31763 0 : }
31764 0 : case 4: {
31765 0 : break;
31766 0 : }
31767 0 : case 5: {
31768 0 : break;
31769 0 : }
31770 0 : case 6: {
31771 0 : break;
31772 0 : }
31773 0 : case 7: {
31774 0 : err = fd_gossip_ping_convert_global_to_local( &mem->pong, &self->pong, ctx );
31775 0 : if( FD_UNLIKELY( err ) ) return err;
31776 0 : break;
31777 0 : }
31778 0 : case 8: {
31779 0 : err = fd_repair_window_index_convert_global_to_local( &mem->window_index, &self->window_index, ctx );
31780 0 : if( FD_UNLIKELY( err ) ) return err;
31781 0 : break;
31782 0 : }
31783 0 : case 9: {
31784 0 : err = fd_repair_highest_window_index_convert_global_to_local( &mem->highest_window_index, &self->highest_window_index, ctx );
31785 0 : if( FD_UNLIKELY( err ) ) return err;
31786 0 : break;
31787 0 : }
31788 0 : case 10: {
31789 0 : err = fd_repair_orphan_convert_global_to_local( &mem->orphan, &self->orphan, ctx );
31790 0 : if( FD_UNLIKELY( err ) ) return err;
31791 0 : break;
31792 0 : }
31793 0 : case 11: {
31794 0 : err = fd_repair_ancestor_hashes_convert_global_to_local( &mem->ancestor_hashes, &self->ancestor_hashes, ctx );
31795 0 : if( FD_UNLIKELY( err ) ) return err;
31796 0 : break;
31797 0 : }
31798 0 : }
31799 0 : return FD_BINCODE_SUCCESS;
31800 0 : }
31801 0 : int fd_repair_protocol_convert_global_to_local( void const * global_self, fd_repair_protocol_t * self, fd_bincode_decode_ctx_t * ctx ) {
31802 0 : fd_repair_protocol_global_t const * mem = (fd_repair_protocol_global_t const *)global_self;
31803 0 : uint discriminant = mem->discriminant;
31804 0 : self->discriminant = mem->discriminant;
31805 0 : int err = fd_repair_protocol_convert_global_to_local_inner( &mem->inner, &self->inner, discriminant, ctx );
31806 0 : return FD_BINCODE_SUCCESS;
31807 0 : }
31808 0 : void fd_repair_protocol_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
31809 0 : fd_repair_protocol_t * self = (fd_repair_protocol_t *)struct_mem;
31810 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
31811 0 : fd_repair_protocol_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
31812 0 : }
31813 0 : void * fd_repair_protocol_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
31814 0 : fd_repair_protocol_t * self = (fd_repair_protocol_t *)mem;
31815 0 : fd_repair_protocol_new( self );
31816 0 : void * alloc_region = (uchar *)mem + sizeof(fd_repair_protocol_t);
31817 0 : void * * alloc_mem = &alloc_region;
31818 0 : fd_repair_protocol_decode_inner( mem, alloc_mem, ctx );
31819 0 : return self;
31820 0 : }
31821 0 : void * fd_repair_protocol_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
31822 0 : fd_repair_protocol_t * self = (fd_repair_protocol_t *)mem;
31823 0 : fd_repair_protocol_new( self );
31824 0 : void * alloc_region = (uchar *)mem + sizeof(fd_repair_protocol_t);
31825 0 : void * * alloc_mem = &alloc_region;
31826 0 : fd_repair_protocol_decode_inner_global( mem, alloc_mem, ctx );
31827 0 : return self;
31828 0 : }
31829 0 : void fd_repair_protocol_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
31830 0 : fd_repair_protocol_global_t * self = (fd_repair_protocol_global_t *)struct_mem;
31831 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
31832 0 : fd_repair_protocol_inner_decode_inner_global( &self->inner, alloc_mem, self->discriminant, ctx );
31833 0 : }
31834 0 : void fd_repair_protocol_inner_new( fd_repair_protocol_inner_t * self, uint discriminant ) {
31835 0 : switch( discriminant ) {
31836 0 : case 0: {
31837 0 : break;
31838 0 : }
31839 0 : case 1: {
31840 0 : break;
31841 0 : }
31842 0 : case 2: {
31843 0 : break;
31844 0 : }
31845 0 : case 3: {
31846 0 : break;
31847 0 : }
31848 0 : case 4: {
31849 0 : break;
31850 0 : }
31851 0 : case 5: {
31852 0 : break;
31853 0 : }
31854 0 : case 6: {
31855 0 : break;
31856 0 : }
31857 0 : case 7: {
31858 0 : fd_gossip_ping_new( &self->pong );
31859 0 : break;
31860 0 : }
31861 0 : case 8: {
31862 0 : fd_repair_window_index_new( &self->window_index );
31863 0 : break;
31864 0 : }
31865 0 : case 9: {
31866 0 : fd_repair_highest_window_index_new( &self->highest_window_index );
31867 0 : break;
31868 0 : }
31869 0 : case 10: {
31870 0 : fd_repair_orphan_new( &self->orphan );
31871 0 : break;
31872 0 : }
31873 0 : case 11: {
31874 0 : fd_repair_ancestor_hashes_new( &self->ancestor_hashes );
31875 0 : break;
31876 0 : }
31877 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
31878 0 : }
31879 0 : }
31880 0 : void fd_repair_protocol_new_disc( fd_repair_protocol_t * self, uint discriminant ) {
31881 0 : self->discriminant = discriminant;
31882 0 : fd_repair_protocol_inner_new( &self->inner, self->discriminant );
31883 0 : }
31884 0 : void fd_repair_protocol_new( fd_repair_protocol_t * self ) {
31885 0 : fd_memset( self, 0, sizeof(fd_repair_protocol_t) );
31886 0 : fd_repair_protocol_new_disc( self, UINT_MAX );
31887 0 : }
31888 0 : void fd_repair_protocol_inner_destroy( fd_repair_protocol_inner_t * self, uint discriminant ) {
31889 0 : switch( discriminant ) {
31890 0 : case 7: {
31891 0 : fd_gossip_ping_destroy( &self->pong );
31892 0 : break;
31893 0 : }
31894 0 : case 8: {
31895 0 : fd_repair_window_index_destroy( &self->window_index );
31896 0 : break;
31897 0 : }
31898 0 : case 9: {
31899 0 : fd_repair_highest_window_index_destroy( &self->highest_window_index );
31900 0 : break;
31901 0 : }
31902 0 : case 10: {
31903 0 : fd_repair_orphan_destroy( &self->orphan );
31904 0 : break;
31905 0 : }
31906 0 : case 11: {
31907 0 : fd_repair_ancestor_hashes_destroy( &self->ancestor_hashes );
31908 0 : break;
31909 0 : }
31910 0 : default: break; // FD_LOG_ERR(( "unhandled type" ));
31911 0 : }
31912 0 : }
31913 0 : void fd_repair_protocol_destroy( fd_repair_protocol_t * self ) {
31914 0 : fd_repair_protocol_inner_destroy( &self->inner, self->discriminant );
31915 0 : }
31916 :
31917 0 : ulong fd_repair_protocol_footprint( void ){ return FD_REPAIR_PROTOCOL_FOOTPRINT; }
31918 0 : ulong fd_repair_protocol_align( void ){ return FD_REPAIR_PROTOCOL_ALIGN; }
31919 :
31920 0 : void fd_repair_protocol_walk( void * w, fd_repair_protocol_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
31921 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_repair_protocol", level++);
31922 0 : switch( self->discriminant ) {
31923 0 : case 0: {
31924 0 : fun( w, self, "LegacyWindowIndex", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31925 0 : break;
31926 0 : }
31927 0 : case 1: {
31928 0 : fun( w, self, "LegacyHighestWindowIndex", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31929 0 : break;
31930 0 : }
31931 0 : case 2: {
31932 0 : fun( w, self, "LegacyOrphan", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31933 0 : break;
31934 0 : }
31935 0 : case 3: {
31936 0 : fun( w, self, "LegacyWindowIndexWithNonce", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31937 0 : break;
31938 0 : }
31939 0 : case 4: {
31940 0 : fun( w, self, "LegacyHighestWindowIndexWithNonce", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31941 0 : break;
31942 0 : }
31943 0 : case 5: {
31944 0 : fun( w, self, "LegacyOrphanWithNonce", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31945 0 : break;
31946 0 : }
31947 0 : case 6: {
31948 0 : fun( w, self, "LegacyAncestorHashes", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31949 0 : break;
31950 0 : }
31951 0 : case 7: {
31952 0 : fun( w, self, "pong", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31953 0 : fd_gossip_ping_walk( w, &self->inner.pong, fun, "pong", level );
31954 0 : break;
31955 0 : }
31956 0 : case 8: {
31957 0 : fun( w, self, "window_index", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31958 0 : fd_repair_window_index_walk( w, &self->inner.window_index, fun, "window_index", level );
31959 0 : break;
31960 0 : }
31961 0 : case 9: {
31962 0 : fun( w, self, "highest_window_index", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31963 0 : fd_repair_highest_window_index_walk( w, &self->inner.highest_window_index, fun, "highest_window_index", level );
31964 0 : break;
31965 0 : }
31966 0 : case 10: {
31967 0 : fun( w, self, "orphan", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31968 0 : fd_repair_orphan_walk( w, &self->inner.orphan, fun, "orphan", level );
31969 0 : break;
31970 0 : }
31971 0 : case 11: {
31972 0 : fun( w, self, "ancestor_hashes", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31973 0 : fd_repair_ancestor_hashes_walk( w, &self->inner.ancestor_hashes, fun, "ancestor_hashes", level );
31974 0 : break;
31975 0 : }
31976 0 : }
31977 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_repair_protocol", level-- );
31978 0 : }
31979 0 : ulong fd_repair_protocol_size( fd_repair_protocol_t const * self ) {
31980 0 : ulong size = 0;
31981 0 : size += sizeof(uint);
31982 0 : switch (self->discriminant) {
31983 0 : case 7: {
31984 0 : size += fd_gossip_ping_size( &self->inner.pong );
31985 0 : break;
31986 0 : }
31987 0 : case 8: {
31988 0 : size += fd_repair_window_index_size( &self->inner.window_index );
31989 0 : break;
31990 0 : }
31991 0 : case 9: {
31992 0 : size += fd_repair_highest_window_index_size( &self->inner.highest_window_index );
31993 0 : break;
31994 0 : }
31995 0 : case 10: {
31996 0 : size += fd_repair_orphan_size( &self->inner.orphan );
31997 0 : break;
31998 0 : }
31999 0 : case 11: {
32000 0 : size += fd_repair_ancestor_hashes_size( &self->inner.ancestor_hashes );
32001 0 : break;
32002 0 : }
32003 0 : }
32004 0 : return size;
32005 0 : }
32006 :
32007 0 : int fd_repair_protocol_inner_encode( fd_repair_protocol_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
32008 0 : int err;
32009 0 : switch (discriminant) {
32010 0 : case 7: {
32011 0 : err = fd_gossip_ping_encode( &self->pong, ctx );
32012 0 : if( FD_UNLIKELY( err ) ) return err;
32013 0 : break;
32014 0 : }
32015 0 : case 8: {
32016 0 : err = fd_repair_window_index_encode( &self->window_index, ctx );
32017 0 : if( FD_UNLIKELY( err ) ) return err;
32018 0 : break;
32019 0 : }
32020 0 : case 9: {
32021 0 : err = fd_repair_highest_window_index_encode( &self->highest_window_index, ctx );
32022 0 : if( FD_UNLIKELY( err ) ) return err;
32023 0 : break;
32024 0 : }
32025 0 : case 10: {
32026 0 : err = fd_repair_orphan_encode( &self->orphan, ctx );
32027 0 : if( FD_UNLIKELY( err ) ) return err;
32028 0 : break;
32029 0 : }
32030 0 : case 11: {
32031 0 : err = fd_repair_ancestor_hashes_encode( &self->ancestor_hashes, ctx );
32032 0 : if( FD_UNLIKELY( err ) ) return err;
32033 0 : break;
32034 0 : }
32035 0 : }
32036 0 : return FD_BINCODE_SUCCESS;
32037 0 : }
32038 0 : int fd_repair_protocol_encode( fd_repair_protocol_t const * self, fd_bincode_encode_ctx_t * ctx ) {
32039 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
32040 0 : if( FD_UNLIKELY( err ) ) return err;
32041 0 : return fd_repair_protocol_inner_encode( &self->inner, self->discriminant, ctx );
32042 0 : }
32043 :
32044 0 : FD_FN_PURE uchar fd_repair_response_is_ping(fd_repair_response_t const * self) {
32045 0 : return self->discriminant == 0;
32046 0 : }
32047 : void fd_repair_response_inner_new( fd_repair_response_inner_t * self, uint discriminant );
32048 0 : int fd_repair_response_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
32049 0 : int err;
32050 0 : switch (discriminant) {
32051 0 : case 0: {
32052 0 : err = fd_gossip_ping_decode_footprint_inner( ctx, total_sz );
32053 0 : if( FD_UNLIKELY( err ) ) return err;
32054 0 : return FD_BINCODE_SUCCESS;
32055 0 : }
32056 0 : default: return FD_BINCODE_ERR_ENCODING;
32057 0 : }
32058 0 : }
32059 0 : int fd_repair_response_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
32060 0 : *total_sz += sizeof(fd_repair_response_t);
32061 0 : void const * start_data = ctx->data;
32062 0 : int err = fd_repair_response_decode_footprint_inner( ctx, total_sz );
32063 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
32064 0 : ctx->data = start_data;
32065 0 : return err;
32066 0 : }
32067 0 : int fd_repair_response_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
32068 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
32069 0 : uint discriminant = 0;
32070 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
32071 0 : if( FD_UNLIKELY( err ) ) return err;
32072 0 : return fd_repair_response_inner_decode_footprint( discriminant, ctx, total_sz );
32073 0 : }
32074 0 : void fd_repair_response_inner_decode_inner( fd_repair_response_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
32075 0 : switch (discriminant) {
32076 0 : case 0: {
32077 0 : fd_gossip_ping_decode_inner( &self->ping, alloc_mem, ctx );
32078 0 : break;
32079 0 : }
32080 0 : }
32081 0 : }
32082 0 : void fd_repair_response_inner_decode_inner_global( fd_repair_response_inner_global_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
32083 0 : switch (discriminant) {
32084 0 : case 0: {
32085 0 : fd_gossip_ping_decode_inner_global( &self->ping, alloc_mem, ctx );
32086 0 : break;
32087 0 : }
32088 0 : }
32089 0 : }
32090 0 : int fd_repair_response_convert_global_to_local_inner( fd_repair_response_inner_global_t const * mem, fd_repair_response_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
32091 0 : int err = 0;
32092 0 : switch( discriminant ) {
32093 0 : case 0: {
32094 0 : err = fd_gossip_ping_convert_global_to_local( &mem->ping, &self->ping, ctx );
32095 0 : if( FD_UNLIKELY( err ) ) return err;
32096 0 : break;
32097 0 : }
32098 0 : }
32099 0 : return FD_BINCODE_SUCCESS;
32100 0 : }
32101 0 : int fd_repair_response_convert_global_to_local( void const * global_self, fd_repair_response_t * self, fd_bincode_decode_ctx_t * ctx ) {
32102 0 : fd_repair_response_global_t const * mem = (fd_repair_response_global_t const *)global_self;
32103 0 : uint discriminant = mem->discriminant;
32104 0 : self->discriminant = mem->discriminant;
32105 0 : int err = fd_repair_response_convert_global_to_local_inner( &mem->inner, &self->inner, discriminant, ctx );
32106 0 : return FD_BINCODE_SUCCESS;
32107 0 : }
32108 0 : void fd_repair_response_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
32109 0 : fd_repair_response_t * self = (fd_repair_response_t *)struct_mem;
32110 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
32111 0 : fd_repair_response_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
32112 0 : }
32113 0 : void * fd_repair_response_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
32114 0 : fd_repair_response_t * self = (fd_repair_response_t *)mem;
32115 0 : fd_repair_response_new( self );
32116 0 : void * alloc_region = (uchar *)mem + sizeof(fd_repair_response_t);
32117 0 : void * * alloc_mem = &alloc_region;
32118 0 : fd_repair_response_decode_inner( mem, alloc_mem, ctx );
32119 0 : return self;
32120 0 : }
32121 0 : void * fd_repair_response_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
32122 0 : fd_repair_response_t * self = (fd_repair_response_t *)mem;
32123 0 : fd_repair_response_new( self );
32124 0 : void * alloc_region = (uchar *)mem + sizeof(fd_repair_response_t);
32125 0 : void * * alloc_mem = &alloc_region;
32126 0 : fd_repair_response_decode_inner_global( mem, alloc_mem, ctx );
32127 0 : return self;
32128 0 : }
32129 0 : void fd_repair_response_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
32130 0 : fd_repair_response_global_t * self = (fd_repair_response_global_t *)struct_mem;
32131 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
32132 0 : fd_repair_response_inner_decode_inner_global( &self->inner, alloc_mem, self->discriminant, ctx );
32133 0 : }
32134 0 : void fd_repair_response_inner_new( fd_repair_response_inner_t * self, uint discriminant ) {
32135 0 : switch( discriminant ) {
32136 0 : case 0: {
32137 0 : fd_gossip_ping_new( &self->ping );
32138 0 : break;
32139 0 : }
32140 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
32141 0 : }
32142 0 : }
32143 0 : void fd_repair_response_new_disc( fd_repair_response_t * self, uint discriminant ) {
32144 0 : self->discriminant = discriminant;
32145 0 : fd_repair_response_inner_new( &self->inner, self->discriminant );
32146 0 : }
32147 0 : void fd_repair_response_new( fd_repair_response_t * self ) {
32148 0 : fd_memset( self, 0, sizeof(fd_repair_response_t) );
32149 0 : fd_repair_response_new_disc( self, UINT_MAX );
32150 0 : }
32151 0 : void fd_repair_response_inner_destroy( fd_repair_response_inner_t * self, uint discriminant ) {
32152 0 : switch( discriminant ) {
32153 0 : case 0: {
32154 0 : fd_gossip_ping_destroy( &self->ping );
32155 0 : break;
32156 0 : }
32157 0 : default: break; // FD_LOG_ERR(( "unhandled type" ));
32158 0 : }
32159 0 : }
32160 0 : void fd_repair_response_destroy( fd_repair_response_t * self ) {
32161 0 : fd_repair_response_inner_destroy( &self->inner, self->discriminant );
32162 0 : }
32163 :
32164 0 : ulong fd_repair_response_footprint( void ){ return FD_REPAIR_RESPONSE_FOOTPRINT; }
32165 0 : ulong fd_repair_response_align( void ){ return FD_REPAIR_RESPONSE_ALIGN; }
32166 :
32167 0 : void fd_repair_response_walk( void * w, fd_repair_response_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
32168 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_repair_response", level++);
32169 0 : switch( self->discriminant ) {
32170 0 : case 0: {
32171 0 : fun( w, self, "ping", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
32172 0 : fd_gossip_ping_walk( w, &self->inner.ping, fun, "ping", level );
32173 0 : break;
32174 0 : }
32175 0 : }
32176 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_repair_response", level-- );
32177 0 : }
32178 0 : ulong fd_repair_response_size( fd_repair_response_t const * self ) {
32179 0 : ulong size = 0;
32180 0 : size += sizeof(uint);
32181 0 : switch (self->discriminant) {
32182 0 : case 0: {
32183 0 : size += fd_gossip_ping_size( &self->inner.ping );
32184 0 : break;
32185 0 : }
32186 0 : }
32187 0 : return size;
32188 0 : }
32189 :
32190 0 : int fd_repair_response_inner_encode( fd_repair_response_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
32191 0 : int err;
32192 0 : switch (discriminant) {
32193 0 : case 0: {
32194 0 : err = fd_gossip_ping_encode( &self->ping, ctx );
32195 0 : if( FD_UNLIKELY( err ) ) return err;
32196 0 : break;
32197 0 : }
32198 0 : }
32199 0 : return FD_BINCODE_SUCCESS;
32200 0 : }
32201 0 : int fd_repair_response_encode( fd_repair_response_t const * self, fd_bincode_encode_ctx_t * ctx ) {
32202 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
32203 0 : if( FD_UNLIKELY( err ) ) return err;
32204 0 : return fd_repair_response_inner_encode( &self->inner, self->discriminant, ctx );
32205 0 : }
32206 :
32207 0 : FD_FN_PURE uchar fd_instr_error_enum_is_generic_error(fd_instr_error_enum_t const * self) {
32208 0 : return self->discriminant == 0;
32209 0 : }
32210 0 : FD_FN_PURE uchar fd_instr_error_enum_is_invalid_argument(fd_instr_error_enum_t const * self) {
32211 0 : return self->discriminant == 1;
32212 0 : }
32213 0 : FD_FN_PURE uchar fd_instr_error_enum_is_invalid_instruction_data(fd_instr_error_enum_t const * self) {
32214 0 : return self->discriminant == 2;
32215 0 : }
32216 0 : FD_FN_PURE uchar fd_instr_error_enum_is_invalid_account_data(fd_instr_error_enum_t const * self) {
32217 0 : return self->discriminant == 3;
32218 0 : }
32219 0 : FD_FN_PURE uchar fd_instr_error_enum_is_account_data_too_small(fd_instr_error_enum_t const * self) {
32220 0 : return self->discriminant == 4;
32221 0 : }
32222 0 : FD_FN_PURE uchar fd_instr_error_enum_is_insufficient_funds(fd_instr_error_enum_t const * self) {
32223 0 : return self->discriminant == 5;
32224 0 : }
32225 0 : FD_FN_PURE uchar fd_instr_error_enum_is_incorrect_program_id(fd_instr_error_enum_t const * self) {
32226 0 : return self->discriminant == 6;
32227 0 : }
32228 0 : FD_FN_PURE uchar fd_instr_error_enum_is_missing_required_signature(fd_instr_error_enum_t const * self) {
32229 0 : return self->discriminant == 7;
32230 0 : }
32231 0 : FD_FN_PURE uchar fd_instr_error_enum_is_account_already_initialized(fd_instr_error_enum_t const * self) {
32232 0 : return self->discriminant == 8;
32233 0 : }
32234 0 : FD_FN_PURE uchar fd_instr_error_enum_is_uninitialized_account(fd_instr_error_enum_t const * self) {
32235 0 : return self->discriminant == 9;
32236 0 : }
32237 0 : FD_FN_PURE uchar fd_instr_error_enum_is_unbalanced_instruction(fd_instr_error_enum_t const * self) {
32238 0 : return self->discriminant == 10;
32239 0 : }
32240 0 : FD_FN_PURE uchar fd_instr_error_enum_is_modified_program_id(fd_instr_error_enum_t const * self) {
32241 0 : return self->discriminant == 11;
32242 0 : }
32243 0 : FD_FN_PURE uchar fd_instr_error_enum_is_external_account_lamport_spend(fd_instr_error_enum_t const * self) {
32244 0 : return self->discriminant == 12;
32245 0 : }
32246 0 : FD_FN_PURE uchar fd_instr_error_enum_is_external_account_data_modified(fd_instr_error_enum_t const * self) {
32247 0 : return self->discriminant == 13;
32248 0 : }
32249 0 : FD_FN_PURE uchar fd_instr_error_enum_is_readonly_lamport_change(fd_instr_error_enum_t const * self) {
32250 0 : return self->discriminant == 14;
32251 0 : }
32252 0 : FD_FN_PURE uchar fd_instr_error_enum_is_readonly_data_modified(fd_instr_error_enum_t const * self) {
32253 0 : return self->discriminant == 15;
32254 0 : }
32255 0 : FD_FN_PURE uchar fd_instr_error_enum_is_duplicate_account_index(fd_instr_error_enum_t const * self) {
32256 0 : return self->discriminant == 16;
32257 0 : }
32258 0 : FD_FN_PURE uchar fd_instr_error_enum_is_executable_modified(fd_instr_error_enum_t const * self) {
32259 0 : return self->discriminant == 17;
32260 0 : }
32261 0 : FD_FN_PURE uchar fd_instr_error_enum_is_rent_epoch_modified(fd_instr_error_enum_t const * self) {
32262 0 : return self->discriminant == 18;
32263 0 : }
32264 0 : FD_FN_PURE uchar fd_instr_error_enum_is_not_enough_account_keys(fd_instr_error_enum_t const * self) {
32265 0 : return self->discriminant == 19;
32266 0 : }
32267 0 : FD_FN_PURE uchar fd_instr_error_enum_is_account_data_size_changed(fd_instr_error_enum_t const * self) {
32268 0 : return self->discriminant == 20;
32269 0 : }
32270 0 : FD_FN_PURE uchar fd_instr_error_enum_is_account_not_executable(fd_instr_error_enum_t const * self) {
32271 0 : return self->discriminant == 21;
32272 0 : }
32273 0 : FD_FN_PURE uchar fd_instr_error_enum_is_account_borrow_failed(fd_instr_error_enum_t const * self) {
32274 0 : return self->discriminant == 22;
32275 0 : }
32276 0 : FD_FN_PURE uchar fd_instr_error_enum_is_account_borrow_outstanding(fd_instr_error_enum_t const * self) {
32277 0 : return self->discriminant == 23;
32278 0 : }
32279 0 : FD_FN_PURE uchar fd_instr_error_enum_is_duplicate_account_out_of_sync(fd_instr_error_enum_t const * self) {
32280 0 : return self->discriminant == 24;
32281 0 : }
32282 0 : FD_FN_PURE uchar fd_instr_error_enum_is_custom(fd_instr_error_enum_t const * self) {
32283 0 : return self->discriminant == 25;
32284 0 : }
32285 0 : FD_FN_PURE uchar fd_instr_error_enum_is_invalid_error(fd_instr_error_enum_t const * self) {
32286 0 : return self->discriminant == 26;
32287 0 : }
32288 0 : FD_FN_PURE uchar fd_instr_error_enum_is_executable_data_modified(fd_instr_error_enum_t const * self) {
32289 0 : return self->discriminant == 27;
32290 0 : }
32291 0 : FD_FN_PURE uchar fd_instr_error_enum_is_executable_lamport_change(fd_instr_error_enum_t const * self) {
32292 0 : return self->discriminant == 28;
32293 0 : }
32294 0 : FD_FN_PURE uchar fd_instr_error_enum_is_executable_account_not_rent_exempt(fd_instr_error_enum_t const * self) {
32295 0 : return self->discriminant == 29;
32296 0 : }
32297 0 : FD_FN_PURE uchar fd_instr_error_enum_is_unsupported_program_id(fd_instr_error_enum_t const * self) {
32298 0 : return self->discriminant == 30;
32299 0 : }
32300 0 : FD_FN_PURE uchar fd_instr_error_enum_is_call_depth(fd_instr_error_enum_t const * self) {
32301 0 : return self->discriminant == 31;
32302 0 : }
32303 0 : FD_FN_PURE uchar fd_instr_error_enum_is_missing_account(fd_instr_error_enum_t const * self) {
32304 0 : return self->discriminant == 32;
32305 0 : }
32306 0 : FD_FN_PURE uchar fd_instr_error_enum_is_reentrancy_not_allowed(fd_instr_error_enum_t const * self) {
32307 0 : return self->discriminant == 33;
32308 0 : }
32309 0 : FD_FN_PURE uchar fd_instr_error_enum_is_max_seed_length_exceeded(fd_instr_error_enum_t const * self) {
32310 0 : return self->discriminant == 34;
32311 0 : }
32312 0 : FD_FN_PURE uchar fd_instr_error_enum_is_invalid_seeds(fd_instr_error_enum_t const * self) {
32313 0 : return self->discriminant == 35;
32314 0 : }
32315 0 : FD_FN_PURE uchar fd_instr_error_enum_is_invalid_realloc(fd_instr_error_enum_t const * self) {
32316 0 : return self->discriminant == 36;
32317 0 : }
32318 0 : FD_FN_PURE uchar fd_instr_error_enum_is_computational_budget_exceeded(fd_instr_error_enum_t const * self) {
32319 0 : return self->discriminant == 37;
32320 0 : }
32321 0 : FD_FN_PURE uchar fd_instr_error_enum_is_privilege_escalation(fd_instr_error_enum_t const * self) {
32322 0 : return self->discriminant == 38;
32323 0 : }
32324 0 : FD_FN_PURE uchar fd_instr_error_enum_is_program_environment_setup_failure(fd_instr_error_enum_t const * self) {
32325 0 : return self->discriminant == 39;
32326 0 : }
32327 0 : FD_FN_PURE uchar fd_instr_error_enum_is_program_failed_to_complete(fd_instr_error_enum_t const * self) {
32328 0 : return self->discriminant == 40;
32329 0 : }
32330 0 : FD_FN_PURE uchar fd_instr_error_enum_is_program_failed_to_compile(fd_instr_error_enum_t const * self) {
32331 0 : return self->discriminant == 41;
32332 0 : }
32333 0 : FD_FN_PURE uchar fd_instr_error_enum_is_immutable(fd_instr_error_enum_t const * self) {
32334 0 : return self->discriminant == 42;
32335 0 : }
32336 0 : FD_FN_PURE uchar fd_instr_error_enum_is_incorrect_authority(fd_instr_error_enum_t const * self) {
32337 0 : return self->discriminant == 43;
32338 0 : }
32339 0 : FD_FN_PURE uchar fd_instr_error_enum_is_borsh_io_error(fd_instr_error_enum_t const * self) {
32340 0 : return self->discriminant == 44;
32341 0 : }
32342 0 : FD_FN_PURE uchar fd_instr_error_enum_is_account_not_rent_exempt(fd_instr_error_enum_t const * self) {
32343 0 : return self->discriminant == 45;
32344 0 : }
32345 0 : FD_FN_PURE uchar fd_instr_error_enum_is_invalid_account_owner(fd_instr_error_enum_t const * self) {
32346 0 : return self->discriminant == 46;
32347 0 : }
32348 0 : FD_FN_PURE uchar fd_instr_error_enum_is_arithmetic_overflow(fd_instr_error_enum_t const * self) {
32349 0 : return self->discriminant == 47;
32350 0 : }
32351 0 : FD_FN_PURE uchar fd_instr_error_enum_is_unsupported_sysvar(fd_instr_error_enum_t const * self) {
32352 0 : return self->discriminant == 48;
32353 0 : }
32354 0 : FD_FN_PURE uchar fd_instr_error_enum_is_illegal_owner(fd_instr_error_enum_t const * self) {
32355 0 : return self->discriminant == 49;
32356 0 : }
32357 0 : FD_FN_PURE uchar fd_instr_error_enum_is_max_accounts_data_allocations_exceeded(fd_instr_error_enum_t const * self) {
32358 0 : return self->discriminant == 50;
32359 0 : }
32360 0 : FD_FN_PURE uchar fd_instr_error_enum_is_max_accounts_exceeded(fd_instr_error_enum_t const * self) {
32361 0 : return self->discriminant == 51;
32362 0 : }
32363 0 : FD_FN_PURE uchar fd_instr_error_enum_is_max_instruction_trace_length_exceeded(fd_instr_error_enum_t const * self) {
32364 0 : return self->discriminant == 52;
32365 0 : }
32366 0 : FD_FN_PURE uchar fd_instr_error_enum_is_builtin_programs_must_consume_compute_units(fd_instr_error_enum_t const * self) {
32367 0 : return self->discriminant == 53;
32368 0 : }
32369 : void fd_instr_error_enum_inner_new( fd_instr_error_enum_inner_t * self, uint discriminant );
32370 0 : int fd_instr_error_enum_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
32371 0 : int err;
32372 0 : switch (discriminant) {
32373 0 : case 0: {
32374 0 : return FD_BINCODE_SUCCESS;
32375 0 : }
32376 0 : case 1: {
32377 0 : return FD_BINCODE_SUCCESS;
32378 0 : }
32379 0 : case 2: {
32380 0 : return FD_BINCODE_SUCCESS;
32381 0 : }
32382 0 : case 3: {
32383 0 : return FD_BINCODE_SUCCESS;
32384 0 : }
32385 0 : case 4: {
32386 0 : return FD_BINCODE_SUCCESS;
32387 0 : }
32388 0 : case 5: {
32389 0 : return FD_BINCODE_SUCCESS;
32390 0 : }
32391 0 : case 6: {
32392 0 : return FD_BINCODE_SUCCESS;
32393 0 : }
32394 0 : case 7: {
32395 0 : return FD_BINCODE_SUCCESS;
32396 0 : }
32397 0 : case 8: {
32398 0 : return FD_BINCODE_SUCCESS;
32399 0 : }
32400 0 : case 9: {
32401 0 : return FD_BINCODE_SUCCESS;
32402 0 : }
32403 0 : case 10: {
32404 0 : return FD_BINCODE_SUCCESS;
32405 0 : }
32406 0 : case 11: {
32407 0 : return FD_BINCODE_SUCCESS;
32408 0 : }
32409 0 : case 12: {
32410 0 : return FD_BINCODE_SUCCESS;
32411 0 : }
32412 0 : case 13: {
32413 0 : return FD_BINCODE_SUCCESS;
32414 0 : }
32415 0 : case 14: {
32416 0 : return FD_BINCODE_SUCCESS;
32417 0 : }
32418 0 : case 15: {
32419 0 : return FD_BINCODE_SUCCESS;
32420 0 : }
32421 0 : case 16: {
32422 0 : return FD_BINCODE_SUCCESS;
32423 0 : }
32424 0 : case 17: {
32425 0 : return FD_BINCODE_SUCCESS;
32426 0 : }
32427 0 : case 18: {
32428 0 : return FD_BINCODE_SUCCESS;
32429 0 : }
32430 0 : case 19: {
32431 0 : return FD_BINCODE_SUCCESS;
32432 0 : }
32433 0 : case 20: {
32434 0 : return FD_BINCODE_SUCCESS;
32435 0 : }
32436 0 : case 21: {
32437 0 : return FD_BINCODE_SUCCESS;
32438 0 : }
32439 0 : case 22: {
32440 0 : return FD_BINCODE_SUCCESS;
32441 0 : }
32442 0 : case 23: {
32443 0 : return FD_BINCODE_SUCCESS;
32444 0 : }
32445 0 : case 24: {
32446 0 : return FD_BINCODE_SUCCESS;
32447 0 : }
32448 0 : case 25: {
32449 0 : err = fd_bincode_uint32_decode_footprint( ctx );
32450 0 : if( FD_UNLIKELY( err ) ) return err;
32451 0 : return FD_BINCODE_SUCCESS;
32452 0 : }
32453 0 : case 26: {
32454 0 : return FD_BINCODE_SUCCESS;
32455 0 : }
32456 0 : case 27: {
32457 0 : return FD_BINCODE_SUCCESS;
32458 0 : }
32459 0 : case 28: {
32460 0 : return FD_BINCODE_SUCCESS;
32461 0 : }
32462 0 : case 29: {
32463 0 : return FD_BINCODE_SUCCESS;
32464 0 : }
32465 0 : case 30: {
32466 0 : return FD_BINCODE_SUCCESS;
32467 0 : }
32468 0 : case 31: {
32469 0 : return FD_BINCODE_SUCCESS;
32470 0 : }
32471 0 : case 32: {
32472 0 : return FD_BINCODE_SUCCESS;
32473 0 : }
32474 0 : case 33: {
32475 0 : return FD_BINCODE_SUCCESS;
32476 0 : }
32477 0 : case 34: {
32478 0 : return FD_BINCODE_SUCCESS;
32479 0 : }
32480 0 : case 35: {
32481 0 : return FD_BINCODE_SUCCESS;
32482 0 : }
32483 0 : case 36: {
32484 0 : return FD_BINCODE_SUCCESS;
32485 0 : }
32486 0 : case 37: {
32487 0 : return FD_BINCODE_SUCCESS;
32488 0 : }
32489 0 : case 38: {
32490 0 : return FD_BINCODE_SUCCESS;
32491 0 : }
32492 0 : case 39: {
32493 0 : return FD_BINCODE_SUCCESS;
32494 0 : }
32495 0 : case 40: {
32496 0 : return FD_BINCODE_SUCCESS;
32497 0 : }
32498 0 : case 41: {
32499 0 : return FD_BINCODE_SUCCESS;
32500 0 : }
32501 0 : case 42: {
32502 0 : return FD_BINCODE_SUCCESS;
32503 0 : }
32504 0 : case 43: {
32505 0 : return FD_BINCODE_SUCCESS;
32506 0 : }
32507 0 : case 44: {
32508 0 : ulong slen;
32509 0 : err = fd_bincode_uint64_decode( &slen, ctx );
32510 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
32511 0 : err = fd_bincode_bytes_decode_footprint( slen, ctx );
32512 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
32513 0 : *total_sz += slen;
32514 0 : return FD_BINCODE_SUCCESS;
32515 0 : }
32516 0 : case 45: {
32517 0 : return FD_BINCODE_SUCCESS;
32518 0 : }
32519 0 : case 46: {
32520 0 : return FD_BINCODE_SUCCESS;
32521 0 : }
32522 0 : case 47: {
32523 0 : return FD_BINCODE_SUCCESS;
32524 0 : }
32525 0 : case 48: {
32526 0 : return FD_BINCODE_SUCCESS;
32527 0 : }
32528 0 : case 49: {
32529 0 : return FD_BINCODE_SUCCESS;
32530 0 : }
32531 0 : case 50: {
32532 0 : return FD_BINCODE_SUCCESS;
32533 0 : }
32534 0 : case 51: {
32535 0 : return FD_BINCODE_SUCCESS;
32536 0 : }
32537 0 : case 52: {
32538 0 : return FD_BINCODE_SUCCESS;
32539 0 : }
32540 0 : case 53: {
32541 0 : return FD_BINCODE_SUCCESS;
32542 0 : }
32543 0 : default: return FD_BINCODE_ERR_ENCODING;
32544 0 : }
32545 0 : }
32546 0 : int fd_instr_error_enum_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
32547 0 : *total_sz += sizeof(fd_instr_error_enum_t);
32548 0 : void const * start_data = ctx->data;
32549 0 : int err = fd_instr_error_enum_decode_footprint_inner( ctx, total_sz );
32550 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
32551 0 : ctx->data = start_data;
32552 0 : return err;
32553 0 : }
32554 0 : int fd_instr_error_enum_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
32555 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
32556 0 : uint discriminant = 0;
32557 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
32558 0 : if( FD_UNLIKELY( err ) ) return err;
32559 0 : return fd_instr_error_enum_inner_decode_footprint( discriminant, ctx, total_sz );
32560 0 : }
32561 0 : void fd_instr_error_enum_inner_decode_inner( fd_instr_error_enum_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
32562 0 : switch (discriminant) {
32563 0 : case 0: {
32564 0 : break;
32565 0 : }
32566 0 : case 1: {
32567 0 : break;
32568 0 : }
32569 0 : case 2: {
32570 0 : break;
32571 0 : }
32572 0 : case 3: {
32573 0 : break;
32574 0 : }
32575 0 : case 4: {
32576 0 : break;
32577 0 : }
32578 0 : case 5: {
32579 0 : break;
32580 0 : }
32581 0 : case 6: {
32582 0 : break;
32583 0 : }
32584 0 : case 7: {
32585 0 : break;
32586 0 : }
32587 0 : case 8: {
32588 0 : break;
32589 0 : }
32590 0 : case 9: {
32591 0 : break;
32592 0 : }
32593 0 : case 10: {
32594 0 : break;
32595 0 : }
32596 0 : case 11: {
32597 0 : break;
32598 0 : }
32599 0 : case 12: {
32600 0 : break;
32601 0 : }
32602 0 : case 13: {
32603 0 : break;
32604 0 : }
32605 0 : case 14: {
32606 0 : break;
32607 0 : }
32608 0 : case 15: {
32609 0 : break;
32610 0 : }
32611 0 : case 16: {
32612 0 : break;
32613 0 : }
32614 0 : case 17: {
32615 0 : break;
32616 0 : }
32617 0 : case 18: {
32618 0 : break;
32619 0 : }
32620 0 : case 19: {
32621 0 : break;
32622 0 : }
32623 0 : case 20: {
32624 0 : break;
32625 0 : }
32626 0 : case 21: {
32627 0 : break;
32628 0 : }
32629 0 : case 22: {
32630 0 : break;
32631 0 : }
32632 0 : case 23: {
32633 0 : break;
32634 0 : }
32635 0 : case 24: {
32636 0 : break;
32637 0 : }
32638 0 : case 25: {
32639 0 : fd_bincode_uint32_decode_unsafe( &self->custom, ctx );
32640 0 : break;
32641 0 : }
32642 0 : case 26: {
32643 0 : break;
32644 0 : }
32645 0 : case 27: {
32646 0 : break;
32647 0 : }
32648 0 : case 28: {
32649 0 : break;
32650 0 : }
32651 0 : case 29: {
32652 0 : break;
32653 0 : }
32654 0 : case 30: {
32655 0 : break;
32656 0 : }
32657 0 : case 31: {
32658 0 : break;
32659 0 : }
32660 0 : case 32: {
32661 0 : break;
32662 0 : }
32663 0 : case 33: {
32664 0 : break;
32665 0 : }
32666 0 : case 34: {
32667 0 : break;
32668 0 : }
32669 0 : case 35: {
32670 0 : break;
32671 0 : }
32672 0 : case 36: {
32673 0 : break;
32674 0 : }
32675 0 : case 37: {
32676 0 : break;
32677 0 : }
32678 0 : case 38: {
32679 0 : break;
32680 0 : }
32681 0 : case 39: {
32682 0 : break;
32683 0 : }
32684 0 : case 40: {
32685 0 : break;
32686 0 : }
32687 0 : case 41: {
32688 0 : break;
32689 0 : }
32690 0 : case 42: {
32691 0 : break;
32692 0 : }
32693 0 : case 43: {
32694 0 : break;
32695 0 : }
32696 0 : case 44: {
32697 0 : ulong slen;
32698 0 : fd_bincode_uint64_decode_unsafe( &slen, ctx );
32699 0 : self->borsh_io_error = *alloc_mem;
32700 0 : fd_bincode_bytes_decode_unsafe( (uchar *)self->borsh_io_error, slen, ctx );
32701 0 : self->borsh_io_error[slen] = '\0';
32702 0 : *alloc_mem = (uchar *)(*alloc_mem) + slen;
32703 0 : break;
32704 0 : }
32705 0 : case 45: {
32706 0 : break;
32707 0 : }
32708 0 : case 46: {
32709 0 : break;
32710 0 : }
32711 0 : case 47: {
32712 0 : break;
32713 0 : }
32714 0 : case 48: {
32715 0 : break;
32716 0 : }
32717 0 : case 49: {
32718 0 : break;
32719 0 : }
32720 0 : case 50: {
32721 0 : break;
32722 0 : }
32723 0 : case 51: {
32724 0 : break;
32725 0 : }
32726 0 : case 52: {
32727 0 : break;
32728 0 : }
32729 0 : case 53: {
32730 0 : break;
32731 0 : }
32732 0 : }
32733 0 : }
32734 0 : void fd_instr_error_enum_inner_decode_inner_global( fd_instr_error_enum_inner_global_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
32735 0 : switch (discriminant) {
32736 0 : case 0: {
32737 0 : break;
32738 0 : }
32739 0 : case 1: {
32740 0 : break;
32741 0 : }
32742 0 : case 2: {
32743 0 : break;
32744 0 : }
32745 0 : case 3: {
32746 0 : break;
32747 0 : }
32748 0 : case 4: {
32749 0 : break;
32750 0 : }
32751 0 : case 5: {
32752 0 : break;
32753 0 : }
32754 0 : case 6: {
32755 0 : break;
32756 0 : }
32757 0 : case 7: {
32758 0 : break;
32759 0 : }
32760 0 : case 8: {
32761 0 : break;
32762 0 : }
32763 0 : case 9: {
32764 0 : break;
32765 0 : }
32766 0 : case 10: {
32767 0 : break;
32768 0 : }
32769 0 : case 11: {
32770 0 : break;
32771 0 : }
32772 0 : case 12: {
32773 0 : break;
32774 0 : }
32775 0 : case 13: {
32776 0 : break;
32777 0 : }
32778 0 : case 14: {
32779 0 : break;
32780 0 : }
32781 0 : case 15: {
32782 0 : break;
32783 0 : }
32784 0 : case 16: {
32785 0 : break;
32786 0 : }
32787 0 : case 17: {
32788 0 : break;
32789 0 : }
32790 0 : case 18: {
32791 0 : break;
32792 0 : }
32793 0 : case 19: {
32794 0 : break;
32795 0 : }
32796 0 : case 20: {
32797 0 : break;
32798 0 : }
32799 0 : case 21: {
32800 0 : break;
32801 0 : }
32802 0 : case 22: {
32803 0 : break;
32804 0 : }
32805 0 : case 23: {
32806 0 : break;
32807 0 : }
32808 0 : case 24: {
32809 0 : break;
32810 0 : }
32811 0 : case 25: {
32812 0 : fd_bincode_uint32_decode_unsafe( &self->custom, ctx );
32813 0 : break;
32814 0 : }
32815 0 : case 26: {
32816 0 : break;
32817 0 : }
32818 0 : case 27: {
32819 0 : break;
32820 0 : }
32821 0 : case 28: {
32822 0 : break;
32823 0 : }
32824 0 : case 29: {
32825 0 : break;
32826 0 : }
32827 0 : case 30: {
32828 0 : break;
32829 0 : }
32830 0 : case 31: {
32831 0 : break;
32832 0 : }
32833 0 : case 32: {
32834 0 : break;
32835 0 : }
32836 0 : case 33: {
32837 0 : break;
32838 0 : }
32839 0 : case 34: {
32840 0 : break;
32841 0 : }
32842 0 : case 35: {
32843 0 : break;
32844 0 : }
32845 0 : case 36: {
32846 0 : break;
32847 0 : }
32848 0 : case 37: {
32849 0 : break;
32850 0 : }
32851 0 : case 38: {
32852 0 : break;
32853 0 : }
32854 0 : case 39: {
32855 0 : break;
32856 0 : }
32857 0 : case 40: {
32858 0 : break;
32859 0 : }
32860 0 : case 41: {
32861 0 : break;
32862 0 : }
32863 0 : case 42: {
32864 0 : break;
32865 0 : }
32866 0 : case 43: {
32867 0 : break;
32868 0 : }
32869 0 : case 44: {
32870 0 : ulong slen;
32871 0 : fd_bincode_uint64_decode_unsafe( &slen, ctx );
32872 0 : self->borsh_io_error = *alloc_mem;
32873 0 : fd_bincode_bytes_decode_unsafe( (uchar *)self->borsh_io_error, slen, ctx );
32874 0 : self->borsh_io_error[slen] = '\0';
32875 0 : *alloc_mem = (uchar *)(*alloc_mem) + slen;
32876 0 : break;
32877 0 : }
32878 0 : case 45: {
32879 0 : break;
32880 0 : }
32881 0 : case 46: {
32882 0 : break;
32883 0 : }
32884 0 : case 47: {
32885 0 : break;
32886 0 : }
32887 0 : case 48: {
32888 0 : break;
32889 0 : }
32890 0 : case 49: {
32891 0 : break;
32892 0 : }
32893 0 : case 50: {
32894 0 : break;
32895 0 : }
32896 0 : case 51: {
32897 0 : break;
32898 0 : }
32899 0 : case 52: {
32900 0 : break;
32901 0 : }
32902 0 : case 53: {
32903 0 : break;
32904 0 : }
32905 0 : }
32906 0 : }
32907 0 : int fd_instr_error_enum_convert_global_to_local_inner( fd_instr_error_enum_inner_global_t const * mem, fd_instr_error_enum_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
32908 0 : int err = 0;
32909 0 : switch( discriminant ) {
32910 0 : case 0: {
32911 0 : break;
32912 0 : }
32913 0 : case 1: {
32914 0 : break;
32915 0 : }
32916 0 : case 2: {
32917 0 : break;
32918 0 : }
32919 0 : case 3: {
32920 0 : break;
32921 0 : }
32922 0 : case 4: {
32923 0 : break;
32924 0 : }
32925 0 : case 5: {
32926 0 : break;
32927 0 : }
32928 0 : case 6: {
32929 0 : break;
32930 0 : }
32931 0 : case 7: {
32932 0 : break;
32933 0 : }
32934 0 : case 8: {
32935 0 : break;
32936 0 : }
32937 0 : case 9: {
32938 0 : break;
32939 0 : }
32940 0 : case 10: {
32941 0 : break;
32942 0 : }
32943 0 : case 11: {
32944 0 : break;
32945 0 : }
32946 0 : case 12: {
32947 0 : break;
32948 0 : }
32949 0 : case 13: {
32950 0 : break;
32951 0 : }
32952 0 : case 14: {
32953 0 : break;
32954 0 : }
32955 0 : case 15: {
32956 0 : break;
32957 0 : }
32958 0 : case 16: {
32959 0 : break;
32960 0 : }
32961 0 : case 17: {
32962 0 : break;
32963 0 : }
32964 0 : case 18: {
32965 0 : break;
32966 0 : }
32967 0 : case 19: {
32968 0 : break;
32969 0 : }
32970 0 : case 20: {
32971 0 : break;
32972 0 : }
32973 0 : case 21: {
32974 0 : break;
32975 0 : }
32976 0 : case 22: {
32977 0 : break;
32978 0 : }
32979 0 : case 23: {
32980 0 : break;
32981 0 : }
32982 0 : case 24: {
32983 0 : break;
32984 0 : }
32985 0 : case 25: {
32986 0 : self->custom = mem->custom;
32987 0 : break;
32988 0 : }
32989 0 : case 26: {
32990 0 : break;
32991 0 : }
32992 0 : case 27: {
32993 0 : break;
32994 0 : }
32995 0 : case 28: {
32996 0 : break;
32997 0 : }
32998 0 : case 29: {
32999 0 : break;
33000 0 : }
33001 0 : case 30: {
33002 0 : break;
33003 0 : }
33004 0 : case 31: {
33005 0 : break;
33006 0 : }
33007 0 : case 32: {
33008 0 : break;
33009 0 : }
33010 0 : case 33: {
33011 0 : break;
33012 0 : }
33013 0 : case 34: {
33014 0 : break;
33015 0 : }
33016 0 : case 35: {
33017 0 : break;
33018 0 : }
33019 0 : case 36: {
33020 0 : break;
33021 0 : }
33022 0 : case 37: {
33023 0 : break;
33024 0 : }
33025 0 : case 38: {
33026 0 : break;
33027 0 : }
33028 0 : case 39: {
33029 0 : break;
33030 0 : }
33031 0 : case 40: {
33032 0 : break;
33033 0 : }
33034 0 : case 41: {
33035 0 : break;
33036 0 : }
33037 0 : case 42: {
33038 0 : break;
33039 0 : }
33040 0 : case 43: {
33041 0 : break;
33042 0 : }
33043 0 : case 44: {
33044 0 : strcpy( self->borsh_io_error, mem->borsh_io_error);
33045 0 : break;
33046 0 : }
33047 0 : case 45: {
33048 0 : break;
33049 0 : }
33050 0 : case 46: {
33051 0 : break;
33052 0 : }
33053 0 : case 47: {
33054 0 : break;
33055 0 : }
33056 0 : case 48: {
33057 0 : break;
33058 0 : }
33059 0 : case 49: {
33060 0 : break;
33061 0 : }
33062 0 : case 50: {
33063 0 : break;
33064 0 : }
33065 0 : case 51: {
33066 0 : break;
33067 0 : }
33068 0 : case 52: {
33069 0 : break;
33070 0 : }
33071 0 : case 53: {
33072 0 : break;
33073 0 : }
33074 0 : }
33075 0 : return FD_BINCODE_SUCCESS;
33076 0 : }
33077 0 : int fd_instr_error_enum_convert_global_to_local( void const * global_self, fd_instr_error_enum_t * self, fd_bincode_decode_ctx_t * ctx ) {
33078 0 : fd_instr_error_enum_global_t const * mem = (fd_instr_error_enum_global_t const *)global_self;
33079 0 : uint discriminant = mem->discriminant;
33080 0 : self->discriminant = mem->discriminant;
33081 0 : int err = fd_instr_error_enum_convert_global_to_local_inner( &mem->inner, &self->inner, discriminant, ctx );
33082 0 : return FD_BINCODE_SUCCESS;
33083 0 : }
33084 0 : void fd_instr_error_enum_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
33085 0 : fd_instr_error_enum_t * self = (fd_instr_error_enum_t *)struct_mem;
33086 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
33087 0 : fd_instr_error_enum_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
33088 0 : }
33089 0 : void * fd_instr_error_enum_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
33090 0 : fd_instr_error_enum_t * self = (fd_instr_error_enum_t *)mem;
33091 0 : fd_instr_error_enum_new( self );
33092 0 : void * alloc_region = (uchar *)mem + sizeof(fd_instr_error_enum_t);
33093 0 : void * * alloc_mem = &alloc_region;
33094 0 : fd_instr_error_enum_decode_inner( mem, alloc_mem, ctx );
33095 0 : return self;
33096 0 : }
33097 0 : void * fd_instr_error_enum_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
33098 0 : fd_instr_error_enum_t * self = (fd_instr_error_enum_t *)mem;
33099 0 : fd_instr_error_enum_new( self );
33100 0 : void * alloc_region = (uchar *)mem + sizeof(fd_instr_error_enum_t);
33101 0 : void * * alloc_mem = &alloc_region;
33102 0 : fd_instr_error_enum_decode_inner_global( mem, alloc_mem, ctx );
33103 0 : return self;
33104 0 : }
33105 0 : void fd_instr_error_enum_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
33106 0 : fd_instr_error_enum_global_t * self = (fd_instr_error_enum_global_t *)struct_mem;
33107 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
33108 0 : fd_instr_error_enum_inner_decode_inner_global( &self->inner, alloc_mem, self->discriminant, ctx );
33109 0 : }
33110 0 : void fd_instr_error_enum_inner_new( fd_instr_error_enum_inner_t * self, uint discriminant ) {
33111 0 : switch( discriminant ) {
33112 0 : case 0: {
33113 0 : break;
33114 0 : }
33115 0 : case 1: {
33116 0 : break;
33117 0 : }
33118 0 : case 2: {
33119 0 : break;
33120 0 : }
33121 0 : case 3: {
33122 0 : break;
33123 0 : }
33124 0 : case 4: {
33125 0 : break;
33126 0 : }
33127 0 : case 5: {
33128 0 : break;
33129 0 : }
33130 0 : case 6: {
33131 0 : break;
33132 0 : }
33133 0 : case 7: {
33134 0 : break;
33135 0 : }
33136 0 : case 8: {
33137 0 : break;
33138 0 : }
33139 0 : case 9: {
33140 0 : break;
33141 0 : }
33142 0 : case 10: {
33143 0 : break;
33144 0 : }
33145 0 : case 11: {
33146 0 : break;
33147 0 : }
33148 0 : case 12: {
33149 0 : break;
33150 0 : }
33151 0 : case 13: {
33152 0 : break;
33153 0 : }
33154 0 : case 14: {
33155 0 : break;
33156 0 : }
33157 0 : case 15: {
33158 0 : break;
33159 0 : }
33160 0 : case 16: {
33161 0 : break;
33162 0 : }
33163 0 : case 17: {
33164 0 : break;
33165 0 : }
33166 0 : case 18: {
33167 0 : break;
33168 0 : }
33169 0 : case 19: {
33170 0 : break;
33171 0 : }
33172 0 : case 20: {
33173 0 : break;
33174 0 : }
33175 0 : case 21: {
33176 0 : break;
33177 0 : }
33178 0 : case 22: {
33179 0 : break;
33180 0 : }
33181 0 : case 23: {
33182 0 : break;
33183 0 : }
33184 0 : case 24: {
33185 0 : break;
33186 0 : }
33187 0 : case 25: {
33188 0 : break;
33189 0 : }
33190 0 : case 26: {
33191 0 : break;
33192 0 : }
33193 0 : case 27: {
33194 0 : break;
33195 0 : }
33196 0 : case 28: {
33197 0 : break;
33198 0 : }
33199 0 : case 29: {
33200 0 : break;
33201 0 : }
33202 0 : case 30: {
33203 0 : break;
33204 0 : }
33205 0 : case 31: {
33206 0 : break;
33207 0 : }
33208 0 : case 32: {
33209 0 : break;
33210 0 : }
33211 0 : case 33: {
33212 0 : break;
33213 0 : }
33214 0 : case 34: {
33215 0 : break;
33216 0 : }
33217 0 : case 35: {
33218 0 : break;
33219 0 : }
33220 0 : case 36: {
33221 0 : break;
33222 0 : }
33223 0 : case 37: {
33224 0 : break;
33225 0 : }
33226 0 : case 38: {
33227 0 : break;
33228 0 : }
33229 0 : case 39: {
33230 0 : break;
33231 0 : }
33232 0 : case 40: {
33233 0 : break;
33234 0 : }
33235 0 : case 41: {
33236 0 : break;
33237 0 : }
33238 0 : case 42: {
33239 0 : break;
33240 0 : }
33241 0 : case 43: {
33242 0 : break;
33243 0 : }
33244 0 : case 44: {
33245 0 : break;
33246 0 : }
33247 0 : case 45: {
33248 0 : break;
33249 0 : }
33250 0 : case 46: {
33251 0 : break;
33252 0 : }
33253 0 : case 47: {
33254 0 : break;
33255 0 : }
33256 0 : case 48: {
33257 0 : break;
33258 0 : }
33259 0 : case 49: {
33260 0 : break;
33261 0 : }
33262 0 : case 50: {
33263 0 : break;
33264 0 : }
33265 0 : case 51: {
33266 0 : break;
33267 0 : }
33268 0 : case 52: {
33269 0 : break;
33270 0 : }
33271 0 : case 53: {
33272 0 : break;
33273 0 : }
33274 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
33275 0 : }
33276 0 : }
33277 0 : void fd_instr_error_enum_new_disc( fd_instr_error_enum_t * self, uint discriminant ) {
33278 0 : self->discriminant = discriminant;
33279 0 : fd_instr_error_enum_inner_new( &self->inner, self->discriminant );
33280 0 : }
33281 0 : void fd_instr_error_enum_new( fd_instr_error_enum_t * self ) {
33282 0 : fd_memset( self, 0, sizeof(fd_instr_error_enum_t) );
33283 0 : fd_instr_error_enum_new_disc( self, UINT_MAX );
33284 0 : }
33285 0 : void fd_instr_error_enum_inner_destroy( fd_instr_error_enum_inner_t * self, uint discriminant ) {
33286 0 : switch( discriminant ) {
33287 0 : case 25: {
33288 0 : break;
33289 0 : }
33290 0 : case 44: {
33291 0 : self->borsh_io_error = NULL;
33292 :
33293 0 : break;
33294 0 : }
33295 0 : default: break; // FD_LOG_ERR(( "unhandled type" ));
33296 0 : }
33297 0 : }
33298 0 : void fd_instr_error_enum_destroy( fd_instr_error_enum_t * self ) {
33299 0 : fd_instr_error_enum_inner_destroy( &self->inner, self->discriminant );
33300 0 : }
33301 :
33302 0 : ulong fd_instr_error_enum_footprint( void ){ return FD_INSTR_ERROR_ENUM_FOOTPRINT; }
33303 0 : ulong fd_instr_error_enum_align( void ){ return FD_INSTR_ERROR_ENUM_ALIGN; }
33304 :
33305 0 : void fd_instr_error_enum_walk( void * w, fd_instr_error_enum_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
33306 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_instr_error_enum", level++);
33307 0 : switch( self->discriminant ) {
33308 0 : case 0: {
33309 0 : fun( w, self, "generic_error", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
33310 0 : break;
33311 0 : }
33312 0 : case 1: {
33313 0 : fun( w, self, "invalid_argument", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
33314 0 : break;
33315 0 : }
33316 0 : case 2: {
33317 0 : fun( w, self, "invalid_instruction_data", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
33318 0 : break;
33319 0 : }
33320 0 : case 3: {
33321 0 : fun( w, self, "invalid_account_data", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
33322 0 : break;
33323 0 : }
33324 0 : case 4: {
33325 0 : fun( w, self, "account_data_too_small", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
33326 0 : break;
33327 0 : }
33328 0 : case 5: {
33329 0 : fun( w, self, "insufficient_funds", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
33330 0 : break;
33331 0 : }
33332 0 : case 6: {
33333 0 : fun( w, self, "incorrect_program_id", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
33334 0 : break;
33335 0 : }
33336 0 : case 7: {
33337 0 : fun( w, self, "missing_required_signature", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
33338 0 : break;
33339 0 : }
33340 0 : case 8: {
33341 0 : fun( w, self, "account_already_initialized", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
33342 0 : break;
33343 0 : }
33344 0 : case 9: {
33345 0 : fun( w, self, "uninitialized_account", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
33346 0 : break;
33347 0 : }
33348 0 : case 10: {
33349 0 : fun( w, self, "unbalanced_instruction", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
33350 0 : break;
33351 0 : }
33352 0 : case 11: {
33353 0 : fun( w, self, "modified_program_id", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
33354 0 : break;
33355 0 : }
33356 0 : case 12: {
33357 0 : fun( w, self, "external_account_lamport_spend", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
33358 0 : break;
33359 0 : }
33360 0 : case 13: {
33361 0 : fun( w, self, "external_account_data_modified", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
33362 0 : break;
33363 0 : }
33364 0 : case 14: {
33365 0 : fun( w, self, "readonly_lamport_change", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
33366 0 : break;
33367 0 : }
33368 0 : case 15: {
33369 0 : fun( w, self, "readonly_data_modified", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
33370 0 : break;
33371 0 : }
33372 0 : case 16: {
33373 0 : fun( w, self, "duplicate_account_index", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
33374 0 : break;
33375 0 : }
33376 0 : case 17: {
33377 0 : fun( w, self, "executable_modified", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
33378 0 : break;
33379 0 : }
33380 0 : case 18: {
33381 0 : fun( w, self, "rent_epoch_modified", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
33382 0 : break;
33383 0 : }
33384 0 : case 19: {
33385 0 : fun( w, self, "not_enough_account_keys", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
33386 0 : break;
33387 0 : }
33388 0 : case 20: {
33389 0 : fun( w, self, "account_data_size_changed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
33390 0 : break;
33391 0 : }
33392 0 : case 21: {
33393 0 : fun( w, self, "account_not_executable", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
33394 0 : break;
33395 0 : }
33396 0 : case 22: {
33397 0 : fun( w, self, "account_borrow_failed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
33398 0 : break;
33399 0 : }
33400 0 : case 23: {
33401 0 : fun( w, self, "account_borrow_outstanding", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
33402 0 : break;
33403 0 : }
33404 0 : case 24: {
33405 0 : fun( w, self, "duplicate_account_out_of_sync", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
33406 0 : break;
33407 0 : }
33408 0 : case 25: {
33409 0 : fun( w, self, "custom", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
33410 0 : fun( w, &self->inner.custom, "custom", FD_FLAMENCO_TYPE_UINT, "uint", level );
33411 0 : break;
33412 0 : }
33413 0 : case 26: {
33414 0 : fun( w, self, "invalid_error", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
33415 0 : break;
33416 0 : }
33417 0 : case 27: {
33418 0 : fun( w, self, "executable_data_modified", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
33419 0 : break;
33420 0 : }
33421 0 : case 28: {
33422 0 : fun( w, self, "executable_lamport_change", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
33423 0 : break;
33424 0 : }
33425 0 : case 29: {
33426 0 : fun( w, self, "executable_account_not_rent_exempt", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
33427 0 : break;
33428 0 : }
33429 0 : case 30: {
33430 0 : fun( w, self, "unsupported_program_id", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
33431 0 : break;
33432 0 : }
33433 0 : case 31: {
33434 0 : fun( w, self, "call_depth", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
33435 0 : break;
33436 0 : }
33437 0 : case 32: {
33438 0 : fun( w, self, "missing_account", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
33439 0 : break;
33440 0 : }
33441 0 : case 33: {
33442 0 : fun( w, self, "reentrancy_not_allowed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
33443 0 : break;
33444 0 : }
33445 0 : case 34: {
33446 0 : fun( w, self, "max_seed_length_exceeded", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
33447 0 : break;
33448 0 : }
33449 0 : case 35: {
33450 0 : fun( w, self, "invalid_seeds", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
33451 0 : break;
33452 0 : }
33453 0 : case 36: {
33454 0 : fun( w, self, "invalid_realloc", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
33455 0 : break;
33456 0 : }
33457 0 : case 37: {
33458 0 : fun( w, self, "computational_budget_exceeded", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
33459 0 : break;
33460 0 : }
33461 0 : case 38: {
33462 0 : fun( w, self, "privilege_escalation", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
33463 0 : break;
33464 0 : }
33465 0 : case 39: {
33466 0 : fun( w, self, "program_environment_setup_failure", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
33467 0 : break;
33468 0 : }
33469 0 : case 40: {
33470 0 : fun( w, self, "program_failed_to_complete", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
33471 0 : break;
33472 0 : }
33473 0 : case 41: {
33474 0 : fun( w, self, "program_failed_to_compile", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
33475 0 : break;
33476 0 : }
33477 0 : case 42: {
33478 0 : fun( w, self, "immutable", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
33479 0 : break;
33480 0 : }
33481 0 : case 43: {
33482 0 : fun( w, self, "incorrect_authority", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
33483 0 : break;
33484 0 : }
33485 0 : case 44: {
33486 0 : fun( w, self, "borsh_io_error", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
33487 0 : fun( w, self->inner.borsh_io_error, "borsh_io_error", FD_FLAMENCO_TYPE_CSTR, "char*", level );
33488 0 : break;
33489 0 : }
33490 0 : case 45: {
33491 0 : fun( w, self, "account_not_rent_exempt", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
33492 0 : break;
33493 0 : }
33494 0 : case 46: {
33495 0 : fun( w, self, "invalid_account_owner", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
33496 0 : break;
33497 0 : }
33498 0 : case 47: {
33499 0 : fun( w, self, "arithmetic_overflow", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
33500 0 : break;
33501 0 : }
33502 0 : case 48: {
33503 0 : fun( w, self, "unsupported_sysvar", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
33504 0 : break;
33505 0 : }
33506 0 : case 49: {
33507 0 : fun( w, self, "illegal_owner", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
33508 0 : break;
33509 0 : }
33510 0 : case 50: {
33511 0 : fun( w, self, "max_accounts_data_allocations_exceeded", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
33512 0 : break;
33513 0 : }
33514 0 : case 51: {
33515 0 : fun( w, self, "max_accounts_exceeded", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
33516 0 : break;
33517 0 : }
33518 0 : case 52: {
33519 0 : fun( w, self, "max_instruction_trace_length_exceeded", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
33520 0 : break;
33521 0 : }
33522 0 : case 53: {
33523 0 : fun( w, self, "builtin_programs_must_consume_compute_units", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
33524 0 : break;
33525 0 : }
33526 0 : }
33527 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_instr_error_enum", level-- );
33528 0 : }
33529 0 : ulong fd_instr_error_enum_size( fd_instr_error_enum_t const * self ) {
33530 0 : ulong size = 0;
33531 0 : size += sizeof(uint);
33532 0 : switch (self->discriminant) {
33533 0 : case 25: {
33534 0 : size += sizeof(uint);
33535 0 : break;
33536 0 : }
33537 0 : case 44: {
33538 0 : size += sizeof(ulong) + strlen(self->inner.borsh_io_error);
33539 0 : break;
33540 0 : }
33541 0 : }
33542 0 : return size;
33543 0 : }
33544 :
33545 0 : int fd_instr_error_enum_inner_encode( fd_instr_error_enum_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
33546 0 : int err;
33547 0 : switch (discriminant) {
33548 0 : case 25: {
33549 0 : err = fd_bincode_uint32_encode( self->custom, ctx );
33550 0 : if( FD_UNLIKELY( err ) ) return err;
33551 0 : break;
33552 0 : }
33553 0 : case 44: {
33554 0 : ulong slen = strlen( (char *) self->borsh_io_error );
33555 0 : err = fd_bincode_uint64_encode( slen, ctx );
33556 0 : if( FD_UNLIKELY( err ) ) return err;
33557 0 : err = fd_bincode_bytes_encode( (uchar *) self->borsh_io_error, slen, ctx );
33558 0 : if( FD_UNLIKELY( err ) ) return err;
33559 0 : break;
33560 0 : }
33561 0 : }
33562 0 : return FD_BINCODE_SUCCESS;
33563 0 : }
33564 0 : int fd_instr_error_enum_encode( fd_instr_error_enum_t const * self, fd_bincode_encode_ctx_t * ctx ) {
33565 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
33566 0 : if( FD_UNLIKELY( err ) ) return err;
33567 0 : return fd_instr_error_enum_inner_encode( &self->inner, self->discriminant, ctx );
33568 0 : }
33569 :
33570 0 : int fd_txn_instr_error_encode( fd_txn_instr_error_t const * self, fd_bincode_encode_ctx_t * ctx ) {
33571 0 : int err;
33572 0 : err = fd_bincode_uint8_encode( (uchar)(self->instr_idx), ctx );
33573 0 : if( FD_UNLIKELY( err ) ) return err;
33574 0 : err = fd_instr_error_enum_encode( &self->error, ctx );
33575 0 : if( FD_UNLIKELY( err ) ) return err;
33576 0 : return FD_BINCODE_SUCCESS;
33577 0 : }
33578 0 : int fd_txn_instr_error_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
33579 0 : *total_sz += sizeof(fd_txn_instr_error_t);
33580 0 : void const * start_data = ctx->data;
33581 0 : int err = fd_txn_instr_error_decode_footprint_inner( ctx, total_sz );
33582 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
33583 0 : ctx->data = start_data;
33584 0 : return err;
33585 0 : }
33586 0 : int fd_txn_instr_error_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
33587 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
33588 0 : int err = 0;
33589 0 : err = fd_bincode_uint8_decode_footprint( ctx );
33590 0 : if( FD_UNLIKELY( err ) ) return err;
33591 0 : err = fd_instr_error_enum_decode_footprint_inner( ctx, total_sz );
33592 0 : if( FD_UNLIKELY( err ) ) return err;
33593 0 : return 0;
33594 0 : }
33595 0 : void * fd_txn_instr_error_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
33596 0 : fd_txn_instr_error_t * self = (fd_txn_instr_error_t *)mem;
33597 0 : fd_txn_instr_error_new( self );
33598 0 : void * alloc_region = (uchar *)mem + sizeof(fd_txn_instr_error_t);
33599 0 : void * * alloc_mem = &alloc_region;
33600 0 : fd_txn_instr_error_decode_inner( mem, alloc_mem, ctx );
33601 0 : return self;
33602 0 : }
33603 0 : void fd_txn_instr_error_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
33604 0 : fd_txn_instr_error_t * self = (fd_txn_instr_error_t *)struct_mem;
33605 0 : fd_bincode_uint8_decode_unsafe( &self->instr_idx, ctx );
33606 0 : fd_instr_error_enum_decode_inner( &self->error, alloc_mem, ctx );
33607 0 : }
33608 0 : void * fd_txn_instr_error_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
33609 0 : fd_txn_instr_error_global_t * self = (fd_txn_instr_error_global_t *)mem;
33610 0 : fd_txn_instr_error_new( (fd_txn_instr_error_t *)self );
33611 0 : void * alloc_region = (uchar *)mem + sizeof(fd_txn_instr_error_global_t);
33612 0 : void * * alloc_mem = &alloc_region;
33613 0 : fd_txn_instr_error_decode_inner_global( mem, alloc_mem, ctx );
33614 0 : return self;
33615 0 : }
33616 0 : void fd_txn_instr_error_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
33617 0 : fd_txn_instr_error_global_t * self = (fd_txn_instr_error_global_t *)struct_mem;
33618 0 : fd_bincode_uint8_decode_unsafe( &self->instr_idx, ctx );
33619 0 : fd_instr_error_enum_decode_inner_global( &self->error, alloc_mem, ctx );
33620 0 : }
33621 0 : int fd_txn_instr_error_convert_global_to_local( void const * global_self, fd_txn_instr_error_t * self, fd_bincode_decode_ctx_t * ctx ) {
33622 0 : int err = 0;
33623 0 : fd_txn_instr_error_global_t const * mem = (fd_txn_instr_error_global_t const *)global_self;
33624 0 : self->instr_idx = mem->instr_idx;
33625 0 : err = fd_instr_error_enum_convert_global_to_local( &mem->error, &self->error, ctx );
33626 0 : if( FD_UNLIKELY( err ) ) return err;
33627 0 : return FD_BINCODE_SUCCESS;
33628 0 : }
33629 0 : void fd_txn_instr_error_new(fd_txn_instr_error_t * self) {
33630 0 : fd_memset( self, 0, sizeof(fd_txn_instr_error_t) );
33631 0 : fd_instr_error_enum_new( &self->error );
33632 0 : }
33633 0 : void fd_txn_instr_error_destroy( fd_txn_instr_error_t * self ) {
33634 0 : fd_instr_error_enum_destroy( &self->error );
33635 0 : }
33636 :
33637 0 : ulong fd_txn_instr_error_footprint( void ){ return FD_TXN_INSTR_ERROR_FOOTPRINT; }
33638 0 : ulong fd_txn_instr_error_align( void ){ return FD_TXN_INSTR_ERROR_ALIGN; }
33639 :
33640 0 : void fd_txn_instr_error_walk( void * w, fd_txn_instr_error_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
33641 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_txn_instr_error", level++ );
33642 0 : fun( w, &self->instr_idx, "instr_idx", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
33643 0 : fd_instr_error_enum_walk( w, &self->error, fun, "error", level );
33644 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_txn_instr_error", level-- );
33645 0 : }
33646 0 : ulong fd_txn_instr_error_size( fd_txn_instr_error_t const * self ) {
33647 0 : ulong size = 0;
33648 0 : size += sizeof(char);
33649 0 : size += fd_instr_error_enum_size( &self->error );
33650 0 : return size;
33651 0 : }
33652 :
33653 0 : FD_FN_PURE uchar fd_txn_error_enum_is_account_in_use(fd_txn_error_enum_t const * self) {
33654 0 : return self->discriminant == 0;
33655 0 : }
33656 0 : FD_FN_PURE uchar fd_txn_error_enum_is_account_loaded_twice(fd_txn_error_enum_t const * self) {
33657 0 : return self->discriminant == 1;
33658 0 : }
33659 0 : FD_FN_PURE uchar fd_txn_error_enum_is_account_not_found(fd_txn_error_enum_t const * self) {
33660 0 : return self->discriminant == 2;
33661 0 : }
33662 0 : FD_FN_PURE uchar fd_txn_error_enum_is_program_account_not_found(fd_txn_error_enum_t const * self) {
33663 0 : return self->discriminant == 3;
33664 0 : }
33665 0 : FD_FN_PURE uchar fd_txn_error_enum_is_insufficient_funds_for_fee(fd_txn_error_enum_t const * self) {
33666 0 : return self->discriminant == 4;
33667 0 : }
33668 0 : FD_FN_PURE uchar fd_txn_error_enum_is_invalid_account_for_fee(fd_txn_error_enum_t const * self) {
33669 0 : return self->discriminant == 5;
33670 0 : }
33671 0 : FD_FN_PURE uchar fd_txn_error_enum_is_already_processed(fd_txn_error_enum_t const * self) {
33672 0 : return self->discriminant == 6;
33673 0 : }
33674 0 : FD_FN_PURE uchar fd_txn_error_enum_is_blockhash_not_found(fd_txn_error_enum_t const * self) {
33675 0 : return self->discriminant == 7;
33676 0 : }
33677 0 : FD_FN_PURE uchar fd_txn_error_enum_is_instruction_error(fd_txn_error_enum_t const * self) {
33678 0 : return self->discriminant == 8;
33679 0 : }
33680 0 : FD_FN_PURE uchar fd_txn_error_enum_is_call_chain_too_deep(fd_txn_error_enum_t const * self) {
33681 0 : return self->discriminant == 9;
33682 0 : }
33683 0 : FD_FN_PURE uchar fd_txn_error_enum_is_missing_signature_for_fee(fd_txn_error_enum_t const * self) {
33684 0 : return self->discriminant == 10;
33685 0 : }
33686 0 : FD_FN_PURE uchar fd_txn_error_enum_is_invalid_account_index(fd_txn_error_enum_t const * self) {
33687 0 : return self->discriminant == 11;
33688 0 : }
33689 0 : FD_FN_PURE uchar fd_txn_error_enum_is_signature_failure(fd_txn_error_enum_t const * self) {
33690 0 : return self->discriminant == 12;
33691 0 : }
33692 0 : FD_FN_PURE uchar fd_txn_error_enum_is_invalid_program_for_execution(fd_txn_error_enum_t const * self) {
33693 0 : return self->discriminant == 13;
33694 0 : }
33695 0 : FD_FN_PURE uchar fd_txn_error_enum_is_sanitize_failure(fd_txn_error_enum_t const * self) {
33696 0 : return self->discriminant == 14;
33697 0 : }
33698 0 : FD_FN_PURE uchar fd_txn_error_enum_is_cluster_maintenance(fd_txn_error_enum_t const * self) {
33699 0 : return self->discriminant == 15;
33700 0 : }
33701 0 : FD_FN_PURE uchar fd_txn_error_enum_is_account_borrow_outstanding(fd_txn_error_enum_t const * self) {
33702 0 : return self->discriminant == 16;
33703 0 : }
33704 0 : FD_FN_PURE uchar fd_txn_error_enum_is_would_exceed_max_block_cost_limit(fd_txn_error_enum_t const * self) {
33705 0 : return self->discriminant == 17;
33706 0 : }
33707 0 : FD_FN_PURE uchar fd_txn_error_enum_is_unsupported_version(fd_txn_error_enum_t const * self) {
33708 0 : return self->discriminant == 18;
33709 0 : }
33710 0 : FD_FN_PURE uchar fd_txn_error_enum_is_invalid_writable_account(fd_txn_error_enum_t const * self) {
33711 0 : return self->discriminant == 19;
33712 0 : }
33713 0 : FD_FN_PURE uchar fd_txn_error_enum_is_would_exceed_max_account_cost_limit(fd_txn_error_enum_t const * self) {
33714 0 : return self->discriminant == 20;
33715 0 : }
33716 0 : FD_FN_PURE uchar fd_txn_error_enum_is_would_exceed_account_data_block_limit(fd_txn_error_enum_t const * self) {
33717 0 : return self->discriminant == 21;
33718 0 : }
33719 0 : FD_FN_PURE uchar fd_txn_error_enum_is_too_many_account_locks(fd_txn_error_enum_t const * self) {
33720 0 : return self->discriminant == 22;
33721 0 : }
33722 0 : FD_FN_PURE uchar fd_txn_error_enum_is_address_lookup_table_not_found(fd_txn_error_enum_t const * self) {
33723 0 : return self->discriminant == 23;
33724 0 : }
33725 0 : FD_FN_PURE uchar fd_txn_error_enum_is_invalid_address_lookup_table_owner(fd_txn_error_enum_t const * self) {
33726 0 : return self->discriminant == 24;
33727 0 : }
33728 0 : FD_FN_PURE uchar fd_txn_error_enum_is_invalid_address_lookup_table_data(fd_txn_error_enum_t const * self) {
33729 0 : return self->discriminant == 25;
33730 0 : }
33731 0 : FD_FN_PURE uchar fd_txn_error_enum_is_invalid_address_lookup_table_index(fd_txn_error_enum_t const * self) {
33732 0 : return self->discriminant == 26;
33733 0 : }
33734 0 : FD_FN_PURE uchar fd_txn_error_enum_is_invalid_rent_paying_account(fd_txn_error_enum_t const * self) {
33735 0 : return self->discriminant == 27;
33736 0 : }
33737 0 : FD_FN_PURE uchar fd_txn_error_enum_is_would_exceed_max_vote_cost_limit(fd_txn_error_enum_t const * self) {
33738 0 : return self->discriminant == 28;
33739 0 : }
33740 0 : FD_FN_PURE uchar fd_txn_error_enum_is_would_exceed_account_data_total_limit(fd_txn_error_enum_t const * self) {
33741 0 : return self->discriminant == 29;
33742 0 : }
33743 0 : FD_FN_PURE uchar fd_txn_error_enum_is_duplicate_instruction(fd_txn_error_enum_t const * self) {
33744 0 : return self->discriminant == 30;
33745 0 : }
33746 0 : FD_FN_PURE uchar fd_txn_error_enum_is_insufficient_funds_for_rent(fd_txn_error_enum_t const * self) {
33747 0 : return self->discriminant == 31;
33748 0 : }
33749 0 : FD_FN_PURE uchar fd_txn_error_enum_is_max_loaded_accounts_data_size_exceeded(fd_txn_error_enum_t const * self) {
33750 0 : return self->discriminant == 32;
33751 0 : }
33752 0 : FD_FN_PURE uchar fd_txn_error_enum_is_invalid_loaded_accounts_data_size_limit(fd_txn_error_enum_t const * self) {
33753 0 : return self->discriminant == 33;
33754 0 : }
33755 0 : FD_FN_PURE uchar fd_txn_error_enum_is_resanitization_needed(fd_txn_error_enum_t const * self) {
33756 0 : return self->discriminant == 34;
33757 0 : }
33758 0 : FD_FN_PURE uchar fd_txn_error_enum_is_program_execution_temporarily_restricted(fd_txn_error_enum_t const * self) {
33759 0 : return self->discriminant == 35;
33760 0 : }
33761 0 : FD_FN_PURE uchar fd_txn_error_enum_is_unbalanced_transaction(fd_txn_error_enum_t const * self) {
33762 0 : return self->discriminant == 36;
33763 0 : }
33764 : void fd_txn_error_enum_inner_new( fd_txn_error_enum_inner_t * self, uint discriminant );
33765 0 : int fd_txn_error_enum_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
33766 0 : int err;
33767 0 : switch (discriminant) {
33768 0 : case 0: {
33769 0 : return FD_BINCODE_SUCCESS;
33770 0 : }
33771 0 : case 1: {
33772 0 : return FD_BINCODE_SUCCESS;
33773 0 : }
33774 0 : case 2: {
33775 0 : return FD_BINCODE_SUCCESS;
33776 0 : }
33777 0 : case 3: {
33778 0 : return FD_BINCODE_SUCCESS;
33779 0 : }
33780 0 : case 4: {
33781 0 : return FD_BINCODE_SUCCESS;
33782 0 : }
33783 0 : case 5: {
33784 0 : return FD_BINCODE_SUCCESS;
33785 0 : }
33786 0 : case 6: {
33787 0 : return FD_BINCODE_SUCCESS;
33788 0 : }
33789 0 : case 7: {
33790 0 : return FD_BINCODE_SUCCESS;
33791 0 : }
33792 0 : case 8: {
33793 0 : err = fd_txn_instr_error_decode_footprint_inner( ctx, total_sz );
33794 0 : if( FD_UNLIKELY( err ) ) return err;
33795 0 : return FD_BINCODE_SUCCESS;
33796 0 : }
33797 0 : case 9: {
33798 0 : return FD_BINCODE_SUCCESS;
33799 0 : }
33800 0 : case 10: {
33801 0 : return FD_BINCODE_SUCCESS;
33802 0 : }
33803 0 : case 11: {
33804 0 : return FD_BINCODE_SUCCESS;
33805 0 : }
33806 0 : case 12: {
33807 0 : return FD_BINCODE_SUCCESS;
33808 0 : }
33809 0 : case 13: {
33810 0 : return FD_BINCODE_SUCCESS;
33811 0 : }
33812 0 : case 14: {
33813 0 : return FD_BINCODE_SUCCESS;
33814 0 : }
33815 0 : case 15: {
33816 0 : return FD_BINCODE_SUCCESS;
33817 0 : }
33818 0 : case 16: {
33819 0 : return FD_BINCODE_SUCCESS;
33820 0 : }
33821 0 : case 17: {
33822 0 : return FD_BINCODE_SUCCESS;
33823 0 : }
33824 0 : case 18: {
33825 0 : return FD_BINCODE_SUCCESS;
33826 0 : }
33827 0 : case 19: {
33828 0 : return FD_BINCODE_SUCCESS;
33829 0 : }
33830 0 : case 20: {
33831 0 : return FD_BINCODE_SUCCESS;
33832 0 : }
33833 0 : case 21: {
33834 0 : return FD_BINCODE_SUCCESS;
33835 0 : }
33836 0 : case 22: {
33837 0 : return FD_BINCODE_SUCCESS;
33838 0 : }
33839 0 : case 23: {
33840 0 : return FD_BINCODE_SUCCESS;
33841 0 : }
33842 0 : case 24: {
33843 0 : return FD_BINCODE_SUCCESS;
33844 0 : }
33845 0 : case 25: {
33846 0 : return FD_BINCODE_SUCCESS;
33847 0 : }
33848 0 : case 26: {
33849 0 : return FD_BINCODE_SUCCESS;
33850 0 : }
33851 0 : case 27: {
33852 0 : return FD_BINCODE_SUCCESS;
33853 0 : }
33854 0 : case 28: {
33855 0 : return FD_BINCODE_SUCCESS;
33856 0 : }
33857 0 : case 29: {
33858 0 : return FD_BINCODE_SUCCESS;
33859 0 : }
33860 0 : case 30: {
33861 0 : err = fd_bincode_uint8_decode_footprint( ctx );
33862 0 : if( FD_UNLIKELY( err ) ) return err;
33863 0 : return FD_BINCODE_SUCCESS;
33864 0 : }
33865 0 : case 31: {
33866 0 : err = fd_bincode_uint8_decode_footprint( ctx );
33867 0 : if( FD_UNLIKELY( err ) ) return err;
33868 0 : return FD_BINCODE_SUCCESS;
33869 0 : }
33870 0 : case 32: {
33871 0 : return FD_BINCODE_SUCCESS;
33872 0 : }
33873 0 : case 33: {
33874 0 : return FD_BINCODE_SUCCESS;
33875 0 : }
33876 0 : case 34: {
33877 0 : return FD_BINCODE_SUCCESS;
33878 0 : }
33879 0 : case 35: {
33880 0 : err = fd_bincode_uint8_decode_footprint( ctx );
33881 0 : if( FD_UNLIKELY( err ) ) return err;
33882 0 : return FD_BINCODE_SUCCESS;
33883 0 : }
33884 0 : case 36: {
33885 0 : return FD_BINCODE_SUCCESS;
33886 0 : }
33887 0 : default: return FD_BINCODE_ERR_ENCODING;
33888 0 : }
33889 0 : }
33890 0 : int fd_txn_error_enum_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
33891 0 : *total_sz += sizeof(fd_txn_error_enum_t);
33892 0 : void const * start_data = ctx->data;
33893 0 : int err = fd_txn_error_enum_decode_footprint_inner( ctx, total_sz );
33894 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
33895 0 : ctx->data = start_data;
33896 0 : return err;
33897 0 : }
33898 0 : int fd_txn_error_enum_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
33899 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
33900 0 : uint discriminant = 0;
33901 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
33902 0 : if( FD_UNLIKELY( err ) ) return err;
33903 0 : return fd_txn_error_enum_inner_decode_footprint( discriminant, ctx, total_sz );
33904 0 : }
33905 0 : void fd_txn_error_enum_inner_decode_inner( fd_txn_error_enum_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
33906 0 : switch (discriminant) {
33907 0 : case 0: {
33908 0 : break;
33909 0 : }
33910 0 : case 1: {
33911 0 : break;
33912 0 : }
33913 0 : case 2: {
33914 0 : break;
33915 0 : }
33916 0 : case 3: {
33917 0 : break;
33918 0 : }
33919 0 : case 4: {
33920 0 : break;
33921 0 : }
33922 0 : case 5: {
33923 0 : break;
33924 0 : }
33925 0 : case 6: {
33926 0 : break;
33927 0 : }
33928 0 : case 7: {
33929 0 : break;
33930 0 : }
33931 0 : case 8: {
33932 0 : fd_txn_instr_error_decode_inner( &self->instruction_error, alloc_mem, ctx );
33933 0 : break;
33934 0 : }
33935 0 : case 9: {
33936 0 : break;
33937 0 : }
33938 0 : case 10: {
33939 0 : break;
33940 0 : }
33941 0 : case 11: {
33942 0 : break;
33943 0 : }
33944 0 : case 12: {
33945 0 : break;
33946 0 : }
33947 0 : case 13: {
33948 0 : break;
33949 0 : }
33950 0 : case 14: {
33951 0 : break;
33952 0 : }
33953 0 : case 15: {
33954 0 : break;
33955 0 : }
33956 0 : case 16: {
33957 0 : break;
33958 0 : }
33959 0 : case 17: {
33960 0 : break;
33961 0 : }
33962 0 : case 18: {
33963 0 : break;
33964 0 : }
33965 0 : case 19: {
33966 0 : break;
33967 0 : }
33968 0 : case 20: {
33969 0 : break;
33970 0 : }
33971 0 : case 21: {
33972 0 : break;
33973 0 : }
33974 0 : case 22: {
33975 0 : break;
33976 0 : }
33977 0 : case 23: {
33978 0 : break;
33979 0 : }
33980 0 : case 24: {
33981 0 : break;
33982 0 : }
33983 0 : case 25: {
33984 0 : break;
33985 0 : }
33986 0 : case 26: {
33987 0 : break;
33988 0 : }
33989 0 : case 27: {
33990 0 : break;
33991 0 : }
33992 0 : case 28: {
33993 0 : break;
33994 0 : }
33995 0 : case 29: {
33996 0 : break;
33997 0 : }
33998 0 : case 30: {
33999 0 : fd_bincode_uint8_decode_unsafe( &self->duplicate_instruction, ctx );
34000 0 : break;
34001 0 : }
34002 0 : case 31: {
34003 0 : fd_bincode_uint8_decode_unsafe( &self->insufficient_funds_for_rent, ctx );
34004 0 : break;
34005 0 : }
34006 0 : case 32: {
34007 0 : break;
34008 0 : }
34009 0 : case 33: {
34010 0 : break;
34011 0 : }
34012 0 : case 34: {
34013 0 : break;
34014 0 : }
34015 0 : case 35: {
34016 0 : fd_bincode_uint8_decode_unsafe( &self->program_execution_temporarily_restricted, ctx );
34017 0 : break;
34018 0 : }
34019 0 : case 36: {
34020 0 : break;
34021 0 : }
34022 0 : }
34023 0 : }
34024 0 : void fd_txn_error_enum_inner_decode_inner_global( fd_txn_error_enum_inner_global_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
34025 0 : switch (discriminant) {
34026 0 : case 0: {
34027 0 : break;
34028 0 : }
34029 0 : case 1: {
34030 0 : break;
34031 0 : }
34032 0 : case 2: {
34033 0 : break;
34034 0 : }
34035 0 : case 3: {
34036 0 : break;
34037 0 : }
34038 0 : case 4: {
34039 0 : break;
34040 0 : }
34041 0 : case 5: {
34042 0 : break;
34043 0 : }
34044 0 : case 6: {
34045 0 : break;
34046 0 : }
34047 0 : case 7: {
34048 0 : break;
34049 0 : }
34050 0 : case 8: {
34051 0 : fd_txn_instr_error_decode_inner_global( &self->instruction_error, alloc_mem, ctx );
34052 0 : break;
34053 0 : }
34054 0 : case 9: {
34055 0 : break;
34056 0 : }
34057 0 : case 10: {
34058 0 : break;
34059 0 : }
34060 0 : case 11: {
34061 0 : break;
34062 0 : }
34063 0 : case 12: {
34064 0 : break;
34065 0 : }
34066 0 : case 13: {
34067 0 : break;
34068 0 : }
34069 0 : case 14: {
34070 0 : break;
34071 0 : }
34072 0 : case 15: {
34073 0 : break;
34074 0 : }
34075 0 : case 16: {
34076 0 : break;
34077 0 : }
34078 0 : case 17: {
34079 0 : break;
34080 0 : }
34081 0 : case 18: {
34082 0 : break;
34083 0 : }
34084 0 : case 19: {
34085 0 : break;
34086 0 : }
34087 0 : case 20: {
34088 0 : break;
34089 0 : }
34090 0 : case 21: {
34091 0 : break;
34092 0 : }
34093 0 : case 22: {
34094 0 : break;
34095 0 : }
34096 0 : case 23: {
34097 0 : break;
34098 0 : }
34099 0 : case 24: {
34100 0 : break;
34101 0 : }
34102 0 : case 25: {
34103 0 : break;
34104 0 : }
34105 0 : case 26: {
34106 0 : break;
34107 0 : }
34108 0 : case 27: {
34109 0 : break;
34110 0 : }
34111 0 : case 28: {
34112 0 : break;
34113 0 : }
34114 0 : case 29: {
34115 0 : break;
34116 0 : }
34117 0 : case 30: {
34118 0 : fd_bincode_uint8_decode_unsafe( &self->duplicate_instruction, ctx );
34119 0 : break;
34120 0 : }
34121 0 : case 31: {
34122 0 : fd_bincode_uint8_decode_unsafe( &self->insufficient_funds_for_rent, ctx );
34123 0 : break;
34124 0 : }
34125 0 : case 32: {
34126 0 : break;
34127 0 : }
34128 0 : case 33: {
34129 0 : break;
34130 0 : }
34131 0 : case 34: {
34132 0 : break;
34133 0 : }
34134 0 : case 35: {
34135 0 : fd_bincode_uint8_decode_unsafe( &self->program_execution_temporarily_restricted, ctx );
34136 0 : break;
34137 0 : }
34138 0 : case 36: {
34139 0 : break;
34140 0 : }
34141 0 : }
34142 0 : }
34143 0 : int fd_txn_error_enum_convert_global_to_local_inner( fd_txn_error_enum_inner_global_t const * mem, fd_txn_error_enum_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
34144 0 : int err = 0;
34145 0 : switch( discriminant ) {
34146 0 : case 0: {
34147 0 : break;
34148 0 : }
34149 0 : case 1: {
34150 0 : break;
34151 0 : }
34152 0 : case 2: {
34153 0 : break;
34154 0 : }
34155 0 : case 3: {
34156 0 : break;
34157 0 : }
34158 0 : case 4: {
34159 0 : break;
34160 0 : }
34161 0 : case 5: {
34162 0 : break;
34163 0 : }
34164 0 : case 6: {
34165 0 : break;
34166 0 : }
34167 0 : case 7: {
34168 0 : break;
34169 0 : }
34170 0 : case 8: {
34171 0 : err = fd_txn_instr_error_convert_global_to_local( &mem->instruction_error, &self->instruction_error, ctx );
34172 0 : if( FD_UNLIKELY( err ) ) return err;
34173 0 : break;
34174 0 : }
34175 0 : case 9: {
34176 0 : break;
34177 0 : }
34178 0 : case 10: {
34179 0 : break;
34180 0 : }
34181 0 : case 11: {
34182 0 : break;
34183 0 : }
34184 0 : case 12: {
34185 0 : break;
34186 0 : }
34187 0 : case 13: {
34188 0 : break;
34189 0 : }
34190 0 : case 14: {
34191 0 : break;
34192 0 : }
34193 0 : case 15: {
34194 0 : break;
34195 0 : }
34196 0 : case 16: {
34197 0 : break;
34198 0 : }
34199 0 : case 17: {
34200 0 : break;
34201 0 : }
34202 0 : case 18: {
34203 0 : break;
34204 0 : }
34205 0 : case 19: {
34206 0 : break;
34207 0 : }
34208 0 : case 20: {
34209 0 : break;
34210 0 : }
34211 0 : case 21: {
34212 0 : break;
34213 0 : }
34214 0 : case 22: {
34215 0 : break;
34216 0 : }
34217 0 : case 23: {
34218 0 : break;
34219 0 : }
34220 0 : case 24: {
34221 0 : break;
34222 0 : }
34223 0 : case 25: {
34224 0 : break;
34225 0 : }
34226 0 : case 26: {
34227 0 : break;
34228 0 : }
34229 0 : case 27: {
34230 0 : break;
34231 0 : }
34232 0 : case 28: {
34233 0 : break;
34234 0 : }
34235 0 : case 29: {
34236 0 : break;
34237 0 : }
34238 0 : case 30: {
34239 0 : self->duplicate_instruction = mem->duplicate_instruction;
34240 0 : break;
34241 0 : }
34242 0 : case 31: {
34243 0 : self->insufficient_funds_for_rent = mem->insufficient_funds_for_rent;
34244 0 : break;
34245 0 : }
34246 0 : case 32: {
34247 0 : break;
34248 0 : }
34249 0 : case 33: {
34250 0 : break;
34251 0 : }
34252 0 : case 34: {
34253 0 : break;
34254 0 : }
34255 0 : case 35: {
34256 0 : self->program_execution_temporarily_restricted = mem->program_execution_temporarily_restricted;
34257 0 : break;
34258 0 : }
34259 0 : case 36: {
34260 0 : break;
34261 0 : }
34262 0 : }
34263 0 : return FD_BINCODE_SUCCESS;
34264 0 : }
34265 0 : int fd_txn_error_enum_convert_global_to_local( void const * global_self, fd_txn_error_enum_t * self, fd_bincode_decode_ctx_t * ctx ) {
34266 0 : fd_txn_error_enum_global_t const * mem = (fd_txn_error_enum_global_t const *)global_self;
34267 0 : uint discriminant = mem->discriminant;
34268 0 : self->discriminant = mem->discriminant;
34269 0 : int err = fd_txn_error_enum_convert_global_to_local_inner( &mem->inner, &self->inner, discriminant, ctx );
34270 0 : return FD_BINCODE_SUCCESS;
34271 0 : }
34272 0 : void fd_txn_error_enum_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
34273 0 : fd_txn_error_enum_t * self = (fd_txn_error_enum_t *)struct_mem;
34274 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
34275 0 : fd_txn_error_enum_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
34276 0 : }
34277 0 : void * fd_txn_error_enum_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
34278 0 : fd_txn_error_enum_t * self = (fd_txn_error_enum_t *)mem;
34279 0 : fd_txn_error_enum_new( self );
34280 0 : void * alloc_region = (uchar *)mem + sizeof(fd_txn_error_enum_t);
34281 0 : void * * alloc_mem = &alloc_region;
34282 0 : fd_txn_error_enum_decode_inner( mem, alloc_mem, ctx );
34283 0 : return self;
34284 0 : }
34285 0 : void * fd_txn_error_enum_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
34286 0 : fd_txn_error_enum_t * self = (fd_txn_error_enum_t *)mem;
34287 0 : fd_txn_error_enum_new( self );
34288 0 : void * alloc_region = (uchar *)mem + sizeof(fd_txn_error_enum_t);
34289 0 : void * * alloc_mem = &alloc_region;
34290 0 : fd_txn_error_enum_decode_inner_global( mem, alloc_mem, ctx );
34291 0 : return self;
34292 0 : }
34293 0 : void fd_txn_error_enum_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
34294 0 : fd_txn_error_enum_global_t * self = (fd_txn_error_enum_global_t *)struct_mem;
34295 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
34296 0 : fd_txn_error_enum_inner_decode_inner_global( &self->inner, alloc_mem, self->discriminant, ctx );
34297 0 : }
34298 0 : void fd_txn_error_enum_inner_new( fd_txn_error_enum_inner_t * self, uint discriminant ) {
34299 0 : switch( discriminant ) {
34300 0 : case 0: {
34301 0 : break;
34302 0 : }
34303 0 : case 1: {
34304 0 : break;
34305 0 : }
34306 0 : case 2: {
34307 0 : break;
34308 0 : }
34309 0 : case 3: {
34310 0 : break;
34311 0 : }
34312 0 : case 4: {
34313 0 : break;
34314 0 : }
34315 0 : case 5: {
34316 0 : break;
34317 0 : }
34318 0 : case 6: {
34319 0 : break;
34320 0 : }
34321 0 : case 7: {
34322 0 : break;
34323 0 : }
34324 0 : case 8: {
34325 0 : fd_txn_instr_error_new( &self->instruction_error );
34326 0 : break;
34327 0 : }
34328 0 : case 9: {
34329 0 : break;
34330 0 : }
34331 0 : case 10: {
34332 0 : break;
34333 0 : }
34334 0 : case 11: {
34335 0 : break;
34336 0 : }
34337 0 : case 12: {
34338 0 : break;
34339 0 : }
34340 0 : case 13: {
34341 0 : break;
34342 0 : }
34343 0 : case 14: {
34344 0 : break;
34345 0 : }
34346 0 : case 15: {
34347 0 : break;
34348 0 : }
34349 0 : case 16: {
34350 0 : break;
34351 0 : }
34352 0 : case 17: {
34353 0 : break;
34354 0 : }
34355 0 : case 18: {
34356 0 : break;
34357 0 : }
34358 0 : case 19: {
34359 0 : break;
34360 0 : }
34361 0 : case 20: {
34362 0 : break;
34363 0 : }
34364 0 : case 21: {
34365 0 : break;
34366 0 : }
34367 0 : case 22: {
34368 0 : break;
34369 0 : }
34370 0 : case 23: {
34371 0 : break;
34372 0 : }
34373 0 : case 24: {
34374 0 : break;
34375 0 : }
34376 0 : case 25: {
34377 0 : break;
34378 0 : }
34379 0 : case 26: {
34380 0 : break;
34381 0 : }
34382 0 : case 27: {
34383 0 : break;
34384 0 : }
34385 0 : case 28: {
34386 0 : break;
34387 0 : }
34388 0 : case 29: {
34389 0 : break;
34390 0 : }
34391 0 : case 30: {
34392 0 : break;
34393 0 : }
34394 0 : case 31: {
34395 0 : break;
34396 0 : }
34397 0 : case 32: {
34398 0 : break;
34399 0 : }
34400 0 : case 33: {
34401 0 : break;
34402 0 : }
34403 0 : case 34: {
34404 0 : break;
34405 0 : }
34406 0 : case 35: {
34407 0 : break;
34408 0 : }
34409 0 : case 36: {
34410 0 : break;
34411 0 : }
34412 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
34413 0 : }
34414 0 : }
34415 0 : void fd_txn_error_enum_new_disc( fd_txn_error_enum_t * self, uint discriminant ) {
34416 0 : self->discriminant = discriminant;
34417 0 : fd_txn_error_enum_inner_new( &self->inner, self->discriminant );
34418 0 : }
34419 0 : void fd_txn_error_enum_new( fd_txn_error_enum_t * self ) {
34420 0 : fd_memset( self, 0, sizeof(fd_txn_error_enum_t) );
34421 0 : fd_txn_error_enum_new_disc( self, UINT_MAX );
34422 0 : }
34423 0 : void fd_txn_error_enum_inner_destroy( fd_txn_error_enum_inner_t * self, uint discriminant ) {
34424 0 : switch( discriminant ) {
34425 0 : case 8: {
34426 0 : fd_txn_instr_error_destroy( &self->instruction_error );
34427 0 : break;
34428 0 : }
34429 0 : case 30: {
34430 0 : break;
34431 0 : }
34432 0 : case 31: {
34433 0 : break;
34434 0 : }
34435 0 : case 35: {
34436 0 : break;
34437 0 : }
34438 0 : default: break; // FD_LOG_ERR(( "unhandled type" ));
34439 0 : }
34440 0 : }
34441 0 : void fd_txn_error_enum_destroy( fd_txn_error_enum_t * self ) {
34442 0 : fd_txn_error_enum_inner_destroy( &self->inner, self->discriminant );
34443 0 : }
34444 :
34445 0 : ulong fd_txn_error_enum_footprint( void ){ return FD_TXN_ERROR_ENUM_FOOTPRINT; }
34446 0 : ulong fd_txn_error_enum_align( void ){ return FD_TXN_ERROR_ENUM_ALIGN; }
34447 :
34448 0 : void fd_txn_error_enum_walk( void * w, fd_txn_error_enum_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
34449 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_txn_error_enum", level++);
34450 0 : switch( self->discriminant ) {
34451 0 : case 0: {
34452 0 : fun( w, self, "account_in_use", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
34453 0 : break;
34454 0 : }
34455 0 : case 1: {
34456 0 : fun( w, self, "account_loaded_twice", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
34457 0 : break;
34458 0 : }
34459 0 : case 2: {
34460 0 : fun( w, self, "account_not_found", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
34461 0 : break;
34462 0 : }
34463 0 : case 3: {
34464 0 : fun( w, self, "program_account_not_found", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
34465 0 : break;
34466 0 : }
34467 0 : case 4: {
34468 0 : fun( w, self, "insufficient_funds_for_fee", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
34469 0 : break;
34470 0 : }
34471 0 : case 5: {
34472 0 : fun( w, self, "invalid_account_for_fee", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
34473 0 : break;
34474 0 : }
34475 0 : case 6: {
34476 0 : fun( w, self, "already_processed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
34477 0 : break;
34478 0 : }
34479 0 : case 7: {
34480 0 : fun( w, self, "blockhash_not_found", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
34481 0 : break;
34482 0 : }
34483 0 : case 8: {
34484 0 : fun( w, self, "instruction_error", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
34485 0 : fd_txn_instr_error_walk( w, &self->inner.instruction_error, fun, "instruction_error", level );
34486 0 : break;
34487 0 : }
34488 0 : case 9: {
34489 0 : fun( w, self, "call_chain_too_deep", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
34490 0 : break;
34491 0 : }
34492 0 : case 10: {
34493 0 : fun( w, self, "missing_signature_for_fee", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
34494 0 : break;
34495 0 : }
34496 0 : case 11: {
34497 0 : fun( w, self, "invalid_account_index", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
34498 0 : break;
34499 0 : }
34500 0 : case 12: {
34501 0 : fun( w, self, "signature_failure", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
34502 0 : break;
34503 0 : }
34504 0 : case 13: {
34505 0 : fun( w, self, "invalid_program_for_execution", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
34506 0 : break;
34507 0 : }
34508 0 : case 14: {
34509 0 : fun( w, self, "sanitize_failure", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
34510 0 : break;
34511 0 : }
34512 0 : case 15: {
34513 0 : fun( w, self, "cluster_maintenance", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
34514 0 : break;
34515 0 : }
34516 0 : case 16: {
34517 0 : fun( w, self, "account_borrow_outstanding", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
34518 0 : break;
34519 0 : }
34520 0 : case 17: {
34521 0 : fun( w, self, "would_exceed_max_block_cost_limit", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
34522 0 : break;
34523 0 : }
34524 0 : case 18: {
34525 0 : fun( w, self, "unsupported_version", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
34526 0 : break;
34527 0 : }
34528 0 : case 19: {
34529 0 : fun( w, self, "invalid_writable_account", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
34530 0 : break;
34531 0 : }
34532 0 : case 20: {
34533 0 : fun( w, self, "would_exceed_max_account_cost_limit", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
34534 0 : break;
34535 0 : }
34536 0 : case 21: {
34537 0 : fun( w, self, "would_exceed_account_data_block_limit", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
34538 0 : break;
34539 0 : }
34540 0 : case 22: {
34541 0 : fun( w, self, "too_many_account_locks", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
34542 0 : break;
34543 0 : }
34544 0 : case 23: {
34545 0 : fun( w, self, "address_lookup_table_not_found", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
34546 0 : break;
34547 0 : }
34548 0 : case 24: {
34549 0 : fun( w, self, "invalid_address_lookup_table_owner", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
34550 0 : break;
34551 0 : }
34552 0 : case 25: {
34553 0 : fun( w, self, "invalid_address_lookup_table_data", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
34554 0 : break;
34555 0 : }
34556 0 : case 26: {
34557 0 : fun( w, self, "invalid_address_lookup_table_index", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
34558 0 : break;
34559 0 : }
34560 0 : case 27: {
34561 0 : fun( w, self, "invalid_rent_paying_account", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
34562 0 : break;
34563 0 : }
34564 0 : case 28: {
34565 0 : fun( w, self, "would_exceed_max_vote_cost_limit", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
34566 0 : break;
34567 0 : }
34568 0 : case 29: {
34569 0 : fun( w, self, "would_exceed_account_data_total_limit", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
34570 0 : break;
34571 0 : }
34572 0 : case 30: {
34573 0 : fun( w, self, "duplicate_instruction", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
34574 0 : fun( w, &self->inner.duplicate_instruction, "duplicate_instruction", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
34575 0 : break;
34576 0 : }
34577 0 : case 31: {
34578 0 : fun( w, self, "insufficient_funds_for_rent", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
34579 0 : fun( w, &self->inner.insufficient_funds_for_rent, "insufficient_funds_for_rent", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
34580 0 : break;
34581 0 : }
34582 0 : case 32: {
34583 0 : fun( w, self, "max_loaded_accounts_data_size_exceeded", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
34584 0 : break;
34585 0 : }
34586 0 : case 33: {
34587 0 : fun( w, self, "invalid_loaded_accounts_data_size_limit", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
34588 0 : break;
34589 0 : }
34590 0 : case 34: {
34591 0 : fun( w, self, "resanitization_needed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
34592 0 : break;
34593 0 : }
34594 0 : case 35: {
34595 0 : fun( w, self, "program_execution_temporarily_restricted", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
34596 0 : fun( w, &self->inner.program_execution_temporarily_restricted, "program_execution_temporarily_restricted", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
34597 0 : break;
34598 0 : }
34599 0 : case 36: {
34600 0 : fun( w, self, "unbalanced_transaction", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
34601 0 : break;
34602 0 : }
34603 0 : }
34604 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_txn_error_enum", level-- );
34605 0 : }
34606 0 : ulong fd_txn_error_enum_size( fd_txn_error_enum_t const * self ) {
34607 0 : ulong size = 0;
34608 0 : size += sizeof(uint);
34609 0 : switch (self->discriminant) {
34610 0 : case 8: {
34611 0 : size += fd_txn_instr_error_size( &self->inner.instruction_error );
34612 0 : break;
34613 0 : }
34614 0 : case 30: {
34615 0 : size += sizeof(char);
34616 0 : break;
34617 0 : }
34618 0 : case 31: {
34619 0 : size += sizeof(char);
34620 0 : break;
34621 0 : }
34622 0 : case 35: {
34623 0 : size += sizeof(char);
34624 0 : break;
34625 0 : }
34626 0 : }
34627 0 : return size;
34628 0 : }
34629 :
34630 0 : int fd_txn_error_enum_inner_encode( fd_txn_error_enum_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
34631 0 : int err;
34632 0 : switch (discriminant) {
34633 0 : case 8: {
34634 0 : err = fd_txn_instr_error_encode( &self->instruction_error, ctx );
34635 0 : if( FD_UNLIKELY( err ) ) return err;
34636 0 : break;
34637 0 : }
34638 0 : case 30: {
34639 0 : err = fd_bincode_uint8_encode( (uchar)(self->duplicate_instruction), ctx );
34640 0 : if( FD_UNLIKELY( err ) ) return err;
34641 0 : break;
34642 0 : }
34643 0 : case 31: {
34644 0 : err = fd_bincode_uint8_encode( (uchar)(self->insufficient_funds_for_rent), ctx );
34645 0 : if( FD_UNLIKELY( err ) ) return err;
34646 0 : break;
34647 0 : }
34648 0 : case 35: {
34649 0 : err = fd_bincode_uint8_encode( (uchar)(self->program_execution_temporarily_restricted), ctx );
34650 0 : if( FD_UNLIKELY( err ) ) return err;
34651 0 : break;
34652 0 : }
34653 0 : }
34654 0 : return FD_BINCODE_SUCCESS;
34655 0 : }
34656 0 : int fd_txn_error_enum_encode( fd_txn_error_enum_t const * self, fd_bincode_encode_ctx_t * ctx ) {
34657 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
34658 0 : if( FD_UNLIKELY( err ) ) return err;
34659 0 : return fd_txn_error_enum_inner_encode( &self->inner, self->discriminant, ctx );
34660 0 : }
34661 :
34662 0 : FD_FN_PURE uchar fd_txn_result_is_ok(fd_txn_result_t const * self) {
34663 0 : return self->discriminant == 0;
34664 0 : }
34665 0 : FD_FN_PURE uchar fd_txn_result_is_error(fd_txn_result_t const * self) {
34666 0 : return self->discriminant == 1;
34667 0 : }
34668 : void fd_txn_result_inner_new( fd_txn_result_inner_t * self, uint discriminant );
34669 3 : int fd_txn_result_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
34670 3 : int err;
34671 3 : switch (discriminant) {
34672 3 : case 0: {
34673 3 : return FD_BINCODE_SUCCESS;
34674 0 : }
34675 0 : case 1: {
34676 0 : err = fd_txn_error_enum_decode_footprint_inner( ctx, total_sz );
34677 0 : if( FD_UNLIKELY( err ) ) return err;
34678 0 : return FD_BINCODE_SUCCESS;
34679 0 : }
34680 0 : default: return FD_BINCODE_ERR_ENCODING;
34681 3 : }
34682 3 : }
34683 0 : int fd_txn_result_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
34684 0 : *total_sz += sizeof(fd_txn_result_t);
34685 0 : void const * start_data = ctx->data;
34686 0 : int err = fd_txn_result_decode_footprint_inner( ctx, total_sz );
34687 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
34688 0 : ctx->data = start_data;
34689 0 : return err;
34690 0 : }
34691 3 : int fd_txn_result_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
34692 3 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
34693 3 : uint discriminant = 0;
34694 3 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
34695 3 : if( FD_UNLIKELY( err ) ) return err;
34696 3 : return fd_txn_result_inner_decode_footprint( discriminant, ctx, total_sz );
34697 3 : }
34698 3 : void fd_txn_result_inner_decode_inner( fd_txn_result_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
34699 3 : switch (discriminant) {
34700 3 : case 0: {
34701 3 : break;
34702 0 : }
34703 0 : case 1: {
34704 0 : fd_txn_error_enum_decode_inner( &self->error, alloc_mem, ctx );
34705 0 : break;
34706 0 : }
34707 3 : }
34708 3 : }
34709 0 : void fd_txn_result_inner_decode_inner_global( fd_txn_result_inner_global_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
34710 0 : switch (discriminant) {
34711 0 : case 0: {
34712 0 : break;
34713 0 : }
34714 0 : case 1: {
34715 0 : fd_txn_error_enum_decode_inner_global( &self->error, alloc_mem, ctx );
34716 0 : break;
34717 0 : }
34718 0 : }
34719 0 : }
34720 0 : int fd_txn_result_convert_global_to_local_inner( fd_txn_result_inner_global_t const * mem, fd_txn_result_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
34721 0 : int err = 0;
34722 0 : switch( discriminant ) {
34723 0 : case 0: {
34724 0 : break;
34725 0 : }
34726 0 : case 1: {
34727 0 : err = fd_txn_error_enum_convert_global_to_local( &mem->error, &self->error, ctx );
34728 0 : if( FD_UNLIKELY( err ) ) return err;
34729 0 : break;
34730 0 : }
34731 0 : }
34732 0 : return FD_BINCODE_SUCCESS;
34733 0 : }
34734 0 : int fd_txn_result_convert_global_to_local( void const * global_self, fd_txn_result_t * self, fd_bincode_decode_ctx_t * ctx ) {
34735 0 : fd_txn_result_global_t const * mem = (fd_txn_result_global_t const *)global_self;
34736 0 : uint discriminant = mem->discriminant;
34737 0 : self->discriminant = mem->discriminant;
34738 0 : int err = fd_txn_result_convert_global_to_local_inner( &mem->inner, &self->inner, discriminant, ctx );
34739 0 : return FD_BINCODE_SUCCESS;
34740 0 : }
34741 3 : void fd_txn_result_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
34742 3 : fd_txn_result_t * self = (fd_txn_result_t *)struct_mem;
34743 3 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
34744 3 : fd_txn_result_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
34745 3 : }
34746 0 : void * fd_txn_result_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
34747 0 : fd_txn_result_t * self = (fd_txn_result_t *)mem;
34748 0 : fd_txn_result_new( self );
34749 0 : void * alloc_region = (uchar *)mem + sizeof(fd_txn_result_t);
34750 0 : void * * alloc_mem = &alloc_region;
34751 0 : fd_txn_result_decode_inner( mem, alloc_mem, ctx );
34752 0 : return self;
34753 0 : }
34754 0 : void * fd_txn_result_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
34755 0 : fd_txn_result_t * self = (fd_txn_result_t *)mem;
34756 0 : fd_txn_result_new( self );
34757 0 : void * alloc_region = (uchar *)mem + sizeof(fd_txn_result_t);
34758 0 : void * * alloc_mem = &alloc_region;
34759 0 : fd_txn_result_decode_inner_global( mem, alloc_mem, ctx );
34760 0 : return self;
34761 0 : }
34762 0 : void fd_txn_result_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
34763 0 : fd_txn_result_global_t * self = (fd_txn_result_global_t *)struct_mem;
34764 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
34765 0 : fd_txn_result_inner_decode_inner_global( &self->inner, alloc_mem, self->discriminant, ctx );
34766 0 : }
34767 3 : void fd_txn_result_inner_new( fd_txn_result_inner_t * self, uint discriminant ) {
34768 3 : switch( discriminant ) {
34769 0 : case 0: {
34770 0 : break;
34771 0 : }
34772 0 : case 1: {
34773 0 : fd_txn_error_enum_new( &self->error );
34774 0 : break;
34775 0 : }
34776 3 : default: break; // FD_LOG_ERR(( "unhandled type"));
34777 3 : }
34778 3 : }
34779 3 : void fd_txn_result_new_disc( fd_txn_result_t * self, uint discriminant ) {
34780 3 : self->discriminant = discriminant;
34781 3 : fd_txn_result_inner_new( &self->inner, self->discriminant );
34782 3 : }
34783 3 : void fd_txn_result_new( fd_txn_result_t * self ) {
34784 3 : fd_memset( self, 0, sizeof(fd_txn_result_t) );
34785 3 : fd_txn_result_new_disc( self, UINT_MAX );
34786 3 : }
34787 0 : void fd_txn_result_inner_destroy( fd_txn_result_inner_t * self, uint discriminant ) {
34788 0 : switch( discriminant ) {
34789 0 : case 1: {
34790 0 : fd_txn_error_enum_destroy( &self->error );
34791 0 : break;
34792 0 : }
34793 0 : default: break; // FD_LOG_ERR(( "unhandled type" ));
34794 0 : }
34795 0 : }
34796 0 : void fd_txn_result_destroy( fd_txn_result_t * self ) {
34797 0 : fd_txn_result_inner_destroy( &self->inner, self->discriminant );
34798 0 : }
34799 :
34800 0 : ulong fd_txn_result_footprint( void ){ return FD_TXN_RESULT_FOOTPRINT; }
34801 0 : ulong fd_txn_result_align( void ){ return FD_TXN_RESULT_ALIGN; }
34802 :
34803 0 : void fd_txn_result_walk( void * w, fd_txn_result_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
34804 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_txn_result", level++);
34805 0 : switch( self->discriminant ) {
34806 0 : case 0: {
34807 0 : fun( w, self, "ok", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
34808 0 : break;
34809 0 : }
34810 0 : case 1: {
34811 0 : fun( w, self, "error", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
34812 0 : fd_txn_error_enum_walk( w, &self->inner.error, fun, "error", level );
34813 0 : break;
34814 0 : }
34815 0 : }
34816 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_txn_result", level-- );
34817 0 : }
34818 3 : ulong fd_txn_result_size( fd_txn_result_t const * self ) {
34819 3 : ulong size = 0;
34820 3 : size += sizeof(uint);
34821 3 : switch (self->discriminant) {
34822 0 : case 1: {
34823 0 : size += fd_txn_error_enum_size( &self->inner.error );
34824 0 : break;
34825 0 : }
34826 3 : }
34827 3 : return size;
34828 3 : }
34829 :
34830 3 : int fd_txn_result_inner_encode( fd_txn_result_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
34831 3 : int err;
34832 3 : switch (discriminant) {
34833 0 : case 1: {
34834 0 : err = fd_txn_error_enum_encode( &self->error, ctx );
34835 0 : if( FD_UNLIKELY( err ) ) return err;
34836 0 : break;
34837 0 : }
34838 3 : }
34839 3 : return FD_BINCODE_SUCCESS;
34840 3 : }
34841 3 : int fd_txn_result_encode( fd_txn_result_t const * self, fd_bincode_encode_ctx_t * ctx ) {
34842 3 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
34843 3 : if( FD_UNLIKELY( err ) ) return err;
34844 3 : return fd_txn_result_inner_encode( &self->inner, self->discriminant, ctx );
34845 3 : }
34846 :
34847 3 : int fd_cache_status_encode( fd_cache_status_t const * self, fd_bincode_encode_ctx_t * ctx ) {
34848 3 : int err;
34849 3 : err = fd_bincode_bytes_encode( self->key_slice, 20, ctx );
34850 3 : if( FD_UNLIKELY( err ) ) return err;
34851 3 : err = fd_txn_result_encode( &self->result, ctx );
34852 3 : if( FD_UNLIKELY( err ) ) return err;
34853 3 : return FD_BINCODE_SUCCESS;
34854 3 : }
34855 0 : int fd_cache_status_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
34856 0 : *total_sz += sizeof(fd_cache_status_t);
34857 0 : void const * start_data = ctx->data;
34858 0 : int err = fd_cache_status_decode_footprint_inner( ctx, total_sz );
34859 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
34860 0 : ctx->data = start_data;
34861 0 : return err;
34862 0 : }
34863 3 : int fd_cache_status_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
34864 3 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
34865 3 : int err = 0;
34866 3 : err = fd_bincode_bytes_decode_footprint( 20, ctx );
34867 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
34868 3 : err = fd_txn_result_decode_footprint_inner( ctx, total_sz );
34869 3 : if( FD_UNLIKELY( err ) ) return err;
34870 3 : return 0;
34871 3 : }
34872 0 : void * fd_cache_status_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
34873 0 : fd_cache_status_t * self = (fd_cache_status_t *)mem;
34874 0 : fd_cache_status_new( self );
34875 0 : void * alloc_region = (uchar *)mem + sizeof(fd_cache_status_t);
34876 0 : void * * alloc_mem = &alloc_region;
34877 0 : fd_cache_status_decode_inner( mem, alloc_mem, ctx );
34878 0 : return self;
34879 0 : }
34880 3 : void fd_cache_status_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
34881 3 : fd_cache_status_t * self = (fd_cache_status_t *)struct_mem;
34882 3 : fd_bincode_bytes_decode_unsafe( self->key_slice, 20, ctx );
34883 3 : fd_txn_result_decode_inner( &self->result, alloc_mem, ctx );
34884 3 : }
34885 0 : void * fd_cache_status_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
34886 0 : fd_cache_status_global_t * self = (fd_cache_status_global_t *)mem;
34887 0 : fd_cache_status_new( (fd_cache_status_t *)self );
34888 0 : void * alloc_region = (uchar *)mem + sizeof(fd_cache_status_global_t);
34889 0 : void * * alloc_mem = &alloc_region;
34890 0 : fd_cache_status_decode_inner_global( mem, alloc_mem, ctx );
34891 0 : return self;
34892 0 : }
34893 0 : void fd_cache_status_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
34894 0 : fd_cache_status_global_t * self = (fd_cache_status_global_t *)struct_mem;
34895 0 : fd_bincode_bytes_decode_unsafe( self->key_slice, 20, ctx );
34896 0 : fd_txn_result_decode_inner_global( &self->result, alloc_mem, ctx );
34897 0 : }
34898 0 : int fd_cache_status_convert_global_to_local( void const * global_self, fd_cache_status_t * self, fd_bincode_decode_ctx_t * ctx ) {
34899 0 : int err = 0;
34900 0 : fd_cache_status_global_t const * mem = (fd_cache_status_global_t const *)global_self;
34901 0 : fd_memcpy( self->key_slice, mem->key_slice, 20 * sizeof(uchar) );
34902 0 : err = fd_txn_result_convert_global_to_local( &mem->result, &self->result, ctx );
34903 0 : if( FD_UNLIKELY( err ) ) return err;
34904 0 : return FD_BINCODE_SUCCESS;
34905 0 : }
34906 3 : void fd_cache_status_new(fd_cache_status_t * self) {
34907 3 : fd_memset( self, 0, sizeof(fd_cache_status_t) );
34908 3 : fd_txn_result_new( &self->result );
34909 3 : }
34910 0 : void fd_cache_status_destroy( fd_cache_status_t * self ) {
34911 0 : fd_txn_result_destroy( &self->result );
34912 0 : }
34913 :
34914 3 : ulong fd_cache_status_footprint( void ){ return FD_CACHE_STATUS_FOOTPRINT; }
34915 3 : ulong fd_cache_status_align( void ){ return FD_CACHE_STATUS_ALIGN; }
34916 :
34917 0 : void fd_cache_status_walk( void * w, fd_cache_status_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
34918 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_cache_status", level++ );
34919 0 : fun(w, self->key_slice, "key_slice", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
34920 0 : fd_txn_result_walk( w, &self->result, fun, "result", level );
34921 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_cache_status", level-- );
34922 0 : }
34923 3 : ulong fd_cache_status_size( fd_cache_status_t const * self ) {
34924 3 : ulong size = 0;
34925 3 : size += 20;
34926 3 : size += fd_txn_result_size( &self->result );
34927 3 : return size;
34928 3 : }
34929 :
34930 3 : int fd_status_value_encode( fd_status_value_t const * self, fd_bincode_encode_ctx_t * ctx ) {
34931 3 : int err;
34932 3 : err = fd_bincode_uint64_encode( self->txn_idx, ctx );
34933 3 : if( FD_UNLIKELY( err ) ) return err;
34934 3 : err = fd_bincode_uint64_encode( self->statuses_len, ctx );
34935 3 : if( FD_UNLIKELY(err) ) return err;
34936 3 : if( self->statuses_len ) {
34937 6 : for( ulong i=0; i < self->statuses_len; i++ ) {
34938 3 : err = fd_cache_status_encode( self->statuses + i, ctx );
34939 3 : if( FD_UNLIKELY( err ) ) return err;
34940 3 : }
34941 3 : }
34942 3 : return FD_BINCODE_SUCCESS;
34943 3 : }
34944 0 : int fd_status_value_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
34945 0 : *total_sz += sizeof(fd_status_value_t);
34946 0 : void const * start_data = ctx->data;
34947 0 : int err = fd_status_value_decode_footprint_inner( ctx, total_sz );
34948 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
34949 0 : ctx->data = start_data;
34950 0 : return err;
34951 0 : }
34952 3 : int fd_status_value_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
34953 3 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
34954 3 : int err = 0;
34955 3 : err = fd_bincode_uint64_decode_footprint( ctx );
34956 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
34957 3 : ulong statuses_len;
34958 3 : err = fd_bincode_uint64_decode( &statuses_len, ctx );
34959 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
34960 3 : if( statuses_len ) {
34961 3 : *total_sz += FD_CACHE_STATUS_ALIGN + FD_CACHE_STATUS_FOOTPRINT*statuses_len;
34962 6 : for( ulong i=0; i < statuses_len; i++ ) {
34963 3 : err = fd_cache_status_decode_footprint_inner( ctx, total_sz );
34964 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
34965 3 : }
34966 3 : }
34967 3 : return 0;
34968 3 : }
34969 0 : void * fd_status_value_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
34970 0 : fd_status_value_t * self = (fd_status_value_t *)mem;
34971 0 : fd_status_value_new( self );
34972 0 : void * alloc_region = (uchar *)mem + sizeof(fd_status_value_t);
34973 0 : void * * alloc_mem = &alloc_region;
34974 0 : fd_status_value_decode_inner( mem, alloc_mem, ctx );
34975 0 : return self;
34976 0 : }
34977 3 : void fd_status_value_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
34978 3 : fd_status_value_t * self = (fd_status_value_t *)struct_mem;
34979 3 : fd_bincode_uint64_decode_unsafe( &self->txn_idx, ctx );
34980 3 : fd_bincode_uint64_decode_unsafe( &self->statuses_len, ctx );
34981 3 : if( self->statuses_len ) {
34982 3 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_CACHE_STATUS_ALIGN );
34983 3 : self->statuses = *alloc_mem;
34984 3 : *alloc_mem = (uchar *)(*alloc_mem) + FD_CACHE_STATUS_FOOTPRINT*self->statuses_len;
34985 6 : for( ulong i=0; i < self->statuses_len; i++ ) {
34986 3 : fd_cache_status_new( self->statuses + i );
34987 3 : fd_cache_status_decode_inner( self->statuses + i, alloc_mem, ctx );
34988 3 : }
34989 3 : } else
34990 0 : self->statuses = NULL;
34991 3 : }
34992 0 : void * fd_status_value_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
34993 0 : fd_status_value_global_t * self = (fd_status_value_global_t *)mem;
34994 0 : fd_status_value_new( (fd_status_value_t *)self );
34995 0 : void * alloc_region = (uchar *)mem + sizeof(fd_status_value_global_t);
34996 0 : void * * alloc_mem = &alloc_region;
34997 0 : fd_status_value_decode_inner_global( mem, alloc_mem, ctx );
34998 0 : return self;
34999 0 : }
35000 0 : void fd_status_value_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
35001 0 : fd_status_value_global_t * self = (fd_status_value_global_t *)struct_mem;
35002 0 : fd_bincode_uint64_decode_unsafe( &self->txn_idx, ctx );
35003 0 : fd_bincode_uint64_decode_unsafe( &self->statuses_len, ctx );
35004 0 : if( self->statuses_len ) {
35005 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_CACHE_STATUS_ALIGN );
35006 0 : self->statuses_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
35007 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
35008 0 : *alloc_mem = (uchar *)(*alloc_mem) + FD_CACHE_STATUS_FOOTPRINT*self->statuses_len;
35009 0 : for( ulong i=0; i < self->statuses_len; i++ ) {
35010 0 : fd_cache_status_new( (fd_cache_status_t *)(cur_mem + FD_CACHE_STATUS_FOOTPRINT * i) );
35011 0 : fd_cache_status_decode_inner_global( cur_mem + FD_CACHE_STATUS_FOOTPRINT * i, alloc_mem, ctx );
35012 0 : }
35013 0 : } else
35014 0 : self->statuses_gaddr = 0UL;
35015 0 : }
35016 0 : int fd_status_value_convert_global_to_local( void const * global_self, fd_status_value_t * self, fd_bincode_decode_ctx_t * ctx ) {
35017 0 : int err = 0;
35018 0 : fd_status_value_global_t const * mem = (fd_status_value_global_t const *)global_self;
35019 0 : self->txn_idx = mem->txn_idx;
35020 0 : self->statuses_len = mem->statuses_len;
35021 0 : self->statuses = fd_wksp_laddr_fast( ctx->wksp, mem->statuses_gaddr );
35022 0 : return FD_BINCODE_SUCCESS;
35023 0 : }
35024 3 : void fd_status_value_new(fd_status_value_t * self) {
35025 3 : fd_memset( self, 0, sizeof(fd_status_value_t) );
35026 3 : }
35027 0 : void fd_status_value_destroy( fd_status_value_t * self ) {
35028 0 : if( self->statuses ) {
35029 0 : for( ulong i=0; i < self->statuses_len; i++ )
35030 0 : fd_cache_status_destroy( self->statuses + i );
35031 0 : self->statuses = NULL;
35032 0 : }
35033 0 : }
35034 :
35035 0 : ulong fd_status_value_footprint( void ){ return FD_STATUS_VALUE_FOOTPRINT; }
35036 0 : ulong fd_status_value_align( void ){ return FD_STATUS_VALUE_ALIGN; }
35037 :
35038 0 : void fd_status_value_walk( void * w, fd_status_value_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
35039 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_status_value", level++ );
35040 0 : fun( w, &self->txn_idx, "txn_idx", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
35041 0 : if( self->statuses_len ) {
35042 0 : fun( w, NULL, "statuses", FD_FLAMENCO_TYPE_ARR, "array", level++ );
35043 0 : for( ulong i=0; i < self->statuses_len; i++ )
35044 0 : fd_cache_status_walk(w, self->statuses + i, fun, "cache_status", level );
35045 0 : fun( w, NULL, "statuses", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
35046 0 : }
35047 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_status_value", level-- );
35048 0 : }
35049 3 : ulong fd_status_value_size( fd_status_value_t const * self ) {
35050 3 : ulong size = 0;
35051 3 : size += sizeof(ulong);
35052 3 : do {
35053 3 : size += sizeof(ulong);
35054 6 : for( ulong i=0; i < self->statuses_len; i++ )
35055 3 : size += fd_cache_status_size( self->statuses + i );
35056 3 : } while(0);
35057 3 : return size;
35058 3 : }
35059 :
35060 3 : int fd_status_pair_encode( fd_status_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
35061 3 : int err;
35062 3 : err = fd_hash_encode( &self->hash, ctx );
35063 3 : if( FD_UNLIKELY( err ) ) return err;
35064 3 : err = fd_status_value_encode( &self->value, ctx );
35065 3 : if( FD_UNLIKELY( err ) ) return err;
35066 3 : return FD_BINCODE_SUCCESS;
35067 3 : }
35068 0 : int fd_status_pair_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
35069 0 : *total_sz += sizeof(fd_status_pair_t);
35070 0 : void const * start_data = ctx->data;
35071 0 : int err = fd_status_pair_decode_footprint_inner( ctx, total_sz );
35072 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
35073 0 : ctx->data = start_data;
35074 0 : return err;
35075 0 : }
35076 3 : int fd_status_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
35077 3 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
35078 3 : int err = 0;
35079 3 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
35080 3 : if( FD_UNLIKELY( err ) ) return err;
35081 3 : err = fd_status_value_decode_footprint_inner( ctx, total_sz );
35082 3 : if( FD_UNLIKELY( err ) ) return err;
35083 3 : return 0;
35084 3 : }
35085 0 : void * fd_status_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
35086 0 : fd_status_pair_t * self = (fd_status_pair_t *)mem;
35087 0 : fd_status_pair_new( self );
35088 0 : void * alloc_region = (uchar *)mem + sizeof(fd_status_pair_t);
35089 0 : void * * alloc_mem = &alloc_region;
35090 0 : fd_status_pair_decode_inner( mem, alloc_mem, ctx );
35091 0 : return self;
35092 0 : }
35093 3 : void fd_status_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
35094 3 : fd_status_pair_t * self = (fd_status_pair_t *)struct_mem;
35095 3 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
35096 3 : fd_status_value_decode_inner( &self->value, alloc_mem, ctx );
35097 3 : }
35098 0 : void * fd_status_pair_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
35099 0 : fd_status_pair_global_t * self = (fd_status_pair_global_t *)mem;
35100 0 : fd_status_pair_new( (fd_status_pair_t *)self );
35101 0 : void * alloc_region = (uchar *)mem + sizeof(fd_status_pair_global_t);
35102 0 : void * * alloc_mem = &alloc_region;
35103 0 : fd_status_pair_decode_inner_global( mem, alloc_mem, ctx );
35104 0 : return self;
35105 0 : }
35106 0 : void fd_status_pair_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
35107 0 : fd_status_pair_global_t * self = (fd_status_pair_global_t *)struct_mem;
35108 0 : fd_hash_decode_inner_global( &self->hash, alloc_mem, ctx );
35109 0 : fd_status_value_decode_inner_global( &self->value, alloc_mem, ctx );
35110 0 : }
35111 0 : int fd_status_pair_convert_global_to_local( void const * global_self, fd_status_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
35112 0 : int err = 0;
35113 0 : fd_status_pair_global_t const * mem = (fd_status_pair_global_t const *)global_self;
35114 0 : err = fd_hash_convert_global_to_local( &mem->hash, &self->hash, ctx );
35115 0 : if( FD_UNLIKELY( err ) ) return err;
35116 0 : err = fd_status_value_convert_global_to_local( &mem->value, &self->value, ctx );
35117 0 : if( FD_UNLIKELY( err ) ) return err;
35118 0 : return FD_BINCODE_SUCCESS;
35119 0 : }
35120 3 : void fd_status_pair_new(fd_status_pair_t * self) {
35121 3 : fd_memset( self, 0, sizeof(fd_status_pair_t) );
35122 3 : fd_hash_new( &self->hash );
35123 3 : fd_status_value_new( &self->value );
35124 3 : }
35125 0 : void fd_status_pair_destroy( fd_status_pair_t * self ) {
35126 0 : fd_hash_destroy( &self->hash );
35127 0 : fd_status_value_destroy( &self->value );
35128 0 : }
35129 :
35130 3 : ulong fd_status_pair_footprint( void ){ return FD_STATUS_PAIR_FOOTPRINT; }
35131 3 : ulong fd_status_pair_align( void ){ return FD_STATUS_PAIR_ALIGN; }
35132 :
35133 0 : void fd_status_pair_walk( void * w, fd_status_pair_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
35134 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_status_pair", level++ );
35135 0 : fd_hash_walk( w, &self->hash, fun, "hash", level );
35136 0 : fd_status_value_walk( w, &self->value, fun, "value", level );
35137 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_status_pair", level-- );
35138 0 : }
35139 3 : ulong fd_status_pair_size( fd_status_pair_t const * self ) {
35140 3 : ulong size = 0;
35141 3 : size += fd_hash_size( &self->hash );
35142 3 : size += fd_status_value_size( &self->value );
35143 3 : return size;
35144 3 : }
35145 :
35146 3 : int fd_slot_delta_encode( fd_slot_delta_t const * self, fd_bincode_encode_ctx_t * ctx ) {
35147 3 : int err;
35148 3 : err = fd_bincode_uint64_encode( self->slot, ctx );
35149 3 : if( FD_UNLIKELY( err ) ) return err;
35150 3 : err = fd_bincode_bool_encode( (uchar)(self->is_root), ctx );
35151 3 : if( FD_UNLIKELY( err ) ) return err;
35152 3 : err = fd_bincode_uint64_encode( self->slot_delta_vec_len, ctx );
35153 3 : if( FD_UNLIKELY(err) ) return err;
35154 3 : if( self->slot_delta_vec_len ) {
35155 6 : for( ulong i=0; i < self->slot_delta_vec_len; i++ ) {
35156 3 : err = fd_status_pair_encode( self->slot_delta_vec + i, ctx );
35157 3 : if( FD_UNLIKELY( err ) ) return err;
35158 3 : }
35159 3 : }
35160 3 : return FD_BINCODE_SUCCESS;
35161 3 : }
35162 0 : int fd_slot_delta_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
35163 0 : *total_sz += sizeof(fd_slot_delta_t);
35164 0 : void const * start_data = ctx->data;
35165 0 : int err = fd_slot_delta_decode_footprint_inner( ctx, total_sz );
35166 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
35167 0 : ctx->data = start_data;
35168 0 : return err;
35169 0 : }
35170 6 : int fd_slot_delta_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
35171 6 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
35172 6 : int err = 0;
35173 6 : err = fd_bincode_uint64_decode_footprint( ctx );
35174 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
35175 6 : err = fd_bincode_bool_decode_footprint( ctx );
35176 6 : if( FD_UNLIKELY( err ) ) return err;
35177 3 : ulong slot_delta_vec_len;
35178 3 : err = fd_bincode_uint64_decode( &slot_delta_vec_len, ctx );
35179 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
35180 3 : if( slot_delta_vec_len ) {
35181 3 : *total_sz += FD_STATUS_PAIR_ALIGN + FD_STATUS_PAIR_FOOTPRINT*slot_delta_vec_len;
35182 6 : for( ulong i=0; i < slot_delta_vec_len; i++ ) {
35183 3 : err = fd_status_pair_decode_footprint_inner( ctx, total_sz );
35184 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
35185 3 : }
35186 3 : }
35187 3 : return 0;
35188 3 : }
35189 0 : void * fd_slot_delta_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
35190 0 : fd_slot_delta_t * self = (fd_slot_delta_t *)mem;
35191 0 : fd_slot_delta_new( self );
35192 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_delta_t);
35193 0 : void * * alloc_mem = &alloc_region;
35194 0 : fd_slot_delta_decode_inner( mem, alloc_mem, ctx );
35195 0 : return self;
35196 0 : }
35197 3 : void fd_slot_delta_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
35198 3 : fd_slot_delta_t * self = (fd_slot_delta_t *)struct_mem;
35199 3 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
35200 3 : fd_bincode_bool_decode_unsafe( &self->is_root, ctx );
35201 3 : fd_bincode_uint64_decode_unsafe( &self->slot_delta_vec_len, ctx );
35202 3 : if( self->slot_delta_vec_len ) {
35203 3 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_STATUS_PAIR_ALIGN );
35204 3 : self->slot_delta_vec = *alloc_mem;
35205 3 : *alloc_mem = (uchar *)(*alloc_mem) + FD_STATUS_PAIR_FOOTPRINT*self->slot_delta_vec_len;
35206 6 : for( ulong i=0; i < self->slot_delta_vec_len; i++ ) {
35207 3 : fd_status_pair_new( self->slot_delta_vec + i );
35208 3 : fd_status_pair_decode_inner( self->slot_delta_vec + i, alloc_mem, ctx );
35209 3 : }
35210 3 : } else
35211 0 : self->slot_delta_vec = NULL;
35212 3 : }
35213 0 : void * fd_slot_delta_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
35214 0 : fd_slot_delta_global_t * self = (fd_slot_delta_global_t *)mem;
35215 0 : fd_slot_delta_new( (fd_slot_delta_t *)self );
35216 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_delta_global_t);
35217 0 : void * * alloc_mem = &alloc_region;
35218 0 : fd_slot_delta_decode_inner_global( mem, alloc_mem, ctx );
35219 0 : return self;
35220 0 : }
35221 0 : void fd_slot_delta_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
35222 0 : fd_slot_delta_global_t * self = (fd_slot_delta_global_t *)struct_mem;
35223 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
35224 0 : fd_bincode_bool_decode_unsafe( &self->is_root, ctx );
35225 0 : fd_bincode_uint64_decode_unsafe( &self->slot_delta_vec_len, ctx );
35226 0 : if( self->slot_delta_vec_len ) {
35227 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_STATUS_PAIR_ALIGN );
35228 0 : self->slot_delta_vec_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
35229 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
35230 0 : *alloc_mem = (uchar *)(*alloc_mem) + FD_STATUS_PAIR_FOOTPRINT*self->slot_delta_vec_len;
35231 0 : for( ulong i=0; i < self->slot_delta_vec_len; i++ ) {
35232 0 : fd_status_pair_new( (fd_status_pair_t *)(cur_mem + FD_STATUS_PAIR_FOOTPRINT * i) );
35233 0 : fd_status_pair_decode_inner_global( cur_mem + FD_STATUS_PAIR_FOOTPRINT * i, alloc_mem, ctx );
35234 0 : }
35235 0 : } else
35236 0 : self->slot_delta_vec_gaddr = 0UL;
35237 0 : }
35238 0 : int fd_slot_delta_convert_global_to_local( void const * global_self, fd_slot_delta_t * self, fd_bincode_decode_ctx_t * ctx ) {
35239 0 : int err = 0;
35240 0 : fd_slot_delta_global_t const * mem = (fd_slot_delta_global_t const *)global_self;
35241 0 : self->slot = mem->slot;
35242 0 : self->is_root = mem->is_root;
35243 0 : self->slot_delta_vec_len = mem->slot_delta_vec_len;
35244 0 : self->slot_delta_vec = fd_wksp_laddr_fast( ctx->wksp, mem->slot_delta_vec_gaddr );
35245 0 : return FD_BINCODE_SUCCESS;
35246 0 : }
35247 3 : void fd_slot_delta_new(fd_slot_delta_t * self) {
35248 3 : fd_memset( self, 0, sizeof(fd_slot_delta_t) );
35249 3 : }
35250 0 : void fd_slot_delta_destroy( fd_slot_delta_t * self ) {
35251 0 : if( self->slot_delta_vec ) {
35252 0 : for( ulong i=0; i < self->slot_delta_vec_len; i++ )
35253 0 : fd_status_pair_destroy( self->slot_delta_vec + i );
35254 0 : self->slot_delta_vec = NULL;
35255 0 : }
35256 0 : }
35257 :
35258 3 : ulong fd_slot_delta_footprint( void ){ return FD_SLOT_DELTA_FOOTPRINT; }
35259 3 : ulong fd_slot_delta_align( void ){ return FD_SLOT_DELTA_ALIGN; }
35260 :
35261 0 : void fd_slot_delta_walk( void * w, fd_slot_delta_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
35262 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_slot_delta", level++ );
35263 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
35264 0 : fun( w, &self->is_root, "is_root", FD_FLAMENCO_TYPE_BOOL, "bool", level );
35265 0 : if( self->slot_delta_vec_len ) {
35266 0 : fun( w, NULL, "slot_delta_vec", FD_FLAMENCO_TYPE_ARR, "array", level++ );
35267 0 : for( ulong i=0; i < self->slot_delta_vec_len; i++ )
35268 0 : fd_status_pair_walk(w, self->slot_delta_vec + i, fun, "status_pair", level );
35269 0 : fun( w, NULL, "slot_delta_vec", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
35270 0 : }
35271 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_slot_delta", level-- );
35272 0 : }
35273 3 : ulong fd_slot_delta_size( fd_slot_delta_t const * self ) {
35274 3 : ulong size = 0;
35275 3 : size += sizeof(ulong);
35276 3 : size += sizeof(char);
35277 3 : do {
35278 3 : size += sizeof(ulong);
35279 6 : for( ulong i=0; i < self->slot_delta_vec_len; i++ )
35280 3 : size += fd_status_pair_size( self->slot_delta_vec + i );
35281 3 : } while(0);
35282 3 : return size;
35283 3 : }
35284 :
35285 3 : int fd_bank_slot_deltas_encode( fd_bank_slot_deltas_t const * self, fd_bincode_encode_ctx_t * ctx ) {
35286 3 : int err;
35287 3 : err = fd_bincode_uint64_encode( self->slot_deltas_len, ctx );
35288 3 : if( FD_UNLIKELY(err) ) return err;
35289 3 : if( self->slot_deltas_len ) {
35290 6 : for( ulong i=0; i < self->slot_deltas_len; i++ ) {
35291 3 : err = fd_slot_delta_encode( self->slot_deltas + i, ctx );
35292 3 : if( FD_UNLIKELY( err ) ) return err;
35293 3 : }
35294 3 : }
35295 3 : return FD_BINCODE_SUCCESS;
35296 3 : }
35297 6 : int fd_bank_slot_deltas_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
35298 6 : *total_sz += sizeof(fd_bank_slot_deltas_t);
35299 6 : void const * start_data = ctx->data;
35300 6 : int err = fd_bank_slot_deltas_decode_footprint_inner( ctx, total_sz );
35301 6 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
35302 6 : ctx->data = start_data;
35303 6 : return err;
35304 6 : }
35305 6 : int fd_bank_slot_deltas_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
35306 6 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
35307 6 : int err = 0;
35308 6 : ulong slot_deltas_len;
35309 6 : err = fd_bincode_uint64_decode( &slot_deltas_len, ctx );
35310 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
35311 6 : if( slot_deltas_len ) {
35312 6 : *total_sz += FD_SLOT_DELTA_ALIGN + FD_SLOT_DELTA_FOOTPRINT*slot_deltas_len;
35313 9 : for( ulong i=0; i < slot_deltas_len; i++ ) {
35314 6 : err = fd_slot_delta_decode_footprint_inner( ctx, total_sz );
35315 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
35316 6 : }
35317 6 : }
35318 3 : return 0;
35319 6 : }
35320 3 : void * fd_bank_slot_deltas_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
35321 3 : fd_bank_slot_deltas_t * self = (fd_bank_slot_deltas_t *)mem;
35322 3 : fd_bank_slot_deltas_new( self );
35323 3 : void * alloc_region = (uchar *)mem + sizeof(fd_bank_slot_deltas_t);
35324 3 : void * * alloc_mem = &alloc_region;
35325 3 : fd_bank_slot_deltas_decode_inner( mem, alloc_mem, ctx );
35326 3 : return self;
35327 3 : }
35328 3 : void fd_bank_slot_deltas_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
35329 3 : fd_bank_slot_deltas_t * self = (fd_bank_slot_deltas_t *)struct_mem;
35330 3 : fd_bincode_uint64_decode_unsafe( &self->slot_deltas_len, ctx );
35331 3 : if( self->slot_deltas_len ) {
35332 3 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_SLOT_DELTA_ALIGN );
35333 3 : self->slot_deltas = *alloc_mem;
35334 3 : *alloc_mem = (uchar *)(*alloc_mem) + FD_SLOT_DELTA_FOOTPRINT*self->slot_deltas_len;
35335 6 : for( ulong i=0; i < self->slot_deltas_len; i++ ) {
35336 3 : fd_slot_delta_new( self->slot_deltas + i );
35337 3 : fd_slot_delta_decode_inner( self->slot_deltas + i, alloc_mem, ctx );
35338 3 : }
35339 3 : } else
35340 0 : self->slot_deltas = NULL;
35341 3 : }
35342 0 : void * fd_bank_slot_deltas_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
35343 0 : fd_bank_slot_deltas_global_t * self = (fd_bank_slot_deltas_global_t *)mem;
35344 0 : fd_bank_slot_deltas_new( (fd_bank_slot_deltas_t *)self );
35345 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bank_slot_deltas_global_t);
35346 0 : void * * alloc_mem = &alloc_region;
35347 0 : fd_bank_slot_deltas_decode_inner_global( mem, alloc_mem, ctx );
35348 0 : return self;
35349 0 : }
35350 0 : void fd_bank_slot_deltas_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
35351 0 : fd_bank_slot_deltas_global_t * self = (fd_bank_slot_deltas_global_t *)struct_mem;
35352 0 : fd_bincode_uint64_decode_unsafe( &self->slot_deltas_len, ctx );
35353 0 : if( self->slot_deltas_len ) {
35354 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_SLOT_DELTA_ALIGN );
35355 0 : self->slot_deltas_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
35356 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
35357 0 : *alloc_mem = (uchar *)(*alloc_mem) + FD_SLOT_DELTA_FOOTPRINT*self->slot_deltas_len;
35358 0 : for( ulong i=0; i < self->slot_deltas_len; i++ ) {
35359 0 : fd_slot_delta_new( (fd_slot_delta_t *)(cur_mem + FD_SLOT_DELTA_FOOTPRINT * i) );
35360 0 : fd_slot_delta_decode_inner_global( cur_mem + FD_SLOT_DELTA_FOOTPRINT * i, alloc_mem, ctx );
35361 0 : }
35362 0 : } else
35363 0 : self->slot_deltas_gaddr = 0UL;
35364 0 : }
35365 0 : int fd_bank_slot_deltas_convert_global_to_local( void const * global_self, fd_bank_slot_deltas_t * self, fd_bincode_decode_ctx_t * ctx ) {
35366 0 : int err = 0;
35367 0 : fd_bank_slot_deltas_global_t const * mem = (fd_bank_slot_deltas_global_t const *)global_self;
35368 0 : self->slot_deltas_len = mem->slot_deltas_len;
35369 0 : self->slot_deltas = fd_wksp_laddr_fast( ctx->wksp, mem->slot_deltas_gaddr );
35370 0 : return FD_BINCODE_SUCCESS;
35371 0 : }
35372 3 : void fd_bank_slot_deltas_new(fd_bank_slot_deltas_t * self) {
35373 3 : fd_memset( self, 0, sizeof(fd_bank_slot_deltas_t) );
35374 3 : }
35375 0 : void fd_bank_slot_deltas_destroy( fd_bank_slot_deltas_t * self ) {
35376 0 : if( self->slot_deltas ) {
35377 0 : for( ulong i=0; i < self->slot_deltas_len; i++ )
35378 0 : fd_slot_delta_destroy( self->slot_deltas + i );
35379 0 : self->slot_deltas = NULL;
35380 0 : }
35381 0 : }
35382 :
35383 0 : ulong fd_bank_slot_deltas_footprint( void ){ return FD_BANK_SLOT_DELTAS_FOOTPRINT; }
35384 3 : ulong fd_bank_slot_deltas_align( void ){ return FD_BANK_SLOT_DELTAS_ALIGN; }
35385 :
35386 0 : void fd_bank_slot_deltas_walk( void * w, fd_bank_slot_deltas_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
35387 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_bank_slot_deltas", level++ );
35388 0 : if( self->slot_deltas_len ) {
35389 0 : fun( w, NULL, "slot_deltas", FD_FLAMENCO_TYPE_ARR, "array", level++ );
35390 0 : for( ulong i=0; i < self->slot_deltas_len; i++ )
35391 0 : fd_slot_delta_walk(w, self->slot_deltas + i, fun, "slot_delta", level );
35392 0 : fun( w, NULL, "slot_deltas", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
35393 0 : }
35394 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_bank_slot_deltas", level-- );
35395 0 : }
35396 3 : ulong fd_bank_slot_deltas_size( fd_bank_slot_deltas_t const * self ) {
35397 3 : ulong size = 0;
35398 3 : do {
35399 3 : size += sizeof(ulong);
35400 6 : for( ulong i=0; i < self->slot_deltas_len; i++ )
35401 3 : size += fd_slot_delta_size( self->slot_deltas + i );
35402 3 : } while(0);
35403 3 : return size;
35404 3 : }
35405 :
35406 0 : int fd_pubkey_rewardinfo_pair_encode( fd_pubkey_rewardinfo_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
35407 0 : int err;
35408 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
35409 0 : if( FD_UNLIKELY( err ) ) return err;
35410 0 : err = fd_reward_info_encode( &self->reward_info, ctx );
35411 0 : if( FD_UNLIKELY( err ) ) return err;
35412 0 : return FD_BINCODE_SUCCESS;
35413 0 : }
35414 0 : int fd_pubkey_rewardinfo_pair_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
35415 0 : *total_sz += sizeof(fd_pubkey_rewardinfo_pair_t);
35416 0 : void const * start_data = ctx->data;
35417 0 : int err = fd_pubkey_rewardinfo_pair_decode_footprint_inner( ctx, total_sz );
35418 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
35419 0 : ctx->data = start_data;
35420 0 : return err;
35421 0 : }
35422 0 : int fd_pubkey_rewardinfo_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
35423 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
35424 0 : int err = 0;
35425 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
35426 0 : if( FD_UNLIKELY( err ) ) return err;
35427 0 : err = fd_reward_info_decode_footprint_inner( ctx, total_sz );
35428 0 : if( FD_UNLIKELY( err ) ) return err;
35429 0 : return 0;
35430 0 : }
35431 0 : void * fd_pubkey_rewardinfo_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
35432 0 : fd_pubkey_rewardinfo_pair_t * self = (fd_pubkey_rewardinfo_pair_t *)mem;
35433 0 : fd_pubkey_rewardinfo_pair_new( self );
35434 0 : void * alloc_region = (uchar *)mem + sizeof(fd_pubkey_rewardinfo_pair_t);
35435 0 : void * * alloc_mem = &alloc_region;
35436 0 : fd_pubkey_rewardinfo_pair_decode_inner( mem, alloc_mem, ctx );
35437 0 : return self;
35438 0 : }
35439 0 : void fd_pubkey_rewardinfo_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
35440 0 : fd_pubkey_rewardinfo_pair_t * self = (fd_pubkey_rewardinfo_pair_t *)struct_mem;
35441 0 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
35442 0 : fd_reward_info_decode_inner( &self->reward_info, alloc_mem, ctx );
35443 0 : }
35444 0 : void * fd_pubkey_rewardinfo_pair_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
35445 0 : fd_pubkey_rewardinfo_pair_global_t * self = (fd_pubkey_rewardinfo_pair_global_t *)mem;
35446 0 : fd_pubkey_rewardinfo_pair_new( (fd_pubkey_rewardinfo_pair_t *)self );
35447 0 : void * alloc_region = (uchar *)mem + sizeof(fd_pubkey_rewardinfo_pair_global_t);
35448 0 : void * * alloc_mem = &alloc_region;
35449 0 : fd_pubkey_rewardinfo_pair_decode_inner_global( mem, alloc_mem, ctx );
35450 0 : return self;
35451 0 : }
35452 0 : void fd_pubkey_rewardinfo_pair_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
35453 0 : fd_pubkey_rewardinfo_pair_global_t * self = (fd_pubkey_rewardinfo_pair_global_t *)struct_mem;
35454 0 : fd_pubkey_decode_inner_global( &self->pubkey, alloc_mem, ctx );
35455 0 : fd_reward_info_decode_inner_global( &self->reward_info, alloc_mem, ctx );
35456 0 : }
35457 0 : int fd_pubkey_rewardinfo_pair_convert_global_to_local( void const * global_self, fd_pubkey_rewardinfo_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
35458 0 : int err = 0;
35459 0 : fd_pubkey_rewardinfo_pair_global_t const * mem = (fd_pubkey_rewardinfo_pair_global_t const *)global_self;
35460 0 : err = fd_pubkey_convert_global_to_local( &mem->pubkey, &self->pubkey, ctx );
35461 0 : if( FD_UNLIKELY( err ) ) return err;
35462 0 : err = fd_reward_info_convert_global_to_local( &mem->reward_info, &self->reward_info, ctx );
35463 0 : if( FD_UNLIKELY( err ) ) return err;
35464 0 : return FD_BINCODE_SUCCESS;
35465 0 : }
35466 0 : void fd_pubkey_rewardinfo_pair_new(fd_pubkey_rewardinfo_pair_t * self) {
35467 0 : fd_memset( self, 0, sizeof(fd_pubkey_rewardinfo_pair_t) );
35468 0 : fd_pubkey_new( &self->pubkey );
35469 0 : fd_reward_info_new( &self->reward_info );
35470 0 : }
35471 0 : void fd_pubkey_rewardinfo_pair_destroy( fd_pubkey_rewardinfo_pair_t * self ) {
35472 0 : fd_pubkey_destroy( &self->pubkey );
35473 0 : fd_reward_info_destroy( &self->reward_info );
35474 0 : }
35475 :
35476 0 : ulong fd_pubkey_rewardinfo_pair_footprint( void ){ return FD_PUBKEY_REWARDINFO_PAIR_FOOTPRINT; }
35477 0 : ulong fd_pubkey_rewardinfo_pair_align( void ){ return FD_PUBKEY_REWARDINFO_PAIR_ALIGN; }
35478 :
35479 0 : void fd_pubkey_rewardinfo_pair_walk( void * w, fd_pubkey_rewardinfo_pair_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
35480 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_pubkey_rewardinfo_pair", level++ );
35481 0 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level );
35482 0 : fd_reward_info_walk( w, &self->reward_info, fun, "reward_info", level );
35483 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_pubkey_rewardinfo_pair", level-- );
35484 0 : }
35485 0 : ulong fd_pubkey_rewardinfo_pair_size( fd_pubkey_rewardinfo_pair_t const * self ) {
35486 0 : ulong size = 0;
35487 0 : size += fd_pubkey_size( &self->pubkey );
35488 0 : size += fd_reward_info_size( &self->reward_info );
35489 0 : return size;
35490 0 : }
35491 :
35492 0 : int fd_optional_account_encode( fd_optional_account_t const * self, fd_bincode_encode_ctx_t * ctx ) {
35493 0 : int err;
35494 0 : if( self->account != NULL ) {
35495 0 : err = fd_bincode_bool_encode( 1, ctx );
35496 0 : if( FD_UNLIKELY( err ) ) return err;
35497 0 : err = fd_solana_account_encode( self->account, ctx );
35498 0 : if( FD_UNLIKELY( err ) ) return err;
35499 0 : } else {
35500 0 : err = fd_bincode_bool_encode( 0, ctx );
35501 0 : if( FD_UNLIKELY( err ) ) return err;
35502 0 : }
35503 0 : return FD_BINCODE_SUCCESS;
35504 0 : }
35505 0 : int fd_optional_account_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
35506 0 : *total_sz += sizeof(fd_optional_account_t);
35507 0 : void const * start_data = ctx->data;
35508 0 : int err = fd_optional_account_decode_footprint_inner( ctx, total_sz );
35509 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
35510 0 : ctx->data = start_data;
35511 0 : return err;
35512 0 : }
35513 0 : int fd_optional_account_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
35514 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
35515 0 : int err = 0;
35516 0 : {
35517 0 : uchar o;
35518 0 : err = fd_bincode_bool_decode( &o, ctx );
35519 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
35520 0 : if( o ) {
35521 0 : *total_sz += FD_SOLANA_ACCOUNT_ALIGN + FD_SOLANA_ACCOUNT_FOOTPRINT;
35522 0 : err = fd_solana_account_decode_footprint_inner( ctx, total_sz );
35523 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
35524 0 : }
35525 0 : }
35526 0 : return 0;
35527 0 : }
35528 0 : void * fd_optional_account_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
35529 0 : fd_optional_account_t * self = (fd_optional_account_t *)mem;
35530 0 : fd_optional_account_new( self );
35531 0 : void * alloc_region = (uchar *)mem + sizeof(fd_optional_account_t);
35532 0 : void * * alloc_mem = &alloc_region;
35533 0 : fd_optional_account_decode_inner( mem, alloc_mem, ctx );
35534 0 : return self;
35535 0 : }
35536 0 : void fd_optional_account_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
35537 0 : fd_optional_account_t * self = (fd_optional_account_t *)struct_mem;
35538 0 : {
35539 0 : uchar o;
35540 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
35541 0 : if( o ) {
35542 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, FD_SOLANA_ACCOUNT_ALIGN );
35543 0 : self->account = *alloc_mem;
35544 0 : *alloc_mem = (uchar *)*alloc_mem + FD_SOLANA_ACCOUNT_FOOTPRINT;
35545 0 : fd_solana_account_new( self->account );
35546 0 : fd_solana_account_decode_inner( self->account, alloc_mem, ctx );
35547 0 : } else {
35548 0 : self->account = NULL;
35549 0 : }
35550 0 : }
35551 0 : }
35552 0 : void * fd_optional_account_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
35553 0 : fd_optional_account_global_t * self = (fd_optional_account_global_t *)mem;
35554 0 : fd_optional_account_new( (fd_optional_account_t *)self );
35555 0 : void * alloc_region = (uchar *)mem + sizeof(fd_optional_account_global_t);
35556 0 : void * * alloc_mem = &alloc_region;
35557 0 : fd_optional_account_decode_inner_global( mem, alloc_mem, ctx );
35558 0 : return self;
35559 0 : }
35560 0 : void fd_optional_account_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
35561 0 : fd_optional_account_global_t * self = (fd_optional_account_global_t *)struct_mem;
35562 0 : {
35563 0 : uchar o;
35564 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
35565 0 : if( o ) {
35566 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, FD_SOLANA_ACCOUNT_ALIGN );
35567 0 : self->account_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
35568 0 : fd_solana_account_new( *alloc_mem );
35569 0 : *alloc_mem = (uchar *)*alloc_mem + FD_SOLANA_ACCOUNT_FOOTPRINT;
35570 0 : fd_solana_account_decode_inner_global( fd_wksp_laddr_fast( ctx->wksp, self->account_gaddr ), alloc_mem, ctx );
35571 0 : } else {
35572 0 : self->account_gaddr = 0UL;
35573 0 : }
35574 0 : }
35575 0 : }
35576 0 : int fd_optional_account_convert_global_to_local( void const * global_self, fd_optional_account_t * self, fd_bincode_decode_ctx_t * ctx ) {
35577 0 : int err = 0;
35578 0 : fd_optional_account_global_t const * mem = (fd_optional_account_global_t const *)global_self;
35579 0 : self->account = fd_wksp_laddr_fast( ctx->wksp, mem->account_gaddr );
35580 0 : return FD_BINCODE_SUCCESS;
35581 0 : }
35582 0 : void fd_optional_account_new(fd_optional_account_t * self) {
35583 0 : fd_memset( self, 0, sizeof(fd_optional_account_t) );
35584 0 : }
35585 0 : void fd_optional_account_destroy( fd_optional_account_t * self ) {
35586 0 : if( self->account ) {
35587 0 : fd_solana_account_destroy( self->account );
35588 0 : self->account = NULL;
35589 0 : }
35590 0 : }
35591 :
35592 0 : ulong fd_optional_account_footprint( void ){ return FD_OPTIONAL_ACCOUNT_FOOTPRINT; }
35593 0 : ulong fd_optional_account_align( void ){ return FD_OPTIONAL_ACCOUNT_ALIGN; }
35594 :
35595 0 : void fd_optional_account_walk( void * w, fd_optional_account_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
35596 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_optional_account", level++ );
35597 0 : if( !self->account ) {
35598 0 : fun( w, NULL, "account", FD_FLAMENCO_TYPE_NULL, "solana_account", level );
35599 0 : } else {
35600 0 : fd_solana_account_walk( w, self->account, fun, "account", level );
35601 0 : }
35602 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_optional_account", level-- );
35603 0 : }
35604 0 : ulong fd_optional_account_size( fd_optional_account_t const * self ) {
35605 0 : ulong size = 0;
35606 0 : size += sizeof(char);
35607 0 : if( NULL != self->account ) {
35608 0 : size += fd_solana_account_size( self->account );
35609 0 : }
35610 0 : return size;
35611 0 : }
35612 :
35613 0 : int fd_calculated_stake_points_encode( fd_calculated_stake_points_t const * self, fd_bincode_encode_ctx_t * ctx ) {
35614 0 : int err;
35615 0 : err = fd_bincode_uint128_encode( self->points, ctx );
35616 0 : if( FD_UNLIKELY( err ) ) return err;
35617 0 : err = fd_bincode_uint64_encode( self->new_credits_observed, ctx );
35618 0 : if( FD_UNLIKELY( err ) ) return err;
35619 0 : err = fd_bincode_uint8_encode( (uchar)(self->force_credits_update_with_skipped_reward), ctx );
35620 0 : if( FD_UNLIKELY( err ) ) return err;
35621 0 : return FD_BINCODE_SUCCESS;
35622 0 : }
35623 0 : int fd_calculated_stake_points_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
35624 0 : *total_sz += sizeof(fd_calculated_stake_points_t);
35625 0 : void const * start_data = ctx->data;
35626 0 : int err = fd_calculated_stake_points_decode_footprint_inner( ctx, total_sz );
35627 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
35628 0 : ctx->data = start_data;
35629 0 : return err;
35630 0 : }
35631 0 : int fd_calculated_stake_points_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
35632 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
35633 0 : int err = 0;
35634 0 : err = fd_bincode_uint128_decode_footprint( ctx );
35635 0 : if( FD_UNLIKELY( err ) ) return err;
35636 0 : err = fd_bincode_uint64_decode_footprint( ctx );
35637 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
35638 0 : err = fd_bincode_uint8_decode_footprint( ctx );
35639 0 : if( FD_UNLIKELY( err ) ) return err;
35640 0 : return 0;
35641 0 : }
35642 0 : void * fd_calculated_stake_points_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
35643 0 : fd_calculated_stake_points_t * self = (fd_calculated_stake_points_t *)mem;
35644 0 : fd_calculated_stake_points_new( self );
35645 0 : void * alloc_region = (uchar *)mem + sizeof(fd_calculated_stake_points_t);
35646 0 : void * * alloc_mem = &alloc_region;
35647 0 : fd_calculated_stake_points_decode_inner( mem, alloc_mem, ctx );
35648 0 : return self;
35649 0 : }
35650 0 : void fd_calculated_stake_points_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
35651 0 : fd_calculated_stake_points_t * self = (fd_calculated_stake_points_t *)struct_mem;
35652 0 : fd_bincode_uint128_decode_unsafe( &self->points, ctx );
35653 0 : fd_bincode_uint64_decode_unsafe( &self->new_credits_observed, ctx );
35654 0 : fd_bincode_uint8_decode_unsafe( &self->force_credits_update_with_skipped_reward, ctx );
35655 0 : }
35656 0 : void * fd_calculated_stake_points_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
35657 0 : fd_calculated_stake_points_global_t * self = (fd_calculated_stake_points_global_t *)mem;
35658 0 : fd_calculated_stake_points_new( (fd_calculated_stake_points_t *)self );
35659 0 : void * alloc_region = (uchar *)mem + sizeof(fd_calculated_stake_points_global_t);
35660 0 : void * * alloc_mem = &alloc_region;
35661 0 : fd_calculated_stake_points_decode_inner_global( mem, alloc_mem, ctx );
35662 0 : return self;
35663 0 : }
35664 0 : void fd_calculated_stake_points_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
35665 0 : fd_calculated_stake_points_global_t * self = (fd_calculated_stake_points_global_t *)struct_mem;
35666 0 : fd_bincode_uint128_decode_unsafe( &self->points, ctx );
35667 0 : fd_bincode_uint64_decode_unsafe( &self->new_credits_observed, ctx );
35668 0 : fd_bincode_uint8_decode_unsafe( &self->force_credits_update_with_skipped_reward, ctx );
35669 0 : }
35670 0 : int fd_calculated_stake_points_convert_global_to_local( void const * global_self, fd_calculated_stake_points_t * self, fd_bincode_decode_ctx_t * ctx ) {
35671 0 : int err = 0;
35672 0 : fd_calculated_stake_points_global_t const * mem = (fd_calculated_stake_points_global_t const *)global_self;
35673 0 : self->points = mem->points;
35674 0 : self->new_credits_observed = mem->new_credits_observed;
35675 0 : self->force_credits_update_with_skipped_reward = mem->force_credits_update_with_skipped_reward;
35676 0 : return FD_BINCODE_SUCCESS;
35677 0 : }
35678 0 : void fd_calculated_stake_points_new(fd_calculated_stake_points_t * self) {
35679 0 : fd_memset( self, 0, sizeof(fd_calculated_stake_points_t) );
35680 0 : }
35681 0 : void fd_calculated_stake_points_destroy( fd_calculated_stake_points_t * self ) {
35682 0 : }
35683 :
35684 0 : ulong fd_calculated_stake_points_footprint( void ){ return FD_CALCULATED_STAKE_POINTS_FOOTPRINT; }
35685 0 : ulong fd_calculated_stake_points_align( void ){ return FD_CALCULATED_STAKE_POINTS_ALIGN; }
35686 :
35687 0 : void fd_calculated_stake_points_walk( void * w, fd_calculated_stake_points_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
35688 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_calculated_stake_points", level++ );
35689 0 : fun( w, &self->points, "points", FD_FLAMENCO_TYPE_UINT128, "uint128", level );
35690 0 : fun( w, &self->new_credits_observed, "new_credits_observed", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
35691 0 : fun( w, &self->force_credits_update_with_skipped_reward, "force_credits_update_with_skipped_reward", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
35692 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_calculated_stake_points", level-- );
35693 0 : }
35694 0 : ulong fd_calculated_stake_points_size( fd_calculated_stake_points_t const * self ) {
35695 0 : ulong size = 0;
35696 0 : size += sizeof(uint128);
35697 0 : size += sizeof(ulong);
35698 0 : size += sizeof(char);
35699 0 : return size;
35700 0 : }
35701 :
35702 0 : int fd_calculated_stake_rewards_encode( fd_calculated_stake_rewards_t const * self, fd_bincode_encode_ctx_t * ctx ) {
35703 0 : int err;
35704 0 : err = fd_bincode_uint64_encode( self->staker_rewards, ctx );
35705 0 : if( FD_UNLIKELY( err ) ) return err;
35706 0 : err = fd_bincode_uint64_encode( self->voter_rewards, ctx );
35707 0 : if( FD_UNLIKELY( err ) ) return err;
35708 0 : err = fd_bincode_uint64_encode( self->new_credits_observed, ctx );
35709 0 : if( FD_UNLIKELY( err ) ) return err;
35710 0 : return FD_BINCODE_SUCCESS;
35711 0 : }
35712 0 : int fd_calculated_stake_rewards_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
35713 0 : *total_sz += sizeof(fd_calculated_stake_rewards_t);
35714 0 : void const * start_data = ctx->data;
35715 0 : int err = fd_calculated_stake_rewards_decode_footprint_inner( ctx, total_sz );
35716 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
35717 0 : ctx->data = start_data;
35718 0 : return err;
35719 0 : }
35720 0 : int fd_calculated_stake_rewards_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
35721 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
35722 0 : int err = 0;
35723 0 : err = fd_bincode_uint64_decode_footprint( ctx );
35724 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
35725 0 : err = fd_bincode_uint64_decode_footprint( ctx );
35726 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
35727 0 : err = fd_bincode_uint64_decode_footprint( ctx );
35728 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
35729 0 : return 0;
35730 0 : }
35731 0 : void * fd_calculated_stake_rewards_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
35732 0 : fd_calculated_stake_rewards_t * self = (fd_calculated_stake_rewards_t *)mem;
35733 0 : fd_calculated_stake_rewards_new( self );
35734 0 : void * alloc_region = (uchar *)mem + sizeof(fd_calculated_stake_rewards_t);
35735 0 : void * * alloc_mem = &alloc_region;
35736 0 : fd_calculated_stake_rewards_decode_inner( mem, alloc_mem, ctx );
35737 0 : return self;
35738 0 : }
35739 0 : void fd_calculated_stake_rewards_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
35740 0 : fd_calculated_stake_rewards_t * self = (fd_calculated_stake_rewards_t *)struct_mem;
35741 0 : fd_bincode_uint64_decode_unsafe( &self->staker_rewards, ctx );
35742 0 : fd_bincode_uint64_decode_unsafe( &self->voter_rewards, ctx );
35743 0 : fd_bincode_uint64_decode_unsafe( &self->new_credits_observed, ctx );
35744 0 : }
35745 0 : void * fd_calculated_stake_rewards_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
35746 0 : fd_calculated_stake_rewards_global_t * self = (fd_calculated_stake_rewards_global_t *)mem;
35747 0 : fd_calculated_stake_rewards_new( (fd_calculated_stake_rewards_t *)self );
35748 0 : void * alloc_region = (uchar *)mem + sizeof(fd_calculated_stake_rewards_global_t);
35749 0 : void * * alloc_mem = &alloc_region;
35750 0 : fd_calculated_stake_rewards_decode_inner_global( mem, alloc_mem, ctx );
35751 0 : return self;
35752 0 : }
35753 0 : void fd_calculated_stake_rewards_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
35754 0 : fd_calculated_stake_rewards_global_t * self = (fd_calculated_stake_rewards_global_t *)struct_mem;
35755 0 : fd_bincode_uint64_decode_unsafe( &self->staker_rewards, ctx );
35756 0 : fd_bincode_uint64_decode_unsafe( &self->voter_rewards, ctx );
35757 0 : fd_bincode_uint64_decode_unsafe( &self->new_credits_observed, ctx );
35758 0 : }
35759 0 : int fd_calculated_stake_rewards_convert_global_to_local( void const * global_self, fd_calculated_stake_rewards_t * self, fd_bincode_decode_ctx_t * ctx ) {
35760 0 : int err = 0;
35761 0 : fd_calculated_stake_rewards_global_t const * mem = (fd_calculated_stake_rewards_global_t const *)global_self;
35762 0 : self->staker_rewards = mem->staker_rewards;
35763 0 : self->voter_rewards = mem->voter_rewards;
35764 0 : self->new_credits_observed = mem->new_credits_observed;
35765 0 : return FD_BINCODE_SUCCESS;
35766 0 : }
35767 0 : void fd_calculated_stake_rewards_new(fd_calculated_stake_rewards_t * self) {
35768 0 : fd_memset( self, 0, sizeof(fd_calculated_stake_rewards_t) );
35769 0 : }
35770 0 : void fd_calculated_stake_rewards_destroy( fd_calculated_stake_rewards_t * self ) {
35771 0 : }
35772 :
35773 0 : ulong fd_calculated_stake_rewards_footprint( void ){ return FD_CALCULATED_STAKE_REWARDS_FOOTPRINT; }
35774 0 : ulong fd_calculated_stake_rewards_align( void ){ return FD_CALCULATED_STAKE_REWARDS_ALIGN; }
35775 :
35776 0 : void fd_calculated_stake_rewards_walk( void * w, fd_calculated_stake_rewards_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
35777 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_calculated_stake_rewards", level++ );
35778 0 : fun( w, &self->staker_rewards, "staker_rewards", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
35779 0 : fun( w, &self->voter_rewards, "voter_rewards", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
35780 0 : fun( w, &self->new_credits_observed, "new_credits_observed", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
35781 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_calculated_stake_rewards", level-- );
35782 0 : }
35783 0 : ulong fd_calculated_stake_rewards_size( fd_calculated_stake_rewards_t const * self ) {
35784 0 : ulong size = 0;
35785 0 : size += sizeof(ulong);
35786 0 : size += sizeof(ulong);
35787 0 : size += sizeof(ulong);
35788 0 : return size;
35789 0 : }
35790 :
35791 0 : int fd_duplicate_slot_proof_encode( fd_duplicate_slot_proof_t const * self, fd_bincode_encode_ctx_t * ctx ) {
35792 0 : int err;
35793 0 : err = fd_bincode_uint64_encode( self->shred1_len, ctx );
35794 0 : if( FD_UNLIKELY(err) ) return err;
35795 0 : if( self->shred1_len ) {
35796 0 : err = fd_bincode_bytes_encode( self->shred1, self->shred1_len, ctx );
35797 0 : if( FD_UNLIKELY( err ) ) return err;
35798 0 : }
35799 0 : err = fd_bincode_uint64_encode( self->shred2_len, ctx );
35800 0 : if( FD_UNLIKELY(err) ) return err;
35801 0 : if( self->shred2_len ) {
35802 0 : err = fd_bincode_bytes_encode( self->shred2, self->shred2_len, ctx );
35803 0 : if( FD_UNLIKELY( err ) ) return err;
35804 0 : }
35805 0 : return FD_BINCODE_SUCCESS;
35806 0 : }
35807 0 : int fd_duplicate_slot_proof_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
35808 0 : *total_sz += sizeof(fd_duplicate_slot_proof_t);
35809 0 : void const * start_data = ctx->data;
35810 0 : int err = fd_duplicate_slot_proof_decode_footprint_inner( ctx, total_sz );
35811 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
35812 0 : ctx->data = start_data;
35813 0 : return err;
35814 0 : }
35815 0 : int fd_duplicate_slot_proof_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
35816 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
35817 0 : int err = 0;
35818 0 : ulong shred1_len;
35819 0 : err = fd_bincode_uint64_decode( &shred1_len, ctx );
35820 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
35821 0 : if( shred1_len ) {
35822 0 : *total_sz += 8UL + shred1_len;
35823 0 : err = fd_bincode_bytes_decode_footprint( shred1_len, ctx );
35824 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
35825 0 : }
35826 0 : ulong shred2_len;
35827 0 : err = fd_bincode_uint64_decode( &shred2_len, ctx );
35828 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
35829 0 : if( shred2_len ) {
35830 0 : *total_sz += 8UL + shred2_len;
35831 0 : err = fd_bincode_bytes_decode_footprint( shred2_len, ctx );
35832 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
35833 0 : }
35834 0 : return 0;
35835 0 : }
35836 0 : void * fd_duplicate_slot_proof_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
35837 0 : fd_duplicate_slot_proof_t * self = (fd_duplicate_slot_proof_t *)mem;
35838 0 : fd_duplicate_slot_proof_new( self );
35839 0 : void * alloc_region = (uchar *)mem + sizeof(fd_duplicate_slot_proof_t);
35840 0 : void * * alloc_mem = &alloc_region;
35841 0 : fd_duplicate_slot_proof_decode_inner( mem, alloc_mem, ctx );
35842 0 : return self;
35843 0 : }
35844 0 : void fd_duplicate_slot_proof_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
35845 0 : fd_duplicate_slot_proof_t * self = (fd_duplicate_slot_proof_t *)struct_mem;
35846 0 : fd_bincode_uint64_decode_unsafe( &self->shred1_len, ctx );
35847 0 : if( self->shred1_len ) {
35848 0 : self->shred1 = *alloc_mem;
35849 0 : fd_bincode_bytes_decode_unsafe( self->shred1, self->shred1_len, ctx );
35850 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->shred1_len;
35851 0 : } else
35852 0 : self->shred1 = NULL;
35853 0 : fd_bincode_uint64_decode_unsafe( &self->shred2_len, ctx );
35854 0 : if( self->shred2_len ) {
35855 0 : self->shred2 = *alloc_mem;
35856 0 : fd_bincode_bytes_decode_unsafe( self->shred2, self->shred2_len, ctx );
35857 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->shred2_len;
35858 0 : } else
35859 0 : self->shred2 = NULL;
35860 0 : }
35861 0 : void * fd_duplicate_slot_proof_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
35862 0 : fd_duplicate_slot_proof_global_t * self = (fd_duplicate_slot_proof_global_t *)mem;
35863 0 : fd_duplicate_slot_proof_new( (fd_duplicate_slot_proof_t *)self );
35864 0 : void * alloc_region = (uchar *)mem + sizeof(fd_duplicate_slot_proof_global_t);
35865 0 : void * * alloc_mem = &alloc_region;
35866 0 : fd_duplicate_slot_proof_decode_inner_global( mem, alloc_mem, ctx );
35867 0 : return self;
35868 0 : }
35869 0 : void fd_duplicate_slot_proof_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
35870 0 : fd_duplicate_slot_proof_global_t * self = (fd_duplicate_slot_proof_global_t *)struct_mem;
35871 0 : fd_bincode_uint64_decode_unsafe( &self->shred1_len, ctx );
35872 0 : if( self->shred1_len ) {
35873 0 : self->shred1_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
35874 0 : fd_bincode_bytes_decode_unsafe( *alloc_mem, self->shred1_len, ctx );
35875 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->shred1_len;
35876 0 : } else
35877 0 : self->shred1_gaddr = 0UL;
35878 0 : fd_bincode_uint64_decode_unsafe( &self->shred2_len, ctx );
35879 0 : if( self->shred2_len ) {
35880 0 : self->shred2_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
35881 0 : fd_bincode_bytes_decode_unsafe( *alloc_mem, self->shred2_len, ctx );
35882 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->shred2_len;
35883 0 : } else
35884 0 : self->shred2_gaddr = 0UL;
35885 0 : }
35886 0 : int fd_duplicate_slot_proof_convert_global_to_local( void const * global_self, fd_duplicate_slot_proof_t * self, fd_bincode_decode_ctx_t * ctx ) {
35887 0 : int err = 0;
35888 0 : fd_duplicate_slot_proof_global_t const * mem = (fd_duplicate_slot_proof_global_t const *)global_self;
35889 0 : self->shred1_len = mem->shred1_len;
35890 0 : self->shred1 = fd_wksp_laddr_fast( ctx->wksp, mem->shred1_gaddr );
35891 0 : self->shred2_len = mem->shred2_len;
35892 0 : self->shred2 = fd_wksp_laddr_fast( ctx->wksp, mem->shred2_gaddr );
35893 0 : return FD_BINCODE_SUCCESS;
35894 0 : }
35895 0 : void fd_duplicate_slot_proof_new(fd_duplicate_slot_proof_t * self) {
35896 0 : fd_memset( self, 0, sizeof(fd_duplicate_slot_proof_t) );
35897 0 : }
35898 0 : void fd_duplicate_slot_proof_destroy( fd_duplicate_slot_proof_t * self ) {
35899 0 : if( self->shred1 ) {
35900 0 : self->shred1 = NULL;
35901 0 : }
35902 0 : if( self->shred2 ) {
35903 0 : self->shred2 = NULL;
35904 0 : }
35905 0 : }
35906 :
35907 0 : ulong fd_duplicate_slot_proof_footprint( void ){ return FD_DUPLICATE_SLOT_PROOF_FOOTPRINT; }
35908 0 : ulong fd_duplicate_slot_proof_align( void ){ return FD_DUPLICATE_SLOT_PROOF_ALIGN; }
35909 :
35910 0 : void fd_duplicate_slot_proof_walk( void * w, fd_duplicate_slot_proof_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
35911 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_duplicate_slot_proof", level++ );
35912 0 : fun(w, self->shred1, "shred1", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
35913 0 : fun(w, self->shred2, "shred2", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
35914 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_duplicate_slot_proof", level-- );
35915 0 : }
35916 0 : ulong fd_duplicate_slot_proof_size( fd_duplicate_slot_proof_t const * self ) {
35917 0 : ulong size = 0;
35918 0 : do {
35919 0 : size += sizeof(ulong);
35920 0 : size += self->shred1_len;
35921 0 : } while(0);
35922 0 : do {
35923 0 : size += sizeof(ulong);
35924 0 : size += self->shred2_len;
35925 0 : } while(0);
35926 0 : return size;
35927 0 : }
35928 :
35929 0 : int fd_epoch_info_pair_encode( fd_epoch_info_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
35930 0 : int err;
35931 0 : err = fd_pubkey_encode( &self->account, ctx );
35932 0 : if( FD_UNLIKELY( err ) ) return err;
35933 0 : err = fd_stake_encode( &self->stake, ctx );
35934 0 : if( FD_UNLIKELY( err ) ) return err;
35935 0 : return FD_BINCODE_SUCCESS;
35936 0 : }
35937 0 : int fd_epoch_info_pair_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
35938 0 : *total_sz += sizeof(fd_epoch_info_pair_t);
35939 0 : void const * start_data = ctx->data;
35940 0 : int err = fd_epoch_info_pair_decode_footprint_inner( ctx, total_sz );
35941 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
35942 0 : ctx->data = start_data;
35943 0 : return err;
35944 0 : }
35945 0 : int fd_epoch_info_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
35946 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
35947 0 : int err = 0;
35948 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
35949 0 : if( FD_UNLIKELY( err ) ) return err;
35950 0 : err = fd_stake_decode_footprint_inner( ctx, total_sz );
35951 0 : if( FD_UNLIKELY( err ) ) return err;
35952 0 : return 0;
35953 0 : }
35954 0 : void * fd_epoch_info_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
35955 0 : fd_epoch_info_pair_t * self = (fd_epoch_info_pair_t *)mem;
35956 0 : fd_epoch_info_pair_new( self );
35957 0 : void * alloc_region = (uchar *)mem + sizeof(fd_epoch_info_pair_t);
35958 0 : void * * alloc_mem = &alloc_region;
35959 0 : fd_epoch_info_pair_decode_inner( mem, alloc_mem, ctx );
35960 0 : return self;
35961 0 : }
35962 0 : void fd_epoch_info_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
35963 0 : fd_epoch_info_pair_t * self = (fd_epoch_info_pair_t *)struct_mem;
35964 0 : fd_pubkey_decode_inner( &self->account, alloc_mem, ctx );
35965 0 : fd_stake_decode_inner( &self->stake, alloc_mem, ctx );
35966 0 : }
35967 0 : void * fd_epoch_info_pair_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
35968 0 : fd_epoch_info_pair_global_t * self = (fd_epoch_info_pair_global_t *)mem;
35969 0 : fd_epoch_info_pair_new( (fd_epoch_info_pair_t *)self );
35970 0 : void * alloc_region = (uchar *)mem + sizeof(fd_epoch_info_pair_global_t);
35971 0 : void * * alloc_mem = &alloc_region;
35972 0 : fd_epoch_info_pair_decode_inner_global( mem, alloc_mem, ctx );
35973 0 : return self;
35974 0 : }
35975 0 : void fd_epoch_info_pair_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
35976 0 : fd_epoch_info_pair_global_t * self = (fd_epoch_info_pair_global_t *)struct_mem;
35977 0 : fd_pubkey_decode_inner_global( &self->account, alloc_mem, ctx );
35978 0 : fd_stake_decode_inner_global( &self->stake, alloc_mem, ctx );
35979 0 : }
35980 0 : int fd_epoch_info_pair_convert_global_to_local( void const * global_self, fd_epoch_info_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
35981 0 : int err = 0;
35982 0 : fd_epoch_info_pair_global_t const * mem = (fd_epoch_info_pair_global_t const *)global_self;
35983 0 : err = fd_pubkey_convert_global_to_local( &mem->account, &self->account, ctx );
35984 0 : if( FD_UNLIKELY( err ) ) return err;
35985 0 : err = fd_stake_convert_global_to_local( &mem->stake, &self->stake, ctx );
35986 0 : if( FD_UNLIKELY( err ) ) return err;
35987 0 : return FD_BINCODE_SUCCESS;
35988 0 : }
35989 0 : void fd_epoch_info_pair_new(fd_epoch_info_pair_t * self) {
35990 0 : fd_memset( self, 0, sizeof(fd_epoch_info_pair_t) );
35991 0 : fd_pubkey_new( &self->account );
35992 0 : fd_stake_new( &self->stake );
35993 0 : }
35994 0 : void fd_epoch_info_pair_destroy( fd_epoch_info_pair_t * self ) {
35995 0 : fd_pubkey_destroy( &self->account );
35996 0 : fd_stake_destroy( &self->stake );
35997 0 : }
35998 :
35999 0 : ulong fd_epoch_info_pair_footprint( void ){ return FD_EPOCH_INFO_PAIR_FOOTPRINT; }
36000 0 : ulong fd_epoch_info_pair_align( void ){ return FD_EPOCH_INFO_PAIR_ALIGN; }
36001 :
36002 0 : void fd_epoch_info_pair_walk( void * w, fd_epoch_info_pair_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
36003 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_epoch_info_pair", level++ );
36004 0 : fd_pubkey_walk( w, &self->account, fun, "account", level );
36005 0 : fd_stake_walk( w, &self->stake, fun, "stake", level );
36006 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_epoch_info_pair", level-- );
36007 0 : }
36008 0 : ulong fd_epoch_info_pair_size( fd_epoch_info_pair_t const * self ) {
36009 0 : ulong size = 0;
36010 0 : size += fd_pubkey_size( &self->account );
36011 0 : size += fd_stake_size( &self->stake );
36012 0 : return size;
36013 0 : }
36014 :
36015 0 : int fd_vote_info_pair_encode( fd_vote_info_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
36016 0 : int err;
36017 0 : err = fd_pubkey_encode( &self->account, ctx );
36018 0 : if( FD_UNLIKELY( err ) ) return err;
36019 0 : err = fd_vote_state_versioned_encode( &self->state, ctx );
36020 0 : if( FD_UNLIKELY( err ) ) return err;
36021 0 : return FD_BINCODE_SUCCESS;
36022 0 : }
36023 0 : int fd_vote_info_pair_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
36024 0 : *total_sz += sizeof(fd_vote_info_pair_t);
36025 0 : void const * start_data = ctx->data;
36026 0 : int err = fd_vote_info_pair_decode_footprint_inner( ctx, total_sz );
36027 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
36028 0 : ctx->data = start_data;
36029 0 : return err;
36030 0 : }
36031 0 : int fd_vote_info_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
36032 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
36033 0 : int err = 0;
36034 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
36035 0 : if( FD_UNLIKELY( err ) ) return err;
36036 0 : err = fd_vote_state_versioned_decode_footprint_inner( ctx, total_sz );
36037 0 : if( FD_UNLIKELY( err ) ) return err;
36038 0 : return 0;
36039 0 : }
36040 0 : void * fd_vote_info_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
36041 0 : fd_vote_info_pair_t * self = (fd_vote_info_pair_t *)mem;
36042 0 : fd_vote_info_pair_new( self );
36043 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_info_pair_t);
36044 0 : void * * alloc_mem = &alloc_region;
36045 0 : fd_vote_info_pair_decode_inner( mem, alloc_mem, ctx );
36046 0 : return self;
36047 0 : }
36048 0 : void fd_vote_info_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
36049 0 : fd_vote_info_pair_t * self = (fd_vote_info_pair_t *)struct_mem;
36050 0 : fd_pubkey_decode_inner( &self->account, alloc_mem, ctx );
36051 0 : fd_vote_state_versioned_decode_inner( &self->state, alloc_mem, ctx );
36052 0 : }
36053 0 : void * fd_vote_info_pair_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
36054 0 : fd_vote_info_pair_global_t * self = (fd_vote_info_pair_global_t *)mem;
36055 0 : fd_vote_info_pair_new( (fd_vote_info_pair_t *)self );
36056 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_info_pair_global_t);
36057 0 : void * * alloc_mem = &alloc_region;
36058 0 : fd_vote_info_pair_decode_inner_global( mem, alloc_mem, ctx );
36059 0 : return self;
36060 0 : }
36061 0 : void fd_vote_info_pair_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
36062 0 : fd_vote_info_pair_global_t * self = (fd_vote_info_pair_global_t *)struct_mem;
36063 0 : fd_pubkey_decode_inner_global( &self->account, alloc_mem, ctx );
36064 0 : fd_vote_state_versioned_decode_inner_global( &self->state, alloc_mem, ctx );
36065 0 : }
36066 0 : int fd_vote_info_pair_convert_global_to_local( void const * global_self, fd_vote_info_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
36067 0 : int err = 0;
36068 0 : fd_vote_info_pair_global_t const * mem = (fd_vote_info_pair_global_t const *)global_self;
36069 0 : err = fd_pubkey_convert_global_to_local( &mem->account, &self->account, ctx );
36070 0 : if( FD_UNLIKELY( err ) ) return err;
36071 0 : err = fd_vote_state_versioned_convert_global_to_local( &mem->state, &self->state, ctx );
36072 0 : if( FD_UNLIKELY( err ) ) return err;
36073 0 : return FD_BINCODE_SUCCESS;
36074 0 : }
36075 0 : void fd_vote_info_pair_new(fd_vote_info_pair_t * self) {
36076 0 : fd_memset( self, 0, sizeof(fd_vote_info_pair_t) );
36077 0 : fd_pubkey_new( &self->account );
36078 0 : fd_vote_state_versioned_new( &self->state );
36079 0 : }
36080 0 : void fd_vote_info_pair_destroy( fd_vote_info_pair_t * self ) {
36081 0 : fd_pubkey_destroy( &self->account );
36082 0 : fd_vote_state_versioned_destroy( &self->state );
36083 0 : }
36084 :
36085 0 : ulong fd_vote_info_pair_footprint( void ){ return FD_VOTE_INFO_PAIR_FOOTPRINT; }
36086 0 : ulong fd_vote_info_pair_align( void ){ return FD_VOTE_INFO_PAIR_ALIGN; }
36087 :
36088 0 : void fd_vote_info_pair_walk( void * w, fd_vote_info_pair_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
36089 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_info_pair", level++ );
36090 0 : fd_pubkey_walk( w, &self->account, fun, "account", level );
36091 0 : fd_vote_state_versioned_walk( w, &self->state, fun, "state", level );
36092 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_info_pair", level-- );
36093 0 : }
36094 0 : ulong fd_vote_info_pair_size( fd_vote_info_pair_t const * self ) {
36095 0 : ulong size = 0;
36096 0 : size += fd_pubkey_size( &self->account );
36097 0 : size += fd_vote_state_versioned_size( &self->state );
36098 0 : return size;
36099 0 : }
36100 :
36101 0 : int fd_epoch_info_encode( fd_epoch_info_t const * self, fd_bincode_encode_ctx_t * ctx ) {
36102 0 : int err;
36103 0 : err = fd_bincode_uint64_encode( self->stake_infos_len, ctx );
36104 0 : if( FD_UNLIKELY(err) ) return err;
36105 0 : if( self->stake_infos_len ) {
36106 0 : for( ulong i=0; i < self->stake_infos_len; i++ ) {
36107 0 : err = fd_epoch_info_pair_encode( self->stake_infos + i, ctx );
36108 0 : if( FD_UNLIKELY( err ) ) return err;
36109 0 : }
36110 0 : }
36111 0 : if( self->vote_states_root ) {
36112 0 : ulong vote_states_len = fd_vote_info_pair_t_map_size( self->vote_states_pool, self->vote_states_root );
36113 0 : err = fd_bincode_uint64_encode( vote_states_len, ctx );
36114 0 : if( FD_UNLIKELY( err ) ) return err;
36115 0 : for( fd_vote_info_pair_t_mapnode_t * n = fd_vote_info_pair_t_map_minimum( self->vote_states_pool, self->vote_states_root ); n; n = fd_vote_info_pair_t_map_successor( self->vote_states_pool, n ) ) {
36116 0 : err = fd_vote_info_pair_encode( &n->elem, ctx );
36117 0 : if( FD_UNLIKELY( err ) ) return err;
36118 0 : }
36119 0 : } else {
36120 0 : ulong vote_states_len = 0;
36121 0 : err = fd_bincode_uint64_encode( vote_states_len, ctx );
36122 0 : if( FD_UNLIKELY( err ) ) return err;
36123 0 : }
36124 0 : err = fd_bincode_uint64_encode( self->stake_infos_new_keys_start_idx, ctx );
36125 0 : if( FD_UNLIKELY( err ) ) return err;
36126 0 : return FD_BINCODE_SUCCESS;
36127 0 : }
36128 0 : int fd_epoch_info_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
36129 0 : *total_sz += sizeof(fd_epoch_info_t);
36130 0 : void const * start_data = ctx->data;
36131 0 : int err = fd_epoch_info_decode_footprint_inner( ctx, total_sz );
36132 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
36133 0 : ctx->data = start_data;
36134 0 : return err;
36135 0 : }
36136 0 : int fd_epoch_info_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
36137 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
36138 0 : int err = 0;
36139 0 : ulong stake_infos_len;
36140 0 : err = fd_bincode_uint64_decode( &stake_infos_len, ctx );
36141 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
36142 0 : if( stake_infos_len ) {
36143 0 : *total_sz += FD_EPOCH_INFO_PAIR_ALIGN + FD_EPOCH_INFO_PAIR_FOOTPRINT*stake_infos_len;
36144 0 : for( ulong i=0; i < stake_infos_len; i++ ) {
36145 0 : err = fd_epoch_info_pair_decode_footprint_inner( ctx, total_sz );
36146 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
36147 0 : }
36148 0 : }
36149 0 : ulong vote_states_len = 0UL;
36150 0 : err = fd_bincode_uint64_decode( &vote_states_len, ctx );
36151 0 : ulong vote_states_cnt = vote_states_len;
36152 0 : *total_sz += fd_vote_info_pair_t_map_align() + fd_vote_info_pair_t_map_footprint( vote_states_cnt );
36153 0 : if( FD_UNLIKELY( err ) ) return err;
36154 0 : for( ulong i=0; i < vote_states_len; i++ ) {
36155 0 : err = fd_vote_info_pair_decode_footprint_inner( ctx, total_sz );
36156 0 : if( FD_UNLIKELY( err ) ) return err;
36157 0 : }
36158 0 : err = fd_bincode_uint64_decode_footprint( ctx );
36159 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
36160 0 : return 0;
36161 0 : }
36162 0 : void * fd_epoch_info_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
36163 0 : fd_epoch_info_t * self = (fd_epoch_info_t *)mem;
36164 0 : fd_epoch_info_new( self );
36165 0 : void * alloc_region = (uchar *)mem + sizeof(fd_epoch_info_t);
36166 0 : void * * alloc_mem = &alloc_region;
36167 0 : fd_epoch_info_decode_inner( mem, alloc_mem, ctx );
36168 0 : return self;
36169 0 : }
36170 0 : void fd_epoch_info_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
36171 0 : fd_epoch_info_t * self = (fd_epoch_info_t *)struct_mem;
36172 0 : fd_bincode_uint64_decode_unsafe( &self->stake_infos_len, ctx );
36173 0 : if( self->stake_infos_len ) {
36174 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_EPOCH_INFO_PAIR_ALIGN );
36175 0 : self->stake_infos = *alloc_mem;
36176 0 : *alloc_mem = (uchar *)(*alloc_mem) + FD_EPOCH_INFO_PAIR_FOOTPRINT*self->stake_infos_len;
36177 0 : for( ulong i=0; i < self->stake_infos_len; i++ ) {
36178 0 : fd_epoch_info_pair_new( self->stake_infos + i );
36179 0 : fd_epoch_info_pair_decode_inner( self->stake_infos + i, alloc_mem, ctx );
36180 0 : }
36181 0 : } else
36182 0 : self->stake_infos = NULL;
36183 0 : ulong vote_states_len;
36184 0 : fd_bincode_uint64_decode_unsafe( &vote_states_len, ctx );
36185 0 : self->vote_states_pool = fd_vote_info_pair_t_map_join_new( alloc_mem, vote_states_len );
36186 0 : self->vote_states_root = NULL;
36187 0 : for( ulong i=0; i < vote_states_len; i++ ) {
36188 0 : fd_vote_info_pair_t_mapnode_t * node = fd_vote_info_pair_t_map_acquire( self->vote_states_pool );
36189 0 : fd_vote_info_pair_new( &node->elem );
36190 0 : fd_vote_info_pair_decode_inner( &node->elem, alloc_mem, ctx );
36191 0 : fd_vote_info_pair_t_map_insert( self->vote_states_pool, &self->vote_states_root, node );
36192 0 : }
36193 0 : fd_bincode_uint64_decode_unsafe( &self->stake_infos_new_keys_start_idx, ctx );
36194 0 : }
36195 0 : void * fd_epoch_info_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
36196 0 : fd_epoch_info_global_t * self = (fd_epoch_info_global_t *)mem;
36197 0 : fd_epoch_info_new( (fd_epoch_info_t *)self );
36198 0 : void * alloc_region = (uchar *)mem + sizeof(fd_epoch_info_global_t);
36199 0 : void * * alloc_mem = &alloc_region;
36200 0 : fd_epoch_info_decode_inner_global( mem, alloc_mem, ctx );
36201 0 : return self;
36202 0 : }
36203 0 : void fd_epoch_info_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
36204 0 : fd_epoch_info_global_t * self = (fd_epoch_info_global_t *)struct_mem;
36205 0 : fd_bincode_uint64_decode_unsafe( &self->stake_infos_len, ctx );
36206 0 : if( self->stake_infos_len ) {
36207 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_EPOCH_INFO_PAIR_ALIGN );
36208 0 : self->stake_infos_gaddr = fd_wksp_gaddr_fast( ctx->wksp, *alloc_mem );
36209 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
36210 0 : *alloc_mem = (uchar *)(*alloc_mem) + FD_EPOCH_INFO_PAIR_FOOTPRINT*self->stake_infos_len;
36211 0 : for( ulong i=0; i < self->stake_infos_len; i++ ) {
36212 0 : fd_epoch_info_pair_new( (fd_epoch_info_pair_t *)(cur_mem + FD_EPOCH_INFO_PAIR_FOOTPRINT * i) );
36213 0 : fd_epoch_info_pair_decode_inner_global( cur_mem + FD_EPOCH_INFO_PAIR_FOOTPRINT * i, alloc_mem, ctx );
36214 0 : }
36215 0 : } else
36216 0 : self->stake_infos_gaddr = 0UL;
36217 0 : ulong vote_states_len;
36218 0 : fd_bincode_uint64_decode_unsafe( &vote_states_len, ctx );
36219 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, fd_vote_info_pair_t_map_align() );
36220 0 : fd_vote_info_pair_t_mapnode_t * vote_states_pool = fd_vote_info_pair_t_map_join_new( alloc_mem, vote_states_len );
36221 0 : fd_vote_info_pair_t_mapnode_t * vote_states_root = NULL;
36222 0 : self->vote_states_root_gaddr = 0UL;
36223 0 : for( ulong i=0; i < vote_states_len; i++ ) {
36224 0 : fd_vote_info_pair_t_mapnode_t * node = fd_vote_info_pair_t_map_acquire( vote_states_pool );
36225 0 : fd_vote_info_pair_new( &node->elem );
36226 0 : fd_vote_info_pair_decode_inner( &node->elem, alloc_mem, ctx );
36227 0 : fd_vote_info_pair_t_map_insert( vote_states_pool, &vote_states_root, node );
36228 0 : }
36229 0 : self->vote_states_pool_gaddr = fd_wksp_gaddr_fast( ctx->wksp, vote_states_pool );
36230 0 : self->vote_states_root_gaddr = fd_wksp_gaddr_fast( ctx->wksp, vote_states_root );
36231 0 : fd_bincode_uint64_decode_unsafe( &self->stake_infos_new_keys_start_idx, ctx );
36232 0 : }
36233 0 : int fd_epoch_info_convert_global_to_local( void const * global_self, fd_epoch_info_t * self, fd_bincode_decode_ctx_t * ctx ) {
36234 0 : int err = 0;
36235 0 : fd_epoch_info_global_t const * mem = (fd_epoch_info_global_t const *)global_self;
36236 0 : self->stake_infos_len = mem->stake_infos_len;
36237 0 : self->stake_infos = fd_wksp_laddr_fast( ctx->wksp, mem->stake_infos_gaddr );
36238 0 : self->vote_states_pool = fd_wksp_laddr_fast( ctx->wksp, mem->vote_states_pool_gaddr );
36239 0 : self->vote_states_root = fd_wksp_laddr_fast( ctx->wksp, mem->vote_states_root_gaddr );
36240 0 : self->stake_infos_new_keys_start_idx = mem->stake_infos_new_keys_start_idx;
36241 0 : return FD_BINCODE_SUCCESS;
36242 0 : }
36243 0 : void fd_epoch_info_new(fd_epoch_info_t * self) {
36244 0 : fd_memset( self, 0, sizeof(fd_epoch_info_t) );
36245 0 : }
36246 0 : void fd_epoch_info_destroy( fd_epoch_info_t * self ) {
36247 0 : if( self->stake_infos ) {
36248 0 : for( ulong i=0; i < self->stake_infos_len; i++ )
36249 0 : fd_epoch_info_pair_destroy( self->stake_infos + i );
36250 0 : self->stake_infos = NULL;
36251 0 : }
36252 0 : for( fd_vote_info_pair_t_mapnode_t * n = fd_vote_info_pair_t_map_minimum(self->vote_states_pool, self->vote_states_root ); n; n = fd_vote_info_pair_t_map_successor(self->vote_states_pool, n) ) {
36253 0 : fd_vote_info_pair_destroy( &n->elem );
36254 0 : }
36255 0 : self->vote_states_pool = NULL;
36256 0 : self->vote_states_root = NULL;
36257 0 : }
36258 :
36259 0 : ulong fd_epoch_info_footprint( void ){ return FD_EPOCH_INFO_FOOTPRINT; }
36260 0 : ulong fd_epoch_info_align( void ){ return FD_EPOCH_INFO_ALIGN; }
36261 :
36262 0 : void fd_epoch_info_walk( void * w, fd_epoch_info_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
36263 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_epoch_info", level++ );
36264 0 : if( self->stake_infos_len ) {
36265 0 : fun( w, NULL, "stake_infos", FD_FLAMENCO_TYPE_ARR, "array", level++ );
36266 0 : for( ulong i=0; i < self->stake_infos_len; i++ )
36267 0 : fd_epoch_info_pair_walk(w, self->stake_infos + i, fun, "epoch_info_pair", level );
36268 0 : fun( w, NULL, "stake_infos", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
36269 0 : }
36270 0 : if( self->vote_states_root ) {
36271 0 : for( fd_vote_info_pair_t_mapnode_t * n = fd_vote_info_pair_t_map_minimum(self->vote_states_pool, self->vote_states_root ); n; n = fd_vote_info_pair_t_map_successor( self->vote_states_pool, n ) ) {
36272 0 : fd_vote_info_pair_walk(w, &n->elem, fun, "vote_states", level );
36273 0 : }
36274 0 : }
36275 0 : fun( w, &self->stake_infos_new_keys_start_idx, "stake_infos_new_keys_start_idx", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
36276 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_epoch_info", level-- );
36277 0 : }
36278 0 : ulong fd_epoch_info_size( fd_epoch_info_t const * self ) {
36279 0 : ulong size = 0;
36280 0 : do {
36281 0 : size += sizeof(ulong);
36282 0 : for( ulong i=0; i < self->stake_infos_len; i++ )
36283 0 : size += fd_epoch_info_pair_size( self->stake_infos + i );
36284 0 : } while(0);
36285 0 : if( self->vote_states_root ) {
36286 0 : size += sizeof(ulong);
36287 0 : for( fd_vote_info_pair_t_mapnode_t * n = fd_vote_info_pair_t_map_minimum( self->vote_states_pool, self->vote_states_root ); n; n = fd_vote_info_pair_t_map_successor( self->vote_states_pool, n ) ) {
36288 0 : size += fd_vote_info_pair_size( &n->elem );
36289 0 : }
36290 0 : } else {
36291 0 : size += sizeof(ulong);
36292 0 : }
36293 0 : size += sizeof(ulong);
36294 0 : return size;
36295 0 : }
36296 :
36297 0 : int fd_usage_cost_details_encode( fd_usage_cost_details_t const * self, fd_bincode_encode_ctx_t * ctx ) {
36298 0 : int err;
36299 0 : err = fd_bincode_uint64_encode( self->signature_cost, ctx );
36300 0 : if( FD_UNLIKELY( err ) ) return err;
36301 0 : err = fd_bincode_uint64_encode( self->write_lock_cost, ctx );
36302 0 : if( FD_UNLIKELY( err ) ) return err;
36303 0 : err = fd_bincode_uint64_encode( self->data_bytes_cost, ctx );
36304 0 : if( FD_UNLIKELY( err ) ) return err;
36305 0 : err = fd_bincode_uint64_encode( self->programs_execution_cost, ctx );
36306 0 : if( FD_UNLIKELY( err ) ) return err;
36307 0 : err = fd_bincode_uint64_encode( self->loaded_accounts_data_size_cost, ctx );
36308 0 : if( FD_UNLIKELY( err ) ) return err;
36309 0 : err = fd_bincode_uint64_encode( self->allocated_accounts_data_size, ctx );
36310 0 : if( FD_UNLIKELY( err ) ) return err;
36311 0 : return FD_BINCODE_SUCCESS;
36312 0 : }
36313 0 : int fd_usage_cost_details_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
36314 0 : *total_sz += sizeof(fd_usage_cost_details_t);
36315 0 : void const * start_data = ctx->data;
36316 0 : int err = fd_usage_cost_details_decode_footprint_inner( ctx, total_sz );
36317 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
36318 0 : ctx->data = start_data;
36319 0 : return err;
36320 0 : }
36321 0 : int fd_usage_cost_details_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
36322 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
36323 0 : int err = 0;
36324 0 : err = fd_bincode_uint64_decode_footprint( ctx );
36325 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
36326 0 : err = fd_bincode_uint64_decode_footprint( ctx );
36327 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
36328 0 : err = fd_bincode_uint64_decode_footprint( ctx );
36329 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
36330 0 : err = fd_bincode_uint64_decode_footprint( ctx );
36331 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
36332 0 : err = fd_bincode_uint64_decode_footprint( ctx );
36333 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
36334 0 : err = fd_bincode_uint64_decode_footprint( ctx );
36335 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
36336 0 : return 0;
36337 0 : }
36338 0 : void * fd_usage_cost_details_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
36339 0 : fd_usage_cost_details_t * self = (fd_usage_cost_details_t *)mem;
36340 0 : fd_usage_cost_details_new( self );
36341 0 : void * alloc_region = (uchar *)mem + sizeof(fd_usage_cost_details_t);
36342 0 : void * * alloc_mem = &alloc_region;
36343 0 : fd_usage_cost_details_decode_inner( mem, alloc_mem, ctx );
36344 0 : return self;
36345 0 : }
36346 0 : void fd_usage_cost_details_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
36347 0 : fd_usage_cost_details_t * self = (fd_usage_cost_details_t *)struct_mem;
36348 0 : fd_bincode_uint64_decode_unsafe( &self->signature_cost, ctx );
36349 0 : fd_bincode_uint64_decode_unsafe( &self->write_lock_cost, ctx );
36350 0 : fd_bincode_uint64_decode_unsafe( &self->data_bytes_cost, ctx );
36351 0 : fd_bincode_uint64_decode_unsafe( &self->programs_execution_cost, ctx );
36352 0 : fd_bincode_uint64_decode_unsafe( &self->loaded_accounts_data_size_cost, ctx );
36353 0 : fd_bincode_uint64_decode_unsafe( &self->allocated_accounts_data_size, ctx );
36354 0 : }
36355 0 : void * fd_usage_cost_details_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
36356 0 : fd_usage_cost_details_global_t * self = (fd_usage_cost_details_global_t *)mem;
36357 0 : fd_usage_cost_details_new( (fd_usage_cost_details_t *)self );
36358 0 : void * alloc_region = (uchar *)mem + sizeof(fd_usage_cost_details_global_t);
36359 0 : void * * alloc_mem = &alloc_region;
36360 0 : fd_usage_cost_details_decode_inner_global( mem, alloc_mem, ctx );
36361 0 : return self;
36362 0 : }
36363 0 : void fd_usage_cost_details_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
36364 0 : fd_usage_cost_details_global_t * self = (fd_usage_cost_details_global_t *)struct_mem;
36365 0 : fd_bincode_uint64_decode_unsafe( &self->signature_cost, ctx );
36366 0 : fd_bincode_uint64_decode_unsafe( &self->write_lock_cost, ctx );
36367 0 : fd_bincode_uint64_decode_unsafe( &self->data_bytes_cost, ctx );
36368 0 : fd_bincode_uint64_decode_unsafe( &self->programs_execution_cost, ctx );
36369 0 : fd_bincode_uint64_decode_unsafe( &self->loaded_accounts_data_size_cost, ctx );
36370 0 : fd_bincode_uint64_decode_unsafe( &self->allocated_accounts_data_size, ctx );
36371 0 : }
36372 0 : int fd_usage_cost_details_convert_global_to_local( void const * global_self, fd_usage_cost_details_t * self, fd_bincode_decode_ctx_t * ctx ) {
36373 0 : int err = 0;
36374 0 : fd_usage_cost_details_global_t const * mem = (fd_usage_cost_details_global_t const *)global_self;
36375 0 : self->signature_cost = mem->signature_cost;
36376 0 : self->write_lock_cost = mem->write_lock_cost;
36377 0 : self->data_bytes_cost = mem->data_bytes_cost;
36378 0 : self->programs_execution_cost = mem->programs_execution_cost;
36379 0 : self->loaded_accounts_data_size_cost = mem->loaded_accounts_data_size_cost;
36380 0 : self->allocated_accounts_data_size = mem->allocated_accounts_data_size;
36381 0 : return FD_BINCODE_SUCCESS;
36382 0 : }
36383 0 : void fd_usage_cost_details_new(fd_usage_cost_details_t * self) {
36384 0 : fd_memset( self, 0, sizeof(fd_usage_cost_details_t) );
36385 0 : }
36386 0 : void fd_usage_cost_details_destroy( fd_usage_cost_details_t * self ) {
36387 0 : }
36388 :
36389 0 : ulong fd_usage_cost_details_footprint( void ){ return FD_USAGE_COST_DETAILS_FOOTPRINT; }
36390 0 : ulong fd_usage_cost_details_align( void ){ return FD_USAGE_COST_DETAILS_ALIGN; }
36391 :
36392 0 : void fd_usage_cost_details_walk( void * w, fd_usage_cost_details_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
36393 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_usage_cost_details", level++ );
36394 0 : fun( w, &self->signature_cost, "signature_cost", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
36395 0 : fun( w, &self->write_lock_cost, "write_lock_cost", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
36396 0 : fun( w, &self->data_bytes_cost, "data_bytes_cost", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
36397 0 : fun( w, &self->programs_execution_cost, "programs_execution_cost", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
36398 0 : fun( w, &self->loaded_accounts_data_size_cost, "loaded_accounts_data_size_cost", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
36399 0 : fun( w, &self->allocated_accounts_data_size, "allocated_accounts_data_size", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
36400 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_usage_cost_details", level-- );
36401 0 : }
36402 0 : ulong fd_usage_cost_details_size( fd_usage_cost_details_t const * self ) {
36403 0 : ulong size = 0;
36404 0 : size += sizeof(ulong);
36405 0 : size += sizeof(ulong);
36406 0 : size += sizeof(ulong);
36407 0 : size += sizeof(ulong);
36408 0 : size += sizeof(ulong);
36409 0 : size += sizeof(ulong);
36410 0 : return size;
36411 0 : }
36412 :
36413 0 : FD_FN_PURE uchar fd_transaction_cost_is_simple_vote(fd_transaction_cost_t const * self) {
36414 0 : return self->discriminant == 0;
36415 0 : }
36416 0 : FD_FN_PURE uchar fd_transaction_cost_is_transaction(fd_transaction_cost_t const * self) {
36417 0 : return self->discriminant == 1;
36418 0 : }
36419 : void fd_transaction_cost_inner_new( fd_transaction_cost_inner_t * self, uint discriminant );
36420 0 : int fd_transaction_cost_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
36421 0 : int err;
36422 0 : switch (discriminant) {
36423 0 : case 0: {
36424 0 : return FD_BINCODE_SUCCESS;
36425 0 : }
36426 0 : case 1: {
36427 0 : err = fd_usage_cost_details_decode_footprint_inner( ctx, total_sz );
36428 0 : if( FD_UNLIKELY( err ) ) return err;
36429 0 : return FD_BINCODE_SUCCESS;
36430 0 : }
36431 0 : default: return FD_BINCODE_ERR_ENCODING;
36432 0 : }
36433 0 : }
36434 0 : int fd_transaction_cost_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
36435 0 : *total_sz += sizeof(fd_transaction_cost_t);
36436 0 : void const * start_data = ctx->data;
36437 0 : int err = fd_transaction_cost_decode_footprint_inner( ctx, total_sz );
36438 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
36439 0 : ctx->data = start_data;
36440 0 : return err;
36441 0 : }
36442 0 : int fd_transaction_cost_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
36443 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
36444 0 : uint discriminant = 0;
36445 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
36446 0 : if( FD_UNLIKELY( err ) ) return err;
36447 0 : return fd_transaction_cost_inner_decode_footprint( discriminant, ctx, total_sz );
36448 0 : }
36449 0 : void fd_transaction_cost_inner_decode_inner( fd_transaction_cost_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
36450 0 : switch (discriminant) {
36451 0 : case 0: {
36452 0 : break;
36453 0 : }
36454 0 : case 1: {
36455 0 : fd_usage_cost_details_decode_inner( &self->transaction, alloc_mem, ctx );
36456 0 : break;
36457 0 : }
36458 0 : }
36459 0 : }
36460 0 : void fd_transaction_cost_inner_decode_inner_global( fd_transaction_cost_inner_global_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
36461 0 : switch (discriminant) {
36462 0 : case 0: {
36463 0 : break;
36464 0 : }
36465 0 : case 1: {
36466 0 : fd_usage_cost_details_decode_inner_global( &self->transaction, alloc_mem, ctx );
36467 0 : break;
36468 0 : }
36469 0 : }
36470 0 : }
36471 0 : int fd_transaction_cost_convert_global_to_local_inner( fd_transaction_cost_inner_global_t const * mem, fd_transaction_cost_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
36472 0 : int err = 0;
36473 0 : switch( discriminant ) {
36474 0 : case 0: {
36475 0 : break;
36476 0 : }
36477 0 : case 1: {
36478 0 : err = fd_usage_cost_details_convert_global_to_local( &mem->transaction, &self->transaction, ctx );
36479 0 : if( FD_UNLIKELY( err ) ) return err;
36480 0 : break;
36481 0 : }
36482 0 : }
36483 0 : return FD_BINCODE_SUCCESS;
36484 0 : }
36485 0 : int fd_transaction_cost_convert_global_to_local( void const * global_self, fd_transaction_cost_t * self, fd_bincode_decode_ctx_t * ctx ) {
36486 0 : fd_transaction_cost_global_t const * mem = (fd_transaction_cost_global_t const *)global_self;
36487 0 : uint discriminant = mem->discriminant;
36488 0 : self->discriminant = mem->discriminant;
36489 0 : int err = fd_transaction_cost_convert_global_to_local_inner( &mem->inner, &self->inner, discriminant, ctx );
36490 0 : return FD_BINCODE_SUCCESS;
36491 0 : }
36492 0 : void fd_transaction_cost_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
36493 0 : fd_transaction_cost_t * self = (fd_transaction_cost_t *)struct_mem;
36494 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
36495 0 : fd_transaction_cost_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
36496 0 : }
36497 0 : void * fd_transaction_cost_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
36498 0 : fd_transaction_cost_t * self = (fd_transaction_cost_t *)mem;
36499 0 : fd_transaction_cost_new( self );
36500 0 : void * alloc_region = (uchar *)mem + sizeof(fd_transaction_cost_t);
36501 0 : void * * alloc_mem = &alloc_region;
36502 0 : fd_transaction_cost_decode_inner( mem, alloc_mem, ctx );
36503 0 : return self;
36504 0 : }
36505 0 : void * fd_transaction_cost_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
36506 0 : fd_transaction_cost_t * self = (fd_transaction_cost_t *)mem;
36507 0 : fd_transaction_cost_new( self );
36508 0 : void * alloc_region = (uchar *)mem + sizeof(fd_transaction_cost_t);
36509 0 : void * * alloc_mem = &alloc_region;
36510 0 : fd_transaction_cost_decode_inner_global( mem, alloc_mem, ctx );
36511 0 : return self;
36512 0 : }
36513 0 : void fd_transaction_cost_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
36514 0 : fd_transaction_cost_global_t * self = (fd_transaction_cost_global_t *)struct_mem;
36515 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
36516 0 : fd_transaction_cost_inner_decode_inner_global( &self->inner, alloc_mem, self->discriminant, ctx );
36517 0 : }
36518 0 : void fd_transaction_cost_inner_new( fd_transaction_cost_inner_t * self, uint discriminant ) {
36519 0 : switch( discriminant ) {
36520 0 : case 0: {
36521 0 : break;
36522 0 : }
36523 0 : case 1: {
36524 0 : fd_usage_cost_details_new( &self->transaction );
36525 0 : break;
36526 0 : }
36527 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
36528 0 : }
36529 0 : }
36530 0 : void fd_transaction_cost_new_disc( fd_transaction_cost_t * self, uint discriminant ) {
36531 0 : self->discriminant = discriminant;
36532 0 : fd_transaction_cost_inner_new( &self->inner, self->discriminant );
36533 0 : }
36534 0 : void fd_transaction_cost_new( fd_transaction_cost_t * self ) {
36535 0 : fd_memset( self, 0, sizeof(fd_transaction_cost_t) );
36536 0 : fd_transaction_cost_new_disc( self, UINT_MAX );
36537 0 : }
36538 0 : void fd_transaction_cost_inner_destroy( fd_transaction_cost_inner_t * self, uint discriminant ) {
36539 0 : switch( discriminant ) {
36540 0 : case 1: {
36541 0 : fd_usage_cost_details_destroy( &self->transaction );
36542 0 : break;
36543 0 : }
36544 0 : default: break; // FD_LOG_ERR(( "unhandled type" ));
36545 0 : }
36546 0 : }
36547 0 : void fd_transaction_cost_destroy( fd_transaction_cost_t * self ) {
36548 0 : fd_transaction_cost_inner_destroy( &self->inner, self->discriminant );
36549 0 : }
36550 :
36551 0 : ulong fd_transaction_cost_footprint( void ){ return FD_TRANSACTION_COST_FOOTPRINT; }
36552 0 : ulong fd_transaction_cost_align( void ){ return FD_TRANSACTION_COST_ALIGN; }
36553 :
36554 0 : void fd_transaction_cost_walk( void * w, fd_transaction_cost_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
36555 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_transaction_cost", level++);
36556 0 : switch( self->discriminant ) {
36557 0 : case 0: {
36558 0 : fun( w, self, "simple_vote", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
36559 0 : break;
36560 0 : }
36561 0 : case 1: {
36562 0 : fun( w, self, "transaction", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
36563 0 : fd_usage_cost_details_walk( w, &self->inner.transaction, fun, "transaction", level );
36564 0 : break;
36565 0 : }
36566 0 : }
36567 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_transaction_cost", level-- );
36568 0 : }
36569 0 : ulong fd_transaction_cost_size( fd_transaction_cost_t const * self ) {
36570 0 : ulong size = 0;
36571 0 : size += sizeof(uint);
36572 0 : switch (self->discriminant) {
36573 0 : case 1: {
36574 0 : size += fd_usage_cost_details_size( &self->inner.transaction );
36575 0 : break;
36576 0 : }
36577 0 : }
36578 0 : return size;
36579 0 : }
36580 :
36581 0 : int fd_transaction_cost_inner_encode( fd_transaction_cost_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
36582 0 : int err;
36583 0 : switch (discriminant) {
36584 0 : case 1: {
36585 0 : err = fd_usage_cost_details_encode( &self->transaction, ctx );
36586 0 : if( FD_UNLIKELY( err ) ) return err;
36587 0 : break;
36588 0 : }
36589 0 : }
36590 0 : return FD_BINCODE_SUCCESS;
36591 0 : }
36592 0 : int fd_transaction_cost_encode( fd_transaction_cost_t const * self, fd_bincode_encode_ctx_t * ctx ) {
36593 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
36594 0 : if( FD_UNLIKELY( err ) ) return err;
36595 0 : return fd_transaction_cost_inner_encode( &self->inner, self->discriminant, ctx );
36596 0 : }
36597 :
36598 0 : int fd_account_costs_pair_encode( fd_account_costs_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
36599 0 : int err;
36600 0 : err = fd_pubkey_encode( &self->key, ctx );
36601 0 : if( FD_UNLIKELY( err ) ) return err;
36602 0 : err = fd_bincode_uint64_encode( self->cost, ctx );
36603 0 : if( FD_UNLIKELY( err ) ) return err;
36604 0 : return FD_BINCODE_SUCCESS;
36605 0 : }
36606 0 : int fd_account_costs_pair_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
36607 0 : *total_sz += sizeof(fd_account_costs_pair_t);
36608 0 : void const * start_data = ctx->data;
36609 0 : int err = fd_account_costs_pair_decode_footprint_inner( ctx, total_sz );
36610 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
36611 0 : ctx->data = start_data;
36612 0 : return err;
36613 0 : }
36614 0 : int fd_account_costs_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
36615 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
36616 0 : int err = 0;
36617 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
36618 0 : if( FD_UNLIKELY( err ) ) return err;
36619 0 : err = fd_bincode_uint64_decode_footprint( ctx );
36620 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
36621 0 : return 0;
36622 0 : }
36623 0 : void * fd_account_costs_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
36624 0 : fd_account_costs_pair_t * self = (fd_account_costs_pair_t *)mem;
36625 0 : fd_account_costs_pair_new( self );
36626 0 : void * alloc_region = (uchar *)mem + sizeof(fd_account_costs_pair_t);
36627 0 : void * * alloc_mem = &alloc_region;
36628 0 : fd_account_costs_pair_decode_inner( mem, alloc_mem, ctx );
36629 0 : return self;
36630 0 : }
36631 0 : void fd_account_costs_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
36632 0 : fd_account_costs_pair_t * self = (fd_account_costs_pair_t *)struct_mem;
36633 0 : fd_pubkey_decode_inner( &self->key, alloc_mem, ctx );
36634 0 : fd_bincode_uint64_decode_unsafe( &self->cost, ctx );
36635 0 : }
36636 0 : void * fd_account_costs_pair_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
36637 0 : fd_account_costs_pair_global_t * self = (fd_account_costs_pair_global_t *)mem;
36638 0 : fd_account_costs_pair_new( (fd_account_costs_pair_t *)self );
36639 0 : void * alloc_region = (uchar *)mem + sizeof(fd_account_costs_pair_global_t);
36640 0 : void * * alloc_mem = &alloc_region;
36641 0 : fd_account_costs_pair_decode_inner_global( mem, alloc_mem, ctx );
36642 0 : return self;
36643 0 : }
36644 0 : void fd_account_costs_pair_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
36645 0 : fd_account_costs_pair_global_t * self = (fd_account_costs_pair_global_t *)struct_mem;
36646 0 : fd_pubkey_decode_inner_global( &self->key, alloc_mem, ctx );
36647 0 : fd_bincode_uint64_decode_unsafe( &self->cost, ctx );
36648 0 : }
36649 0 : int fd_account_costs_pair_convert_global_to_local( void const * global_self, fd_account_costs_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
36650 0 : int err = 0;
36651 0 : fd_account_costs_pair_global_t const * mem = (fd_account_costs_pair_global_t const *)global_self;
36652 0 : err = fd_pubkey_convert_global_to_local( &mem->key, &self->key, ctx );
36653 0 : if( FD_UNLIKELY( err ) ) return err;
36654 0 : self->cost = mem->cost;
36655 0 : return FD_BINCODE_SUCCESS;
36656 0 : }
36657 0 : void fd_account_costs_pair_new(fd_account_costs_pair_t * self) {
36658 0 : fd_memset( self, 0, sizeof(fd_account_costs_pair_t) );
36659 0 : fd_pubkey_new( &self->key );
36660 0 : }
36661 0 : void fd_account_costs_pair_destroy( fd_account_costs_pair_t * self ) {
36662 0 : fd_pubkey_destroy( &self->key );
36663 0 : }
36664 :
36665 0 : ulong fd_account_costs_pair_footprint( void ){ return FD_ACCOUNT_COSTS_PAIR_FOOTPRINT; }
36666 0 : ulong fd_account_costs_pair_align( void ){ return FD_ACCOUNT_COSTS_PAIR_ALIGN; }
36667 :
36668 0 : void fd_account_costs_pair_walk( void * w, fd_account_costs_pair_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
36669 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_account_costs_pair", level++ );
36670 0 : fd_pubkey_walk( w, &self->key, fun, "key", level );
36671 0 : fun( w, &self->cost, "cost", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
36672 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_account_costs_pair", level-- );
36673 0 : }
36674 0 : ulong fd_account_costs_pair_size( fd_account_costs_pair_t const * self ) {
36675 0 : ulong size = 0;
36676 0 : size += fd_pubkey_size( &self->key );
36677 0 : size += sizeof(ulong);
36678 0 : return size;
36679 0 : }
36680 :
36681 0 : int fd_account_costs_encode( fd_account_costs_t const * self, fd_bincode_encode_ctx_t * ctx ) {
36682 0 : int err;
36683 0 : if( self->account_costs_root ) {
36684 0 : ulong account_costs_len = fd_account_costs_pair_t_map_size( self->account_costs_pool, self->account_costs_root );
36685 0 : err = fd_bincode_uint64_encode( account_costs_len, ctx );
36686 0 : if( FD_UNLIKELY( err ) ) return err;
36687 0 : for( fd_account_costs_pair_t_mapnode_t * n = fd_account_costs_pair_t_map_minimum( self->account_costs_pool, self->account_costs_root ); n; n = fd_account_costs_pair_t_map_successor( self->account_costs_pool, n ) ) {
36688 0 : err = fd_account_costs_pair_encode( &n->elem, ctx );
36689 0 : if( FD_UNLIKELY( err ) ) return err;
36690 0 : }
36691 0 : } else {
36692 0 : ulong account_costs_len = 0;
36693 0 : err = fd_bincode_uint64_encode( account_costs_len, ctx );
36694 0 : if( FD_UNLIKELY( err ) ) return err;
36695 0 : }
36696 0 : return FD_BINCODE_SUCCESS;
36697 0 : }
36698 0 : int fd_account_costs_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
36699 0 : *total_sz += sizeof(fd_account_costs_t);
36700 0 : void const * start_data = ctx->data;
36701 0 : int err = fd_account_costs_decode_footprint_inner( ctx, total_sz );
36702 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
36703 0 : ctx->data = start_data;
36704 0 : return err;
36705 0 : }
36706 0 : int fd_account_costs_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
36707 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
36708 0 : int err = 0;
36709 0 : ulong account_costs_len = 0UL;
36710 0 : err = fd_bincode_uint64_decode( &account_costs_len, ctx );
36711 0 : ulong account_costs_cnt = fd_ulong_max( account_costs_len, 4096 );
36712 0 : *total_sz += fd_account_costs_pair_t_map_align() + fd_account_costs_pair_t_map_footprint( account_costs_cnt );
36713 0 : if( FD_UNLIKELY( err ) ) return err;
36714 0 : for( ulong i=0; i < account_costs_len; i++ ) {
36715 0 : err = fd_account_costs_pair_decode_footprint_inner( ctx, total_sz );
36716 0 : if( FD_UNLIKELY( err ) ) return err;
36717 0 : }
36718 0 : return 0;
36719 0 : }
36720 0 : void * fd_account_costs_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
36721 0 : fd_account_costs_t * self = (fd_account_costs_t *)mem;
36722 0 : fd_account_costs_new( self );
36723 0 : void * alloc_region = (uchar *)mem + sizeof(fd_account_costs_t);
36724 0 : void * * alloc_mem = &alloc_region;
36725 0 : fd_account_costs_decode_inner( mem, alloc_mem, ctx );
36726 0 : return self;
36727 0 : }
36728 0 : void fd_account_costs_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
36729 0 : fd_account_costs_t * self = (fd_account_costs_t *)struct_mem;
36730 0 : ulong account_costs_len;
36731 0 : fd_bincode_uint64_decode_unsafe( &account_costs_len, ctx );
36732 0 : self->account_costs_pool = fd_account_costs_pair_t_map_join_new( alloc_mem, fd_ulong_max( account_costs_len, 4096 ) );
36733 0 : self->account_costs_root = NULL;
36734 0 : for( ulong i=0; i < account_costs_len; i++ ) {
36735 0 : fd_account_costs_pair_t_mapnode_t * node = fd_account_costs_pair_t_map_acquire( self->account_costs_pool );
36736 0 : fd_account_costs_pair_new( &node->elem );
36737 0 : fd_account_costs_pair_decode_inner( &node->elem, alloc_mem, ctx );
36738 0 : fd_account_costs_pair_t_map_insert( self->account_costs_pool, &self->account_costs_root, node );
36739 0 : }
36740 0 : }
36741 0 : void * fd_account_costs_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
36742 0 : fd_account_costs_global_t * self = (fd_account_costs_global_t *)mem;
36743 0 : fd_account_costs_new( (fd_account_costs_t *)self );
36744 0 : void * alloc_region = (uchar *)mem + sizeof(fd_account_costs_global_t);
36745 0 : void * * alloc_mem = &alloc_region;
36746 0 : fd_account_costs_decode_inner_global( mem, alloc_mem, ctx );
36747 0 : return self;
36748 0 : }
36749 0 : void fd_account_costs_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
36750 0 : fd_account_costs_global_t * self = (fd_account_costs_global_t *)struct_mem;
36751 0 : ulong account_costs_len;
36752 0 : fd_bincode_uint64_decode_unsafe( &account_costs_len, ctx );
36753 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, fd_account_costs_pair_t_map_align() );
36754 0 : fd_account_costs_pair_t_mapnode_t * account_costs_pool = fd_account_costs_pair_t_map_join_new( alloc_mem, fd_ulong_max( account_costs_len, 4096 ) );
36755 0 : fd_account_costs_pair_t_mapnode_t * account_costs_root = NULL;
36756 0 : self->account_costs_root_gaddr = 0UL;
36757 0 : for( ulong i=0; i < account_costs_len; i++ ) {
36758 0 : fd_account_costs_pair_t_mapnode_t * node = fd_account_costs_pair_t_map_acquire( account_costs_pool );
36759 0 : fd_account_costs_pair_new( &node->elem );
36760 0 : fd_account_costs_pair_decode_inner( &node->elem, alloc_mem, ctx );
36761 0 : fd_account_costs_pair_t_map_insert( account_costs_pool, &account_costs_root, node );
36762 0 : }
36763 0 : self->account_costs_pool_gaddr = fd_wksp_gaddr_fast( ctx->wksp, account_costs_pool );
36764 0 : self->account_costs_root_gaddr = fd_wksp_gaddr_fast( ctx->wksp, account_costs_root );
36765 0 : }
36766 0 : int fd_account_costs_convert_global_to_local( void const * global_self, fd_account_costs_t * self, fd_bincode_decode_ctx_t * ctx ) {
36767 0 : int err = 0;
36768 0 : fd_account_costs_global_t const * mem = (fd_account_costs_global_t const *)global_self;
36769 0 : self->account_costs_pool = fd_wksp_laddr_fast( ctx->wksp, mem->account_costs_pool_gaddr );
36770 0 : self->account_costs_root = fd_wksp_laddr_fast( ctx->wksp, mem->account_costs_root_gaddr );
36771 0 : return FD_BINCODE_SUCCESS;
36772 0 : }
36773 0 : void fd_account_costs_new(fd_account_costs_t * self) {
36774 0 : fd_memset( self, 0, sizeof(fd_account_costs_t) );
36775 0 : }
36776 0 : void fd_account_costs_destroy( fd_account_costs_t * self ) {
36777 0 : for( fd_account_costs_pair_t_mapnode_t * n = fd_account_costs_pair_t_map_minimum(self->account_costs_pool, self->account_costs_root ); n; n = fd_account_costs_pair_t_map_successor(self->account_costs_pool, n) ) {
36778 0 : fd_account_costs_pair_destroy( &n->elem );
36779 0 : }
36780 0 : self->account_costs_pool = NULL;
36781 0 : self->account_costs_root = NULL;
36782 0 : }
36783 :
36784 0 : ulong fd_account_costs_footprint( void ){ return FD_ACCOUNT_COSTS_FOOTPRINT; }
36785 0 : ulong fd_account_costs_align( void ){ return FD_ACCOUNT_COSTS_ALIGN; }
36786 :
36787 0 : void fd_account_costs_walk( void * w, fd_account_costs_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
36788 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_account_costs", level++ );
36789 0 : if( self->account_costs_root ) {
36790 0 : for( fd_account_costs_pair_t_mapnode_t * n = fd_account_costs_pair_t_map_minimum(self->account_costs_pool, self->account_costs_root ); n; n = fd_account_costs_pair_t_map_successor( self->account_costs_pool, n ) ) {
36791 0 : fd_account_costs_pair_walk(w, &n->elem, fun, "account_costs", level );
36792 0 : }
36793 0 : }
36794 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_account_costs", level-- );
36795 0 : }
36796 0 : ulong fd_account_costs_size( fd_account_costs_t const * self ) {
36797 0 : ulong size = 0;
36798 0 : if( self->account_costs_root ) {
36799 0 : size += sizeof(ulong);
36800 0 : for( fd_account_costs_pair_t_mapnode_t * n = fd_account_costs_pair_t_map_minimum( self->account_costs_pool, self->account_costs_root ); n; n = fd_account_costs_pair_t_map_successor( self->account_costs_pool, n ) ) {
36801 0 : size += fd_account_costs_pair_size( &n->elem );
36802 0 : }
36803 0 : } else {
36804 0 : size += sizeof(ulong);
36805 0 : }
36806 0 : return size;
36807 0 : }
36808 :
36809 0 : int fd_cost_tracker_encode( fd_cost_tracker_t const * self, fd_bincode_encode_ctx_t * ctx ) {
36810 0 : int err;
36811 0 : err = fd_bincode_uint64_encode( self->account_cost_limit, ctx );
36812 0 : if( FD_UNLIKELY( err ) ) return err;
36813 0 : err = fd_bincode_uint64_encode( self->block_cost_limit, ctx );
36814 0 : if( FD_UNLIKELY( err ) ) return err;
36815 0 : err = fd_bincode_uint64_encode( self->vote_cost_limit, ctx );
36816 0 : if( FD_UNLIKELY( err ) ) return err;
36817 0 : err = fd_account_costs_encode( &self->cost_by_writable_accounts, ctx );
36818 0 : if( FD_UNLIKELY( err ) ) return err;
36819 0 : err = fd_bincode_uint64_encode( self->block_cost, ctx );
36820 0 : if( FD_UNLIKELY( err ) ) return err;
36821 0 : err = fd_bincode_uint64_encode( self->vote_cost, ctx );
36822 0 : if( FD_UNLIKELY( err ) ) return err;
36823 0 : err = fd_bincode_uint64_encode( self->transaction_count, ctx );
36824 0 : if( FD_UNLIKELY( err ) ) return err;
36825 0 : err = fd_bincode_uint64_encode( self->allocated_accounts_data_size, ctx );
36826 0 : if( FD_UNLIKELY( err ) ) return err;
36827 0 : err = fd_bincode_uint64_encode( self->transaction_signature_count, ctx );
36828 0 : if( FD_UNLIKELY( err ) ) return err;
36829 0 : err = fd_bincode_uint64_encode( self->secp256k1_instruction_signature_count, ctx );
36830 0 : if( FD_UNLIKELY( err ) ) return err;
36831 0 : err = fd_bincode_uint64_encode( self->ed25519_instruction_signature_count, ctx );
36832 0 : if( FD_UNLIKELY( err ) ) return err;
36833 0 : err = fd_bincode_uint64_encode( self->secp256r1_instruction_signature_count, ctx );
36834 0 : if( FD_UNLIKELY( err ) ) return err;
36835 0 : return FD_BINCODE_SUCCESS;
36836 0 : }
36837 0 : int fd_cost_tracker_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
36838 0 : *total_sz += sizeof(fd_cost_tracker_t);
36839 0 : void const * start_data = ctx->data;
36840 0 : int err = fd_cost_tracker_decode_footprint_inner( ctx, total_sz );
36841 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
36842 0 : ctx->data = start_data;
36843 0 : return err;
36844 0 : }
36845 0 : int fd_cost_tracker_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
36846 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
36847 0 : int err = 0;
36848 0 : err = fd_bincode_uint64_decode_footprint( ctx );
36849 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
36850 0 : err = fd_bincode_uint64_decode_footprint( ctx );
36851 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
36852 0 : err = fd_bincode_uint64_decode_footprint( ctx );
36853 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
36854 0 : err = fd_account_costs_decode_footprint_inner( ctx, total_sz );
36855 0 : if( FD_UNLIKELY( err ) ) return err;
36856 0 : err = fd_bincode_uint64_decode_footprint( ctx );
36857 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
36858 0 : err = fd_bincode_uint64_decode_footprint( ctx );
36859 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
36860 0 : err = fd_bincode_uint64_decode_footprint( ctx );
36861 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
36862 0 : err = fd_bincode_uint64_decode_footprint( ctx );
36863 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
36864 0 : err = fd_bincode_uint64_decode_footprint( ctx );
36865 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
36866 0 : err = fd_bincode_uint64_decode_footprint( ctx );
36867 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
36868 0 : err = fd_bincode_uint64_decode_footprint( ctx );
36869 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
36870 0 : err = fd_bincode_uint64_decode_footprint( ctx );
36871 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
36872 0 : return 0;
36873 0 : }
36874 0 : void * fd_cost_tracker_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
36875 0 : fd_cost_tracker_t * self = (fd_cost_tracker_t *)mem;
36876 0 : fd_cost_tracker_new( self );
36877 0 : void * alloc_region = (uchar *)mem + sizeof(fd_cost_tracker_t);
36878 0 : void * * alloc_mem = &alloc_region;
36879 0 : fd_cost_tracker_decode_inner( mem, alloc_mem, ctx );
36880 0 : return self;
36881 0 : }
36882 0 : void fd_cost_tracker_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
36883 0 : fd_cost_tracker_t * self = (fd_cost_tracker_t *)struct_mem;
36884 0 : fd_bincode_uint64_decode_unsafe( &self->account_cost_limit, ctx );
36885 0 : fd_bincode_uint64_decode_unsafe( &self->block_cost_limit, ctx );
36886 0 : fd_bincode_uint64_decode_unsafe( &self->vote_cost_limit, ctx );
36887 0 : fd_account_costs_decode_inner( &self->cost_by_writable_accounts, alloc_mem, ctx );
36888 0 : fd_bincode_uint64_decode_unsafe( &self->block_cost, ctx );
36889 0 : fd_bincode_uint64_decode_unsafe( &self->vote_cost, ctx );
36890 0 : fd_bincode_uint64_decode_unsafe( &self->transaction_count, ctx );
36891 0 : fd_bincode_uint64_decode_unsafe( &self->allocated_accounts_data_size, ctx );
36892 0 : fd_bincode_uint64_decode_unsafe( &self->transaction_signature_count, ctx );
36893 0 : fd_bincode_uint64_decode_unsafe( &self->secp256k1_instruction_signature_count, ctx );
36894 0 : fd_bincode_uint64_decode_unsafe( &self->ed25519_instruction_signature_count, ctx );
36895 0 : fd_bincode_uint64_decode_unsafe( &self->secp256r1_instruction_signature_count, ctx );
36896 0 : }
36897 0 : void * fd_cost_tracker_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
36898 0 : fd_cost_tracker_global_t * self = (fd_cost_tracker_global_t *)mem;
36899 0 : fd_cost_tracker_new( (fd_cost_tracker_t *)self );
36900 0 : void * alloc_region = (uchar *)mem + sizeof(fd_cost_tracker_global_t);
36901 0 : void * * alloc_mem = &alloc_region;
36902 0 : fd_cost_tracker_decode_inner_global( mem, alloc_mem, ctx );
36903 0 : return self;
36904 0 : }
36905 0 : void fd_cost_tracker_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
36906 0 : fd_cost_tracker_global_t * self = (fd_cost_tracker_global_t *)struct_mem;
36907 0 : fd_bincode_uint64_decode_unsafe( &self->account_cost_limit, ctx );
36908 0 : fd_bincode_uint64_decode_unsafe( &self->block_cost_limit, ctx );
36909 0 : fd_bincode_uint64_decode_unsafe( &self->vote_cost_limit, ctx );
36910 0 : fd_account_costs_decode_inner_global( &self->cost_by_writable_accounts, alloc_mem, ctx );
36911 0 : fd_bincode_uint64_decode_unsafe( &self->block_cost, ctx );
36912 0 : fd_bincode_uint64_decode_unsafe( &self->vote_cost, ctx );
36913 0 : fd_bincode_uint64_decode_unsafe( &self->transaction_count, ctx );
36914 0 : fd_bincode_uint64_decode_unsafe( &self->allocated_accounts_data_size, ctx );
36915 0 : fd_bincode_uint64_decode_unsafe( &self->transaction_signature_count, ctx );
36916 0 : fd_bincode_uint64_decode_unsafe( &self->secp256k1_instruction_signature_count, ctx );
36917 0 : fd_bincode_uint64_decode_unsafe( &self->ed25519_instruction_signature_count, ctx );
36918 0 : fd_bincode_uint64_decode_unsafe( &self->secp256r1_instruction_signature_count, ctx );
36919 0 : }
36920 0 : int fd_cost_tracker_convert_global_to_local( void const * global_self, fd_cost_tracker_t * self, fd_bincode_decode_ctx_t * ctx ) {
36921 0 : int err = 0;
36922 0 : fd_cost_tracker_global_t const * mem = (fd_cost_tracker_global_t const *)global_self;
36923 0 : self->account_cost_limit = mem->account_cost_limit;
36924 0 : self->block_cost_limit = mem->block_cost_limit;
36925 0 : self->vote_cost_limit = mem->vote_cost_limit;
36926 0 : err = fd_account_costs_convert_global_to_local( &mem->cost_by_writable_accounts, &self->cost_by_writable_accounts, ctx );
36927 0 : if( FD_UNLIKELY( err ) ) return err;
36928 0 : self->block_cost = mem->block_cost;
36929 0 : self->vote_cost = mem->vote_cost;
36930 0 : self->transaction_count = mem->transaction_count;
36931 0 : self->allocated_accounts_data_size = mem->allocated_accounts_data_size;
36932 0 : self->transaction_signature_count = mem->transaction_signature_count;
36933 0 : self->secp256k1_instruction_signature_count = mem->secp256k1_instruction_signature_count;
36934 0 : self->ed25519_instruction_signature_count = mem->ed25519_instruction_signature_count;
36935 0 : self->secp256r1_instruction_signature_count = mem->secp256r1_instruction_signature_count;
36936 0 : return FD_BINCODE_SUCCESS;
36937 0 : }
36938 0 : void fd_cost_tracker_new(fd_cost_tracker_t * self) {
36939 0 : fd_memset( self, 0, sizeof(fd_cost_tracker_t) );
36940 0 : fd_account_costs_new( &self->cost_by_writable_accounts );
36941 0 : }
36942 0 : void fd_cost_tracker_destroy( fd_cost_tracker_t * self ) {
36943 0 : fd_account_costs_destroy( &self->cost_by_writable_accounts );
36944 0 : }
36945 :
36946 0 : ulong fd_cost_tracker_footprint( void ){ return FD_COST_TRACKER_FOOTPRINT; }
36947 0 : ulong fd_cost_tracker_align( void ){ return FD_COST_TRACKER_ALIGN; }
36948 :
36949 0 : void fd_cost_tracker_walk( void * w, fd_cost_tracker_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
36950 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_cost_tracker", level++ );
36951 0 : fun( w, &self->account_cost_limit, "account_cost_limit", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
36952 0 : fun( w, &self->block_cost_limit, "block_cost_limit", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
36953 0 : fun( w, &self->vote_cost_limit, "vote_cost_limit", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
36954 0 : fd_account_costs_walk( w, &self->cost_by_writable_accounts, fun, "cost_by_writable_accounts", level );
36955 0 : fun( w, &self->block_cost, "block_cost", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
36956 0 : fun( w, &self->vote_cost, "vote_cost", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
36957 0 : fun( w, &self->transaction_count, "transaction_count", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
36958 0 : fun( w, &self->allocated_accounts_data_size, "allocated_accounts_data_size", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
36959 0 : fun( w, &self->transaction_signature_count, "transaction_signature_count", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
36960 0 : fun( w, &self->secp256k1_instruction_signature_count, "secp256k1_instruction_signature_count", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
36961 0 : fun( w, &self->ed25519_instruction_signature_count, "ed25519_instruction_signature_count", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
36962 0 : fun( w, &self->secp256r1_instruction_signature_count, "secp256r1_instruction_signature_count", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
36963 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_cost_tracker", level-- );
36964 0 : }
36965 0 : ulong fd_cost_tracker_size( fd_cost_tracker_t const * self ) {
36966 0 : ulong size = 0;
36967 0 : size += sizeof(ulong);
36968 0 : size += sizeof(ulong);
36969 0 : size += sizeof(ulong);
36970 0 : size += fd_account_costs_size( &self->cost_by_writable_accounts );
36971 0 : size += sizeof(ulong);
36972 0 : size += sizeof(ulong);
36973 0 : size += sizeof(ulong);
36974 0 : size += sizeof(ulong);
36975 0 : size += sizeof(ulong);
36976 0 : size += sizeof(ulong);
36977 0 : size += sizeof(ulong);
36978 0 : size += sizeof(ulong);
36979 0 : return size;
36980 0 : }
36981 :
36982 0 : int fd_pubkey_node_encode( fd_pubkey_node_t const * self, fd_bincode_encode_ctx_t * ctx ) {
36983 0 : int err;
36984 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
36985 0 : if( FD_UNLIKELY( err ) ) return err;
36986 0 : return FD_BINCODE_SUCCESS;
36987 0 : }
36988 0 : int fd_pubkey_node_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
36989 0 : *total_sz += sizeof(fd_pubkey_node_t);
36990 0 : void const * start_data = ctx->data;
36991 0 : int err = fd_pubkey_node_decode_footprint_inner( ctx, total_sz );
36992 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
36993 0 : ctx->data = start_data;
36994 0 : return err;
36995 0 : }
36996 0 : int fd_pubkey_node_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
36997 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
36998 0 : int err = 0;
36999 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
37000 0 : if( FD_UNLIKELY( err ) ) return err;
37001 0 : return 0;
37002 0 : }
37003 0 : void * fd_pubkey_node_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
37004 0 : fd_pubkey_node_t * self = (fd_pubkey_node_t *)mem;
37005 0 : fd_pubkey_node_new( self );
37006 0 : void * alloc_region = (uchar *)mem + sizeof(fd_pubkey_node_t);
37007 0 : void * * alloc_mem = &alloc_region;
37008 0 : fd_pubkey_node_decode_inner( mem, alloc_mem, ctx );
37009 0 : return self;
37010 0 : }
37011 0 : void fd_pubkey_node_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
37012 0 : fd_pubkey_node_t * self = (fd_pubkey_node_t *)struct_mem;
37013 0 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
37014 0 : }
37015 0 : void * fd_pubkey_node_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
37016 0 : fd_pubkey_node_global_t * self = (fd_pubkey_node_global_t *)mem;
37017 0 : fd_pubkey_node_new( (fd_pubkey_node_t *)self );
37018 0 : void * alloc_region = (uchar *)mem + sizeof(fd_pubkey_node_global_t);
37019 0 : void * * alloc_mem = &alloc_region;
37020 0 : fd_pubkey_node_decode_inner_global( mem, alloc_mem, ctx );
37021 0 : return self;
37022 0 : }
37023 0 : void fd_pubkey_node_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
37024 0 : fd_pubkey_node_global_t * self = (fd_pubkey_node_global_t *)struct_mem;
37025 0 : fd_pubkey_decode_inner_global( &self->pubkey, alloc_mem, ctx );
37026 0 : }
37027 0 : int fd_pubkey_node_convert_global_to_local( void const * global_self, fd_pubkey_node_t * self, fd_bincode_decode_ctx_t * ctx ) {
37028 0 : int err = 0;
37029 0 : fd_pubkey_node_global_t const * mem = (fd_pubkey_node_global_t const *)global_self;
37030 0 : err = fd_pubkey_convert_global_to_local( &mem->pubkey, &self->pubkey, ctx );
37031 0 : if( FD_UNLIKELY( err ) ) return err;
37032 0 : return FD_BINCODE_SUCCESS;
37033 0 : }
37034 0 : void fd_pubkey_node_new(fd_pubkey_node_t * self) {
37035 0 : fd_memset( self, 0, sizeof(fd_pubkey_node_t) );
37036 0 : fd_pubkey_new( &self->pubkey );
37037 0 : }
37038 0 : void fd_pubkey_node_destroy( fd_pubkey_node_t * self ) {
37039 0 : fd_pubkey_destroy( &self->pubkey );
37040 0 : }
37041 :
37042 0 : ulong fd_pubkey_node_footprint( void ){ return FD_PUBKEY_NODE_FOOTPRINT; }
37043 0 : ulong fd_pubkey_node_align( void ){ return FD_PUBKEY_NODE_ALIGN; }
37044 :
37045 0 : void fd_pubkey_node_walk( void * w, fd_pubkey_node_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
37046 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_pubkey_node", level++ );
37047 0 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level );
37048 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_pubkey_node", level-- );
37049 0 : }
37050 0 : ulong fd_pubkey_node_size( fd_pubkey_node_t const * self ) {
37051 0 : ulong size = 0;
37052 0 : size += fd_pubkey_size( &self->pubkey );
37053 0 : return size;
37054 0 : }
37055 :
37056 0 : int fd_rent_fresh_accounts_partition_encode( fd_rent_fresh_accounts_partition_t const * self, fd_bincode_encode_ctx_t * ctx ) {
37057 0 : int err;
37058 0 : err = fd_bincode_uint64_encode( self->partition, ctx );
37059 0 : if( FD_UNLIKELY( err ) ) return err;
37060 0 : if( self->accounts_root ) {
37061 0 : ulong accounts_len = fd_pubkey_node_t_map_size( self->accounts_pool, self->accounts_root );
37062 0 : err = fd_bincode_uint64_encode( accounts_len, ctx );
37063 0 : if( FD_UNLIKELY( err ) ) return err;
37064 0 : for( fd_pubkey_node_t_mapnode_t * n = fd_pubkey_node_t_map_minimum( self->accounts_pool, self->accounts_root ); n; n = fd_pubkey_node_t_map_successor( self->accounts_pool, n ) ) {
37065 0 : err = fd_pubkey_node_encode( &n->elem, ctx );
37066 0 : if( FD_UNLIKELY( err ) ) return err;
37067 0 : }
37068 0 : } else {
37069 0 : ulong accounts_len = 0;
37070 0 : err = fd_bincode_uint64_encode( accounts_len, ctx );
37071 0 : if( FD_UNLIKELY( err ) ) return err;
37072 0 : }
37073 0 : return FD_BINCODE_SUCCESS;
37074 0 : }
37075 0 : int fd_rent_fresh_accounts_partition_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
37076 0 : *total_sz += sizeof(fd_rent_fresh_accounts_partition_t);
37077 0 : void const * start_data = ctx->data;
37078 0 : int err = fd_rent_fresh_accounts_partition_decode_footprint_inner( ctx, total_sz );
37079 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
37080 0 : ctx->data = start_data;
37081 0 : return err;
37082 0 : }
37083 0 : int fd_rent_fresh_accounts_partition_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
37084 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
37085 0 : int err = 0;
37086 0 : err = fd_bincode_uint64_decode_footprint( ctx );
37087 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
37088 0 : ulong accounts_len = 0UL;
37089 0 : err = fd_bincode_uint64_decode( &accounts_len, ctx );
37090 0 : ulong accounts_cnt = fd_ulong_max( accounts_len, 100 );
37091 0 : *total_sz += fd_pubkey_node_t_map_align() + fd_pubkey_node_t_map_footprint( accounts_cnt );
37092 0 : if( FD_UNLIKELY( err ) ) return err;
37093 0 : for( ulong i=0; i < accounts_len; i++ ) {
37094 0 : err = fd_pubkey_node_decode_footprint_inner( ctx, total_sz );
37095 0 : if( FD_UNLIKELY( err ) ) return err;
37096 0 : }
37097 0 : return 0;
37098 0 : }
37099 0 : void * fd_rent_fresh_accounts_partition_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
37100 0 : fd_rent_fresh_accounts_partition_t * self = (fd_rent_fresh_accounts_partition_t *)mem;
37101 0 : fd_rent_fresh_accounts_partition_new( self );
37102 0 : void * alloc_region = (uchar *)mem + sizeof(fd_rent_fresh_accounts_partition_t);
37103 0 : void * * alloc_mem = &alloc_region;
37104 0 : fd_rent_fresh_accounts_partition_decode_inner( mem, alloc_mem, ctx );
37105 0 : return self;
37106 0 : }
37107 0 : void fd_rent_fresh_accounts_partition_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
37108 0 : fd_rent_fresh_accounts_partition_t * self = (fd_rent_fresh_accounts_partition_t *)struct_mem;
37109 0 : fd_bincode_uint64_decode_unsafe( &self->partition, ctx );
37110 0 : ulong accounts_len;
37111 0 : fd_bincode_uint64_decode_unsafe( &accounts_len, ctx );
37112 0 : self->accounts_pool = fd_pubkey_node_t_map_join_new( alloc_mem, fd_ulong_max( accounts_len, 100 ) );
37113 0 : self->accounts_root = NULL;
37114 0 : for( ulong i=0; i < accounts_len; i++ ) {
37115 0 : fd_pubkey_node_t_mapnode_t * node = fd_pubkey_node_t_map_acquire( self->accounts_pool );
37116 0 : fd_pubkey_node_new( &node->elem );
37117 0 : fd_pubkey_node_decode_inner( &node->elem, alloc_mem, ctx );
37118 0 : fd_pubkey_node_t_map_insert( self->accounts_pool, &self->accounts_root, node );
37119 0 : }
37120 0 : }
37121 0 : void * fd_rent_fresh_accounts_partition_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
37122 0 : fd_rent_fresh_accounts_partition_global_t * self = (fd_rent_fresh_accounts_partition_global_t *)mem;
37123 0 : fd_rent_fresh_accounts_partition_new( (fd_rent_fresh_accounts_partition_t *)self );
37124 0 : void * alloc_region = (uchar *)mem + sizeof(fd_rent_fresh_accounts_partition_global_t);
37125 0 : void * * alloc_mem = &alloc_region;
37126 0 : fd_rent_fresh_accounts_partition_decode_inner_global( mem, alloc_mem, ctx );
37127 0 : return self;
37128 0 : }
37129 0 : void fd_rent_fresh_accounts_partition_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
37130 0 : fd_rent_fresh_accounts_partition_global_t * self = (fd_rent_fresh_accounts_partition_global_t *)struct_mem;
37131 0 : fd_bincode_uint64_decode_unsafe( &self->partition, ctx );
37132 0 : ulong accounts_len;
37133 0 : fd_bincode_uint64_decode_unsafe( &accounts_len, ctx );
37134 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, fd_pubkey_node_t_map_align() );
37135 0 : fd_pubkey_node_t_mapnode_t * accounts_pool = fd_pubkey_node_t_map_join_new( alloc_mem, fd_ulong_max( accounts_len, 100 ) );
37136 0 : fd_pubkey_node_t_mapnode_t * accounts_root = NULL;
37137 0 : self->accounts_root_gaddr = 0UL;
37138 0 : for( ulong i=0; i < accounts_len; i++ ) {
37139 0 : fd_pubkey_node_t_mapnode_t * node = fd_pubkey_node_t_map_acquire( accounts_pool );
37140 0 : fd_pubkey_node_new( &node->elem );
37141 0 : fd_pubkey_node_decode_inner( &node->elem, alloc_mem, ctx );
37142 0 : fd_pubkey_node_t_map_insert( accounts_pool, &accounts_root, node );
37143 0 : }
37144 0 : self->accounts_pool_gaddr = fd_wksp_gaddr_fast( ctx->wksp, accounts_pool );
37145 0 : self->accounts_root_gaddr = fd_wksp_gaddr_fast( ctx->wksp, accounts_root );
37146 0 : }
37147 0 : int fd_rent_fresh_accounts_partition_convert_global_to_local( void const * global_self, fd_rent_fresh_accounts_partition_t * self, fd_bincode_decode_ctx_t * ctx ) {
37148 0 : int err = 0;
37149 0 : fd_rent_fresh_accounts_partition_global_t const * mem = (fd_rent_fresh_accounts_partition_global_t const *)global_self;
37150 0 : self->partition = mem->partition;
37151 0 : self->accounts_pool = fd_wksp_laddr_fast( ctx->wksp, mem->accounts_pool_gaddr );
37152 0 : self->accounts_root = fd_wksp_laddr_fast( ctx->wksp, mem->accounts_root_gaddr );
37153 0 : return FD_BINCODE_SUCCESS;
37154 0 : }
37155 0 : void fd_rent_fresh_accounts_partition_new(fd_rent_fresh_accounts_partition_t * self) {
37156 0 : fd_memset( self, 0, sizeof(fd_rent_fresh_accounts_partition_t) );
37157 0 : }
37158 0 : void fd_rent_fresh_accounts_partition_destroy( fd_rent_fresh_accounts_partition_t * self ) {
37159 0 : for( fd_pubkey_node_t_mapnode_t * n = fd_pubkey_node_t_map_minimum(self->accounts_pool, self->accounts_root ); n; n = fd_pubkey_node_t_map_successor(self->accounts_pool, n) ) {
37160 0 : fd_pubkey_node_destroy( &n->elem );
37161 0 : }
37162 0 : self->accounts_pool = NULL;
37163 0 : self->accounts_root = NULL;
37164 0 : }
37165 :
37166 0 : ulong fd_rent_fresh_accounts_partition_footprint( void ){ return FD_RENT_FRESH_ACCOUNTS_PARTITION_FOOTPRINT; }
37167 0 : ulong fd_rent_fresh_accounts_partition_align( void ){ return FD_RENT_FRESH_ACCOUNTS_PARTITION_ALIGN; }
37168 :
37169 0 : void fd_rent_fresh_accounts_partition_walk( void * w, fd_rent_fresh_accounts_partition_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
37170 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_rent_fresh_accounts_partition", level++ );
37171 0 : fun( w, &self->partition, "partition", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
37172 0 : if( self->accounts_root ) {
37173 0 : for( fd_pubkey_node_t_mapnode_t * n = fd_pubkey_node_t_map_minimum(self->accounts_pool, self->accounts_root ); n; n = fd_pubkey_node_t_map_successor( self->accounts_pool, n ) ) {
37174 0 : fd_pubkey_node_walk(w, &n->elem, fun, "accounts", level );
37175 0 : }
37176 0 : }
37177 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_rent_fresh_accounts_partition", level-- );
37178 0 : }
37179 0 : ulong fd_rent_fresh_accounts_partition_size( fd_rent_fresh_accounts_partition_t const * self ) {
37180 0 : ulong size = 0;
37181 0 : size += sizeof(ulong);
37182 0 : if( self->accounts_root ) {
37183 0 : size += sizeof(ulong);
37184 0 : for( fd_pubkey_node_t_mapnode_t * n = fd_pubkey_node_t_map_minimum( self->accounts_pool, self->accounts_root ); n; n = fd_pubkey_node_t_map_successor( self->accounts_pool, n ) ) {
37185 0 : size += fd_pubkey_node_size( &n->elem );
37186 0 : }
37187 0 : } else {
37188 0 : size += sizeof(ulong);
37189 0 : }
37190 0 : return size;
37191 0 : }
37192 :
37193 0 : int fd_rent_fresh_accounts_encode( fd_rent_fresh_accounts_t const * self, fd_bincode_encode_ctx_t * ctx ) {
37194 0 : int err;
37195 0 : err = fd_bincode_uint64_encode( self->total_count, ctx );
37196 0 : if( FD_UNLIKELY( err ) ) return err;
37197 0 : if( self->partitions_root ) {
37198 0 : ulong partitions_len = fd_rent_fresh_accounts_partition_t_map_size( self->partitions_pool, self->partitions_root );
37199 0 : err = fd_bincode_uint64_encode( partitions_len, ctx );
37200 0 : if( FD_UNLIKELY( err ) ) return err;
37201 0 : for( fd_rent_fresh_accounts_partition_t_mapnode_t * n = fd_rent_fresh_accounts_partition_t_map_minimum( self->partitions_pool, self->partitions_root ); n; n = fd_rent_fresh_accounts_partition_t_map_successor( self->partitions_pool, n ) ) {
37202 0 : err = fd_rent_fresh_accounts_partition_encode( &n->elem, ctx );
37203 0 : if( FD_UNLIKELY( err ) ) return err;
37204 0 : }
37205 0 : } else {
37206 0 : ulong partitions_len = 0;
37207 0 : err = fd_bincode_uint64_encode( partitions_len, ctx );
37208 0 : if( FD_UNLIKELY( err ) ) return err;
37209 0 : }
37210 0 : return FD_BINCODE_SUCCESS;
37211 0 : }
37212 0 : int fd_rent_fresh_accounts_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
37213 0 : *total_sz += sizeof(fd_rent_fresh_accounts_t);
37214 0 : void const * start_data = ctx->data;
37215 0 : int err = fd_rent_fresh_accounts_decode_footprint_inner( ctx, total_sz );
37216 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
37217 0 : ctx->data = start_data;
37218 0 : return err;
37219 0 : }
37220 0 : int fd_rent_fresh_accounts_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
37221 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
37222 0 : int err = 0;
37223 0 : err = fd_bincode_uint64_decode_footprint( ctx );
37224 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
37225 0 : ulong partitions_len = 0UL;
37226 0 : err = fd_bincode_uint64_decode( &partitions_len, ctx );
37227 0 : ulong partitions_cnt = fd_ulong_max( partitions_len, 400 );
37228 0 : *total_sz += fd_rent_fresh_accounts_partition_t_map_align() + fd_rent_fresh_accounts_partition_t_map_footprint( partitions_cnt );
37229 0 : if( FD_UNLIKELY( err ) ) return err;
37230 0 : for( ulong i=0; i < partitions_len; i++ ) {
37231 0 : err = fd_rent_fresh_accounts_partition_decode_footprint_inner( ctx, total_sz );
37232 0 : if( FD_UNLIKELY( err ) ) return err;
37233 0 : }
37234 0 : return 0;
37235 0 : }
37236 0 : void * fd_rent_fresh_accounts_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
37237 0 : fd_rent_fresh_accounts_t * self = (fd_rent_fresh_accounts_t *)mem;
37238 0 : fd_rent_fresh_accounts_new( self );
37239 0 : void * alloc_region = (uchar *)mem + sizeof(fd_rent_fresh_accounts_t);
37240 0 : void * * alloc_mem = &alloc_region;
37241 0 : fd_rent_fresh_accounts_decode_inner( mem, alloc_mem, ctx );
37242 0 : return self;
37243 0 : }
37244 0 : void fd_rent_fresh_accounts_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
37245 0 : fd_rent_fresh_accounts_t * self = (fd_rent_fresh_accounts_t *)struct_mem;
37246 0 : fd_bincode_uint64_decode_unsafe( &self->total_count, ctx );
37247 0 : ulong partitions_len;
37248 0 : fd_bincode_uint64_decode_unsafe( &partitions_len, ctx );
37249 0 : self->partitions_pool = fd_rent_fresh_accounts_partition_t_map_join_new( alloc_mem, fd_ulong_max( partitions_len, 400 ) );
37250 0 : self->partitions_root = NULL;
37251 0 : for( ulong i=0; i < partitions_len; i++ ) {
37252 0 : fd_rent_fresh_accounts_partition_t_mapnode_t * node = fd_rent_fresh_accounts_partition_t_map_acquire( self->partitions_pool );
37253 0 : fd_rent_fresh_accounts_partition_new( &node->elem );
37254 0 : fd_rent_fresh_accounts_partition_decode_inner( &node->elem, alloc_mem, ctx );
37255 0 : fd_rent_fresh_accounts_partition_t_map_insert( self->partitions_pool, &self->partitions_root, node );
37256 0 : }
37257 0 : }
37258 0 : void * fd_rent_fresh_accounts_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
37259 0 : fd_rent_fresh_accounts_global_t * self = (fd_rent_fresh_accounts_global_t *)mem;
37260 0 : fd_rent_fresh_accounts_new( (fd_rent_fresh_accounts_t *)self );
37261 0 : void * alloc_region = (uchar *)mem + sizeof(fd_rent_fresh_accounts_global_t);
37262 0 : void * * alloc_mem = &alloc_region;
37263 0 : fd_rent_fresh_accounts_decode_inner_global( mem, alloc_mem, ctx );
37264 0 : return self;
37265 0 : }
37266 0 : void fd_rent_fresh_accounts_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
37267 0 : fd_rent_fresh_accounts_global_t * self = (fd_rent_fresh_accounts_global_t *)struct_mem;
37268 0 : fd_bincode_uint64_decode_unsafe( &self->total_count, ctx );
37269 0 : ulong partitions_len;
37270 0 : fd_bincode_uint64_decode_unsafe( &partitions_len, ctx );
37271 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, fd_rent_fresh_accounts_partition_t_map_align() );
37272 0 : fd_rent_fresh_accounts_partition_t_mapnode_t * partitions_pool = fd_rent_fresh_accounts_partition_t_map_join_new( alloc_mem, fd_ulong_max( partitions_len, 400 ) );
37273 0 : fd_rent_fresh_accounts_partition_t_mapnode_t * partitions_root = NULL;
37274 0 : self->partitions_root_gaddr = 0UL;
37275 0 : for( ulong i=0; i < partitions_len; i++ ) {
37276 0 : fd_rent_fresh_accounts_partition_t_mapnode_t * node = fd_rent_fresh_accounts_partition_t_map_acquire( partitions_pool );
37277 0 : fd_rent_fresh_accounts_partition_new( &node->elem );
37278 0 : fd_rent_fresh_accounts_partition_decode_inner( &node->elem, alloc_mem, ctx );
37279 0 : fd_rent_fresh_accounts_partition_t_map_insert( partitions_pool, &partitions_root, node );
37280 0 : }
37281 0 : self->partitions_pool_gaddr = fd_wksp_gaddr_fast( ctx->wksp, partitions_pool );
37282 0 : self->partitions_root_gaddr = fd_wksp_gaddr_fast( ctx->wksp, partitions_root );
37283 0 : }
37284 0 : int fd_rent_fresh_accounts_convert_global_to_local( void const * global_self, fd_rent_fresh_accounts_t * self, fd_bincode_decode_ctx_t * ctx ) {
37285 0 : int err = 0;
37286 0 : fd_rent_fresh_accounts_global_t const * mem = (fd_rent_fresh_accounts_global_t const *)global_self;
37287 0 : self->total_count = mem->total_count;
37288 0 : self->partitions_pool = fd_wksp_laddr_fast( ctx->wksp, mem->partitions_pool_gaddr );
37289 0 : self->partitions_root = fd_wksp_laddr_fast( ctx->wksp, mem->partitions_root_gaddr );
37290 0 : return FD_BINCODE_SUCCESS;
37291 0 : }
37292 0 : void fd_rent_fresh_accounts_new(fd_rent_fresh_accounts_t * self) {
37293 0 : fd_memset( self, 0, sizeof(fd_rent_fresh_accounts_t) );
37294 0 : }
37295 0 : void fd_rent_fresh_accounts_destroy( fd_rent_fresh_accounts_t * self ) {
37296 0 : for( fd_rent_fresh_accounts_partition_t_mapnode_t * n = fd_rent_fresh_accounts_partition_t_map_minimum(self->partitions_pool, self->partitions_root ); n; n = fd_rent_fresh_accounts_partition_t_map_successor(self->partitions_pool, n) ) {
37297 0 : fd_rent_fresh_accounts_partition_destroy( &n->elem );
37298 0 : }
37299 0 : self->partitions_pool = NULL;
37300 0 : self->partitions_root = NULL;
37301 0 : }
37302 :
37303 0 : ulong fd_rent_fresh_accounts_footprint( void ){ return FD_RENT_FRESH_ACCOUNTS_FOOTPRINT; }
37304 0 : ulong fd_rent_fresh_accounts_align( void ){ return FD_RENT_FRESH_ACCOUNTS_ALIGN; }
37305 :
37306 0 : void fd_rent_fresh_accounts_walk( void * w, fd_rent_fresh_accounts_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
37307 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_rent_fresh_accounts", level++ );
37308 0 : fun( w, &self->total_count, "total_count", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
37309 0 : if( self->partitions_root ) {
37310 0 : for( fd_rent_fresh_accounts_partition_t_mapnode_t * n = fd_rent_fresh_accounts_partition_t_map_minimum(self->partitions_pool, self->partitions_root ); n; n = fd_rent_fresh_accounts_partition_t_map_successor( self->partitions_pool, n ) ) {
37311 0 : fd_rent_fresh_accounts_partition_walk(w, &n->elem, fun, "partitions", level );
37312 0 : }
37313 0 : }
37314 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_rent_fresh_accounts", level-- );
37315 0 : }
37316 0 : ulong fd_rent_fresh_accounts_size( fd_rent_fresh_accounts_t const * self ) {
37317 0 : ulong size = 0;
37318 0 : size += sizeof(ulong);
37319 0 : if( self->partitions_root ) {
37320 0 : size += sizeof(ulong);
37321 0 : for( fd_rent_fresh_accounts_partition_t_mapnode_t * n = fd_rent_fresh_accounts_partition_t_map_minimum( self->partitions_pool, self->partitions_root ); n; n = fd_rent_fresh_accounts_partition_t_map_successor( self->partitions_pool, n ) ) {
37322 0 : size += fd_rent_fresh_accounts_partition_size( &n->elem );
37323 0 : }
37324 0 : } else {
37325 0 : size += sizeof(ulong);
37326 0 : }
37327 0 : return size;
37328 0 : }
37329 :
37330 28935 : #define REDBLK_T fd_hash_hash_age_pair_t_mapnode_t
37331 : #define REDBLK_NAME fd_hash_hash_age_pair_t_map
37332 : #define REDBLK_IMPL_STYLE 2
37333 : #include "../../util/tmpl/fd_redblack.c"
37334 32877 : long fd_hash_hash_age_pair_t_map_compare( fd_hash_hash_age_pair_t_mapnode_t * left, fd_hash_hash_age_pair_t_mapnode_t * right ) {
37335 32877 : return memcmp( left->elem.key.uc, right->elem.key.uc, sizeof(right->elem.key) );
37336 32877 : }
37337 526242 : #define REDBLK_T fd_vote_accounts_pair_t_mapnode_t
37338 : #define REDBLK_NAME fd_vote_accounts_pair_t_map
37339 : #define REDBLK_IMPL_STYLE 2
37340 : #include "../../util/tmpl/fd_redblack.c"
37341 974529 : long fd_vote_accounts_pair_t_map_compare( fd_vote_accounts_pair_t_mapnode_t * left, fd_vote_accounts_pair_t_mapnode_t * right ) {
37342 974529 : return memcmp( left->elem.key.uc, right->elem.key.uc, sizeof(right->elem.key) );
37343 974529 : }
37344 90 : #define REDBLK_T fd_account_keys_pair_t_mapnode_t
37345 : #define REDBLK_NAME fd_account_keys_pair_t_map
37346 : #define REDBLK_IMPL_STYLE 2
37347 : #include "../../util/tmpl/fd_redblack.c"
37348 0 : long fd_account_keys_pair_t_map_compare( fd_account_keys_pair_t_mapnode_t * left, fd_account_keys_pair_t_mapnode_t * right ) {
37349 0 : return memcmp( left->elem.key.uc, right->elem.key.uc, sizeof(right->elem.key) );
37350 0 : }
37351 0 : #define REDBLK_T fd_stake_weight_t_mapnode_t
37352 : #define REDBLK_NAME fd_stake_weight_t_map
37353 : #define REDBLK_IMPL_STYLE 2
37354 : #include "../../util/tmpl/fd_redblack.c"
37355 0 : long fd_stake_weight_t_map_compare( fd_stake_weight_t_mapnode_t * left, fd_stake_weight_t_mapnode_t * right ) {
37356 0 : return memcmp( left->elem.key.uc, right->elem.key.uc, sizeof(right->elem.key) );
37357 0 : }
37358 30 : #define REDBLK_T fd_delegation_pair_t_mapnode_t
37359 : #define REDBLK_NAME fd_delegation_pair_t_map
37360 : #define REDBLK_IMPL_STYLE 2
37361 : #include "../../util/tmpl/fd_redblack.c"
37362 0 : long fd_delegation_pair_t_map_compare( fd_delegation_pair_t_mapnode_t * left, fd_delegation_pair_t_mapnode_t * right ) {
37363 0 : return memcmp( left->elem.account.uc, right->elem.account.uc, sizeof(right->elem.account) );
37364 0 : }
37365 0 : #define REDBLK_T fd_stake_pair_t_mapnode_t
37366 : #define REDBLK_NAME fd_stake_pair_t_map
37367 : #define REDBLK_IMPL_STYLE 2
37368 : #include "../../util/tmpl/fd_redblack.c"
37369 0 : long fd_stake_pair_t_map_compare( fd_stake_pair_t_mapnode_t * left, fd_stake_pair_t_mapnode_t * right ) {
37370 0 : return memcmp( left->elem.account.uc, right->elem.account.uc, sizeof(right->elem.account) );
37371 0 : }
37372 435258 : #define REDBLK_T fd_clock_timestamp_vote_t_mapnode_t
37373 : #define REDBLK_NAME fd_clock_timestamp_vote_t_map
37374 : #define REDBLK_IMPL_STYLE 2
37375 : #include "../../util/tmpl/fd_redblack.c"
37376 784296 : long fd_clock_timestamp_vote_t_map_compare( fd_clock_timestamp_vote_t_mapnode_t * left, fd_clock_timestamp_vote_t_mapnode_t * right ) {
37377 784296 : return memcmp( left->elem.pubkey.uc, right->elem.pubkey.uc, sizeof(right->elem.pubkey) );
37378 784296 : }
37379 0 : #define REDBLK_T fd_vote_info_pair_t_mapnode_t
37380 : #define REDBLK_NAME fd_vote_info_pair_t_map
37381 : #define REDBLK_IMPL_STYLE 2
37382 : #include "../../util/tmpl/fd_redblack.c"
37383 0 : long fd_vote_info_pair_t_map_compare( fd_vote_info_pair_t_mapnode_t * left, fd_vote_info_pair_t_mapnode_t * right ) {
37384 0 : return memcmp( left->elem.account.uc, right->elem.account.uc, sizeof(right->elem.account) );
37385 0 : }
37386 0 : #define REDBLK_T fd_account_costs_pair_t_mapnode_t
37387 : #define REDBLK_NAME fd_account_costs_pair_t_map
37388 : #define REDBLK_IMPL_STYLE 2
37389 : #include "../../util/tmpl/fd_redblack.c"
37390 0 : long fd_account_costs_pair_t_map_compare( fd_account_costs_pair_t_mapnode_t * left, fd_account_costs_pair_t_mapnode_t * right ) {
37391 0 : return memcmp( left->elem.key.uc, right->elem.key.uc, sizeof(right->elem.key) );
37392 0 : }
37393 0 : #define REDBLK_T fd_pubkey_node_t_mapnode_t
37394 : #define REDBLK_NAME fd_pubkey_node_t_map
37395 : #define REDBLK_IMPL_STYLE 2
37396 : #include "../../util/tmpl/fd_redblack.c"
37397 0 : long fd_pubkey_node_t_map_compare( fd_pubkey_node_t_mapnode_t * left, fd_pubkey_node_t_mapnode_t * right ) {
37398 0 : return memcmp( left->elem.pubkey.uc, right->elem.pubkey.uc, sizeof(right->elem.pubkey) );
37399 0 : }
37400 0 : #define REDBLK_T fd_rent_fresh_accounts_partition_t_mapnode_t
37401 : #define REDBLK_NAME fd_rent_fresh_accounts_partition_t_map
37402 : #define REDBLK_IMPL_STYLE 2
37403 : #include "../../util/tmpl/fd_redblack.c"
37404 0 : long fd_rent_fresh_accounts_partition_t_map_compare( fd_rent_fresh_accounts_partition_t_mapnode_t * left, fd_rent_fresh_accounts_partition_t_mapnode_t * right ) {
37405 0 : return (long)( left->elem.partition - right->elem.partition );
37406 0 : }
|