Line data Source code
1 : // This is an auto-generated file. To add entries, edit fd_types.json
2 : #include "fd_types.h"
3 : #pragma GCC diagnostic ignored "-Wunused-parameter"
4 : #pragma GCC diagnostic ignored "-Wunused-variable"
5 : #pragma GCC diagnostic ignored "-Wunused-function"
6 : #if defined(__GNUC__) && (__GNUC__ >= 9)
7 : #pragma GCC diagnostic ignored "-Waddress-of-packed-member"
8 : #endif
9 : #define SOURCE_fd_src_flamenco_types_fd_types_c
10 : #include "fd_types_custom.h"
11 966 : int fd_hash_encode( fd_hash_t const * self, fd_bincode_encode_ctx_t * ctx ) {
12 966 : return fd_bincode_bytes_encode( (uchar const *)self, sizeof(fd_hash_t), ctx );
13 966 : }
14 384 : void fd_hash_walk( void * w, fd_hash_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
15 384 : fun( w, (uchar const *)self, name, FD_FLAMENCO_TYPE_HASH256, name, level, varint );
16 384 : }
17 75 : static int fd_hash_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
18 75 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
19 75 : return fd_bincode_bytes_decode_footprint( sizeof(fd_hash_t), ctx );
20 75 : }
21 0 : int fd_hash_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
22 0 : *total_sz += sizeof(fd_hash_t);
23 0 : void const * start_data = ctx->data;
24 0 : int err = fd_hash_decode_footprint_inner( ctx, total_sz );
25 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
26 0 : ctx->data = start_data;
27 0 : return err;
28 0 : }
29 594 : static void fd_hash_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
30 594 : fd_bincode_bytes_decode_unsafe( struct_mem, sizeof(fd_hash_t), ctx );
31 594 : return;
32 594 : }
33 0 : void * fd_hash_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
34 0 : fd_bincode_bytes_decode_unsafe( mem, sizeof(fd_hash_t), ctx );
35 0 : return mem;
36 0 : }
37 :
38 0 : int fd_signature_encode( fd_signature_t const * self, fd_bincode_encode_ctx_t * ctx ) {
39 0 : return fd_bincode_bytes_encode( (uchar const *)self, sizeof(fd_signature_t), ctx );
40 0 : }
41 39 : void fd_signature_walk( void * w, fd_signature_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
42 39 : fun( w, (uchar const *)self, name, FD_FLAMENCO_TYPE_SIG512, name, level, varint );
43 39 : }
44 30 : static int fd_signature_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
45 30 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
46 30 : return fd_bincode_bytes_decode_footprint( sizeof(fd_signature_t), ctx );
47 30 : }
48 0 : int fd_signature_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
49 0 : *total_sz += sizeof(fd_signature_t);
50 0 : void const * start_data = ctx->data;
51 0 : int err = fd_signature_decode_footprint_inner( ctx, total_sz );
52 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
53 0 : ctx->data = start_data;
54 0 : return err;
55 0 : }
56 39 : static void fd_signature_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
57 39 : fd_bincode_bytes_decode_unsafe( struct_mem, sizeof(fd_signature_t), ctx );
58 39 : return;
59 39 : }
60 0 : void * fd_signature_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
61 0 : fd_bincode_bytes_decode_unsafe( mem, sizeof(fd_signature_t), ctx );
62 0 : return mem;
63 0 : }
64 :
65 0 : int fd_gossip_ip4_addr_encode( fd_gossip_ip4_addr_t const * self, fd_bincode_encode_ctx_t * ctx ) {
66 0 : return fd_bincode_bytes_encode( (uchar const *)self, sizeof(fd_gossip_ip4_addr_t), ctx );
67 0 : }
68 93 : static int fd_gossip_ip4_addr_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
69 93 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
70 93 : return fd_bincode_bytes_decode_footprint( sizeof(fd_gossip_ip4_addr_t), ctx );
71 93 : }
72 0 : int fd_gossip_ip4_addr_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
73 0 : *total_sz += sizeof(fd_gossip_ip4_addr_t);
74 0 : void const * start_data = ctx->data;
75 0 : int err = fd_gossip_ip4_addr_decode_footprint_inner( ctx, total_sz );
76 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
77 0 : ctx->data = start_data;
78 0 : return err;
79 0 : }
80 93 : static void fd_gossip_ip4_addr_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
81 93 : fd_bincode_bytes_decode_unsafe( struct_mem, sizeof(fd_gossip_ip4_addr_t), ctx );
82 93 : return;
83 93 : }
84 0 : void * fd_gossip_ip4_addr_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
85 0 : fd_bincode_bytes_decode_unsafe( mem, sizeof(fd_gossip_ip4_addr_t), ctx );
86 0 : return mem;
87 0 : }
88 :
89 0 : int fd_gossip_ip6_addr_encode( fd_gossip_ip6_addr_t const * self, fd_bincode_encode_ctx_t * ctx ) {
90 0 : return fd_bincode_bytes_encode( (uchar const *)self, sizeof(fd_gossip_ip6_addr_t), ctx );
91 0 : }
92 0 : static int fd_gossip_ip6_addr_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
93 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
94 0 : return fd_bincode_bytes_decode_footprint( sizeof(fd_gossip_ip6_addr_t), ctx );
95 0 : }
96 0 : int fd_gossip_ip6_addr_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
97 0 : *total_sz += sizeof(fd_gossip_ip6_addr_t);
98 0 : void const * start_data = ctx->data;
99 0 : int err = fd_gossip_ip6_addr_decode_footprint_inner( ctx, total_sz );
100 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
101 0 : ctx->data = start_data;
102 0 : return err;
103 0 : }
104 0 : static void fd_gossip_ip6_addr_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
105 0 : fd_bincode_bytes_decode_unsafe( struct_mem, sizeof(fd_gossip_ip6_addr_t), ctx );
106 0 : return;
107 0 : }
108 0 : void * fd_gossip_ip6_addr_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
109 0 : fd_bincode_bytes_decode_unsafe( mem, sizeof(fd_gossip_ip6_addr_t), ctx );
110 0 : return mem;
111 0 : }
112 :
113 0 : int fd_feature_encode( fd_feature_t const * self, fd_bincode_encode_ctx_t * ctx ) {
114 0 : int err;
115 0 : err = fd_bincode_bool_encode( self->has_activated_at, ctx );
116 0 : if( FD_UNLIKELY( err ) ) return err;
117 0 : if( self->has_activated_at ) {
118 0 : err = fd_bincode_uint64_encode( self->activated_at, ctx );
119 0 : if( FD_UNLIKELY( err ) ) return err;
120 0 : }
121 0 : return FD_BINCODE_SUCCESS;
122 0 : }
123 0 : static int fd_feature_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
124 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
125 0 : int err = 0;
126 0 : {
127 0 : uchar o;
128 0 : err = fd_bincode_bool_decode( &o, ctx );
129 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
130 0 : if( o ) {
131 0 : err = fd_bincode_uint64_decode_footprint( ctx );
132 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
133 0 : }
134 0 : }
135 0 : return 0;
136 0 : }
137 0 : int fd_feature_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
138 0 : *total_sz += sizeof(fd_feature_t);
139 0 : void const * start_data = ctx->data;
140 0 : int err = fd_feature_decode_footprint_inner( ctx, total_sz );
141 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
142 0 : ctx->data = start_data;
143 0 : return err;
144 0 : }
145 0 : static void fd_feature_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
146 0 : fd_feature_t * self = (fd_feature_t *)struct_mem;
147 0 : {
148 0 : uchar o;
149 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
150 0 : self->has_activated_at = !!o;
151 0 : if( o ) {
152 0 : fd_bincode_uint64_decode_unsafe( &self->activated_at, ctx );
153 0 : }
154 0 : }
155 0 : }
156 0 : void * fd_feature_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
157 0 : fd_feature_t * self = (fd_feature_t *)mem;
158 0 : fd_feature_new( self );
159 0 : void * alloc_region = (uchar *)mem + sizeof(fd_feature_t);
160 0 : void * * alloc_mem = &alloc_region;
161 0 : fd_feature_decode_inner( mem, alloc_mem, ctx );
162 0 : return self;
163 0 : }
164 0 : void fd_feature_new(fd_feature_t * self) {
165 0 : fd_memset( self, 0, sizeof(fd_feature_t) );
166 0 : }
167 0 : void fd_feature_walk( void * w, fd_feature_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
168 0 : (void) varint;
169 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_feature", level++, 0 );
170 0 : if( !self->has_activated_at ) {
171 0 : fun( w, NULL, "activated_at", FD_FLAMENCO_TYPE_NULL, "ulong", level, 0 );
172 0 : } else {
173 0 : fun( w, &self->activated_at, "activated_at", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
174 0 : }
175 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_feature", level--, 0 );
176 0 : }
177 0 : ulong fd_feature_size( fd_feature_t const * self ) {
178 0 : ulong size = 0;
179 0 : size += sizeof(char);
180 0 : if( self->has_activated_at ) {
181 0 : size += sizeof(ulong);
182 0 : }
183 0 : return size;
184 0 : }
185 :
186 0 : int fd_fee_calculator_encode( fd_fee_calculator_t const * self, fd_bincode_encode_ctx_t * ctx ) {
187 0 : int err;
188 0 : err = fd_bincode_uint64_encode( self->lamports_per_signature, ctx );
189 0 : if( FD_UNLIKELY( err ) ) return err;
190 0 : return FD_BINCODE_SUCCESS;
191 0 : }
192 0 : static inline int fd_fee_calculator_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
193 0 : if( (ulong)ctx->data + 8UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
194 0 : ctx->data = (void *)( (ulong)ctx->data + 8UL );
195 0 : return 0;
196 0 : }
197 0 : static void fd_fee_calculator_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
198 0 : fd_fee_calculator_t * self = (fd_fee_calculator_t *)struct_mem;
199 0 : fd_bincode_uint64_decode_unsafe( &self->lamports_per_signature, ctx );
200 0 : }
201 0 : void * fd_fee_calculator_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
202 0 : fd_fee_calculator_t * self = (fd_fee_calculator_t *)mem;
203 0 : fd_fee_calculator_new( self );
204 0 : void * alloc_region = (uchar *)mem + sizeof(fd_fee_calculator_t);
205 0 : void * * alloc_mem = &alloc_region;
206 0 : fd_fee_calculator_decode_inner( mem, alloc_mem, ctx );
207 0 : return self;
208 0 : }
209 0 : void fd_fee_calculator_walk( void * w, fd_fee_calculator_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
210 0 : (void) varint;
211 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_fee_calculator", level++, 0 );
212 0 : fun( w, &self->lamports_per_signature, "lamports_per_signature", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
213 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_fee_calculator", level--, 0 );
214 0 : }
215 9 : int fd_fee_rate_governor_encode( fd_fee_rate_governor_t const * self, fd_bincode_encode_ctx_t * ctx ) {
216 9 : int err;
217 9 : err = fd_bincode_uint64_encode( self->target_lamports_per_signature, ctx );
218 9 : if( FD_UNLIKELY( err ) ) return err;
219 9 : err = fd_bincode_uint64_encode( self->target_signatures_per_slot, ctx );
220 9 : if( FD_UNLIKELY( err ) ) return err;
221 9 : err = fd_bincode_uint64_encode( self->min_lamports_per_signature, ctx );
222 9 : if( FD_UNLIKELY( err ) ) return err;
223 9 : err = fd_bincode_uint64_encode( self->max_lamports_per_signature, ctx );
224 9 : if( FD_UNLIKELY( err ) ) return err;
225 9 : err = fd_bincode_uint8_encode( (uchar)(self->burn_percent), ctx );
226 9 : if( FD_UNLIKELY( err ) ) return err;
227 9 : return FD_BINCODE_SUCCESS;
228 9 : }
229 0 : static inline int fd_fee_rate_governor_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
230 0 : if( (ulong)ctx->data + 33UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
231 0 : ctx->data = (void *)( (ulong)ctx->data + 33UL );
232 0 : return 0;
233 0 : }
234 0 : static void fd_fee_rate_governor_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
235 0 : fd_fee_rate_governor_t * self = (fd_fee_rate_governor_t *)struct_mem;
236 0 : fd_bincode_uint64_decode_unsafe( &self->target_lamports_per_signature, ctx );
237 0 : fd_bincode_uint64_decode_unsafe( &self->target_signatures_per_slot, ctx );
238 0 : fd_bincode_uint64_decode_unsafe( &self->min_lamports_per_signature, ctx );
239 0 : fd_bincode_uint64_decode_unsafe( &self->max_lamports_per_signature, ctx );
240 0 : fd_bincode_uint8_decode_unsafe( &self->burn_percent, ctx );
241 0 : }
242 0 : void * fd_fee_rate_governor_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
243 0 : fd_fee_rate_governor_t * self = (fd_fee_rate_governor_t *)mem;
244 0 : fd_fee_rate_governor_new( self );
245 0 : void * alloc_region = (uchar *)mem + sizeof(fd_fee_rate_governor_t);
246 0 : void * * alloc_mem = &alloc_region;
247 0 : fd_fee_rate_governor_decode_inner( mem, alloc_mem, ctx );
248 0 : return self;
249 0 : }
250 0 : void fd_fee_rate_governor_walk( void * w, fd_fee_rate_governor_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
251 0 : (void) varint;
252 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_fee_rate_governor", level++, 0 );
253 0 : fun( w, &self->target_lamports_per_signature, "target_lamports_per_signature", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
254 0 : fun( w, &self->target_signatures_per_slot, "target_signatures_per_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
255 0 : fun( w, &self->min_lamports_per_signature, "min_lamports_per_signature", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
256 0 : fun( w, &self->max_lamports_per_signature, "max_lamports_per_signature", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
257 0 : fun( w, &self->burn_percent, "burn_percent", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
258 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_fee_rate_governor", level--, 0 );
259 0 : }
260 0 : int fd_slot_pair_encode( fd_slot_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
261 0 : int err;
262 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
263 0 : if( FD_UNLIKELY( err ) ) return err;
264 0 : err = fd_bincode_uint64_encode( self->val, ctx );
265 0 : if( FD_UNLIKELY( err ) ) return err;
266 0 : return FD_BINCODE_SUCCESS;
267 0 : }
268 0 : static inline int fd_slot_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
269 0 : if( (ulong)ctx->data + 16UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
270 0 : ctx->data = (void *)( (ulong)ctx->data + 16UL );
271 0 : return 0;
272 0 : }
273 0 : static void fd_slot_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
274 0 : fd_slot_pair_t * self = (fd_slot_pair_t *)struct_mem;
275 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
276 0 : fd_bincode_uint64_decode_unsafe( &self->val, ctx );
277 0 : }
278 0 : void * fd_slot_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
279 0 : fd_slot_pair_t * self = (fd_slot_pair_t *)mem;
280 0 : fd_slot_pair_new( self );
281 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_pair_t);
282 0 : void * * alloc_mem = &alloc_region;
283 0 : fd_slot_pair_decode_inner( mem, alloc_mem, ctx );
284 0 : return self;
285 0 : }
286 0 : void fd_slot_pair_walk( void * w, fd_slot_pair_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
287 0 : (void) varint;
288 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_slot_pair", level++, 0 );
289 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
290 0 : fun( w, &self->val, "val", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
291 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_slot_pair", level--, 0 );
292 0 : }
293 0 : int fd_hard_forks_encode( fd_hard_forks_t const * self, fd_bincode_encode_ctx_t * ctx ) {
294 0 : int err;
295 0 : err = fd_bincode_uint64_encode( self->hard_forks_len, ctx );
296 0 : if( FD_UNLIKELY(err) ) return err;
297 0 : if( self->hard_forks_len ) {
298 0 : for( ulong i=0; i < self->hard_forks_len; i++ ) {
299 0 : err = fd_slot_pair_encode( self->hard_forks + i, ctx );
300 0 : if( FD_UNLIKELY( err ) ) return err;
301 0 : }
302 0 : }
303 0 : return FD_BINCODE_SUCCESS;
304 0 : }
305 0 : int fd_hard_forks_encode_global( fd_hard_forks_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
306 0 : int err;
307 0 : err = fd_bincode_uint64_encode( self->hard_forks_len, ctx );
308 0 : if( FD_UNLIKELY( err ) ) return err;
309 0 : if( self->hard_forks_len ) {
310 0 : uchar * hard_forks_laddr = (uchar*)self + self->hard_forks_offset;
311 0 : fd_slot_pair_t * hard_forks = (fd_slot_pair_t *)hard_forks_laddr;
312 0 : for( ulong i=0; i < self->hard_forks_len; i++ ) {
313 0 : err = fd_slot_pair_encode( &hard_forks[i], ctx );
314 0 : if( FD_UNLIKELY( err ) ) return err;
315 0 : }
316 0 : }
317 0 : return FD_BINCODE_SUCCESS;
318 0 : }
319 0 : static int fd_hard_forks_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
320 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
321 0 : int err = 0;
322 0 : ulong hard_forks_len;
323 0 : err = fd_bincode_uint64_decode( &hard_forks_len, ctx );
324 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
325 0 : if( hard_forks_len ) {
326 0 : *total_sz += FD_SLOT_PAIR_ALIGN + sizeof(fd_slot_pair_t)*hard_forks_len;
327 0 : for( ulong i=0; i < hard_forks_len; i++ ) {
328 0 : err = fd_slot_pair_decode_footprint_inner( ctx, total_sz );
329 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
330 0 : }
331 0 : }
332 0 : return 0;
333 0 : }
334 0 : int fd_hard_forks_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
335 0 : *total_sz += sizeof(fd_hard_forks_t);
336 0 : void const * start_data = ctx->data;
337 0 : int err = fd_hard_forks_decode_footprint_inner( ctx, total_sz );
338 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
339 0 : ctx->data = start_data;
340 0 : return err;
341 0 : }
342 0 : static void fd_hard_forks_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
343 0 : fd_hard_forks_t * self = (fd_hard_forks_t *)struct_mem;
344 0 : fd_bincode_uint64_decode_unsafe( &self->hard_forks_len, ctx );
345 0 : if( self->hard_forks_len ) {
346 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_SLOT_PAIR_ALIGN );
347 0 : self->hard_forks = *alloc_mem;
348 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_slot_pair_t)*self->hard_forks_len;
349 0 : for( ulong i=0; i < self->hard_forks_len; i++ ) {
350 0 : fd_slot_pair_new( self->hard_forks + i );
351 0 : fd_slot_pair_decode_inner( self->hard_forks + i, alloc_mem, ctx );
352 0 : }
353 0 : } else
354 0 : self->hard_forks = NULL;
355 0 : }
356 0 : void * fd_hard_forks_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
357 0 : fd_hard_forks_t * self = (fd_hard_forks_t *)mem;
358 0 : fd_hard_forks_new( self );
359 0 : void * alloc_region = (uchar *)mem + sizeof(fd_hard_forks_t);
360 0 : void * * alloc_mem = &alloc_region;
361 0 : fd_hard_forks_decode_inner( mem, alloc_mem, ctx );
362 0 : return self;
363 0 : }
364 0 : static void fd_hard_forks_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
365 0 : fd_hard_forks_global_t * self = (fd_hard_forks_global_t *)struct_mem;
366 0 : fd_bincode_uint64_decode_unsafe( &self->hard_forks_len, ctx );
367 0 : if( self->hard_forks_len ) {
368 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_SLOT_PAIR_ALIGN );
369 0 : self->hard_forks_offset = (ulong)*alloc_mem - (ulong)struct_mem;
370 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
371 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_slot_pair_t)*self->hard_forks_len;
372 0 : for( ulong i=0; i < self->hard_forks_len; i++ ) {
373 0 : fd_slot_pair_new( (fd_slot_pair_t *)fd_type_pun(cur_mem + sizeof(fd_slot_pair_t) * i) );
374 0 : fd_slot_pair_decode_inner( cur_mem + sizeof(fd_slot_pair_t) * i, alloc_mem, ctx );
375 0 : }
376 0 : } else {
377 0 : self->hard_forks_offset = 0UL;
378 0 : }
379 0 : }
380 0 : void * fd_hard_forks_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
381 0 : fd_hard_forks_global_t * self = (fd_hard_forks_global_t *)mem;
382 0 : fd_hard_forks_new( (fd_hard_forks_t *)self );
383 0 : void * alloc_region = (uchar *)mem + sizeof(fd_hard_forks_global_t);
384 0 : void * * alloc_mem = &alloc_region;
385 0 : fd_hard_forks_decode_inner_global( mem, alloc_mem, ctx );
386 0 : return self;
387 0 : }
388 0 : void fd_hard_forks_new(fd_hard_forks_t * self) {
389 0 : fd_memset( self, 0, sizeof(fd_hard_forks_t) );
390 0 : }
391 0 : void fd_hard_forks_walk( void * w, fd_hard_forks_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
392 0 : (void) varint;
393 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_hard_forks", level++, 0 );
394 0 : if( self->hard_forks_len ) {
395 0 : fun( w, NULL, "hard_forks", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
396 0 : for( ulong i=0; i < self->hard_forks_len; i++ )
397 0 : fd_slot_pair_walk(w, self->hard_forks + i, fun, "slot_pair", level, 0 );
398 0 : fun( w, NULL, "hard_forks", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
399 0 : }
400 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_hard_forks", level--, 0 );
401 0 : }
402 0 : ulong fd_hard_forks_size( fd_hard_forks_t const * self ) {
403 0 : ulong size = 0;
404 0 : do {
405 0 : size += sizeof(ulong);
406 0 : for( ulong i=0; i < self->hard_forks_len; i++ )
407 0 : size += fd_slot_pair_size( self->hard_forks + i );
408 0 : } while(0);
409 0 : return size;
410 0 : }
411 :
412 0 : ulong fd_hard_forks_size_global( fd_hard_forks_global_t const * self ) {
413 0 : ulong size = 0;
414 0 : do {
415 0 : size += sizeof(ulong);
416 0 : fd_slot_pair_t * hard_forks = self->hard_forks_offset ? (fd_slot_pair_t *)fd_type_pun( (uchar *)self + self->hard_forks_offset ) : NULL;
417 0 : for( ulong i=0; i < self->hard_forks_len; i++ )
418 0 : size += fd_slot_pair_size( hard_forks + i );
419 0 : } while(0);
420 0 : return size;
421 0 : }
422 :
423 9 : int fd_inflation_encode( fd_inflation_t const * self, fd_bincode_encode_ctx_t * ctx ) {
424 9 : int err;
425 9 : err = fd_bincode_double_encode( self->initial, ctx );
426 9 : if( FD_UNLIKELY( err ) ) return err;
427 9 : err = fd_bincode_double_encode( self->terminal, ctx );
428 9 : if( FD_UNLIKELY( err ) ) return err;
429 9 : err = fd_bincode_double_encode( self->taper, ctx );
430 9 : if( FD_UNLIKELY( err ) ) return err;
431 9 : err = fd_bincode_double_encode( self->foundation, ctx );
432 9 : if( FD_UNLIKELY( err ) ) return err;
433 9 : err = fd_bincode_double_encode( self->foundation_term, ctx );
434 9 : if( FD_UNLIKELY( err ) ) return err;
435 9 : err = fd_bincode_double_encode( self->unused, ctx );
436 9 : if( FD_UNLIKELY( err ) ) return err;
437 9 : return FD_BINCODE_SUCCESS;
438 9 : }
439 0 : static inline int fd_inflation_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
440 0 : if( (ulong)ctx->data + 48UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
441 0 : ctx->data = (void *)( (ulong)ctx->data + 48UL );
442 0 : return 0;
443 0 : }
444 0 : static void fd_inflation_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
445 0 : fd_inflation_t * self = (fd_inflation_t *)struct_mem;
446 0 : fd_bincode_double_decode_unsafe( &self->initial, ctx );
447 0 : fd_bincode_double_decode_unsafe( &self->terminal, ctx );
448 0 : fd_bincode_double_decode_unsafe( &self->taper, ctx );
449 0 : fd_bincode_double_decode_unsafe( &self->foundation, ctx );
450 0 : fd_bincode_double_decode_unsafe( &self->foundation_term, ctx );
451 0 : fd_bincode_double_decode_unsafe( &self->unused, ctx );
452 0 : }
453 0 : void * fd_inflation_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
454 0 : fd_inflation_t * self = (fd_inflation_t *)mem;
455 0 : fd_inflation_new( self );
456 0 : void * alloc_region = (uchar *)mem + sizeof(fd_inflation_t);
457 0 : void * * alloc_mem = &alloc_region;
458 0 : fd_inflation_decode_inner( mem, alloc_mem, ctx );
459 0 : return self;
460 0 : }
461 0 : void fd_inflation_walk( void * w, fd_inflation_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
462 0 : (void) varint;
463 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_inflation", level++, 0 );
464 0 : fun( w, &self->initial, "initial", FD_FLAMENCO_TYPE_DOUBLE, "double", level, 0 );
465 0 : fun( w, &self->terminal, "terminal", FD_FLAMENCO_TYPE_DOUBLE, "double", level, 0 );
466 0 : fun( w, &self->taper, "taper", FD_FLAMENCO_TYPE_DOUBLE, "double", level, 0 );
467 0 : fun( w, &self->foundation, "foundation", FD_FLAMENCO_TYPE_DOUBLE, "double", level, 0 );
468 0 : fun( w, &self->foundation_term, "foundation_term", FD_FLAMENCO_TYPE_DOUBLE, "double", level, 0 );
469 0 : fun( w, &self->unused, "unused", FD_FLAMENCO_TYPE_DOUBLE, "double", level, 0 );
470 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_inflation", level--, 0 );
471 0 : }
472 9 : int fd_rent_encode( fd_rent_t const * self, fd_bincode_encode_ctx_t * ctx ) {
473 9 : int err;
474 9 : err = fd_bincode_uint64_encode( self->lamports_per_uint8_year, ctx );
475 9 : if( FD_UNLIKELY( err ) ) return err;
476 9 : err = fd_bincode_double_encode( self->exemption_threshold, ctx );
477 9 : if( FD_UNLIKELY( err ) ) return err;
478 9 : err = fd_bincode_uint8_encode( (uchar)(self->burn_percent), ctx );
479 9 : if( FD_UNLIKELY( err ) ) return err;
480 9 : return FD_BINCODE_SUCCESS;
481 9 : }
482 0 : static inline int fd_rent_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
483 0 : if( (ulong)ctx->data + 17UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
484 0 : ctx->data = (void *)( (ulong)ctx->data + 17UL );
485 0 : return 0;
486 0 : }
487 0 : static void fd_rent_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
488 0 : fd_rent_t * self = (fd_rent_t *)struct_mem;
489 0 : fd_bincode_uint64_decode_unsafe( &self->lamports_per_uint8_year, ctx );
490 0 : fd_bincode_double_decode_unsafe( &self->exemption_threshold, ctx );
491 0 : fd_bincode_uint8_decode_unsafe( &self->burn_percent, ctx );
492 0 : }
493 0 : void * fd_rent_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
494 0 : fd_rent_t * self = (fd_rent_t *)mem;
495 0 : fd_rent_new( self );
496 0 : void * alloc_region = (uchar *)mem + sizeof(fd_rent_t);
497 0 : void * * alloc_mem = &alloc_region;
498 0 : fd_rent_decode_inner( mem, alloc_mem, ctx );
499 0 : return self;
500 0 : }
501 0 : void fd_rent_walk( void * w, fd_rent_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
502 0 : (void) varint;
503 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_rent", level++, 0 );
504 0 : fun( w, &self->lamports_per_uint8_year, "lamports_per_uint8_year", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
505 0 : fun( w, &self->exemption_threshold, "exemption_threshold", FD_FLAMENCO_TYPE_DOUBLE, "double", level, 0 );
506 0 : fun( w, &self->burn_percent, "burn_percent", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
507 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_rent", level--, 0 );
508 0 : }
509 9 : int fd_epoch_schedule_encode( fd_epoch_schedule_t const * self, fd_bincode_encode_ctx_t * ctx ) {
510 9 : int err;
511 9 : err = fd_bincode_uint64_encode( self->slots_per_epoch, ctx );
512 9 : if( FD_UNLIKELY( err ) ) return err;
513 9 : err = fd_bincode_uint64_encode( self->leader_schedule_slot_offset, ctx );
514 9 : if( FD_UNLIKELY( err ) ) return err;
515 9 : err = fd_bincode_bool_encode( (uchar)(self->warmup), ctx );
516 9 : if( FD_UNLIKELY( err ) ) return err;
517 9 : err = fd_bincode_uint64_encode( self->first_normal_epoch, ctx );
518 9 : if( FD_UNLIKELY( err ) ) return err;
519 9 : err = fd_bincode_uint64_encode( self->first_normal_slot, ctx );
520 9 : if( FD_UNLIKELY( err ) ) return err;
521 9 : return FD_BINCODE_SUCCESS;
522 9 : }
523 3 : static int fd_epoch_schedule_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
524 3 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
525 3 : int err = 0;
526 3 : err = fd_bincode_uint64_decode_footprint( ctx );
527 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
528 3 : err = fd_bincode_uint64_decode_footprint( ctx );
529 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
530 3 : err = fd_bincode_bool_decode_footprint( ctx );
531 3 : if( FD_UNLIKELY( err ) ) return err;
532 3 : err = fd_bincode_uint64_decode_footprint( ctx );
533 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
534 3 : err = fd_bincode_uint64_decode_footprint( ctx );
535 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
536 3 : return 0;
537 3 : }
538 3 : int fd_epoch_schedule_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
539 3 : *total_sz += sizeof(fd_epoch_schedule_t);
540 3 : void const * start_data = ctx->data;
541 3 : int err = fd_epoch_schedule_decode_footprint_inner( ctx, total_sz );
542 3 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
543 3 : ctx->data = start_data;
544 3 : return err;
545 3 : }
546 0 : static void fd_epoch_schedule_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
547 0 : fd_epoch_schedule_t * self = (fd_epoch_schedule_t *)struct_mem;
548 0 : fd_bincode_uint64_decode_unsafe( &self->slots_per_epoch, ctx );
549 0 : fd_bincode_uint64_decode_unsafe( &self->leader_schedule_slot_offset, ctx );
550 0 : fd_bincode_bool_decode_unsafe( &self->warmup, ctx );
551 0 : fd_bincode_uint64_decode_unsafe( &self->first_normal_epoch, ctx );
552 0 : fd_bincode_uint64_decode_unsafe( &self->first_normal_slot, ctx );
553 0 : }
554 0 : void * fd_epoch_schedule_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
555 0 : fd_epoch_schedule_t * self = (fd_epoch_schedule_t *)mem;
556 0 : fd_epoch_schedule_new( self );
557 0 : void * alloc_region = (uchar *)mem + sizeof(fd_epoch_schedule_t);
558 0 : void * * alloc_mem = &alloc_region;
559 0 : fd_epoch_schedule_decode_inner( mem, alloc_mem, ctx );
560 0 : return self;
561 0 : }
562 12 : void fd_epoch_schedule_new(fd_epoch_schedule_t * self) {
563 12 : fd_memset( self, 0, sizeof(fd_epoch_schedule_t) );
564 12 : }
565 0 : void fd_epoch_schedule_walk( void * w, fd_epoch_schedule_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
566 0 : (void) varint;
567 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_epoch_schedule", level++, 0 );
568 0 : fun( w, &self->slots_per_epoch, "slots_per_epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
569 0 : fun( w, &self->leader_schedule_slot_offset, "leader_schedule_slot_offset", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
570 0 : fun( w, &self->warmup, "warmup", FD_FLAMENCO_TYPE_BOOL, "bool", level, 0 );
571 0 : fun( w, &self->first_normal_epoch, "first_normal_epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
572 0 : fun( w, &self->first_normal_slot, "first_normal_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
573 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_epoch_schedule", level--, 0 );
574 0 : }
575 0 : int fd_rent_collector_encode( fd_rent_collector_t const * self, fd_bincode_encode_ctx_t * ctx ) {
576 0 : int err;
577 0 : err = fd_bincode_uint64_encode( self->epoch, ctx );
578 0 : if( FD_UNLIKELY( err ) ) return err;
579 0 : err = fd_epoch_schedule_encode( &self->epoch_schedule, ctx );
580 0 : if( FD_UNLIKELY( err ) ) return err;
581 0 : err = fd_bincode_double_encode( self->slots_per_year, ctx );
582 0 : if( FD_UNLIKELY( err ) ) return err;
583 0 : err = fd_rent_encode( &self->rent, ctx );
584 0 : if( FD_UNLIKELY( err ) ) return err;
585 0 : return FD_BINCODE_SUCCESS;
586 0 : }
587 0 : static int fd_rent_collector_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
588 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
589 0 : int err = 0;
590 0 : err = fd_bincode_uint64_decode_footprint( ctx );
591 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
592 0 : err = fd_epoch_schedule_decode_footprint_inner( ctx, total_sz );
593 0 : if( FD_UNLIKELY( err ) ) return err;
594 0 : err = fd_bincode_double_decode_footprint( ctx );
595 0 : if( FD_UNLIKELY( err ) ) return err;
596 0 : err = fd_rent_decode_footprint_inner( ctx, total_sz );
597 0 : if( FD_UNLIKELY( err ) ) return err;
598 0 : return 0;
599 0 : }
600 0 : int fd_rent_collector_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
601 0 : *total_sz += sizeof(fd_rent_collector_t);
602 0 : void const * start_data = ctx->data;
603 0 : int err = fd_rent_collector_decode_footprint_inner( ctx, total_sz );
604 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
605 0 : ctx->data = start_data;
606 0 : return err;
607 0 : }
608 0 : static void fd_rent_collector_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
609 0 : fd_rent_collector_t * self = (fd_rent_collector_t *)struct_mem;
610 0 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
611 0 : fd_epoch_schedule_decode_inner( &self->epoch_schedule, alloc_mem, ctx );
612 0 : fd_bincode_double_decode_unsafe( &self->slots_per_year, ctx );
613 0 : fd_rent_decode_inner( &self->rent, alloc_mem, ctx );
614 0 : }
615 0 : void * fd_rent_collector_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
616 0 : fd_rent_collector_t * self = (fd_rent_collector_t *)mem;
617 0 : fd_rent_collector_new( self );
618 0 : void * alloc_region = (uchar *)mem + sizeof(fd_rent_collector_t);
619 0 : void * * alloc_mem = &alloc_region;
620 0 : fd_rent_collector_decode_inner( mem, alloc_mem, ctx );
621 0 : return self;
622 0 : }
623 0 : void fd_rent_collector_new(fd_rent_collector_t * self) {
624 0 : fd_memset( self, 0, sizeof(fd_rent_collector_t) );
625 0 : fd_epoch_schedule_new( &self->epoch_schedule );
626 0 : fd_rent_new( &self->rent );
627 0 : }
628 0 : void fd_rent_collector_walk( void * w, fd_rent_collector_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
629 0 : (void) varint;
630 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_rent_collector", level++, 0 );
631 0 : fun( w, &self->epoch, "epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
632 0 : fd_epoch_schedule_walk( w, &self->epoch_schedule, fun, "epoch_schedule", level, 0 );
633 0 : fun( w, &self->slots_per_year, "slots_per_year", FD_FLAMENCO_TYPE_DOUBLE, "double", level, 0 );
634 0 : fd_rent_walk( w, &self->rent, fun, "rent", level, 0 );
635 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_rent_collector", level--, 0 );
636 0 : }
637 9 : int fd_stake_history_entry_encode( fd_stake_history_entry_t const * self, fd_bincode_encode_ctx_t * ctx ) {
638 9 : int err;
639 9 : err = fd_bincode_uint64_encode( self->effective, ctx );
640 9 : if( FD_UNLIKELY( err ) ) return err;
641 9 : err = fd_bincode_uint64_encode( self->activating, ctx );
642 9 : if( FD_UNLIKELY( err ) ) return err;
643 9 : err = fd_bincode_uint64_encode( self->deactivating, ctx );
644 9 : if( FD_UNLIKELY( err ) ) return err;
645 9 : return FD_BINCODE_SUCCESS;
646 9 : }
647 0 : static inline int fd_stake_history_entry_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
648 0 : if( (ulong)ctx->data + 24UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
649 0 : ctx->data = (void *)( (ulong)ctx->data + 24UL );
650 0 : return 0;
651 0 : }
652 12 : static void fd_stake_history_entry_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
653 12 : fd_stake_history_entry_t * self = (fd_stake_history_entry_t *)struct_mem;
654 12 : fd_bincode_uint64_decode_unsafe( &self->effective, ctx );
655 12 : fd_bincode_uint64_decode_unsafe( &self->activating, ctx );
656 12 : fd_bincode_uint64_decode_unsafe( &self->deactivating, ctx );
657 12 : }
658 0 : void * fd_stake_history_entry_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
659 0 : fd_stake_history_entry_t * self = (fd_stake_history_entry_t *)mem;
660 0 : fd_stake_history_entry_new( self );
661 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_history_entry_t);
662 0 : void * * alloc_mem = &alloc_region;
663 0 : fd_stake_history_entry_decode_inner( mem, alloc_mem, ctx );
664 0 : return self;
665 0 : }
666 0 : void fd_stake_history_entry_walk( void * w, fd_stake_history_entry_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
667 0 : (void) varint;
668 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_history_entry", level++, 0 );
669 0 : fun( w, &self->effective, "effective", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
670 0 : fun( w, &self->activating, "activating", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
671 0 : fun( w, &self->deactivating, "deactivating", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
672 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_history_entry", level--, 0 );
673 0 : }
674 9 : int fd_epoch_stake_history_entry_pair_encode( fd_epoch_stake_history_entry_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
675 9 : int err;
676 9 : err = fd_bincode_uint64_encode( self->epoch, ctx );
677 9 : if( FD_UNLIKELY( err ) ) return err;
678 9 : err = fd_stake_history_entry_encode( &self->entry, ctx );
679 9 : if( FD_UNLIKELY( err ) ) return err;
680 9 : return FD_BINCODE_SUCCESS;
681 9 : }
682 1548 : static inline int fd_epoch_stake_history_entry_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
683 1548 : if( (ulong)ctx->data + 32UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
684 1548 : ctx->data = (void *)( (ulong)ctx->data + 32UL );
685 1548 : return 0;
686 1548 : }
687 12 : static void fd_epoch_stake_history_entry_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
688 12 : fd_epoch_stake_history_entry_pair_t * self = (fd_epoch_stake_history_entry_pair_t *)struct_mem;
689 12 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
690 12 : fd_stake_history_entry_decode_inner( &self->entry, alloc_mem, ctx );
691 12 : }
692 0 : void * fd_epoch_stake_history_entry_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
693 0 : fd_epoch_stake_history_entry_pair_t * self = (fd_epoch_stake_history_entry_pair_t *)mem;
694 0 : fd_epoch_stake_history_entry_pair_new( self );
695 0 : void * alloc_region = (uchar *)mem + sizeof(fd_epoch_stake_history_entry_pair_t);
696 0 : void * * alloc_mem = &alloc_region;
697 0 : fd_epoch_stake_history_entry_pair_decode_inner( mem, alloc_mem, ctx );
698 0 : return self;
699 0 : }
700 0 : void fd_epoch_stake_history_entry_pair_walk( void * w, fd_epoch_stake_history_entry_pair_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
701 0 : (void) varint;
702 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_epoch_stake_history_entry_pair", level++, 0 );
703 0 : fun( w, &self->epoch, "epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
704 0 : fd_stake_history_entry_walk( w, &self->entry, fun, "entry", level, 0 );
705 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_epoch_stake_history_entry_pair", level--, 0 );
706 0 : }
707 9 : int fd_stake_history_encode( fd_stake_history_t const * self, fd_bincode_encode_ctx_t * ctx ) {
708 9 : int err;
709 9 : err = fd_bincode_uint64_encode( self->fd_stake_history_len, ctx );
710 9 : if( FD_UNLIKELY(err) ) return err;
711 9 : if( FD_UNLIKELY( 0 == self->fd_stake_history_len ) ) return FD_BINCODE_SUCCESS;
712 15 : for( ulong i=0; i<self->fd_stake_history_len; i++ ) {
713 9 : ulong idx = ( i + self->fd_stake_history_offset ) & (512 - 1);
714 9 : err = fd_epoch_stake_history_entry_pair_encode( self->fd_stake_history + idx, ctx );
715 9 : if( FD_UNLIKELY( err ) ) return err;
716 9 : }
717 6 : return FD_BINCODE_SUCCESS;
718 6 : }
719 15 : static int fd_stake_history_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
720 15 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
721 15 : int err = 0;
722 15 : ulong fd_stake_history_len;
723 15 : err = fd_bincode_uint64_decode( &fd_stake_history_len, ctx );
724 15 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
725 15 : if( fd_stake_history_len ) {
726 1560 : for( ulong i=0; i < fd_stake_history_len; i++ ) {
727 1548 : err = fd_epoch_stake_history_entry_pair_decode_footprint_inner( ctx, total_sz );
728 1548 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
729 1548 : }
730 12 : }
731 15 : return 0;
732 15 : }
733 15 : int fd_stake_history_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
734 15 : *total_sz += sizeof(fd_stake_history_t);
735 15 : void const * start_data = ctx->data;
736 15 : int err = fd_stake_history_decode_footprint_inner( ctx, total_sz );
737 15 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
738 15 : ctx->data = start_data;
739 15 : return err;
740 15 : }
741 12 : static void fd_stake_history_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
742 12 : fd_stake_history_t * self = (fd_stake_history_t *)struct_mem;
743 12 : fd_bincode_uint64_decode_unsafe( &self->fd_stake_history_len, ctx );
744 12 : self->fd_stake_history_size = 512;
745 12 : self->fd_stake_history_offset = 0;
746 24 : for( ulong i=0; i<self->fd_stake_history_len; i++ ) {
747 12 : fd_epoch_stake_history_entry_pair_decode_inner( self->fd_stake_history + i, alloc_mem, ctx );
748 12 : }
749 12 : }
750 12 : void * fd_stake_history_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
751 12 : fd_stake_history_t * self = (fd_stake_history_t *)mem;
752 12 : fd_stake_history_new( self );
753 12 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_history_t);
754 12 : void * * alloc_mem = &alloc_region;
755 12 : fd_stake_history_decode_inner( mem, alloc_mem, ctx );
756 12 : return self;
757 12 : }
758 15 : void fd_stake_history_new(fd_stake_history_t * self) {
759 15 : fd_memset( self, 0, sizeof(fd_stake_history_t) );
760 15 : self->fd_stake_history_size = 512;
761 7695 : for( ulong i=0; i<512; i++ )
762 7680 : fd_epoch_stake_history_entry_pair_new( self->fd_stake_history + i );
763 15 : }
764 0 : void fd_stake_history_walk( void * w, fd_stake_history_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
765 0 : (void) varint;
766 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_history", level++, 0 );
767 0 : fun( w, NULL, "fd_stake_history", FD_FLAMENCO_TYPE_ARR, "epoch_stake_history_entry_pair[]", level++, 0 );
768 0 : for( ulong i=0; i<self->fd_stake_history_len; i++ ) {
769 0 : ulong idx = ( i + self->fd_stake_history_offset ) & (512 - 1);
770 0 : fd_epoch_stake_history_entry_pair_walk( w, self->fd_stake_history + idx, fun, "epoch_stake_history_entry_pair", level, 0 );
771 0 : }
772 0 : fun( w, NULL, "fd_stake_history", FD_FLAMENCO_TYPE_ARR_END, "epoch_stake_history_entry_pair[]", level--, 0 );
773 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_history", level--, 0 );
774 0 : }
775 144 : int fd_solana_account_encode( fd_solana_account_t const * self, fd_bincode_encode_ctx_t * ctx ) {
776 144 : int err;
777 144 : err = fd_bincode_uint64_encode( self->lamports, ctx );
778 144 : if( FD_UNLIKELY( err ) ) return err;
779 144 : err = fd_bincode_uint64_encode( self->data_len, ctx );
780 144 : if( FD_UNLIKELY(err) ) return err;
781 144 : if( self->data_len ) {
782 30 : err = fd_bincode_bytes_encode( self->data, self->data_len, ctx );
783 30 : if( FD_UNLIKELY( err ) ) return err;
784 30 : }
785 144 : err = fd_pubkey_encode( &self->owner, ctx );
786 144 : if( FD_UNLIKELY( err ) ) return err;
787 144 : err = fd_bincode_bool_encode( (uchar)(self->executable), ctx );
788 144 : if( FD_UNLIKELY( err ) ) return err;
789 144 : err = fd_bincode_uint64_encode( self->rent_epoch, ctx );
790 144 : if( FD_UNLIKELY( err ) ) return err;
791 144 : return FD_BINCODE_SUCCESS;
792 144 : }
793 0 : int fd_solana_account_encode_global( fd_solana_account_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
794 0 : int err;
795 0 : err = fd_bincode_uint64_encode( self->lamports, ctx );
796 0 : if( FD_UNLIKELY( err ) ) return err;
797 0 : err = fd_bincode_uint64_encode( self->data_len, ctx );
798 0 : if( FD_UNLIKELY( err ) ) return err;
799 0 : if( self->data_len ) {
800 0 : uchar * data_laddr = (uchar*)self + self->data_offset;
801 0 : err = fd_bincode_bytes_encode( data_laddr, self->data_len, ctx );
802 0 : if( FD_UNLIKELY( err ) ) return err;
803 0 : }
804 0 : err = fd_pubkey_encode( &self->owner, ctx );
805 0 : if( FD_UNLIKELY( err ) ) return err;
806 0 : err = fd_bincode_bool_encode( (uchar)(self->executable), ctx );
807 0 : if( FD_UNLIKELY( err ) ) return err;
808 0 : err = fd_bincode_uint64_encode( self->rent_epoch, ctx );
809 0 : if( FD_UNLIKELY( err ) ) return err;
810 0 : return FD_BINCODE_SUCCESS;
811 0 : }
812 0 : static int fd_solana_account_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
813 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
814 0 : int err = 0;
815 0 : err = fd_bincode_uint64_decode_footprint( ctx );
816 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
817 0 : ulong data_len;
818 0 : err = fd_bincode_uint64_decode( &data_len, ctx );
819 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
820 0 : if( data_len ) {
821 0 : *total_sz += 8UL + data_len;
822 0 : err = fd_bincode_bytes_decode_footprint( data_len, ctx );
823 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
824 0 : }
825 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
826 0 : if( FD_UNLIKELY( err ) ) return err;
827 0 : err = fd_bincode_bool_decode_footprint( ctx );
828 0 : if( FD_UNLIKELY( err ) ) return err;
829 0 : err = fd_bincode_uint64_decode_footprint( ctx );
830 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
831 0 : return 0;
832 0 : }
833 0 : int fd_solana_account_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
834 0 : *total_sz += sizeof(fd_solana_account_t);
835 0 : void const * start_data = ctx->data;
836 0 : int err = fd_solana_account_decode_footprint_inner( ctx, total_sz );
837 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
838 0 : ctx->data = start_data;
839 0 : return err;
840 0 : }
841 0 : static void fd_solana_account_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
842 0 : fd_solana_account_t * self = (fd_solana_account_t *)struct_mem;
843 0 : fd_bincode_uint64_decode_unsafe( &self->lamports, ctx );
844 0 : fd_bincode_uint64_decode_unsafe( &self->data_len, ctx );
845 0 : if( self->data_len ) {
846 0 : self->data = *alloc_mem;
847 0 : fd_bincode_bytes_decode_unsafe( self->data, self->data_len, ctx );
848 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->data_len;
849 0 : } else
850 0 : self->data = NULL;
851 0 : fd_pubkey_decode_inner( &self->owner, alloc_mem, ctx );
852 0 : fd_bincode_bool_decode_unsafe( &self->executable, ctx );
853 0 : fd_bincode_uint64_decode_unsafe( &self->rent_epoch, ctx );
854 0 : }
855 0 : void * fd_solana_account_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
856 0 : fd_solana_account_t * self = (fd_solana_account_t *)mem;
857 0 : fd_solana_account_new( self );
858 0 : void * alloc_region = (uchar *)mem + sizeof(fd_solana_account_t);
859 0 : void * * alloc_mem = &alloc_region;
860 0 : fd_solana_account_decode_inner( mem, alloc_mem, ctx );
861 0 : return self;
862 0 : }
863 0 : static void fd_solana_account_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
864 0 : fd_solana_account_global_t * self = (fd_solana_account_global_t *)struct_mem;
865 0 : fd_bincode_uint64_decode_unsafe( &self->lamports, ctx );
866 0 : fd_bincode_uint64_decode_unsafe( &self->data_len, ctx );
867 0 : if( self->data_len ) {
868 0 : self->data_offset = (ulong)*alloc_mem - (ulong)struct_mem;
869 0 : fd_bincode_bytes_decode_unsafe( *alloc_mem, self->data_len, ctx );
870 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->data_len;
871 0 : } else {
872 0 : self->data_offset = 0UL;
873 0 : }
874 0 : fd_pubkey_decode_inner( &self->owner, alloc_mem, ctx );
875 0 : fd_bincode_bool_decode_unsafe( &self->executable, ctx );
876 0 : fd_bincode_uint64_decode_unsafe( &self->rent_epoch, ctx );
877 0 : }
878 0 : void * fd_solana_account_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
879 0 : fd_solana_account_global_t * self = (fd_solana_account_global_t *)mem;
880 0 : fd_solana_account_new( (fd_solana_account_t *)self );
881 0 : void * alloc_region = (uchar *)mem + sizeof(fd_solana_account_global_t);
882 0 : void * * alloc_mem = &alloc_region;
883 0 : fd_solana_account_decode_inner_global( mem, alloc_mem, ctx );
884 0 : return self;
885 0 : }
886 0 : void fd_solana_account_new(fd_solana_account_t * self) {
887 0 : fd_memset( self, 0, sizeof(fd_solana_account_t) );
888 0 : fd_pubkey_new( &self->owner );
889 0 : }
890 0 : void fd_solana_account_walk( void * w, fd_solana_account_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
891 0 : (void) varint;
892 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_solana_account", level++, 0 );
893 0 : fun( w, &self->lamports, "lamports", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
894 0 : if( self->data_len ) {
895 0 : fun( w, NULL, "data", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
896 0 : for( ulong i=0; i < self->data_len; i++ )
897 0 : fun( w, self->data + i, "data", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
898 0 : fun( w, NULL, "data", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
899 0 : }
900 0 : fd_pubkey_walk( w, &self->owner, fun, "owner", level, 0 );
901 0 : fun( w, &self->executable, "executable", FD_FLAMENCO_TYPE_BOOL, "bool", level, 0 );
902 0 : fun( w, &self->rent_epoch, "rent_epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
903 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_solana_account", level--, 0 );
904 0 : }
905 0 : ulong fd_solana_account_size( fd_solana_account_t const * self ) {
906 0 : ulong size = 0;
907 0 : size += sizeof(ulong);
908 0 : do {
909 0 : size += sizeof(ulong);
910 0 : size += self->data_len;
911 0 : } while(0);
912 0 : size += fd_pubkey_size( &self->owner );
913 0 : size += sizeof(char);
914 0 : size += sizeof(ulong);
915 0 : return size;
916 0 : }
917 :
918 0 : ulong fd_solana_account_size_global( fd_solana_account_global_t const * self ) {
919 0 : ulong size = 0;
920 0 : size += sizeof(ulong);
921 0 : do {
922 0 : size += sizeof(ulong);
923 0 : uchar * data = self->data_offset ? (uchar *)fd_type_pun( (uchar *)self + self->data_offset ) : NULL;
924 0 : size += self->data_len;
925 0 : } while(0);
926 0 : size += fd_pubkey_size( &self->owner );
927 0 : size += sizeof(char);
928 0 : size += sizeof(ulong);
929 0 : return size;
930 0 : }
931 :
932 0 : int fd_solana_account_stored_meta_encode( fd_solana_account_stored_meta_t const * self, fd_bincode_encode_ctx_t * ctx ) {
933 0 : int err;
934 0 : err = fd_bincode_uint64_encode( self->write_version_obsolete, ctx );
935 0 : if( FD_UNLIKELY( err ) ) return err;
936 0 : err = fd_bincode_uint64_encode( self->data_len, ctx );
937 0 : if( FD_UNLIKELY( err ) ) return err;
938 0 : err = fd_bincode_bytes_encode( self->pubkey, sizeof(self->pubkey), ctx );
939 0 : if( FD_UNLIKELY( err ) ) return err;
940 0 : return FD_BINCODE_SUCCESS;
941 0 : }
942 0 : static inline int fd_solana_account_stored_meta_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
943 0 : if( (ulong)ctx->data + 48UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
944 0 : ctx->data = (void *)( (ulong)ctx->data + 48UL );
945 0 : return 0;
946 0 : }
947 0 : static void fd_solana_account_stored_meta_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
948 0 : fd_solana_account_stored_meta_t * self = (fd_solana_account_stored_meta_t *)struct_mem;
949 0 : fd_bincode_uint64_decode_unsafe( &self->write_version_obsolete, ctx );
950 0 : fd_bincode_uint64_decode_unsafe( &self->data_len, ctx );
951 0 : fd_bincode_bytes_decode_unsafe( &self->pubkey[0], sizeof(self->pubkey), ctx );
952 0 : }
953 0 : void * fd_solana_account_stored_meta_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
954 0 : fd_solana_account_stored_meta_t * self = (fd_solana_account_stored_meta_t *)mem;
955 0 : fd_solana_account_stored_meta_new( self );
956 0 : void * alloc_region = (uchar *)mem + sizeof(fd_solana_account_stored_meta_t);
957 0 : void * * alloc_mem = &alloc_region;
958 0 : fd_solana_account_stored_meta_decode_inner( mem, alloc_mem, ctx );
959 0 : return self;
960 0 : }
961 0 : void fd_solana_account_stored_meta_walk( void * w, fd_solana_account_stored_meta_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
962 0 : (void) varint;
963 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_solana_account_stored_meta", level++, 0 );
964 0 : fun( w, &self->write_version_obsolete, "write_version_obsolete", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
965 0 : fun( w, &self->data_len, "data_len", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
966 0 : fun( w, self->pubkey, "pubkey", FD_FLAMENCO_TYPE_HASH256, "uchar[32]", level, 0 );
967 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_solana_account_stored_meta", level--, 0 );
968 0 : }
969 0 : int fd_solana_account_meta_encode( fd_solana_account_meta_t const * self, fd_bincode_encode_ctx_t * ctx ) {
970 0 : int err;
971 0 : err = fd_bincode_uint64_encode( self->lamports, ctx );
972 0 : if( FD_UNLIKELY( err ) ) return err;
973 0 : err = fd_bincode_uint64_encode( self->rent_epoch, ctx );
974 0 : if( FD_UNLIKELY( err ) ) return err;
975 0 : err = fd_bincode_bytes_encode( self->owner, sizeof(self->owner), ctx );
976 0 : if( FD_UNLIKELY( err ) ) return err;
977 0 : err = fd_bincode_bool_encode( (uchar)(self->executable), ctx );
978 0 : if( FD_UNLIKELY( err ) ) return err;
979 0 : err = fd_bincode_bytes_encode( self->padding, 3, ctx );
980 0 : if( FD_UNLIKELY( err ) ) return err;
981 0 : return FD_BINCODE_SUCCESS;
982 0 : }
983 0 : static int fd_solana_account_meta_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
984 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
985 0 : int err = 0;
986 0 : err = fd_bincode_uint64_decode_footprint( ctx );
987 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
988 0 : err = fd_bincode_uint64_decode_footprint( ctx );
989 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
990 0 : err = fd_bincode_bytes_decode_footprint( 32, ctx );
991 0 : if( FD_UNLIKELY( err ) ) return err;
992 0 : err = fd_bincode_bool_decode_footprint( ctx );
993 0 : if( FD_UNLIKELY( err ) ) return err;
994 0 : err = fd_bincode_bytes_decode_footprint( 3, ctx );
995 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
996 0 : return 0;
997 0 : }
998 0 : int fd_solana_account_meta_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
999 0 : *total_sz += sizeof(fd_solana_account_meta_t);
1000 0 : void const * start_data = ctx->data;
1001 0 : int err = fd_solana_account_meta_decode_footprint_inner( ctx, total_sz );
1002 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1003 0 : ctx->data = start_data;
1004 0 : return err;
1005 0 : }
1006 0 : static void fd_solana_account_meta_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1007 0 : fd_solana_account_meta_t * self = (fd_solana_account_meta_t *)struct_mem;
1008 0 : fd_bincode_uint64_decode_unsafe( &self->lamports, ctx );
1009 0 : fd_bincode_uint64_decode_unsafe( &self->rent_epoch, ctx );
1010 0 : fd_bincode_bytes_decode_unsafe( &self->owner[0], sizeof(self->owner), ctx );
1011 0 : fd_bincode_bool_decode_unsafe( &self->executable, ctx );
1012 0 : fd_bincode_bytes_decode_unsafe( self->padding, 3, ctx );
1013 0 : }
1014 0 : void * fd_solana_account_meta_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1015 0 : fd_solana_account_meta_t * self = (fd_solana_account_meta_t *)mem;
1016 0 : fd_solana_account_meta_new( self );
1017 0 : void * alloc_region = (uchar *)mem + sizeof(fd_solana_account_meta_t);
1018 0 : void * * alloc_mem = &alloc_region;
1019 0 : fd_solana_account_meta_decode_inner( mem, alloc_mem, ctx );
1020 0 : return self;
1021 0 : }
1022 0 : void fd_solana_account_meta_new(fd_solana_account_meta_t * self) {
1023 0 : fd_memset( self, 0, sizeof(fd_solana_account_meta_t) );
1024 0 : }
1025 0 : void fd_solana_account_meta_walk( void * w, fd_solana_account_meta_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
1026 0 : (void) varint;
1027 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_solana_account_meta", level++, 0 );
1028 0 : fun( w, &self->lamports, "lamports", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
1029 0 : fun( w, &self->rent_epoch, "rent_epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
1030 0 : fun( w, self->owner, "owner", FD_FLAMENCO_TYPE_HASH256, "uchar[32]", level, 0 );
1031 0 : fun( w, &self->executable, "executable", FD_FLAMENCO_TYPE_BOOL, "bool", level, 0 );
1032 0 : fun(w, self->padding, "padding", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
1033 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_solana_account_meta", level--, 0 );
1034 0 : }
1035 0 : int fd_solana_account_hdr_encode( fd_solana_account_hdr_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1036 0 : int err;
1037 0 : err = fd_solana_account_stored_meta_encode( &self->meta, ctx );
1038 0 : if( FD_UNLIKELY( err ) ) return err;
1039 0 : err = fd_solana_account_meta_encode( &self->info, ctx );
1040 0 : if( FD_UNLIKELY( err ) ) return err;
1041 0 : err = fd_bincode_bytes_encode( self->padding, 4, ctx );
1042 0 : if( FD_UNLIKELY( err ) ) return err;
1043 0 : err = fd_hash_encode( &self->hash, ctx );
1044 0 : if( FD_UNLIKELY( err ) ) return err;
1045 0 : return FD_BINCODE_SUCCESS;
1046 0 : }
1047 0 : static int fd_solana_account_hdr_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1048 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1049 0 : int err = 0;
1050 0 : err = fd_solana_account_stored_meta_decode_footprint_inner( ctx, total_sz );
1051 0 : if( FD_UNLIKELY( err ) ) return err;
1052 0 : err = fd_solana_account_meta_decode_footprint_inner( ctx, total_sz );
1053 0 : if( FD_UNLIKELY( err ) ) return err;
1054 0 : err = fd_bincode_bytes_decode_footprint( 4, ctx );
1055 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1056 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
1057 0 : if( FD_UNLIKELY( err ) ) return err;
1058 0 : return 0;
1059 0 : }
1060 0 : int fd_solana_account_hdr_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1061 0 : *total_sz += sizeof(fd_solana_account_hdr_t);
1062 0 : void const * start_data = ctx->data;
1063 0 : int err = fd_solana_account_hdr_decode_footprint_inner( ctx, total_sz );
1064 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1065 0 : ctx->data = start_data;
1066 0 : return err;
1067 0 : }
1068 0 : static void fd_solana_account_hdr_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1069 0 : fd_solana_account_hdr_t * self = (fd_solana_account_hdr_t *)struct_mem;
1070 0 : fd_solana_account_stored_meta_decode_inner( &self->meta, alloc_mem, ctx );
1071 0 : fd_solana_account_meta_decode_inner( &self->info, alloc_mem, ctx );
1072 0 : fd_bincode_bytes_decode_unsafe( self->padding, 4, ctx );
1073 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
1074 0 : }
1075 0 : void * fd_solana_account_hdr_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1076 0 : fd_solana_account_hdr_t * self = (fd_solana_account_hdr_t *)mem;
1077 0 : fd_solana_account_hdr_new( self );
1078 0 : void * alloc_region = (uchar *)mem + sizeof(fd_solana_account_hdr_t);
1079 0 : void * * alloc_mem = &alloc_region;
1080 0 : fd_solana_account_hdr_decode_inner( mem, alloc_mem, ctx );
1081 0 : return self;
1082 0 : }
1083 0 : void fd_solana_account_hdr_new(fd_solana_account_hdr_t * self) {
1084 0 : fd_memset( self, 0, sizeof(fd_solana_account_hdr_t) );
1085 0 : fd_solana_account_stored_meta_new( &self->meta );
1086 0 : fd_solana_account_meta_new( &self->info );
1087 0 : fd_hash_new( &self->hash );
1088 0 : }
1089 0 : void fd_solana_account_hdr_walk( void * w, fd_solana_account_hdr_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
1090 0 : (void) varint;
1091 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_solana_account_hdr", level++, 0 );
1092 0 : fd_solana_account_stored_meta_walk( w, &self->meta, fun, "meta", level, 0 );
1093 0 : fd_solana_account_meta_walk( w, &self->info, fun, "info", level, 0 );
1094 0 : fun(w, self->padding, "padding", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
1095 0 : fd_hash_walk( w, &self->hash, fun, "hash", level, 0 );
1096 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_solana_account_hdr", level--, 0 );
1097 0 : }
1098 12 : int fd_delegation_encode( fd_delegation_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1099 12 : int err;
1100 12 : err = fd_pubkey_encode( &self->voter_pubkey, ctx );
1101 12 : if( FD_UNLIKELY( err ) ) return err;
1102 12 : err = fd_bincode_uint64_encode( self->stake, ctx );
1103 12 : if( FD_UNLIKELY( err ) ) return err;
1104 12 : err = fd_bincode_uint64_encode( self->activation_epoch, ctx );
1105 12 : if( FD_UNLIKELY( err ) ) return err;
1106 12 : err = fd_bincode_uint64_encode( self->deactivation_epoch, ctx );
1107 12 : if( FD_UNLIKELY( err ) ) return err;
1108 12 : err = fd_bincode_double_encode( self->warmup_cooldown_rate, ctx );
1109 12 : if( FD_UNLIKELY( err ) ) return err;
1110 12 : return FD_BINCODE_SUCCESS;
1111 12 : }
1112 0 : static inline int fd_delegation_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1113 0 : if( (ulong)ctx->data + 64UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1114 0 : ctx->data = (void *)( (ulong)ctx->data + 64UL );
1115 0 : return 0;
1116 0 : }
1117 0 : static void fd_delegation_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1118 0 : fd_delegation_t * self = (fd_delegation_t *)struct_mem;
1119 0 : fd_pubkey_decode_inner( &self->voter_pubkey, alloc_mem, ctx );
1120 0 : fd_bincode_uint64_decode_unsafe( &self->stake, ctx );
1121 0 : fd_bincode_uint64_decode_unsafe( &self->activation_epoch, ctx );
1122 0 : fd_bincode_uint64_decode_unsafe( &self->deactivation_epoch, ctx );
1123 0 : fd_bincode_double_decode_unsafe( &self->warmup_cooldown_rate, ctx );
1124 0 : }
1125 0 : void * fd_delegation_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1126 0 : fd_delegation_t * self = (fd_delegation_t *)mem;
1127 0 : fd_delegation_new( self );
1128 0 : void * alloc_region = (uchar *)mem + sizeof(fd_delegation_t);
1129 0 : void * * alloc_mem = &alloc_region;
1130 0 : fd_delegation_decode_inner( mem, alloc_mem, ctx );
1131 0 : return self;
1132 0 : }
1133 0 : void fd_delegation_walk( void * w, fd_delegation_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
1134 0 : (void) varint;
1135 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_delegation", level++, 0 );
1136 0 : fd_pubkey_walk( w, &self->voter_pubkey, fun, "voter_pubkey", level, 0 );
1137 0 : fun( w, &self->stake, "stake", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
1138 0 : fun( w, &self->activation_epoch, "activation_epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
1139 0 : fun( w, &self->deactivation_epoch, "deactivation_epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
1140 0 : fun( w, &self->warmup_cooldown_rate, "warmup_cooldown_rate", FD_FLAMENCO_TYPE_DOUBLE, "double", level, 0 );
1141 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_delegation", level--, 0 );
1142 0 : }
1143 12 : int fd_stake_encode( fd_stake_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1144 12 : int err;
1145 12 : err = fd_delegation_encode( &self->delegation, ctx );
1146 12 : if( FD_UNLIKELY( err ) ) return err;
1147 12 : err = fd_bincode_uint64_encode( self->credits_observed, ctx );
1148 12 : if( FD_UNLIKELY( err ) ) return err;
1149 12 : return FD_BINCODE_SUCCESS;
1150 12 : }
1151 0 : static inline int fd_stake_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1152 0 : if( (ulong)ctx->data + 72UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1153 0 : ctx->data = (void *)( (ulong)ctx->data + 72UL );
1154 0 : return 0;
1155 0 : }
1156 0 : static void fd_stake_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1157 0 : fd_stake_t * self = (fd_stake_t *)struct_mem;
1158 0 : fd_delegation_decode_inner( &self->delegation, alloc_mem, ctx );
1159 0 : fd_bincode_uint64_decode_unsafe( &self->credits_observed, ctx );
1160 0 : }
1161 0 : void * fd_stake_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1162 0 : fd_stake_t * self = (fd_stake_t *)mem;
1163 0 : fd_stake_new( self );
1164 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_t);
1165 0 : void * * alloc_mem = &alloc_region;
1166 0 : fd_stake_decode_inner( mem, alloc_mem, ctx );
1167 0 : return self;
1168 0 : }
1169 0 : void fd_stake_walk( void * w, fd_stake_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
1170 0 : (void) varint;
1171 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake", level++, 0 );
1172 0 : fd_delegation_walk( w, &self->delegation, fun, "delegation", level, 0 );
1173 0 : fun( w, &self->credits_observed, "credits_observed", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
1174 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake", level--, 0 );
1175 0 : }
1176 0 : FD_FN_PURE uchar fd_reward_type_is_fee(fd_reward_type_t const * self) {
1177 0 : return self->discriminant == 0;
1178 0 : }
1179 0 : FD_FN_PURE uchar fd_reward_type_is_rent(fd_reward_type_t const * self) {
1180 0 : return self->discriminant == 1;
1181 0 : }
1182 0 : FD_FN_PURE uchar fd_reward_type_is_staking(fd_reward_type_t const * self) {
1183 0 : return self->discriminant == 2;
1184 0 : }
1185 0 : FD_FN_PURE uchar fd_reward_type_is_voting(fd_reward_type_t const * self) {
1186 0 : return self->discriminant == 3;
1187 0 : }
1188 0 : int fd_reward_type_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1189 0 : int err;
1190 0 : switch (discriminant) {
1191 0 : case 0: {
1192 0 : return FD_BINCODE_SUCCESS;
1193 0 : }
1194 0 : case 1: {
1195 0 : return FD_BINCODE_SUCCESS;
1196 0 : }
1197 0 : case 2: {
1198 0 : return FD_BINCODE_SUCCESS;
1199 0 : }
1200 0 : case 3: {
1201 0 : return FD_BINCODE_SUCCESS;
1202 0 : }
1203 0 : default: return FD_BINCODE_ERR_ENCODING;
1204 0 : }
1205 0 : }
1206 0 : static int fd_reward_type_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1207 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1208 0 : uint discriminant = 0;
1209 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
1210 0 : if( FD_UNLIKELY( err ) ) return err;
1211 0 : return fd_reward_type_inner_decode_footprint( discriminant, ctx, total_sz );
1212 0 : }
1213 0 : int fd_reward_type_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1214 0 : *total_sz += sizeof(fd_reward_type_t);
1215 0 : void const * start_data = ctx->data;
1216 0 : int err = fd_reward_type_decode_footprint_inner( ctx, total_sz );
1217 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1218 0 : ctx->data = start_data;
1219 0 : return err;
1220 0 : }
1221 0 : static void fd_reward_type_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1222 0 : fd_reward_type_t * self = (fd_reward_type_t *)struct_mem;
1223 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
1224 0 : }
1225 0 : void * fd_reward_type_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1226 0 : fd_reward_type_t * self = (fd_reward_type_t *)mem;
1227 0 : fd_reward_type_new( self );
1228 0 : void * alloc_region = (uchar *)mem + sizeof(fd_reward_type_t);
1229 0 : void * * alloc_mem = &alloc_region;
1230 0 : fd_reward_type_decode_inner( mem, alloc_mem, ctx );
1231 0 : return self;
1232 0 : }
1233 :
1234 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, uint varint ) {
1235 0 : (void) varint;
1236 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_reward_type", level++, 0);
1237 0 : switch( self->discriminant ) {
1238 0 : case 0: {
1239 0 : fun( w, self, "fee", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
1240 0 : break;
1241 0 : }
1242 0 : case 1: {
1243 0 : fun( w, self, "rent", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
1244 0 : break;
1245 0 : }
1246 0 : case 2: {
1247 0 : fun( w, self, "staking", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
1248 0 : break;
1249 0 : }
1250 0 : case 3: {
1251 0 : fun( w, self, "voting", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
1252 0 : break;
1253 0 : }
1254 0 : }
1255 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_reward_type", level--, 0 );
1256 0 : }
1257 0 : ulong fd_reward_type_size( fd_reward_type_t const * self ) {
1258 0 : ulong size = 0;
1259 0 : size += sizeof(uint);
1260 0 : switch (self->discriminant) {
1261 0 : }
1262 0 : return size;
1263 0 : }
1264 :
1265 0 : int fd_reward_type_encode( fd_reward_type_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1266 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
1267 0 : if( FD_UNLIKELY( err ) ) return err;
1268 0 : return err;
1269 0 : }
1270 :
1271 0 : int fd_reward_info_encode( fd_reward_info_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1272 0 : int err;
1273 0 : err = fd_reward_type_encode( &self->reward_type, ctx );
1274 0 : if( FD_UNLIKELY( err ) ) return err;
1275 0 : err = fd_bincode_uint64_encode( self->lamports, ctx );
1276 0 : if( FD_UNLIKELY( err ) ) return err;
1277 0 : err = fd_bincode_uint64_encode( self->post_balance, ctx );
1278 0 : if( FD_UNLIKELY( err ) ) return err;
1279 0 : err = fd_bincode_uint64_encode( self->commission, ctx );
1280 0 : if( FD_UNLIKELY( err ) ) return err;
1281 0 : return FD_BINCODE_SUCCESS;
1282 0 : }
1283 0 : static int fd_reward_info_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1284 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1285 0 : int err = 0;
1286 0 : err = fd_reward_type_decode_footprint_inner( ctx, total_sz );
1287 0 : if( FD_UNLIKELY( err ) ) return err;
1288 0 : err = fd_bincode_uint64_decode_footprint( ctx );
1289 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1290 0 : err = fd_bincode_uint64_decode_footprint( ctx );
1291 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1292 0 : err = fd_bincode_uint64_decode_footprint( ctx );
1293 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1294 0 : return 0;
1295 0 : }
1296 0 : int fd_reward_info_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1297 0 : *total_sz += sizeof(fd_reward_info_t);
1298 0 : void const * start_data = ctx->data;
1299 0 : int err = fd_reward_info_decode_footprint_inner( ctx, total_sz );
1300 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1301 0 : ctx->data = start_data;
1302 0 : return err;
1303 0 : }
1304 0 : static void fd_reward_info_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1305 0 : fd_reward_info_t * self = (fd_reward_info_t *)struct_mem;
1306 0 : fd_reward_type_decode_inner( &self->reward_type, alloc_mem, ctx );
1307 0 : fd_bincode_uint64_decode_unsafe( &self->lamports, ctx );
1308 0 : fd_bincode_uint64_decode_unsafe( &self->post_balance, ctx );
1309 0 : fd_bincode_uint64_decode_unsafe( &self->commission, ctx );
1310 0 : }
1311 0 : void * fd_reward_info_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1312 0 : fd_reward_info_t * self = (fd_reward_info_t *)mem;
1313 0 : fd_reward_info_new( self );
1314 0 : void * alloc_region = (uchar *)mem + sizeof(fd_reward_info_t);
1315 0 : void * * alloc_mem = &alloc_region;
1316 0 : fd_reward_info_decode_inner( mem, alloc_mem, ctx );
1317 0 : return self;
1318 0 : }
1319 0 : void fd_reward_info_new(fd_reward_info_t * self) {
1320 0 : fd_memset( self, 0, sizeof(fd_reward_info_t) );
1321 0 : fd_reward_type_new( &self->reward_type );
1322 0 : }
1323 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, uint varint ) {
1324 0 : (void) varint;
1325 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_reward_info", level++, 0 );
1326 0 : fd_reward_type_walk( w, &self->reward_type, fun, "reward_type", level, 0 );
1327 0 : fun( w, &self->lamports, "lamports", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
1328 0 : fun( w, &self->post_balance, "post_balance", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
1329 0 : fun( w, &self->commission, "commission", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
1330 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_reward_info", level--, 0 );
1331 0 : }
1332 9 : int fd_rust_duration_encode( fd_rust_duration_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1333 9 : int err;
1334 9 : err = fd_bincode_uint64_encode( self->seconds, ctx );
1335 9 : if( FD_UNLIKELY( err ) ) return err;
1336 9 : err = fd_bincode_uint32_encode( self->nanoseconds, ctx );
1337 9 : if( FD_UNLIKELY( err ) ) return err;
1338 9 : return FD_BINCODE_SUCCESS;
1339 9 : }
1340 0 : static inline int fd_rust_duration_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1341 0 : if( (ulong)ctx->data + 12UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1342 0 : int err = fd_rust_duration_footprint_validator( ctx );
1343 0 : if( FD_UNLIKELY( err != FD_BINCODE_SUCCESS ) )
1344 0 : return err;
1345 0 : ctx->data = (void *)( (ulong)ctx->data + 12UL );
1346 0 : return 0;
1347 0 : }
1348 0 : static void fd_rust_duration_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1349 0 : fd_rust_duration_t * self = (fd_rust_duration_t *)struct_mem;
1350 0 : fd_bincode_uint64_decode_unsafe( &self->seconds, ctx );
1351 0 : fd_bincode_uint32_decode_unsafe( &self->nanoseconds, ctx );
1352 0 : fd_rust_duration_normalize( self );
1353 0 : }
1354 0 : void * fd_rust_duration_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1355 0 : fd_rust_duration_t * self = (fd_rust_duration_t *)mem;
1356 0 : fd_rust_duration_new( self );
1357 0 : void * alloc_region = (uchar *)mem + sizeof(fd_rust_duration_t);
1358 0 : void * * alloc_mem = &alloc_region;
1359 0 : fd_rust_duration_decode_inner( mem, alloc_mem, ctx );
1360 0 : return self;
1361 0 : }
1362 0 : void fd_rust_duration_walk( void * w, fd_rust_duration_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
1363 0 : (void) varint;
1364 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_rust_duration", level++, 0 );
1365 0 : fun( w, &self->seconds, "seconds", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
1366 0 : fun( w, &self->nanoseconds, "nanoseconds", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
1367 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_rust_duration", level--, 0 );
1368 0 : }
1369 9 : int fd_poh_config_encode( fd_poh_config_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1370 9 : int err;
1371 9 : err = fd_rust_duration_encode( &self->target_tick_duration, ctx );
1372 9 : if( FD_UNLIKELY( err ) ) return err;
1373 9 : err = fd_bincode_bool_encode( self->has_target_tick_count, ctx );
1374 9 : if( FD_UNLIKELY( err ) ) return err;
1375 9 : if( self->has_target_tick_count ) {
1376 0 : err = fd_bincode_uint64_encode( self->target_tick_count, ctx );
1377 0 : if( FD_UNLIKELY( err ) ) return err;
1378 0 : }
1379 9 : err = fd_bincode_bool_encode( self->has_hashes_per_tick, ctx );
1380 9 : if( FD_UNLIKELY( err ) ) return err;
1381 9 : if( self->has_hashes_per_tick ) {
1382 0 : err = fd_bincode_uint64_encode( self->hashes_per_tick, ctx );
1383 0 : if( FD_UNLIKELY( err ) ) return err;
1384 0 : }
1385 9 : return FD_BINCODE_SUCCESS;
1386 9 : }
1387 0 : int fd_poh_config_encode_global( fd_poh_config_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1388 0 : int err;
1389 0 : err = fd_rust_duration_encode( &self->target_tick_duration, ctx );
1390 0 : if( FD_UNLIKELY( err ) ) return err;
1391 0 : err = fd_bincode_bool_encode( self->has_target_tick_count, ctx );
1392 0 : if( FD_UNLIKELY( err ) ) return err;
1393 0 : if( self->has_target_tick_count ) {
1394 0 : err = fd_bincode_uint64_encode( self->target_tick_count, ctx );
1395 0 : if( FD_UNLIKELY( err ) ) return err;
1396 0 : }
1397 0 : err = fd_bincode_bool_encode( self->has_hashes_per_tick, ctx );
1398 0 : if( FD_UNLIKELY( err ) ) return err;
1399 0 : if( self->has_hashes_per_tick ) {
1400 0 : err = fd_bincode_uint64_encode( self->hashes_per_tick, ctx );
1401 0 : if( FD_UNLIKELY( err ) ) return err;
1402 0 : }
1403 0 : return FD_BINCODE_SUCCESS;
1404 0 : }
1405 0 : static int fd_poh_config_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1406 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1407 0 : int err = 0;
1408 0 : err = fd_rust_duration_decode_footprint_inner( ctx, total_sz );
1409 0 : if( FD_UNLIKELY( err ) ) return err;
1410 0 : {
1411 0 : uchar o;
1412 0 : err = fd_bincode_bool_decode( &o, ctx );
1413 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1414 0 : if( o ) {
1415 0 : err = fd_bincode_uint64_decode_footprint( ctx );
1416 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1417 0 : }
1418 0 : }
1419 0 : {
1420 0 : uchar o;
1421 0 : err = fd_bincode_bool_decode( &o, ctx );
1422 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1423 0 : if( o ) {
1424 0 : err = fd_bincode_uint64_decode_footprint( ctx );
1425 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1426 0 : }
1427 0 : }
1428 0 : return 0;
1429 0 : }
1430 0 : int fd_poh_config_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1431 0 : *total_sz += sizeof(fd_poh_config_t);
1432 0 : void const * start_data = ctx->data;
1433 0 : int err = fd_poh_config_decode_footprint_inner( ctx, total_sz );
1434 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1435 0 : ctx->data = start_data;
1436 0 : return err;
1437 0 : }
1438 0 : static void fd_poh_config_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1439 0 : fd_poh_config_t * self = (fd_poh_config_t *)struct_mem;
1440 0 : fd_rust_duration_decode_inner( &self->target_tick_duration, alloc_mem, ctx );
1441 0 : {
1442 0 : uchar o;
1443 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
1444 0 : self->has_target_tick_count = !!o;
1445 0 : if( o ) {
1446 0 : fd_bincode_uint64_decode_unsafe( &self->target_tick_count, ctx );
1447 0 : }
1448 0 : }
1449 0 : {
1450 0 : uchar o;
1451 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
1452 0 : self->has_hashes_per_tick = !!o;
1453 0 : if( o ) {
1454 0 : fd_bincode_uint64_decode_unsafe( &self->hashes_per_tick, ctx );
1455 0 : }
1456 0 : }
1457 0 : }
1458 0 : void * fd_poh_config_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1459 0 : fd_poh_config_t * self = (fd_poh_config_t *)mem;
1460 0 : fd_poh_config_new( self );
1461 0 : void * alloc_region = (uchar *)mem + sizeof(fd_poh_config_t);
1462 0 : void * * alloc_mem = &alloc_region;
1463 0 : fd_poh_config_decode_inner( mem, alloc_mem, ctx );
1464 0 : return self;
1465 0 : }
1466 0 : static void fd_poh_config_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1467 0 : fd_poh_config_global_t * self = (fd_poh_config_global_t *)struct_mem;
1468 0 : fd_rust_duration_decode_inner( &self->target_tick_duration, alloc_mem, ctx );
1469 0 : {
1470 0 : uchar o;
1471 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
1472 0 : self->has_target_tick_count = !!o;
1473 0 : if( o ) {
1474 0 : fd_bincode_uint64_decode_unsafe( &self->target_tick_count, ctx );
1475 0 : }
1476 0 : }
1477 0 : {
1478 0 : uchar o;
1479 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
1480 0 : self->has_hashes_per_tick = !!o;
1481 0 : if( o ) {
1482 0 : fd_bincode_uint64_decode_unsafe( &self->hashes_per_tick, ctx );
1483 0 : }
1484 0 : }
1485 0 : }
1486 0 : void * fd_poh_config_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1487 0 : fd_poh_config_global_t * self = (fd_poh_config_global_t *)mem;
1488 0 : fd_poh_config_new( (fd_poh_config_t *)self );
1489 0 : void * alloc_region = (uchar *)mem + sizeof(fd_poh_config_global_t);
1490 0 : void * * alloc_mem = &alloc_region;
1491 0 : fd_poh_config_decode_inner_global( mem, alloc_mem, ctx );
1492 0 : return self;
1493 0 : }
1494 12 : void fd_poh_config_new(fd_poh_config_t * self) {
1495 12 : fd_memset( self, 0, sizeof(fd_poh_config_t) );
1496 12 : fd_rust_duration_new( &self->target_tick_duration );
1497 12 : }
1498 0 : void fd_poh_config_walk( void * w, fd_poh_config_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
1499 0 : (void) varint;
1500 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_poh_config", level++, 0 );
1501 0 : fd_rust_duration_walk( w, &self->target_tick_duration, fun, "target_tick_duration", level, 0 );
1502 0 : if( !self->has_target_tick_count ) {
1503 0 : fun( w, NULL, "target_tick_count", FD_FLAMENCO_TYPE_NULL, "ulong", level, 0 );
1504 0 : } else {
1505 0 : fun( w, &self->target_tick_count, "target_tick_count", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
1506 0 : }
1507 0 : if( !self->has_hashes_per_tick ) {
1508 0 : fun( w, NULL, "hashes_per_tick", FD_FLAMENCO_TYPE_NULL, "ulong", level, 0 );
1509 0 : } else {
1510 0 : fun( w, &self->hashes_per_tick, "hashes_per_tick", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
1511 0 : }
1512 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_poh_config", level--, 0 );
1513 0 : }
1514 0 : ulong fd_poh_config_size( fd_poh_config_t const * self ) {
1515 0 : ulong size = 0;
1516 0 : size += fd_rust_duration_size( &self->target_tick_duration );
1517 0 : size += sizeof(char);
1518 0 : if( self->has_target_tick_count ) {
1519 0 : size += sizeof(ulong);
1520 0 : }
1521 0 : size += sizeof(char);
1522 0 : if( self->has_hashes_per_tick ) {
1523 0 : size += sizeof(ulong);
1524 0 : }
1525 0 : return size;
1526 0 : }
1527 :
1528 0 : ulong fd_poh_config_size_global( fd_poh_config_global_t const * self ) {
1529 0 : ulong size = 0;
1530 0 : size += fd_rust_duration_size( &self->target_tick_duration );
1531 0 : size += sizeof(char);
1532 0 : if( self->has_target_tick_count ) {
1533 0 : size += sizeof(ulong);
1534 0 : }
1535 0 : size += sizeof(char);
1536 0 : if( self->has_hashes_per_tick ) {
1537 0 : size += sizeof(ulong);
1538 0 : }
1539 0 : return size;
1540 0 : }
1541 :
1542 0 : int fd_string_pubkey_pair_encode( fd_string_pubkey_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1543 0 : int err;
1544 0 : err = fd_bincode_uint64_encode( self->string_len, ctx );
1545 0 : if( FD_UNLIKELY(err) ) return err;
1546 0 : if( self->string_len ) {
1547 0 : err = fd_bincode_bytes_encode( self->string, self->string_len, ctx );
1548 0 : if( FD_UNLIKELY( err ) ) return err;
1549 0 : }
1550 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
1551 0 : if( FD_UNLIKELY( err ) ) return err;
1552 0 : return FD_BINCODE_SUCCESS;
1553 0 : }
1554 0 : int fd_string_pubkey_pair_encode_global( fd_string_pubkey_pair_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1555 0 : int err;
1556 0 : err = fd_bincode_uint64_encode( self->string_len, ctx );
1557 0 : if( FD_UNLIKELY( err ) ) return err;
1558 0 : if( self->string_len ) {
1559 0 : uchar * string_laddr = (uchar*)self + self->string_offset;
1560 0 : err = fd_bincode_bytes_encode( string_laddr, self->string_len, ctx );
1561 0 : if( FD_UNLIKELY( err ) ) return err;
1562 0 : }
1563 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
1564 0 : if( FD_UNLIKELY( err ) ) return err;
1565 0 : return FD_BINCODE_SUCCESS;
1566 0 : }
1567 0 : static int fd_string_pubkey_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1568 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1569 0 : int err = 0;
1570 0 : ulong string_len;
1571 0 : err = fd_bincode_uint64_decode( &string_len, ctx );
1572 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1573 0 : *total_sz += string_len;
1574 0 : if( string_len ) {
1575 0 : err = fd_bincode_bytes_decode_footprint( string_len, ctx );
1576 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1577 0 : err = !fd_utf8_verify( (char const *) ctx->data - string_len, string_len );
1578 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1579 0 : }
1580 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
1581 0 : if( FD_UNLIKELY( err ) ) return err;
1582 0 : return 0;
1583 0 : }
1584 0 : int fd_string_pubkey_pair_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1585 0 : *total_sz += sizeof(fd_string_pubkey_pair_t);
1586 0 : void const * start_data = ctx->data;
1587 0 : int err = fd_string_pubkey_pair_decode_footprint_inner( ctx, total_sz );
1588 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1589 0 : ctx->data = start_data;
1590 0 : return err;
1591 0 : }
1592 0 : static void fd_string_pubkey_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1593 0 : fd_string_pubkey_pair_t * self = (fd_string_pubkey_pair_t *)struct_mem;
1594 0 : fd_bincode_uint64_decode_unsafe( &self->string_len, ctx );
1595 0 : if( self->string_len ) {
1596 0 : self->string = *alloc_mem;
1597 0 : fd_bincode_bytes_decode_unsafe( self->string, self->string_len, ctx );
1598 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->string_len;
1599 0 : } else
1600 0 : self->string = NULL;
1601 0 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
1602 0 : }
1603 0 : void * fd_string_pubkey_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1604 0 : fd_string_pubkey_pair_t * self = (fd_string_pubkey_pair_t *)mem;
1605 0 : fd_string_pubkey_pair_new( self );
1606 0 : void * alloc_region = (uchar *)mem + sizeof(fd_string_pubkey_pair_t);
1607 0 : void * * alloc_mem = &alloc_region;
1608 0 : fd_string_pubkey_pair_decode_inner( mem, alloc_mem, ctx );
1609 0 : return self;
1610 0 : }
1611 0 : static void fd_string_pubkey_pair_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1612 0 : fd_string_pubkey_pair_global_t * self = (fd_string_pubkey_pair_global_t *)struct_mem;
1613 0 : fd_bincode_uint64_decode_unsafe( &self->string_len, ctx );
1614 0 : if( self->string_len ) {
1615 0 : self->string_offset = (ulong)*alloc_mem - (ulong)struct_mem;
1616 0 : fd_bincode_bytes_decode_unsafe( *alloc_mem, self->string_len, ctx );
1617 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->string_len;
1618 0 : } else {
1619 0 : self->string_offset = 0UL;
1620 0 : }
1621 0 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
1622 0 : }
1623 0 : void * fd_string_pubkey_pair_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1624 0 : fd_string_pubkey_pair_global_t * self = (fd_string_pubkey_pair_global_t *)mem;
1625 0 : fd_string_pubkey_pair_new( (fd_string_pubkey_pair_t *)self );
1626 0 : void * alloc_region = (uchar *)mem + sizeof(fd_string_pubkey_pair_global_t);
1627 0 : void * * alloc_mem = &alloc_region;
1628 0 : fd_string_pubkey_pair_decode_inner_global( mem, alloc_mem, ctx );
1629 0 : return self;
1630 0 : }
1631 0 : void fd_string_pubkey_pair_new(fd_string_pubkey_pair_t * self) {
1632 0 : fd_memset( self, 0, sizeof(fd_string_pubkey_pair_t) );
1633 0 : fd_pubkey_new( &self->pubkey );
1634 0 : }
1635 0 : void fd_string_pubkey_pair_walk( void * w, fd_string_pubkey_pair_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
1636 0 : (void) varint;
1637 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_string_pubkey_pair", level++, 0 );
1638 0 : if( self->string_len ) {
1639 0 : fun( w, NULL, "string", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
1640 0 : for( ulong i=0; i < self->string_len; i++ )
1641 0 : fun( w, self->string + i, "string", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
1642 0 : fun( w, NULL, "string", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
1643 0 : }
1644 0 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level, 0 );
1645 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_string_pubkey_pair", level--, 0 );
1646 0 : }
1647 0 : ulong fd_string_pubkey_pair_size( fd_string_pubkey_pair_t const * self ) {
1648 0 : ulong size = 0;
1649 0 : do {
1650 0 : size += sizeof(ulong);
1651 0 : size += self->string_len;
1652 0 : } while(0);
1653 0 : size += fd_pubkey_size( &self->pubkey );
1654 0 : return size;
1655 0 : }
1656 :
1657 0 : ulong fd_string_pubkey_pair_size_global( fd_string_pubkey_pair_global_t const * self ) {
1658 0 : ulong size = 0;
1659 0 : do {
1660 0 : size += sizeof(ulong);
1661 0 : uchar * string = self->string_offset ? (uchar *)fd_type_pun( (uchar *)self + self->string_offset ) : NULL;
1662 0 : size += self->string_len;
1663 0 : } while(0);
1664 0 : size += fd_pubkey_size( &self->pubkey );
1665 0 : return size;
1666 0 : }
1667 :
1668 144 : int fd_pubkey_account_pair_encode( fd_pubkey_account_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1669 144 : int err;
1670 144 : err = fd_pubkey_encode( &self->key, ctx );
1671 144 : if( FD_UNLIKELY( err ) ) return err;
1672 144 : err = fd_solana_account_encode( &self->account, ctx );
1673 144 : if( FD_UNLIKELY( err ) ) return err;
1674 144 : return FD_BINCODE_SUCCESS;
1675 144 : }
1676 0 : int fd_pubkey_account_pair_encode_global( fd_pubkey_account_pair_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1677 0 : int err;
1678 0 : err = fd_pubkey_encode( &self->key, ctx );
1679 0 : if( FD_UNLIKELY( err ) ) return err;
1680 0 : err = fd_solana_account_encode_global( &self->account, ctx );
1681 0 : if( FD_UNLIKELY( err ) ) return err;
1682 0 : return FD_BINCODE_SUCCESS;
1683 0 : }
1684 0 : static int fd_pubkey_account_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1685 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1686 0 : int err = 0;
1687 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
1688 0 : if( FD_UNLIKELY( err ) ) return err;
1689 0 : err = fd_solana_account_decode_footprint_inner( ctx, total_sz );
1690 0 : if( FD_UNLIKELY( err ) ) return err;
1691 0 : return 0;
1692 0 : }
1693 0 : int fd_pubkey_account_pair_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1694 0 : *total_sz += sizeof(fd_pubkey_account_pair_t);
1695 0 : void const * start_data = ctx->data;
1696 0 : int err = fd_pubkey_account_pair_decode_footprint_inner( ctx, total_sz );
1697 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1698 0 : ctx->data = start_data;
1699 0 : return err;
1700 0 : }
1701 0 : static void fd_pubkey_account_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1702 0 : fd_pubkey_account_pair_t * self = (fd_pubkey_account_pair_t *)struct_mem;
1703 0 : fd_pubkey_decode_inner( &self->key, alloc_mem, ctx );
1704 0 : fd_solana_account_decode_inner( &self->account, alloc_mem, ctx );
1705 0 : }
1706 0 : void * fd_pubkey_account_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1707 0 : fd_pubkey_account_pair_t * self = (fd_pubkey_account_pair_t *)mem;
1708 0 : fd_pubkey_account_pair_new( self );
1709 0 : void * alloc_region = (uchar *)mem + sizeof(fd_pubkey_account_pair_t);
1710 0 : void * * alloc_mem = &alloc_region;
1711 0 : fd_pubkey_account_pair_decode_inner( mem, alloc_mem, ctx );
1712 0 : return self;
1713 0 : }
1714 0 : static void fd_pubkey_account_pair_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1715 0 : fd_pubkey_account_pair_global_t * self = (fd_pubkey_account_pair_global_t *)struct_mem;
1716 0 : fd_pubkey_decode_inner( &self->key, alloc_mem, ctx );
1717 0 : fd_solana_account_decode_inner_global( &self->account, alloc_mem, ctx );
1718 0 : }
1719 0 : void * fd_pubkey_account_pair_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1720 0 : fd_pubkey_account_pair_global_t * self = (fd_pubkey_account_pair_global_t *)mem;
1721 0 : fd_pubkey_account_pair_new( (fd_pubkey_account_pair_t *)self );
1722 0 : void * alloc_region = (uchar *)mem + sizeof(fd_pubkey_account_pair_global_t);
1723 0 : void * * alloc_mem = &alloc_region;
1724 0 : fd_pubkey_account_pair_decode_inner_global( mem, alloc_mem, ctx );
1725 0 : return self;
1726 0 : }
1727 0 : void fd_pubkey_account_pair_new(fd_pubkey_account_pair_t * self) {
1728 0 : fd_memset( self, 0, sizeof(fd_pubkey_account_pair_t) );
1729 0 : fd_pubkey_new( &self->key );
1730 0 : fd_solana_account_new( &self->account );
1731 0 : }
1732 0 : void fd_pubkey_account_pair_walk( void * w, fd_pubkey_account_pair_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
1733 0 : (void) varint;
1734 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_pubkey_account_pair", level++, 0 );
1735 0 : fd_pubkey_walk( w, &self->key, fun, "key", level, 0 );
1736 0 : fd_solana_account_walk( w, &self->account, fun, "account", level, 0 );
1737 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_pubkey_account_pair", level--, 0 );
1738 0 : }
1739 0 : ulong fd_pubkey_account_pair_size( fd_pubkey_account_pair_t const * self ) {
1740 0 : ulong size = 0;
1741 0 : size += fd_pubkey_size( &self->key );
1742 0 : size += fd_solana_account_size( &self->account );
1743 0 : return size;
1744 0 : }
1745 :
1746 0 : ulong fd_pubkey_account_pair_size_global( fd_pubkey_account_pair_global_t const * self ) {
1747 0 : ulong size = 0;
1748 0 : size += fd_pubkey_size( &self->key );
1749 0 : size += fd_solana_account_size_global( &self->account );
1750 0 : return size;
1751 0 : }
1752 :
1753 12 : int fd_genesis_solana_encode( fd_genesis_solana_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1754 12 : int err;
1755 12 : err = fd_bincode_uint64_encode( self->creation_time, ctx );
1756 12 : if( FD_UNLIKELY( err ) ) return err;
1757 9 : err = fd_bincode_uint64_encode( self->accounts_len, ctx );
1758 9 : if( FD_UNLIKELY(err) ) return err;
1759 9 : if( self->accounts_len ) {
1760 153 : for( ulong i=0; i < self->accounts_len; i++ ) {
1761 144 : err = fd_pubkey_account_pair_encode( self->accounts + i, ctx );
1762 144 : if( FD_UNLIKELY( err ) ) return err;
1763 144 : }
1764 9 : }
1765 9 : err = fd_bincode_uint64_encode( self->native_instruction_processors_len, ctx );
1766 9 : if( FD_UNLIKELY(err) ) return err;
1767 9 : if( self->native_instruction_processors_len ) {
1768 0 : for( ulong i=0; i < self->native_instruction_processors_len; i++ ) {
1769 0 : err = fd_string_pubkey_pair_encode( self->native_instruction_processors + i, ctx );
1770 0 : if( FD_UNLIKELY( err ) ) return err;
1771 0 : }
1772 0 : }
1773 9 : err = fd_bincode_uint64_encode( self->rewards_pools_len, ctx );
1774 9 : if( FD_UNLIKELY(err) ) return err;
1775 9 : if( self->rewards_pools_len ) {
1776 0 : for( ulong i=0; i < self->rewards_pools_len; i++ ) {
1777 0 : err = fd_pubkey_account_pair_encode( self->rewards_pools + i, ctx );
1778 0 : if( FD_UNLIKELY( err ) ) return err;
1779 0 : }
1780 0 : }
1781 9 : err = fd_bincode_uint64_encode( self->ticks_per_slot, ctx );
1782 9 : if( FD_UNLIKELY( err ) ) return err;
1783 9 : err = fd_bincode_uint64_encode( self->unused, ctx );
1784 9 : if( FD_UNLIKELY( err ) ) return err;
1785 9 : err = fd_poh_config_encode( &self->poh_config, ctx );
1786 9 : if( FD_UNLIKELY( err ) ) return err;
1787 9 : err = fd_bincode_uint64_encode( self->__backwards_compat_with_v0_23, ctx );
1788 9 : if( FD_UNLIKELY( err ) ) return err;
1789 9 : err = fd_fee_rate_governor_encode( &self->fee_rate_governor, ctx );
1790 9 : if( FD_UNLIKELY( err ) ) return err;
1791 9 : err = fd_rent_encode( &self->rent, ctx );
1792 9 : if( FD_UNLIKELY( err ) ) return err;
1793 9 : err = fd_inflation_encode( &self->inflation, ctx );
1794 9 : if( FD_UNLIKELY( err ) ) return err;
1795 9 : err = fd_epoch_schedule_encode( &self->epoch_schedule, ctx );
1796 9 : if( FD_UNLIKELY( err ) ) return err;
1797 9 : err = fd_bincode_uint32_encode( self->cluster_type, ctx );
1798 9 : if( FD_UNLIKELY( err ) ) return err;
1799 9 : return FD_BINCODE_SUCCESS;
1800 9 : }
1801 0 : int fd_genesis_solana_encode_global( fd_genesis_solana_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1802 0 : int err;
1803 0 : err = fd_bincode_uint64_encode( self->creation_time, ctx );
1804 0 : if( FD_UNLIKELY( err ) ) return err;
1805 0 : err = fd_bincode_uint64_encode( self->accounts_len, ctx );
1806 0 : if( FD_UNLIKELY( err ) ) return err;
1807 0 : if( self->accounts_len ) {
1808 0 : uchar * accounts_laddr = (uchar*)self + self->accounts_offset;
1809 0 : fd_pubkey_account_pair_global_t * accounts = (fd_pubkey_account_pair_global_t *)accounts_laddr;
1810 0 : for( ulong i=0; i < self->accounts_len; i++ ) {
1811 0 : err = fd_pubkey_account_pair_encode_global( &accounts[i], ctx );
1812 0 : if( FD_UNLIKELY( err ) ) return err;
1813 0 : }
1814 0 : }
1815 0 : err = fd_bincode_uint64_encode( self->native_instruction_processors_len, ctx );
1816 0 : if( FD_UNLIKELY( err ) ) return err;
1817 0 : if( self->native_instruction_processors_len ) {
1818 0 : uchar * native_instruction_processors_laddr = (uchar*)self + self->native_instruction_processors_offset;
1819 0 : fd_string_pubkey_pair_global_t * native_instruction_processors = (fd_string_pubkey_pair_global_t *)native_instruction_processors_laddr;
1820 0 : for( ulong i=0; i < self->native_instruction_processors_len; i++ ) {
1821 0 : err = fd_string_pubkey_pair_encode_global( &native_instruction_processors[i], ctx );
1822 0 : if( FD_UNLIKELY( err ) ) return err;
1823 0 : }
1824 0 : }
1825 0 : err = fd_bincode_uint64_encode( self->rewards_pools_len, ctx );
1826 0 : if( FD_UNLIKELY( err ) ) return err;
1827 0 : if( self->rewards_pools_len ) {
1828 0 : uchar * rewards_pools_laddr = (uchar*)self + self->rewards_pools_offset;
1829 0 : fd_pubkey_account_pair_global_t * rewards_pools = (fd_pubkey_account_pair_global_t *)rewards_pools_laddr;
1830 0 : for( ulong i=0; i < self->rewards_pools_len; i++ ) {
1831 0 : err = fd_pubkey_account_pair_encode_global( &rewards_pools[i], ctx );
1832 0 : if( FD_UNLIKELY( err ) ) return err;
1833 0 : }
1834 0 : }
1835 0 : err = fd_bincode_uint64_encode( self->ticks_per_slot, ctx );
1836 0 : if( FD_UNLIKELY( err ) ) return err;
1837 0 : err = fd_bincode_uint64_encode( self->unused, ctx );
1838 0 : if( FD_UNLIKELY( err ) ) return err;
1839 0 : err = fd_poh_config_encode_global( &self->poh_config, ctx );
1840 0 : if( FD_UNLIKELY( err ) ) return err;
1841 0 : err = fd_bincode_uint64_encode( self->__backwards_compat_with_v0_23, ctx );
1842 0 : if( FD_UNLIKELY( err ) ) return err;
1843 0 : err = fd_fee_rate_governor_encode( &self->fee_rate_governor, ctx );
1844 0 : if( FD_UNLIKELY( err ) ) return err;
1845 0 : err = fd_rent_encode( &self->rent, ctx );
1846 0 : if( FD_UNLIKELY( err ) ) return err;
1847 0 : err = fd_inflation_encode( &self->inflation, ctx );
1848 0 : if( FD_UNLIKELY( err ) ) return err;
1849 0 : err = fd_epoch_schedule_encode( &self->epoch_schedule, ctx );
1850 0 : if( FD_UNLIKELY( err ) ) return err;
1851 0 : err = fd_bincode_uint32_encode( self->cluster_type, ctx );
1852 0 : if( FD_UNLIKELY( err ) ) return err;
1853 0 : return FD_BINCODE_SUCCESS;
1854 0 : }
1855 0 : static int fd_genesis_solana_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1856 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1857 0 : int err = 0;
1858 0 : err = fd_bincode_uint64_decode_footprint( ctx );
1859 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1860 0 : ulong accounts_len;
1861 0 : err = fd_bincode_uint64_decode( &accounts_len, ctx );
1862 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1863 0 : if( accounts_len ) {
1864 0 : *total_sz += FD_PUBKEY_ACCOUNT_PAIR_ALIGN + sizeof(fd_pubkey_account_pair_t)*accounts_len;
1865 0 : for( ulong i=0; i < accounts_len; i++ ) {
1866 0 : err = fd_pubkey_account_pair_decode_footprint_inner( ctx, total_sz );
1867 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1868 0 : }
1869 0 : }
1870 0 : ulong native_instruction_processors_len;
1871 0 : err = fd_bincode_uint64_decode( &native_instruction_processors_len, ctx );
1872 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1873 0 : if( native_instruction_processors_len ) {
1874 0 : *total_sz += FD_STRING_PUBKEY_PAIR_ALIGN + sizeof(fd_string_pubkey_pair_t)*native_instruction_processors_len;
1875 0 : for( ulong i=0; i < native_instruction_processors_len; i++ ) {
1876 0 : err = fd_string_pubkey_pair_decode_footprint_inner( ctx, total_sz );
1877 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1878 0 : }
1879 0 : }
1880 0 : ulong rewards_pools_len;
1881 0 : err = fd_bincode_uint64_decode( &rewards_pools_len, ctx );
1882 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1883 0 : if( rewards_pools_len ) {
1884 0 : *total_sz += FD_PUBKEY_ACCOUNT_PAIR_ALIGN + sizeof(fd_pubkey_account_pair_t)*rewards_pools_len;
1885 0 : for( ulong i=0; i < rewards_pools_len; i++ ) {
1886 0 : err = fd_pubkey_account_pair_decode_footprint_inner( ctx, total_sz );
1887 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1888 0 : }
1889 0 : }
1890 0 : err = fd_bincode_uint64_decode_footprint( ctx );
1891 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1892 0 : err = fd_bincode_uint64_decode_footprint( ctx );
1893 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1894 0 : err = fd_poh_config_decode_footprint_inner( ctx, total_sz );
1895 0 : if( FD_UNLIKELY( err ) ) return err;
1896 0 : err = fd_bincode_uint64_decode_footprint( ctx );
1897 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1898 0 : err = fd_fee_rate_governor_decode_footprint_inner( ctx, total_sz );
1899 0 : if( FD_UNLIKELY( err ) ) return err;
1900 0 : err = fd_rent_decode_footprint_inner( ctx, total_sz );
1901 0 : if( FD_UNLIKELY( err ) ) return err;
1902 0 : err = fd_inflation_decode_footprint_inner( ctx, total_sz );
1903 0 : if( FD_UNLIKELY( err ) ) return err;
1904 0 : err = fd_epoch_schedule_decode_footprint_inner( ctx, total_sz );
1905 0 : if( FD_UNLIKELY( err ) ) return err;
1906 0 : err = fd_bincode_uint32_decode_footprint( ctx );
1907 0 : if( FD_UNLIKELY( err ) ) return err;
1908 0 : return 0;
1909 0 : }
1910 0 : int fd_genesis_solana_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1911 0 : *total_sz += sizeof(fd_genesis_solana_t);
1912 0 : void const * start_data = ctx->data;
1913 0 : int err = fd_genesis_solana_decode_footprint_inner( ctx, total_sz );
1914 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1915 0 : ctx->data = start_data;
1916 0 : return err;
1917 0 : }
1918 0 : static void fd_genesis_solana_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1919 0 : fd_genesis_solana_t * self = (fd_genesis_solana_t *)struct_mem;
1920 0 : fd_bincode_uint64_decode_unsafe( &self->creation_time, ctx );
1921 0 : fd_bincode_uint64_decode_unsafe( &self->accounts_len, ctx );
1922 0 : if( self->accounts_len ) {
1923 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_ACCOUNT_PAIR_ALIGN );
1924 0 : self->accounts = *alloc_mem;
1925 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_pubkey_account_pair_t)*self->accounts_len;
1926 0 : for( ulong i=0; i < self->accounts_len; i++ ) {
1927 0 : fd_pubkey_account_pair_new( self->accounts + i );
1928 0 : fd_pubkey_account_pair_decode_inner( self->accounts + i, alloc_mem, ctx );
1929 0 : }
1930 0 : } else
1931 0 : self->accounts = NULL;
1932 0 : fd_bincode_uint64_decode_unsafe( &self->native_instruction_processors_len, ctx );
1933 0 : if( self->native_instruction_processors_len ) {
1934 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_STRING_PUBKEY_PAIR_ALIGN );
1935 0 : self->native_instruction_processors = *alloc_mem;
1936 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_string_pubkey_pair_t)*self->native_instruction_processors_len;
1937 0 : for( ulong i=0; i < self->native_instruction_processors_len; i++ ) {
1938 0 : fd_string_pubkey_pair_new( self->native_instruction_processors + i );
1939 0 : fd_string_pubkey_pair_decode_inner( self->native_instruction_processors + i, alloc_mem, ctx );
1940 0 : }
1941 0 : } else
1942 0 : self->native_instruction_processors = NULL;
1943 0 : fd_bincode_uint64_decode_unsafe( &self->rewards_pools_len, ctx );
1944 0 : if( self->rewards_pools_len ) {
1945 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_ACCOUNT_PAIR_ALIGN );
1946 0 : self->rewards_pools = *alloc_mem;
1947 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_pubkey_account_pair_t)*self->rewards_pools_len;
1948 0 : for( ulong i=0; i < self->rewards_pools_len; i++ ) {
1949 0 : fd_pubkey_account_pair_new( self->rewards_pools + i );
1950 0 : fd_pubkey_account_pair_decode_inner( self->rewards_pools + i, alloc_mem, ctx );
1951 0 : }
1952 0 : } else
1953 0 : self->rewards_pools = NULL;
1954 0 : fd_bincode_uint64_decode_unsafe( &self->ticks_per_slot, ctx );
1955 0 : fd_bincode_uint64_decode_unsafe( &self->unused, ctx );
1956 0 : fd_poh_config_decode_inner( &self->poh_config, alloc_mem, ctx );
1957 0 : fd_bincode_uint64_decode_unsafe( &self->__backwards_compat_with_v0_23, ctx );
1958 0 : fd_fee_rate_governor_decode_inner( &self->fee_rate_governor, alloc_mem, ctx );
1959 0 : fd_rent_decode_inner( &self->rent, alloc_mem, ctx );
1960 0 : fd_inflation_decode_inner( &self->inflation, alloc_mem, ctx );
1961 0 : fd_epoch_schedule_decode_inner( &self->epoch_schedule, alloc_mem, ctx );
1962 0 : fd_bincode_uint32_decode_unsafe( &self->cluster_type, ctx );
1963 0 : }
1964 0 : void * fd_genesis_solana_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1965 0 : fd_genesis_solana_t * self = (fd_genesis_solana_t *)mem;
1966 0 : fd_genesis_solana_new( self );
1967 0 : void * alloc_region = (uchar *)mem + sizeof(fd_genesis_solana_t);
1968 0 : void * * alloc_mem = &alloc_region;
1969 0 : fd_genesis_solana_decode_inner( mem, alloc_mem, ctx );
1970 0 : return self;
1971 0 : }
1972 0 : static void fd_genesis_solana_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1973 0 : fd_genesis_solana_global_t * self = (fd_genesis_solana_global_t *)struct_mem;
1974 0 : fd_bincode_uint64_decode_unsafe( &self->creation_time, ctx );
1975 0 : fd_bincode_uint64_decode_unsafe( &self->accounts_len, ctx );
1976 0 : if( self->accounts_len ) {
1977 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_ACCOUNT_PAIR_ALIGN );
1978 0 : self->accounts_offset = (ulong)*alloc_mem - (ulong)struct_mem;
1979 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
1980 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_pubkey_account_pair_t)*self->accounts_len;
1981 0 : for( ulong i=0; i < self->accounts_len; i++ ) {
1982 0 : fd_pubkey_account_pair_new( (fd_pubkey_account_pair_t *)fd_type_pun(cur_mem + sizeof(fd_pubkey_account_pair_t) * i) );
1983 0 : fd_pubkey_account_pair_decode_inner_global( cur_mem + sizeof(fd_pubkey_account_pair_t) * i, alloc_mem, ctx );
1984 0 : }
1985 0 : } else {
1986 0 : self->accounts_offset = 0UL;
1987 0 : }
1988 0 : fd_bincode_uint64_decode_unsafe( &self->native_instruction_processors_len, ctx );
1989 0 : if( self->native_instruction_processors_len ) {
1990 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_STRING_PUBKEY_PAIR_ALIGN );
1991 0 : self->native_instruction_processors_offset = (ulong)*alloc_mem - (ulong)struct_mem;
1992 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
1993 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_string_pubkey_pair_t)*self->native_instruction_processors_len;
1994 0 : for( ulong i=0; i < self->native_instruction_processors_len; i++ ) {
1995 0 : fd_string_pubkey_pair_new( (fd_string_pubkey_pair_t *)fd_type_pun(cur_mem + sizeof(fd_string_pubkey_pair_t) * i) );
1996 0 : fd_string_pubkey_pair_decode_inner_global( cur_mem + sizeof(fd_string_pubkey_pair_t) * i, alloc_mem, ctx );
1997 0 : }
1998 0 : } else {
1999 0 : self->native_instruction_processors_offset = 0UL;
2000 0 : }
2001 0 : fd_bincode_uint64_decode_unsafe( &self->rewards_pools_len, ctx );
2002 0 : if( self->rewards_pools_len ) {
2003 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_ACCOUNT_PAIR_ALIGN );
2004 0 : self->rewards_pools_offset = (ulong)*alloc_mem - (ulong)struct_mem;
2005 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
2006 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_pubkey_account_pair_t)*self->rewards_pools_len;
2007 0 : for( ulong i=0; i < self->rewards_pools_len; i++ ) {
2008 0 : fd_pubkey_account_pair_new( (fd_pubkey_account_pair_t *)fd_type_pun(cur_mem + sizeof(fd_pubkey_account_pair_t) * i) );
2009 0 : fd_pubkey_account_pair_decode_inner_global( cur_mem + sizeof(fd_pubkey_account_pair_t) * i, alloc_mem, ctx );
2010 0 : }
2011 0 : } else {
2012 0 : self->rewards_pools_offset = 0UL;
2013 0 : }
2014 0 : fd_bincode_uint64_decode_unsafe( &self->ticks_per_slot, ctx );
2015 0 : fd_bincode_uint64_decode_unsafe( &self->unused, ctx );
2016 0 : fd_poh_config_decode_inner_global( &self->poh_config, alloc_mem, ctx );
2017 0 : fd_bincode_uint64_decode_unsafe( &self->__backwards_compat_with_v0_23, ctx );
2018 0 : fd_fee_rate_governor_decode_inner( &self->fee_rate_governor, alloc_mem, ctx );
2019 0 : fd_rent_decode_inner( &self->rent, alloc_mem, ctx );
2020 0 : fd_inflation_decode_inner( &self->inflation, alloc_mem, ctx );
2021 0 : fd_epoch_schedule_decode_inner( &self->epoch_schedule, alloc_mem, ctx );
2022 0 : fd_bincode_uint32_decode_unsafe( &self->cluster_type, ctx );
2023 0 : }
2024 0 : void * fd_genesis_solana_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2025 0 : fd_genesis_solana_global_t * self = (fd_genesis_solana_global_t *)mem;
2026 0 : fd_genesis_solana_new( (fd_genesis_solana_t *)self );
2027 0 : void * alloc_region = (uchar *)mem + sizeof(fd_genesis_solana_global_t);
2028 0 : void * * alloc_mem = &alloc_region;
2029 0 : fd_genesis_solana_decode_inner_global( mem, alloc_mem, ctx );
2030 0 : return self;
2031 0 : }
2032 12 : void fd_genesis_solana_new(fd_genesis_solana_t * self) {
2033 12 : fd_memset( self, 0, sizeof(fd_genesis_solana_t) );
2034 12 : fd_poh_config_new( &self->poh_config );
2035 12 : fd_fee_rate_governor_new( &self->fee_rate_governor );
2036 12 : fd_rent_new( &self->rent );
2037 12 : fd_inflation_new( &self->inflation );
2038 12 : fd_epoch_schedule_new( &self->epoch_schedule );
2039 12 : }
2040 0 : void fd_genesis_solana_walk( void * w, fd_genesis_solana_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
2041 0 : (void) varint;
2042 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_genesis_solana", level++, 0 );
2043 0 : fun( w, &self->creation_time, "creation_time", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2044 0 : if( self->accounts_len ) {
2045 0 : fun( w, NULL, "accounts", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
2046 0 : for( ulong i=0; i < self->accounts_len; i++ )
2047 0 : fd_pubkey_account_pair_walk(w, self->accounts + i, fun, "pubkey_account_pair", level, 0 );
2048 0 : fun( w, NULL, "accounts", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
2049 0 : }
2050 0 : if( self->native_instruction_processors_len ) {
2051 0 : fun( w, NULL, "native_instruction_processors", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
2052 0 : for( ulong i=0; i < self->native_instruction_processors_len; i++ )
2053 0 : fd_string_pubkey_pair_walk(w, self->native_instruction_processors + i, fun, "string_pubkey_pair", level, 0 );
2054 0 : fun( w, NULL, "native_instruction_processors", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
2055 0 : }
2056 0 : if( self->rewards_pools_len ) {
2057 0 : fun( w, NULL, "rewards_pools", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
2058 0 : for( ulong i=0; i < self->rewards_pools_len; i++ )
2059 0 : fd_pubkey_account_pair_walk(w, self->rewards_pools + i, fun, "pubkey_account_pair", level, 0 );
2060 0 : fun( w, NULL, "rewards_pools", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
2061 0 : }
2062 0 : fun( w, &self->ticks_per_slot, "ticks_per_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2063 0 : fun( w, &self->unused, "unused", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2064 0 : fd_poh_config_walk( w, &self->poh_config, fun, "poh_config", level, 0 );
2065 0 : fun( w, &self->__backwards_compat_with_v0_23, "__backwards_compat_with_v0_23", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2066 0 : fd_fee_rate_governor_walk( w, &self->fee_rate_governor, fun, "fee_rate_governor", level, 0 );
2067 0 : fd_rent_walk( w, &self->rent, fun, "rent", level, 0 );
2068 0 : fd_inflation_walk( w, &self->inflation, fun, "inflation", level, 0 );
2069 0 : fd_epoch_schedule_walk( w, &self->epoch_schedule, fun, "epoch_schedule", level, 0 );
2070 0 : fun( w, &self->cluster_type, "cluster_type", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
2071 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_genesis_solana", level--, 0 );
2072 0 : }
2073 0 : ulong fd_genesis_solana_size( fd_genesis_solana_t const * self ) {
2074 0 : ulong size = 0;
2075 0 : size += sizeof(ulong);
2076 0 : do {
2077 0 : size += sizeof(ulong);
2078 0 : for( ulong i=0; i < self->accounts_len; i++ )
2079 0 : size += fd_pubkey_account_pair_size( self->accounts + i );
2080 0 : } while(0);
2081 0 : do {
2082 0 : size += sizeof(ulong);
2083 0 : for( ulong i=0; i < self->native_instruction_processors_len; i++ )
2084 0 : size += fd_string_pubkey_pair_size( self->native_instruction_processors + i );
2085 0 : } while(0);
2086 0 : do {
2087 0 : size += sizeof(ulong);
2088 0 : for( ulong i=0; i < self->rewards_pools_len; i++ )
2089 0 : size += fd_pubkey_account_pair_size( self->rewards_pools + i );
2090 0 : } while(0);
2091 0 : size += sizeof(ulong);
2092 0 : size += sizeof(ulong);
2093 0 : size += fd_poh_config_size( &self->poh_config );
2094 0 : size += sizeof(ulong);
2095 0 : size += fd_fee_rate_governor_size( &self->fee_rate_governor );
2096 0 : size += fd_rent_size( &self->rent );
2097 0 : size += fd_inflation_size( &self->inflation );
2098 0 : size += fd_epoch_schedule_size( &self->epoch_schedule );
2099 0 : size += sizeof(uint);
2100 0 : return size;
2101 0 : }
2102 :
2103 0 : ulong fd_genesis_solana_size_global( fd_genesis_solana_global_t const * self ) {
2104 0 : ulong size = 0;
2105 0 : size += sizeof(ulong);
2106 0 : do {
2107 0 : size += sizeof(ulong);
2108 0 : fd_pubkey_account_pair_global_t * accounts = self->accounts_offset ? (fd_pubkey_account_pair_global_t *)fd_type_pun( (uchar *)self + self->accounts_offset ) : NULL;
2109 0 : for( ulong i=0; i < self->accounts_len; i++ )
2110 0 : size += fd_pubkey_account_pair_size_global( accounts + i );
2111 0 : } while(0);
2112 0 : do {
2113 0 : size += sizeof(ulong);
2114 0 : fd_string_pubkey_pair_global_t * native_instruction_processors = self->native_instruction_processors_offset ? (fd_string_pubkey_pair_global_t *)fd_type_pun( (uchar *)self + self->native_instruction_processors_offset ) : NULL;
2115 0 : for( ulong i=0; i < self->native_instruction_processors_len; i++ )
2116 0 : size += fd_string_pubkey_pair_size_global( native_instruction_processors + i );
2117 0 : } while(0);
2118 0 : do {
2119 0 : size += sizeof(ulong);
2120 0 : fd_pubkey_account_pair_global_t * rewards_pools = self->rewards_pools_offset ? (fd_pubkey_account_pair_global_t *)fd_type_pun( (uchar *)self + self->rewards_pools_offset ) : NULL;
2121 0 : for( ulong i=0; i < self->rewards_pools_len; i++ )
2122 0 : size += fd_pubkey_account_pair_size_global( rewards_pools + i );
2123 0 : } while(0);
2124 0 : size += sizeof(ulong);
2125 0 : size += sizeof(ulong);
2126 0 : size += fd_poh_config_size_global( &self->poh_config );
2127 0 : size += sizeof(ulong);
2128 0 : size += fd_fee_rate_governor_size( &self->fee_rate_governor );
2129 0 : size += fd_rent_size( &self->rent );
2130 0 : size += fd_inflation_size( &self->inflation );
2131 0 : size += fd_epoch_schedule_size( &self->epoch_schedule );
2132 0 : size += sizeof(uint);
2133 0 : return size;
2134 0 : }
2135 :
2136 0 : int fd_sol_sysvar_clock_encode( fd_sol_sysvar_clock_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2137 0 : int err;
2138 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
2139 0 : if( FD_UNLIKELY( err ) ) return err;
2140 0 : err = fd_bincode_uint64_encode( (ulong)self->epoch_start_timestamp, ctx );
2141 0 : if( FD_UNLIKELY( err ) ) return err;
2142 0 : err = fd_bincode_uint64_encode( self->epoch, ctx );
2143 0 : if( FD_UNLIKELY( err ) ) return err;
2144 0 : err = fd_bincode_uint64_encode( self->leader_schedule_epoch, ctx );
2145 0 : if( FD_UNLIKELY( err ) ) return err;
2146 0 : err = fd_bincode_uint64_encode( (ulong)self->unix_timestamp, ctx );
2147 0 : if( FD_UNLIKELY( err ) ) return err;
2148 0 : return FD_BINCODE_SUCCESS;
2149 0 : }
2150 0 : static inline int fd_sol_sysvar_clock_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2151 0 : if( (ulong)ctx->data + 40UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2152 0 : ctx->data = (void *)( (ulong)ctx->data + 40UL );
2153 0 : return 0;
2154 0 : }
2155 3 : static void fd_sol_sysvar_clock_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2156 3 : fd_sol_sysvar_clock_t * self = (fd_sol_sysvar_clock_t *)struct_mem;
2157 3 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
2158 3 : fd_bincode_uint64_decode_unsafe( (ulong *) &self->epoch_start_timestamp, ctx );
2159 3 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
2160 3 : fd_bincode_uint64_decode_unsafe( &self->leader_schedule_epoch, ctx );
2161 3 : fd_bincode_uint64_decode_unsafe( (ulong *) &self->unix_timestamp, ctx );
2162 3 : }
2163 3 : void * fd_sol_sysvar_clock_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2164 3 : fd_sol_sysvar_clock_t * self = (fd_sol_sysvar_clock_t *)mem;
2165 3 : fd_sol_sysvar_clock_new( self );
2166 3 : void * alloc_region = (uchar *)mem + sizeof(fd_sol_sysvar_clock_t);
2167 3 : void * * alloc_mem = &alloc_region;
2168 3 : fd_sol_sysvar_clock_decode_inner( mem, alloc_mem, ctx );
2169 3 : return self;
2170 3 : }
2171 0 : void fd_sol_sysvar_clock_walk( void * w, fd_sol_sysvar_clock_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
2172 0 : (void) varint;
2173 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_sol_sysvar_clock", level++, 0 );
2174 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2175 0 : fun( w, &self->epoch_start_timestamp, "epoch_start_timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level, 0 );
2176 0 : fun( w, &self->epoch, "epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2177 0 : fun( w, &self->leader_schedule_epoch, "leader_schedule_epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2178 0 : fun( w, &self->unix_timestamp, "unix_timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level, 0 );
2179 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_sol_sysvar_clock", level--, 0 );
2180 0 : }
2181 0 : int fd_sol_sysvar_last_restart_slot_encode( fd_sol_sysvar_last_restart_slot_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2182 0 : int err;
2183 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
2184 0 : if( FD_UNLIKELY( err ) ) return err;
2185 0 : return FD_BINCODE_SUCCESS;
2186 0 : }
2187 0 : static inline int fd_sol_sysvar_last_restart_slot_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2188 0 : if( (ulong)ctx->data + 8UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2189 0 : ctx->data = (void *)( (ulong)ctx->data + 8UL );
2190 0 : return 0;
2191 0 : }
2192 0 : static void fd_sol_sysvar_last_restart_slot_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2193 0 : fd_sol_sysvar_last_restart_slot_t * self = (fd_sol_sysvar_last_restart_slot_t *)struct_mem;
2194 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
2195 0 : }
2196 0 : void * fd_sol_sysvar_last_restart_slot_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2197 0 : fd_sol_sysvar_last_restart_slot_t * self = (fd_sol_sysvar_last_restart_slot_t *)mem;
2198 0 : fd_sol_sysvar_last_restart_slot_new( self );
2199 0 : void * alloc_region = (uchar *)mem + sizeof(fd_sol_sysvar_last_restart_slot_t);
2200 0 : void * * alloc_mem = &alloc_region;
2201 0 : fd_sol_sysvar_last_restart_slot_decode_inner( mem, alloc_mem, ctx );
2202 0 : return self;
2203 0 : }
2204 0 : void fd_sol_sysvar_last_restart_slot_walk( void * w, fd_sol_sysvar_last_restart_slot_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
2205 0 : (void) varint;
2206 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_sol_sysvar_last_restart_slot", level++, 0 );
2207 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2208 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_sol_sysvar_last_restart_slot", level--, 0 );
2209 0 : }
2210 96 : int fd_vote_lockout_encode( fd_vote_lockout_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2211 96 : int err;
2212 96 : err = fd_bincode_uint64_encode( self->slot, ctx );
2213 96 : if( FD_UNLIKELY( err ) ) return err;
2214 96 : err = fd_bincode_uint32_encode( self->confirmation_count, ctx );
2215 96 : if( FD_UNLIKELY( err ) ) return err;
2216 96 : return FD_BINCODE_SUCCESS;
2217 96 : }
2218 0 : static inline int fd_vote_lockout_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2219 0 : if( (ulong)ctx->data + 12UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2220 0 : ctx->data = (void *)( (ulong)ctx->data + 12UL );
2221 0 : return 0;
2222 0 : }
2223 195 : static void fd_vote_lockout_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2224 195 : fd_vote_lockout_t * self = (fd_vote_lockout_t *)struct_mem;
2225 195 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
2226 195 : fd_bincode_uint32_decode_unsafe( &self->confirmation_count, ctx );
2227 195 : }
2228 0 : void * fd_vote_lockout_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2229 0 : fd_vote_lockout_t * self = (fd_vote_lockout_t *)mem;
2230 0 : fd_vote_lockout_new( self );
2231 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_lockout_t);
2232 0 : void * * alloc_mem = &alloc_region;
2233 0 : fd_vote_lockout_decode_inner( mem, alloc_mem, ctx );
2234 0 : return self;
2235 0 : }
2236 99 : void fd_vote_lockout_walk( void * w, fd_vote_lockout_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
2237 99 : (void) varint;
2238 99 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_lockout", level++, 0 );
2239 99 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2240 99 : fun( w, &self->confirmation_count, "confirmation_count", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
2241 99 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_lockout", level--, 0 );
2242 99 : }
2243 0 : int fd_lockout_offset_encode( fd_lockout_offset_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2244 0 : int err;
2245 0 : err = fd_bincode_varint_encode( self->offset, ctx );
2246 0 : if( FD_UNLIKELY( err ) ) return err;
2247 0 : err = fd_bincode_uint8_encode( (uchar)(self->confirmation_count), ctx );
2248 0 : if( FD_UNLIKELY( err ) ) return err;
2249 0 : return FD_BINCODE_SUCCESS;
2250 0 : }
2251 0 : static int fd_lockout_offset_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2252 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2253 0 : int err = 0;
2254 0 : err = fd_bincode_varint_decode_footprint( ctx );
2255 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2256 0 : err = fd_bincode_uint8_decode_footprint( ctx );
2257 0 : if( FD_UNLIKELY( err ) ) return err;
2258 0 : return 0;
2259 0 : }
2260 0 : int fd_lockout_offset_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2261 0 : *total_sz += sizeof(fd_lockout_offset_t);
2262 0 : void const * start_data = ctx->data;
2263 0 : int err = fd_lockout_offset_decode_footprint_inner( ctx, total_sz );
2264 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2265 0 : ctx->data = start_data;
2266 0 : return err;
2267 0 : }
2268 0 : static void fd_lockout_offset_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2269 0 : fd_lockout_offset_t * self = (fd_lockout_offset_t *)struct_mem;
2270 0 : fd_bincode_varint_decode_unsafe( &self->offset, ctx );
2271 0 : fd_bincode_uint8_decode_unsafe( &self->confirmation_count, ctx );
2272 0 : }
2273 0 : void * fd_lockout_offset_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2274 0 : fd_lockout_offset_t * self = (fd_lockout_offset_t *)mem;
2275 0 : fd_lockout_offset_new( self );
2276 0 : void * alloc_region = (uchar *)mem + sizeof(fd_lockout_offset_t);
2277 0 : void * * alloc_mem = &alloc_region;
2278 0 : fd_lockout_offset_decode_inner( mem, alloc_mem, ctx );
2279 0 : return self;
2280 0 : }
2281 0 : void fd_lockout_offset_new(fd_lockout_offset_t * self) {
2282 0 : fd_memset( self, 0, sizeof(fd_lockout_offset_t) );
2283 0 : }
2284 0 : void fd_lockout_offset_walk( void * w, fd_lockout_offset_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
2285 0 : (void) varint;
2286 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_lockout_offset", level++, 0 );
2287 0 : fun( w, &self->offset, "offset", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 1 );
2288 0 : fun( w, &self->confirmation_count, "confirmation_count", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
2289 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_lockout_offset", level--, 0 );
2290 0 : }
2291 0 : ulong fd_lockout_offset_size( fd_lockout_offset_t const * self ) {
2292 0 : ulong size = 0;
2293 0 : size += fd_bincode_varint_size( self->offset );
2294 0 : size += sizeof(char);
2295 0 : return size;
2296 0 : }
2297 :
2298 18 : int fd_vote_authorized_voter_encode( fd_vote_authorized_voter_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2299 18 : int err;
2300 18 : err = fd_bincode_uint64_encode( self->epoch, ctx );
2301 18 : if( FD_UNLIKELY( err ) ) return err;
2302 18 : err = fd_pubkey_encode( &self->pubkey, ctx );
2303 18 : if( FD_UNLIKELY( err ) ) return err;
2304 18 : return FD_BINCODE_SUCCESS;
2305 18 : }
2306 15 : static inline int fd_vote_authorized_voter_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2307 15 : if( (ulong)ctx->data + 40UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2308 15 : ctx->data = (void *)( (ulong)ctx->data + 40UL );
2309 15 : return 0;
2310 15 : }
2311 15 : static void fd_vote_authorized_voter_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2312 15 : fd_vote_authorized_voter_t * self = (fd_vote_authorized_voter_t *)struct_mem;
2313 15 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
2314 15 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
2315 15 : }
2316 0 : void * fd_vote_authorized_voter_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2317 0 : fd_vote_authorized_voter_t * self = (fd_vote_authorized_voter_t *)mem;
2318 0 : fd_vote_authorized_voter_new( self );
2319 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_authorized_voter_t);
2320 0 : void * * alloc_mem = &alloc_region;
2321 0 : fd_vote_authorized_voter_decode_inner( mem, alloc_mem, ctx );
2322 0 : return self;
2323 0 : }
2324 9 : void fd_vote_authorized_voter_walk( void * w, fd_vote_authorized_voter_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
2325 9 : (void) varint;
2326 9 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_authorized_voter", level++, 0 );
2327 9 : fun( w, &self->epoch, "epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2328 9 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level, 0 );
2329 9 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_authorized_voter", level--, 0 );
2330 9 : }
2331 576 : int fd_vote_prior_voter_encode( fd_vote_prior_voter_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2332 576 : int err;
2333 576 : err = fd_pubkey_encode( &self->pubkey, ctx );
2334 576 : if( FD_UNLIKELY( err ) ) return err;
2335 576 : err = fd_bincode_uint64_encode( self->epoch_start, ctx );
2336 576 : if( FD_UNLIKELY( err ) ) return err;
2337 576 : err = fd_bincode_uint64_encode( self->epoch_end, ctx );
2338 576 : if( FD_UNLIKELY( err ) ) return err;
2339 576 : return FD_BINCODE_SUCCESS;
2340 576 : }
2341 480 : static inline int fd_vote_prior_voter_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2342 480 : if( (ulong)ctx->data + 48UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2343 480 : ctx->data = (void *)( (ulong)ctx->data + 48UL );
2344 480 : return 0;
2345 480 : }
2346 480 : static void fd_vote_prior_voter_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2347 480 : fd_vote_prior_voter_t * self = (fd_vote_prior_voter_t *)struct_mem;
2348 480 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
2349 480 : fd_bincode_uint64_decode_unsafe( &self->epoch_start, ctx );
2350 480 : fd_bincode_uint64_decode_unsafe( &self->epoch_end, ctx );
2351 480 : }
2352 0 : void * fd_vote_prior_voter_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2353 0 : fd_vote_prior_voter_t * self = (fd_vote_prior_voter_t *)mem;
2354 0 : fd_vote_prior_voter_new( self );
2355 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_prior_voter_t);
2356 0 : void * * alloc_mem = &alloc_region;
2357 0 : fd_vote_prior_voter_decode_inner( mem, alloc_mem, ctx );
2358 0 : return self;
2359 0 : }
2360 288 : void fd_vote_prior_voter_walk( void * w, fd_vote_prior_voter_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
2361 288 : (void) varint;
2362 288 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_prior_voter", level++, 0 );
2363 288 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level, 0 );
2364 288 : fun( w, &self->epoch_start, "epoch_start", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2365 288 : fun( w, &self->epoch_end, "epoch_end", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2366 288 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_prior_voter", level--, 0 );
2367 288 : }
2368 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 ) {
2369 0 : int err;
2370 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
2371 0 : if( FD_UNLIKELY( err ) ) return err;
2372 0 : err = fd_bincode_uint64_encode( self->epoch_start, ctx );
2373 0 : if( FD_UNLIKELY( err ) ) return err;
2374 0 : err = fd_bincode_uint64_encode( self->epoch_end, ctx );
2375 0 : if( FD_UNLIKELY( err ) ) return err;
2376 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
2377 0 : if( FD_UNLIKELY( err ) ) return err;
2378 0 : return FD_BINCODE_SUCCESS;
2379 0 : }
2380 0 : static inline int fd_vote_prior_voter_0_23_5_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2381 0 : if( (ulong)ctx->data + 56UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2382 0 : ctx->data = (void *)( (ulong)ctx->data + 56UL );
2383 0 : return 0;
2384 0 : }
2385 0 : static void fd_vote_prior_voter_0_23_5_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2386 0 : fd_vote_prior_voter_0_23_5_t * self = (fd_vote_prior_voter_0_23_5_t *)struct_mem;
2387 0 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
2388 0 : fd_bincode_uint64_decode_unsafe( &self->epoch_start, ctx );
2389 0 : fd_bincode_uint64_decode_unsafe( &self->epoch_end, ctx );
2390 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
2391 0 : }
2392 0 : void * fd_vote_prior_voter_0_23_5_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2393 0 : fd_vote_prior_voter_0_23_5_t * self = (fd_vote_prior_voter_0_23_5_t *)mem;
2394 0 : fd_vote_prior_voter_0_23_5_new( self );
2395 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_prior_voter_0_23_5_t);
2396 0 : void * * alloc_mem = &alloc_region;
2397 0 : fd_vote_prior_voter_0_23_5_decode_inner( mem, alloc_mem, ctx );
2398 0 : return self;
2399 0 : }
2400 0 : void fd_vote_prior_voter_0_23_5_walk( void * w, fd_vote_prior_voter_0_23_5_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
2401 0 : (void) varint;
2402 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_prior_voter_0_23_5", level++, 0 );
2403 0 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level, 0 );
2404 0 : fun( w, &self->epoch_start, "epoch_start", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2405 0 : fun( w, &self->epoch_end, "epoch_end", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2406 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2407 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_prior_voter_0_23_5", level--, 0 );
2408 0 : }
2409 195 : int fd_vote_epoch_credits_encode( fd_vote_epoch_credits_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2410 195 : int err;
2411 195 : err = fd_bincode_uint64_encode( self->epoch, ctx );
2412 195 : if( FD_UNLIKELY( err ) ) return err;
2413 195 : err = fd_bincode_uint64_encode( self->credits, ctx );
2414 195 : if( FD_UNLIKELY( err ) ) return err;
2415 195 : err = fd_bincode_uint64_encode( self->prev_credits, ctx );
2416 195 : if( FD_UNLIKELY( err ) ) return err;
2417 195 : return FD_BINCODE_SUCCESS;
2418 195 : }
2419 0 : static inline int fd_vote_epoch_credits_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2420 0 : if( (ulong)ctx->data + 24UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2421 0 : ctx->data = (void *)( (ulong)ctx->data + 24UL );
2422 0 : return 0;
2423 0 : }
2424 393 : static void fd_vote_epoch_credits_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2425 393 : fd_vote_epoch_credits_t * self = (fd_vote_epoch_credits_t *)struct_mem;
2426 393 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
2427 393 : fd_bincode_uint64_decode_unsafe( &self->credits, ctx );
2428 393 : fd_bincode_uint64_decode_unsafe( &self->prev_credits, ctx );
2429 393 : }
2430 0 : void * fd_vote_epoch_credits_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2431 0 : fd_vote_epoch_credits_t * self = (fd_vote_epoch_credits_t *)mem;
2432 0 : fd_vote_epoch_credits_new( self );
2433 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_epoch_credits_t);
2434 0 : void * * alloc_mem = &alloc_region;
2435 0 : fd_vote_epoch_credits_decode_inner( mem, alloc_mem, ctx );
2436 0 : return self;
2437 0 : }
2438 198 : void fd_vote_epoch_credits_walk( void * w, fd_vote_epoch_credits_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
2439 198 : (void) varint;
2440 198 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_epoch_credits", level++, 0 );
2441 198 : fun( w, &self->epoch, "epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2442 198 : fun( w, &self->credits, "credits", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2443 198 : fun( w, &self->prev_credits, "prev_credits", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2444 198 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_epoch_credits", level--, 0 );
2445 198 : }
2446 18 : int fd_vote_block_timestamp_encode( fd_vote_block_timestamp_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2447 18 : int err;
2448 18 : err = fd_bincode_uint64_encode( self->slot, ctx );
2449 18 : if( FD_UNLIKELY( err ) ) return err;
2450 18 : err = fd_bincode_uint64_encode( (ulong)self->timestamp, ctx );
2451 18 : if( FD_UNLIKELY( err ) ) return err;
2452 18 : return FD_BINCODE_SUCCESS;
2453 18 : }
2454 15 : static inline int fd_vote_block_timestamp_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2455 15 : if( (ulong)ctx->data + 16UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2456 15 : ctx->data = (void *)( (ulong)ctx->data + 16UL );
2457 15 : return 0;
2458 15 : }
2459 15 : static void fd_vote_block_timestamp_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2460 15 : fd_vote_block_timestamp_t * self = (fd_vote_block_timestamp_t *)struct_mem;
2461 15 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
2462 15 : fd_bincode_uint64_decode_unsafe( (ulong *) &self->timestamp, ctx );
2463 15 : }
2464 0 : void * fd_vote_block_timestamp_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2465 0 : fd_vote_block_timestamp_t * self = (fd_vote_block_timestamp_t *)mem;
2466 0 : fd_vote_block_timestamp_new( self );
2467 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_block_timestamp_t);
2468 0 : void * * alloc_mem = &alloc_region;
2469 0 : fd_vote_block_timestamp_decode_inner( mem, alloc_mem, ctx );
2470 0 : return self;
2471 0 : }
2472 9 : void fd_vote_block_timestamp_walk( void * w, fd_vote_block_timestamp_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
2473 9 : (void) varint;
2474 9 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_block_timestamp", level++, 0 );
2475 9 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2476 9 : fun( w, &self->timestamp, "timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level, 0 );
2477 9 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_block_timestamp", level--, 0 );
2478 9 : }
2479 18 : int fd_vote_prior_voters_encode( fd_vote_prior_voters_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2480 18 : int err;
2481 594 : for( ulong i=0; i<32; i++ ) {
2482 576 : err = fd_vote_prior_voter_encode( self->buf + i, ctx );
2483 576 : if( FD_UNLIKELY( err ) ) return err;
2484 576 : }
2485 18 : err = fd_bincode_uint64_encode( self->idx, ctx );
2486 18 : if( FD_UNLIKELY( err ) ) return err;
2487 18 : err = fd_bincode_bool_encode( (uchar)(self->is_empty), ctx );
2488 18 : if( FD_UNLIKELY( err ) ) return err;
2489 18 : return FD_BINCODE_SUCCESS;
2490 18 : }
2491 15 : static int fd_vote_prior_voters_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2492 15 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2493 15 : int err = 0;
2494 495 : for( ulong i=0; i<32; i++ ) {
2495 480 : err = fd_vote_prior_voter_decode_footprint_inner( ctx, total_sz );
2496 480 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2497 480 : }
2498 15 : err = fd_bincode_uint64_decode_footprint( ctx );
2499 15 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2500 15 : err = fd_bincode_bool_decode_footprint( ctx );
2501 15 : if( FD_UNLIKELY( err ) ) return err;
2502 15 : return 0;
2503 15 : }
2504 0 : int fd_vote_prior_voters_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2505 0 : *total_sz += sizeof(fd_vote_prior_voters_t);
2506 0 : void const * start_data = ctx->data;
2507 0 : int err = fd_vote_prior_voters_decode_footprint_inner( ctx, total_sz );
2508 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2509 0 : ctx->data = start_data;
2510 0 : return err;
2511 0 : }
2512 15 : static void fd_vote_prior_voters_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2513 15 : fd_vote_prior_voters_t * self = (fd_vote_prior_voters_t *)struct_mem;
2514 495 : for( ulong i=0; i<32; i++ ) {
2515 480 : fd_vote_prior_voter_decode_inner( self->buf + i, alloc_mem, ctx );
2516 480 : }
2517 15 : fd_bincode_uint64_decode_unsafe( &self->idx, ctx );
2518 15 : fd_bincode_bool_decode_unsafe( &self->is_empty, ctx );
2519 15 : }
2520 0 : void * fd_vote_prior_voters_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2521 0 : fd_vote_prior_voters_t * self = (fd_vote_prior_voters_t *)mem;
2522 0 : fd_vote_prior_voters_new( self );
2523 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_prior_voters_t);
2524 0 : void * * alloc_mem = &alloc_region;
2525 0 : fd_vote_prior_voters_decode_inner( mem, alloc_mem, ctx );
2526 0 : return self;
2527 0 : }
2528 12 : void fd_vote_prior_voters_new(fd_vote_prior_voters_t * self) {
2529 12 : fd_memset( self, 0, sizeof(fd_vote_prior_voters_t) );
2530 396 : for( ulong i=0; i<32; i++ )
2531 384 : fd_vote_prior_voter_new( self->buf + i );
2532 12 : }
2533 9 : void fd_vote_prior_voters_walk( void * w, fd_vote_prior_voters_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
2534 9 : (void) varint;
2535 9 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_prior_voters", level++, 0 );
2536 9 : fun( w, NULL, "buf", FD_FLAMENCO_TYPE_ARR, "vote_prior_voter[]", level++, 0 );
2537 297 : for( ulong i=0; i<32; i++ )
2538 288 : fd_vote_prior_voter_walk( w, self->buf + i, fun, "vote_prior_voter", level, 0 );
2539 9 : fun( w, NULL, "buf", FD_FLAMENCO_TYPE_ARR_END, "vote_prior_voter[]", level--, 0 );
2540 9 : fun( w, &self->idx, "idx", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2541 9 : fun( w, &self->is_empty, "is_empty", FD_FLAMENCO_TYPE_BOOL, "bool", level, 0 );
2542 9 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_prior_voters", level--, 0 );
2543 9 : }
2544 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 ) {
2545 0 : int err;
2546 0 : for( ulong i=0; i<32; i++ ) {
2547 0 : err = fd_vote_prior_voter_0_23_5_encode( self->buf + i, ctx );
2548 0 : if( FD_UNLIKELY( err ) ) return err;
2549 0 : }
2550 0 : err = fd_bincode_uint64_encode( self->idx, ctx );
2551 0 : if( FD_UNLIKELY( err ) ) return err;
2552 0 : return FD_BINCODE_SUCCESS;
2553 0 : }
2554 0 : static inline int fd_vote_prior_voters_0_23_5_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2555 0 : if( (ulong)ctx->data + 1800UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2556 0 : ctx->data = (void *)( (ulong)ctx->data + 1800UL );
2557 0 : return 0;
2558 0 : }
2559 0 : static void fd_vote_prior_voters_0_23_5_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2560 0 : fd_vote_prior_voters_0_23_5_t * self = (fd_vote_prior_voters_0_23_5_t *)struct_mem;
2561 0 : for( ulong i=0; i<32; i++ ) {
2562 0 : fd_vote_prior_voter_0_23_5_decode_inner( self->buf + i, alloc_mem, ctx );
2563 0 : }
2564 0 : fd_bincode_uint64_decode_unsafe( &self->idx, ctx );
2565 0 : }
2566 0 : void * fd_vote_prior_voters_0_23_5_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2567 0 : fd_vote_prior_voters_0_23_5_t * self = (fd_vote_prior_voters_0_23_5_t *)mem;
2568 0 : fd_vote_prior_voters_0_23_5_new( self );
2569 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_prior_voters_0_23_5_t);
2570 0 : void * * alloc_mem = &alloc_region;
2571 0 : fd_vote_prior_voters_0_23_5_decode_inner( mem, alloc_mem, ctx );
2572 0 : return self;
2573 0 : }
2574 0 : void fd_vote_prior_voters_0_23_5_walk( void * w, fd_vote_prior_voters_0_23_5_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
2575 0 : (void) varint;
2576 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_prior_voters_0_23_5", level++, 0 );
2577 0 : fun( w, NULL, "buf", FD_FLAMENCO_TYPE_ARR, "vote_prior_voter_0_23_5[]", level++, 0 );
2578 0 : for( ulong i=0; i<32; i++ )
2579 0 : fd_vote_prior_voter_0_23_5_walk( w, self->buf + i, fun, "vote_prior_voter_0_23_5", level, 0 );
2580 0 : fun( w, NULL, "buf", FD_FLAMENCO_TYPE_ARR_END, "vote_prior_voter_0_23_5[]", level--, 0 );
2581 0 : fun( w, &self->idx, "idx", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2582 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_prior_voters_0_23_5", level--, 0 );
2583 0 : }
2584 96 : int fd_landed_vote_encode( fd_landed_vote_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2585 96 : int err;
2586 96 : err = fd_bincode_uint8_encode( (uchar)(self->latency), ctx );
2587 96 : if( FD_UNLIKELY( err ) ) return err;
2588 96 : err = fd_vote_lockout_encode( &self->lockout, ctx );
2589 96 : if( FD_UNLIKELY( err ) ) return err;
2590 96 : return FD_BINCODE_SUCCESS;
2591 96 : }
2592 0 : static inline int fd_landed_vote_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2593 0 : if( (ulong)ctx->data + 13UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2594 0 : ctx->data = (void *)( (ulong)ctx->data + 13UL );
2595 0 : return 0;
2596 0 : }
2597 195 : static void fd_landed_vote_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2598 195 : fd_landed_vote_t * self = (fd_landed_vote_t *)struct_mem;
2599 195 : fd_bincode_uint8_decode_unsafe( &self->latency, ctx );
2600 195 : fd_vote_lockout_decode_inner( &self->lockout, alloc_mem, ctx );
2601 195 : }
2602 0 : void * fd_landed_vote_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2603 0 : fd_landed_vote_t * self = (fd_landed_vote_t *)mem;
2604 0 : fd_landed_vote_new( self );
2605 0 : void * alloc_region = (uchar *)mem + sizeof(fd_landed_vote_t);
2606 0 : void * * alloc_mem = &alloc_region;
2607 0 : fd_landed_vote_decode_inner( mem, alloc_mem, ctx );
2608 0 : return self;
2609 0 : }
2610 99 : void fd_landed_vote_walk( void * w, fd_landed_vote_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
2611 99 : (void) varint;
2612 99 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_landed_vote", level++, 0 );
2613 99 : fun( w, &self->latency, "latency", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
2614 99 : fd_vote_lockout_walk( w, &self->lockout, fun, "lockout", level, 0 );
2615 99 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_landed_vote", level--, 0 );
2616 99 : }
2617 0 : int fd_vote_state_0_23_5_encode( fd_vote_state_0_23_5_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2618 0 : int err;
2619 0 : err = fd_pubkey_encode( &self->node_pubkey, ctx );
2620 0 : if( FD_UNLIKELY( err ) ) return err;
2621 0 : err = fd_pubkey_encode( &self->authorized_voter, ctx );
2622 0 : if( FD_UNLIKELY( err ) ) return err;
2623 0 : err = fd_bincode_uint64_encode( self->authorized_voter_epoch, ctx );
2624 0 : if( FD_UNLIKELY( err ) ) return err;
2625 0 : err = fd_vote_prior_voters_0_23_5_encode( &self->prior_voters, ctx );
2626 0 : if( FD_UNLIKELY( err ) ) return err;
2627 0 : err = fd_pubkey_encode( &self->authorized_withdrawer, ctx );
2628 0 : if( FD_UNLIKELY( err ) ) return err;
2629 0 : err = fd_bincode_uint8_encode( (uchar)(self->commission), ctx );
2630 0 : if( FD_UNLIKELY( err ) ) return err;
2631 0 : if( self->votes ) {
2632 0 : ulong votes_len = deq_fd_vote_lockout_t_cnt( self->votes );
2633 0 : err = fd_bincode_uint64_encode( votes_len, ctx );
2634 0 : if( FD_UNLIKELY( err ) ) return err;
2635 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 ) ) {
2636 0 : fd_vote_lockout_t const * ele = deq_fd_vote_lockout_t_iter_ele_const( self->votes, iter );
2637 0 : err = fd_vote_lockout_encode( ele, ctx );
2638 0 : if( FD_UNLIKELY( err ) ) return err;
2639 0 : }
2640 0 : } else {
2641 0 : ulong votes_len = 0;
2642 0 : err = fd_bincode_uint64_encode( votes_len, ctx );
2643 0 : if( FD_UNLIKELY( err ) ) return err;
2644 0 : }
2645 0 : err = fd_bincode_bool_encode( self->has_root_slot, ctx );
2646 0 : if( FD_UNLIKELY( err ) ) return err;
2647 0 : if( self->has_root_slot ) {
2648 0 : err = fd_bincode_uint64_encode( self->root_slot, ctx );
2649 0 : if( FD_UNLIKELY( err ) ) return err;
2650 0 : }
2651 0 : if( self->epoch_credits ) {
2652 0 : ulong epoch_credits_len = deq_fd_vote_epoch_credits_t_cnt( self->epoch_credits );
2653 0 : err = fd_bincode_uint64_encode( epoch_credits_len, ctx );
2654 0 : if( FD_UNLIKELY( err ) ) return err;
2655 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 ) ) {
2656 0 : fd_vote_epoch_credits_t const * ele = deq_fd_vote_epoch_credits_t_iter_ele_const( self->epoch_credits, iter );
2657 0 : err = fd_vote_epoch_credits_encode( ele, ctx );
2658 0 : if( FD_UNLIKELY( err ) ) return err;
2659 0 : }
2660 0 : } else {
2661 0 : ulong epoch_credits_len = 0;
2662 0 : err = fd_bincode_uint64_encode( epoch_credits_len, ctx );
2663 0 : if( FD_UNLIKELY( err ) ) return err;
2664 0 : }
2665 0 : err = fd_vote_block_timestamp_encode( &self->last_timestamp, ctx );
2666 0 : if( FD_UNLIKELY( err ) ) return err;
2667 0 : return FD_BINCODE_SUCCESS;
2668 0 : }
2669 0 : static int fd_vote_state_0_23_5_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2670 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2671 0 : int err = 0;
2672 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
2673 0 : if( FD_UNLIKELY( err ) ) return err;
2674 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
2675 0 : if( FD_UNLIKELY( err ) ) return err;
2676 0 : err = fd_bincode_uint64_decode_footprint( ctx );
2677 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2678 0 : err = fd_vote_prior_voters_0_23_5_decode_footprint_inner( ctx, total_sz );
2679 0 : if( FD_UNLIKELY( err ) ) return err;
2680 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
2681 0 : if( FD_UNLIKELY( err ) ) return err;
2682 0 : err = fd_bincode_uint8_decode_footprint( ctx );
2683 0 : if( FD_UNLIKELY( err ) ) return err;
2684 0 : ulong votes_len;
2685 0 : err = fd_bincode_uint64_decode( &votes_len, ctx );
2686 0 : if( FD_UNLIKELY( err ) ) return err;
2687 0 : ulong votes_max = fd_ulong_max( votes_len, 32 );
2688 0 : *total_sz += deq_fd_vote_lockout_t_align() + deq_fd_vote_lockout_t_footprint( votes_max );
2689 0 : ulong votes_sz;
2690 0 : if( FD_UNLIKELY( __builtin_umull_overflow( votes_len, 12, &votes_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
2691 0 : err = fd_bincode_bytes_decode_footprint( votes_sz, ctx );
2692 0 : if( FD_UNLIKELY( err ) ) return err;
2693 0 : {
2694 0 : uchar o;
2695 0 : err = fd_bincode_bool_decode( &o, ctx );
2696 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2697 0 : if( o ) {
2698 0 : err = fd_bincode_uint64_decode_footprint( ctx );
2699 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2700 0 : }
2701 0 : }
2702 0 : ulong epoch_credits_len;
2703 0 : err = fd_bincode_uint64_decode( &epoch_credits_len, ctx );
2704 0 : if( FD_UNLIKELY( err ) ) return err;
2705 0 : ulong epoch_credits_max = fd_ulong_max( epoch_credits_len, 64 );
2706 0 : *total_sz += deq_fd_vote_epoch_credits_t_align() + deq_fd_vote_epoch_credits_t_footprint( epoch_credits_max );
2707 0 : ulong epoch_credits_sz;
2708 0 : if( FD_UNLIKELY( __builtin_umull_overflow( epoch_credits_len, 24, &epoch_credits_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
2709 0 : err = fd_bincode_bytes_decode_footprint( epoch_credits_sz, ctx );
2710 0 : if( FD_UNLIKELY( err ) ) return err;
2711 0 : err = fd_vote_block_timestamp_decode_footprint_inner( ctx, total_sz );
2712 0 : if( FD_UNLIKELY( err ) ) return err;
2713 0 : return 0;
2714 0 : }
2715 0 : int fd_vote_state_0_23_5_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2716 0 : *total_sz += sizeof(fd_vote_state_0_23_5_t);
2717 0 : void const * start_data = ctx->data;
2718 0 : int err = fd_vote_state_0_23_5_decode_footprint_inner( ctx, total_sz );
2719 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2720 0 : ctx->data = start_data;
2721 0 : return err;
2722 0 : }
2723 0 : static void fd_vote_state_0_23_5_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2724 0 : fd_vote_state_0_23_5_t * self = (fd_vote_state_0_23_5_t *)struct_mem;
2725 0 : fd_pubkey_decode_inner( &self->node_pubkey, alloc_mem, ctx );
2726 0 : fd_pubkey_decode_inner( &self->authorized_voter, alloc_mem, ctx );
2727 0 : fd_bincode_uint64_decode_unsafe( &self->authorized_voter_epoch, ctx );
2728 0 : fd_vote_prior_voters_0_23_5_decode_inner( &self->prior_voters, alloc_mem, ctx );
2729 0 : fd_pubkey_decode_inner( &self->authorized_withdrawer, alloc_mem, ctx );
2730 0 : fd_bincode_uint8_decode_unsafe( &self->commission, ctx );
2731 0 : ulong votes_len;
2732 0 : fd_bincode_uint64_decode_unsafe( &votes_len, ctx );
2733 0 : ulong votes_max = fd_ulong_max( votes_len, 32 );
2734 0 : self->votes = deq_fd_vote_lockout_t_join_new( alloc_mem, votes_max );
2735 0 : for( ulong i=0; i < votes_len; i++ ) {
2736 0 : fd_vote_lockout_t * elem = deq_fd_vote_lockout_t_push_tail_nocopy( self->votes );
2737 0 : fd_vote_lockout_new( elem );
2738 0 : fd_vote_lockout_decode_inner( elem, alloc_mem, ctx );
2739 0 : }
2740 0 : {
2741 0 : uchar o;
2742 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
2743 0 : self->has_root_slot = !!o;
2744 0 : if( o ) {
2745 0 : fd_bincode_uint64_decode_unsafe( &self->root_slot, ctx );
2746 0 : }
2747 0 : }
2748 0 : ulong epoch_credits_len;
2749 0 : fd_bincode_uint64_decode_unsafe( &epoch_credits_len, ctx );
2750 0 : ulong epoch_credits_max = fd_ulong_max( epoch_credits_len, 64 );
2751 0 : self->epoch_credits = deq_fd_vote_epoch_credits_t_join_new( alloc_mem, epoch_credits_max );
2752 0 : for( ulong i=0; i < epoch_credits_len; i++ ) {
2753 0 : fd_vote_epoch_credits_t * elem = deq_fd_vote_epoch_credits_t_push_tail_nocopy( self->epoch_credits );
2754 0 : fd_vote_epoch_credits_new( elem );
2755 0 : fd_vote_epoch_credits_decode_inner( elem, alloc_mem, ctx );
2756 0 : }
2757 0 : fd_vote_block_timestamp_decode_inner( &self->last_timestamp, alloc_mem, ctx );
2758 0 : }
2759 0 : void * fd_vote_state_0_23_5_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2760 0 : fd_vote_state_0_23_5_t * self = (fd_vote_state_0_23_5_t *)mem;
2761 0 : fd_vote_state_0_23_5_new( self );
2762 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_state_0_23_5_t);
2763 0 : void * * alloc_mem = &alloc_region;
2764 0 : fd_vote_state_0_23_5_decode_inner( mem, alloc_mem, ctx );
2765 0 : return self;
2766 0 : }
2767 0 : void fd_vote_state_0_23_5_new(fd_vote_state_0_23_5_t * self) {
2768 0 : fd_memset( self, 0, sizeof(fd_vote_state_0_23_5_t) );
2769 0 : fd_pubkey_new( &self->node_pubkey );
2770 0 : fd_pubkey_new( &self->authorized_voter );
2771 0 : fd_vote_prior_voters_0_23_5_new( &self->prior_voters );
2772 0 : fd_pubkey_new( &self->authorized_withdrawer );
2773 0 : fd_vote_block_timestamp_new( &self->last_timestamp );
2774 0 : }
2775 0 : void fd_vote_state_0_23_5_walk( void * w, fd_vote_state_0_23_5_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
2776 0 : (void) varint;
2777 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_state_0_23_5", level++, 0 );
2778 0 : fd_pubkey_walk( w, &self->node_pubkey, fun, "node_pubkey", level, 0 );
2779 0 : fd_pubkey_walk( w, &self->authorized_voter, fun, "authorized_voter", level, 0 );
2780 0 : fun( w, &self->authorized_voter_epoch, "authorized_voter_epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2781 0 : fd_vote_prior_voters_0_23_5_walk( w, &self->prior_voters, fun, "prior_voters", level, 0 );
2782 0 : fd_pubkey_walk( w, &self->authorized_withdrawer, fun, "authorized_withdrawer", level, 0 );
2783 0 : fun( w, &self->commission, "commission", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
2784 :
2785 : /* Walk deque */
2786 0 : fun( w, self->votes, "votes", FD_FLAMENCO_TYPE_ARR, "votes", level++, 0 );
2787 0 : if( self->votes ) {
2788 0 : for( deq_fd_vote_lockout_t_iter_t iter = deq_fd_vote_lockout_t_iter_init( self->votes );
2789 0 : !deq_fd_vote_lockout_t_iter_done( self->votes, iter );
2790 0 : iter = deq_fd_vote_lockout_t_iter_next( self->votes, iter ) ) {
2791 0 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->votes, iter );
2792 0 : fd_vote_lockout_walk(w, ele, fun, "votes", level, 0 );
2793 0 : }
2794 0 : }
2795 0 : fun( w, self->votes, "votes", FD_FLAMENCO_TYPE_ARR_END, "votes", level--, 0 );
2796 : /* Done walking deque */
2797 :
2798 0 : if( !self->has_root_slot ) {
2799 0 : fun( w, NULL, "root_slot", FD_FLAMENCO_TYPE_NULL, "ulong", level, 0 );
2800 0 : } else {
2801 0 : fun( w, &self->root_slot, "root_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2802 0 : }
2803 :
2804 : /* Walk deque */
2805 0 : fun( w, self->epoch_credits, "epoch_credits", FD_FLAMENCO_TYPE_ARR, "epoch_credits", level++, 0 );
2806 0 : if( self->epoch_credits ) {
2807 0 : for( deq_fd_vote_epoch_credits_t_iter_t iter = deq_fd_vote_epoch_credits_t_iter_init( self->epoch_credits );
2808 0 : !deq_fd_vote_epoch_credits_t_iter_done( self->epoch_credits, iter );
2809 0 : iter = deq_fd_vote_epoch_credits_t_iter_next( self->epoch_credits, iter ) ) {
2810 0 : fd_vote_epoch_credits_t * ele = deq_fd_vote_epoch_credits_t_iter_ele( self->epoch_credits, iter );
2811 0 : fd_vote_epoch_credits_walk(w, ele, fun, "epoch_credits", level, 0 );
2812 0 : }
2813 0 : }
2814 0 : fun( w, self->epoch_credits, "epoch_credits", FD_FLAMENCO_TYPE_ARR_END, "epoch_credits", level--, 0 );
2815 : /* Done walking deque */
2816 :
2817 0 : fd_vote_block_timestamp_walk( w, &self->last_timestamp, fun, "last_timestamp", level, 0 );
2818 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_state_0_23_5", level--, 0 );
2819 0 : }
2820 0 : ulong fd_vote_state_0_23_5_size( fd_vote_state_0_23_5_t const * self ) {
2821 0 : ulong size = 0;
2822 0 : size += fd_pubkey_size( &self->node_pubkey );
2823 0 : size += fd_pubkey_size( &self->authorized_voter );
2824 0 : size += sizeof(ulong);
2825 0 : size += fd_vote_prior_voters_0_23_5_size( &self->prior_voters );
2826 0 : size += fd_pubkey_size( &self->authorized_withdrawer );
2827 0 : size += sizeof(char);
2828 0 : if( self->votes ) {
2829 0 : size += sizeof(ulong);
2830 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 ) ) {
2831 0 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->votes, iter );
2832 0 : size += fd_vote_lockout_size( ele );
2833 0 : }
2834 0 : } else {
2835 0 : size += sizeof(ulong);
2836 0 : }
2837 0 : size += sizeof(char);
2838 0 : if( self->has_root_slot ) {
2839 0 : size += sizeof(ulong);
2840 0 : }
2841 0 : if( self->epoch_credits ) {
2842 0 : size += sizeof(ulong);
2843 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 ) ) {
2844 0 : fd_vote_epoch_credits_t * ele = deq_fd_vote_epoch_credits_t_iter_ele( self->epoch_credits, iter );
2845 0 : size += fd_vote_epoch_credits_size( ele );
2846 0 : }
2847 0 : } else {
2848 0 : size += sizeof(ulong);
2849 0 : }
2850 0 : size += fd_vote_block_timestamp_size( &self->last_timestamp );
2851 0 : return size;
2852 0 : }
2853 :
2854 18 : int fd_vote_authorized_voters_encode( fd_vote_authorized_voters_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2855 18 : int err;
2856 18 : if( self->treap ) {
2857 18 : ulong fd_vote_authorized_voters_len = fd_vote_authorized_voters_treap_ele_cnt( self->treap );
2858 18 : err = fd_bincode_uint64_encode( fd_vote_authorized_voters_len, ctx );
2859 18 : if( FD_UNLIKELY( err ) ) return err;
2860 18 : for( fd_vote_authorized_voters_treap_fwd_iter_t iter = fd_vote_authorized_voters_treap_fwd_iter_init( self->treap, self->pool );
2861 36 : !fd_vote_authorized_voters_treap_fwd_iter_done( iter );
2862 18 : iter = fd_vote_authorized_voters_treap_fwd_iter_next( iter, self->pool ) ) {
2863 18 : fd_vote_authorized_voter_t * ele = fd_vote_authorized_voters_treap_fwd_iter_ele( iter, self->pool );
2864 18 : err = fd_vote_authorized_voter_encode( ele, ctx );
2865 18 : if( FD_UNLIKELY( err ) ) return err;
2866 18 : }
2867 18 : } else {
2868 0 : ulong fd_vote_authorized_voters_len = 0;
2869 0 : err = fd_bincode_uint64_encode( fd_vote_authorized_voters_len, ctx );
2870 0 : if( FD_UNLIKELY( err ) ) return err;
2871 0 : }
2872 18 : return FD_BINCODE_SUCCESS;
2873 18 : }
2874 15 : static int fd_vote_authorized_voters_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2875 15 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2876 15 : int err = 0;
2877 15 : ulong fd_vote_authorized_voters_treap_len;
2878 15 : err = fd_bincode_uint64_decode( &fd_vote_authorized_voters_treap_len, ctx );
2879 15 : if( FD_UNLIKELY( err ) ) return err;
2880 15 : ulong fd_vote_authorized_voters_treap_max = fd_ulong_max( fd_ulong_max( fd_vote_authorized_voters_treap_len, FD_VOTE_AUTHORIZED_VOTERS_MIN ), 1UL );
2881 15 : *total_sz += fd_vote_authorized_voters_pool_align() + fd_vote_authorized_voters_pool_footprint( fd_vote_authorized_voters_treap_max );
2882 15 : *total_sz += fd_vote_authorized_voters_treap_align() + fd_vote_authorized_voters_treap_footprint( fd_vote_authorized_voters_treap_max );
2883 30 : for( ulong i=0; i < fd_vote_authorized_voters_treap_len; i++ ) {
2884 15 : err = fd_vote_authorized_voter_decode_footprint_inner( ctx, total_sz );
2885 15 : if( FD_UNLIKELY ( err ) ) return err;
2886 15 : }
2887 15 : return 0;
2888 15 : }
2889 0 : int fd_vote_authorized_voters_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2890 0 : *total_sz += sizeof(fd_vote_authorized_voters_t);
2891 0 : void const * start_data = ctx->data;
2892 0 : int err = fd_vote_authorized_voters_decode_footprint_inner( ctx, total_sz );
2893 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2894 0 : ctx->data = start_data;
2895 0 : return err;
2896 0 : }
2897 15 : static void fd_vote_authorized_voters_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2898 15 : fd_vote_authorized_voters_t * self = (fd_vote_authorized_voters_t *)struct_mem;
2899 15 : ulong fd_vote_authorized_voters_treap_len;
2900 15 : fd_bincode_uint64_decode_unsafe( &fd_vote_authorized_voters_treap_len, ctx );
2901 15 : ulong fd_vote_authorized_voters_treap_max = fd_ulong_max( fd_vote_authorized_voters_treap_len, FD_VOTE_AUTHORIZED_VOTERS_MIN );
2902 15 : self->pool = fd_vote_authorized_voters_pool_join_new( alloc_mem, fd_vote_authorized_voters_treap_max );
2903 15 : self->treap = fd_vote_authorized_voters_treap_join_new( alloc_mem, fd_vote_authorized_voters_treap_max );
2904 30 : for( ulong i=0; i < fd_vote_authorized_voters_treap_len; i++ ) {
2905 15 : fd_vote_authorized_voter_t * ele = fd_vote_authorized_voters_pool_ele_acquire( self->pool );
2906 15 : fd_vote_authorized_voter_new( ele );
2907 15 : fd_vote_authorized_voter_decode_inner( ele, alloc_mem, ctx );
2908 15 : fd_vote_authorized_voter_t * repeated_entry = fd_vote_authorized_voters_treap_ele_query( self->treap, ele->epoch, self->pool );
2909 15 : if( repeated_entry ) {
2910 0 : fd_vote_authorized_voters_treap_ele_remove( self->treap, repeated_entry, self->pool ); // Remove the element before inserting it back to avoid duplication
2911 0 : fd_vote_authorized_voters_pool_ele_release( self->pool, repeated_entry );
2912 0 : }
2913 15 : fd_vote_authorized_voters_treap_ele_insert( self->treap, ele, self->pool ); /* this cannot fail */
2914 15 : }
2915 15 : }
2916 0 : void * fd_vote_authorized_voters_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2917 0 : fd_vote_authorized_voters_t * self = (fd_vote_authorized_voters_t *)mem;
2918 0 : fd_vote_authorized_voters_new( self );
2919 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_authorized_voters_t);
2920 0 : void * * alloc_mem = &alloc_region;
2921 0 : fd_vote_authorized_voters_decode_inner( mem, alloc_mem, ctx );
2922 0 : return self;
2923 0 : }
2924 12 : void fd_vote_authorized_voters_new(fd_vote_authorized_voters_t * self) {
2925 12 : fd_memset( self, 0, sizeof(fd_vote_authorized_voters_t) );
2926 12 : }
2927 9 : void fd_vote_authorized_voters_walk( void * w, fd_vote_authorized_voters_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
2928 9 : (void) varint;
2929 9 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_authorized_voters", level++, 0 );
2930 9 : if( self->treap ) {
2931 9 : for( fd_vote_authorized_voters_treap_fwd_iter_t iter = fd_vote_authorized_voters_treap_fwd_iter_init( self->treap, self->pool );
2932 18 : !fd_vote_authorized_voters_treap_fwd_iter_done( iter );
2933 9 : iter = fd_vote_authorized_voters_treap_fwd_iter_next( iter, self->pool ) ) {
2934 9 : fd_vote_authorized_voter_t * ele = fd_vote_authorized_voters_treap_fwd_iter_ele( iter, self->pool );
2935 9 : fd_vote_authorized_voter_walk( w, ele, fun, "fd_vote_authorized_voter_t", level, 0 );
2936 9 : }
2937 9 : }
2938 9 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_authorized_voters", level--, 0 );
2939 9 : }
2940 0 : ulong fd_vote_authorized_voters_size( fd_vote_authorized_voters_t const * self ) {
2941 0 : ulong size = 0;
2942 0 : size += sizeof(ulong);
2943 0 : if( self->treap ) {
2944 0 : for( fd_vote_authorized_voters_treap_fwd_iter_t iter = fd_vote_authorized_voters_treap_fwd_iter_init( self->treap, self->pool );
2945 0 : !fd_vote_authorized_voters_treap_fwd_iter_done( iter );
2946 0 : iter = fd_vote_authorized_voters_treap_fwd_iter_next( iter, self->pool ) ) {
2947 0 : fd_vote_authorized_voter_t * ele = fd_vote_authorized_voters_treap_fwd_iter_ele( iter, self->pool );
2948 0 : size += fd_vote_authorized_voter_size( ele );
2949 0 : }
2950 0 : }
2951 0 : return size;
2952 0 : }
2953 :
2954 0 : int fd_vote_state_1_14_11_encode( fd_vote_state_1_14_11_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2955 0 : int err;
2956 0 : err = fd_pubkey_encode( &self->node_pubkey, ctx );
2957 0 : if( FD_UNLIKELY( err ) ) return err;
2958 0 : err = fd_pubkey_encode( &self->authorized_withdrawer, ctx );
2959 0 : if( FD_UNLIKELY( err ) ) return err;
2960 0 : err = fd_bincode_uint8_encode( (uchar)(self->commission), ctx );
2961 0 : if( FD_UNLIKELY( err ) ) return err;
2962 0 : if( self->votes ) {
2963 0 : ulong votes_len = deq_fd_vote_lockout_t_cnt( self->votes );
2964 0 : err = fd_bincode_uint64_encode( votes_len, ctx );
2965 0 : if( FD_UNLIKELY( err ) ) return err;
2966 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 ) ) {
2967 0 : fd_vote_lockout_t const * ele = deq_fd_vote_lockout_t_iter_ele_const( self->votes, iter );
2968 0 : err = fd_vote_lockout_encode( ele, ctx );
2969 0 : if( FD_UNLIKELY( err ) ) return err;
2970 0 : }
2971 0 : } else {
2972 0 : ulong votes_len = 0;
2973 0 : err = fd_bincode_uint64_encode( votes_len, ctx );
2974 0 : if( FD_UNLIKELY( err ) ) return err;
2975 0 : }
2976 0 : err = fd_bincode_bool_encode( self->has_root_slot, ctx );
2977 0 : if( FD_UNLIKELY( err ) ) return err;
2978 0 : if( self->has_root_slot ) {
2979 0 : err = fd_bincode_uint64_encode( self->root_slot, ctx );
2980 0 : if( FD_UNLIKELY( err ) ) return err;
2981 0 : }
2982 0 : err = fd_vote_authorized_voters_encode( &self->authorized_voters, ctx );
2983 0 : if( FD_UNLIKELY( err ) ) return err;
2984 0 : err = fd_vote_prior_voters_encode( &self->prior_voters, ctx );
2985 0 : if( FD_UNLIKELY( err ) ) return err;
2986 0 : if( self->epoch_credits ) {
2987 0 : ulong epoch_credits_len = deq_fd_vote_epoch_credits_t_cnt( self->epoch_credits );
2988 0 : err = fd_bincode_uint64_encode( epoch_credits_len, ctx );
2989 0 : if( FD_UNLIKELY( err ) ) return err;
2990 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 ) ) {
2991 0 : fd_vote_epoch_credits_t const * ele = deq_fd_vote_epoch_credits_t_iter_ele_const( self->epoch_credits, iter );
2992 0 : err = fd_vote_epoch_credits_encode( ele, ctx );
2993 0 : if( FD_UNLIKELY( err ) ) return err;
2994 0 : }
2995 0 : } else {
2996 0 : ulong epoch_credits_len = 0;
2997 0 : err = fd_bincode_uint64_encode( epoch_credits_len, ctx );
2998 0 : if( FD_UNLIKELY( err ) ) return err;
2999 0 : }
3000 0 : err = fd_vote_block_timestamp_encode( &self->last_timestamp, ctx );
3001 0 : if( FD_UNLIKELY( err ) ) return err;
3002 0 : return FD_BINCODE_SUCCESS;
3003 0 : }
3004 0 : static int fd_vote_state_1_14_11_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3005 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3006 0 : int err = 0;
3007 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
3008 0 : if( FD_UNLIKELY( err ) ) return err;
3009 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
3010 0 : if( FD_UNLIKELY( err ) ) return err;
3011 0 : err = fd_bincode_uint8_decode_footprint( ctx );
3012 0 : if( FD_UNLIKELY( err ) ) return err;
3013 0 : ulong votes_len;
3014 0 : err = fd_bincode_uint64_decode( &votes_len, ctx );
3015 0 : if( FD_UNLIKELY( err ) ) return err;
3016 0 : ulong votes_max = fd_ulong_max( votes_len, 32 );
3017 0 : *total_sz += deq_fd_vote_lockout_t_align() + deq_fd_vote_lockout_t_footprint( votes_max );
3018 0 : ulong votes_sz;
3019 0 : if( FD_UNLIKELY( __builtin_umull_overflow( votes_len, 12, &votes_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
3020 0 : err = fd_bincode_bytes_decode_footprint( votes_sz, ctx );
3021 0 : if( FD_UNLIKELY( err ) ) return err;
3022 0 : {
3023 0 : uchar o;
3024 0 : err = fd_bincode_bool_decode( &o, ctx );
3025 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3026 0 : if( o ) {
3027 0 : err = fd_bincode_uint64_decode_footprint( ctx );
3028 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3029 0 : }
3030 0 : }
3031 0 : err = fd_vote_authorized_voters_decode_footprint_inner( ctx, total_sz );
3032 0 : if( FD_UNLIKELY( err ) ) return err;
3033 0 : err = fd_vote_prior_voters_decode_footprint_inner( ctx, total_sz );
3034 0 : if( FD_UNLIKELY( err ) ) return err;
3035 0 : ulong epoch_credits_len;
3036 0 : err = fd_bincode_uint64_decode( &epoch_credits_len, ctx );
3037 0 : if( FD_UNLIKELY( err ) ) return err;
3038 0 : ulong epoch_credits_max = fd_ulong_max( epoch_credits_len, 64 );
3039 0 : *total_sz += deq_fd_vote_epoch_credits_t_align() + deq_fd_vote_epoch_credits_t_footprint( epoch_credits_max );
3040 0 : ulong epoch_credits_sz;
3041 0 : if( FD_UNLIKELY( __builtin_umull_overflow( epoch_credits_len, 24, &epoch_credits_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
3042 0 : err = fd_bincode_bytes_decode_footprint( epoch_credits_sz, ctx );
3043 0 : if( FD_UNLIKELY( err ) ) return err;
3044 0 : err = fd_vote_block_timestamp_decode_footprint_inner( ctx, total_sz );
3045 0 : if( FD_UNLIKELY( err ) ) return err;
3046 0 : return 0;
3047 0 : }
3048 0 : int fd_vote_state_1_14_11_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3049 0 : *total_sz += sizeof(fd_vote_state_1_14_11_t);
3050 0 : void const * start_data = ctx->data;
3051 0 : int err = fd_vote_state_1_14_11_decode_footprint_inner( ctx, total_sz );
3052 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3053 0 : ctx->data = start_data;
3054 0 : return err;
3055 0 : }
3056 0 : static void fd_vote_state_1_14_11_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3057 0 : fd_vote_state_1_14_11_t * self = (fd_vote_state_1_14_11_t *)struct_mem;
3058 0 : fd_pubkey_decode_inner( &self->node_pubkey, alloc_mem, ctx );
3059 0 : fd_pubkey_decode_inner( &self->authorized_withdrawer, alloc_mem, ctx );
3060 0 : fd_bincode_uint8_decode_unsafe( &self->commission, ctx );
3061 0 : ulong votes_len;
3062 0 : fd_bincode_uint64_decode_unsafe( &votes_len, ctx );
3063 0 : ulong votes_max = fd_ulong_max( votes_len, 32 );
3064 0 : self->votes = deq_fd_vote_lockout_t_join_new( alloc_mem, votes_max );
3065 0 : for( ulong i=0; i < votes_len; i++ ) {
3066 0 : fd_vote_lockout_t * elem = deq_fd_vote_lockout_t_push_tail_nocopy( self->votes );
3067 0 : fd_vote_lockout_new( elem );
3068 0 : fd_vote_lockout_decode_inner( elem, alloc_mem, ctx );
3069 0 : }
3070 0 : {
3071 0 : uchar o;
3072 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
3073 0 : self->has_root_slot = !!o;
3074 0 : if( o ) {
3075 0 : fd_bincode_uint64_decode_unsafe( &self->root_slot, ctx );
3076 0 : }
3077 0 : }
3078 0 : fd_vote_authorized_voters_decode_inner( &self->authorized_voters, alloc_mem, ctx );
3079 0 : fd_vote_prior_voters_decode_inner( &self->prior_voters, alloc_mem, ctx );
3080 0 : ulong epoch_credits_len;
3081 0 : fd_bincode_uint64_decode_unsafe( &epoch_credits_len, ctx );
3082 0 : ulong epoch_credits_max = fd_ulong_max( epoch_credits_len, 64 );
3083 0 : self->epoch_credits = deq_fd_vote_epoch_credits_t_join_new( alloc_mem, epoch_credits_max );
3084 0 : for( ulong i=0; i < epoch_credits_len; i++ ) {
3085 0 : fd_vote_epoch_credits_t * elem = deq_fd_vote_epoch_credits_t_push_tail_nocopy( self->epoch_credits );
3086 0 : fd_vote_epoch_credits_new( elem );
3087 0 : fd_vote_epoch_credits_decode_inner( elem, alloc_mem, ctx );
3088 0 : }
3089 0 : fd_vote_block_timestamp_decode_inner( &self->last_timestamp, alloc_mem, ctx );
3090 0 : }
3091 0 : void * fd_vote_state_1_14_11_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3092 0 : fd_vote_state_1_14_11_t * self = (fd_vote_state_1_14_11_t *)mem;
3093 0 : fd_vote_state_1_14_11_new( self );
3094 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_state_1_14_11_t);
3095 0 : void * * alloc_mem = &alloc_region;
3096 0 : fd_vote_state_1_14_11_decode_inner( mem, alloc_mem, ctx );
3097 0 : return self;
3098 0 : }
3099 0 : void fd_vote_state_1_14_11_new(fd_vote_state_1_14_11_t * self) {
3100 0 : fd_memset( self, 0, sizeof(fd_vote_state_1_14_11_t) );
3101 0 : fd_pubkey_new( &self->node_pubkey );
3102 0 : fd_pubkey_new( &self->authorized_withdrawer );
3103 0 : fd_vote_authorized_voters_new( &self->authorized_voters );
3104 0 : fd_vote_prior_voters_new( &self->prior_voters );
3105 0 : fd_vote_block_timestamp_new( &self->last_timestamp );
3106 0 : }
3107 0 : void fd_vote_state_1_14_11_walk( void * w, fd_vote_state_1_14_11_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
3108 0 : (void) varint;
3109 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_state_1_14_11", level++, 0 );
3110 0 : fd_pubkey_walk( w, &self->node_pubkey, fun, "node_pubkey", level, 0 );
3111 0 : fd_pubkey_walk( w, &self->authorized_withdrawer, fun, "authorized_withdrawer", level, 0 );
3112 0 : fun( w, &self->commission, "commission", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
3113 :
3114 : /* Walk deque */
3115 0 : fun( w, self->votes, "votes", FD_FLAMENCO_TYPE_ARR, "votes", level++, 0 );
3116 0 : if( self->votes ) {
3117 0 : for( deq_fd_vote_lockout_t_iter_t iter = deq_fd_vote_lockout_t_iter_init( self->votes );
3118 0 : !deq_fd_vote_lockout_t_iter_done( self->votes, iter );
3119 0 : iter = deq_fd_vote_lockout_t_iter_next( self->votes, iter ) ) {
3120 0 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->votes, iter );
3121 0 : fd_vote_lockout_walk(w, ele, fun, "votes", level, 0 );
3122 0 : }
3123 0 : }
3124 0 : fun( w, self->votes, "votes", FD_FLAMENCO_TYPE_ARR_END, "votes", level--, 0 );
3125 : /* Done walking deque */
3126 :
3127 0 : if( !self->has_root_slot ) {
3128 0 : fun( w, NULL, "root_slot", FD_FLAMENCO_TYPE_NULL, "ulong", level, 0 );
3129 0 : } else {
3130 0 : fun( w, &self->root_slot, "root_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
3131 0 : }
3132 0 : fd_vote_authorized_voters_walk( w, &self->authorized_voters, fun, "authorized_voters", level, 0 );
3133 0 : fd_vote_prior_voters_walk( w, &self->prior_voters, fun, "prior_voters", level, 0 );
3134 :
3135 : /* Walk deque */
3136 0 : fun( w, self->epoch_credits, "epoch_credits", FD_FLAMENCO_TYPE_ARR, "epoch_credits", level++, 0 );
3137 0 : if( self->epoch_credits ) {
3138 0 : for( deq_fd_vote_epoch_credits_t_iter_t iter = deq_fd_vote_epoch_credits_t_iter_init( self->epoch_credits );
3139 0 : !deq_fd_vote_epoch_credits_t_iter_done( self->epoch_credits, iter );
3140 0 : iter = deq_fd_vote_epoch_credits_t_iter_next( self->epoch_credits, iter ) ) {
3141 0 : fd_vote_epoch_credits_t * ele = deq_fd_vote_epoch_credits_t_iter_ele( self->epoch_credits, iter );
3142 0 : fd_vote_epoch_credits_walk(w, ele, fun, "epoch_credits", level, 0 );
3143 0 : }
3144 0 : }
3145 0 : fun( w, self->epoch_credits, "epoch_credits", FD_FLAMENCO_TYPE_ARR_END, "epoch_credits", level--, 0 );
3146 : /* Done walking deque */
3147 :
3148 0 : fd_vote_block_timestamp_walk( w, &self->last_timestamp, fun, "last_timestamp", level, 0 );
3149 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_state_1_14_11", level--, 0 );
3150 0 : }
3151 0 : ulong fd_vote_state_1_14_11_size( fd_vote_state_1_14_11_t const * self ) {
3152 0 : ulong size = 0;
3153 0 : size += fd_pubkey_size( &self->node_pubkey );
3154 0 : size += fd_pubkey_size( &self->authorized_withdrawer );
3155 0 : size += sizeof(char);
3156 0 : if( self->votes ) {
3157 0 : size += sizeof(ulong);
3158 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 ) ) {
3159 0 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->votes, iter );
3160 0 : size += fd_vote_lockout_size( ele );
3161 0 : }
3162 0 : } else {
3163 0 : size += sizeof(ulong);
3164 0 : }
3165 0 : size += sizeof(char);
3166 0 : if( self->has_root_slot ) {
3167 0 : size += sizeof(ulong);
3168 0 : }
3169 0 : size += fd_vote_authorized_voters_size( &self->authorized_voters );
3170 0 : size += fd_vote_prior_voters_size( &self->prior_voters );
3171 0 : if( self->epoch_credits ) {
3172 0 : size += sizeof(ulong);
3173 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 ) ) {
3174 0 : fd_vote_epoch_credits_t * ele = deq_fd_vote_epoch_credits_t_iter_ele( self->epoch_credits, iter );
3175 0 : size += fd_vote_epoch_credits_size( ele );
3176 0 : }
3177 0 : } else {
3178 0 : size += sizeof(ulong);
3179 0 : }
3180 0 : size += fd_vote_block_timestamp_size( &self->last_timestamp );
3181 0 : return size;
3182 0 : }
3183 :
3184 18 : int fd_vote_state_encode( fd_vote_state_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3185 18 : int err;
3186 18 : err = fd_pubkey_encode( &self->node_pubkey, ctx );
3187 18 : if( FD_UNLIKELY( err ) ) return err;
3188 18 : err = fd_pubkey_encode( &self->authorized_withdrawer, ctx );
3189 18 : if( FD_UNLIKELY( err ) ) return err;
3190 18 : err = fd_bincode_uint8_encode( (uchar)(self->commission), ctx );
3191 18 : if( FD_UNLIKELY( err ) ) return err;
3192 18 : if( self->votes ) {
3193 6 : ulong votes_len = deq_fd_landed_vote_t_cnt( self->votes );
3194 6 : err = fd_bincode_uint64_encode( votes_len, ctx );
3195 6 : if( FD_UNLIKELY( err ) ) return err;
3196 102 : for( deq_fd_landed_vote_t_iter_t iter = deq_fd_landed_vote_t_iter_init( self->votes ); !deq_fd_landed_vote_t_iter_done( self->votes, iter ); iter = deq_fd_landed_vote_t_iter_next( self->votes, iter ) ) {
3197 96 : fd_landed_vote_t const * ele = deq_fd_landed_vote_t_iter_ele_const( self->votes, iter );
3198 96 : err = fd_landed_vote_encode( ele, ctx );
3199 96 : if( FD_UNLIKELY( err ) ) return err;
3200 96 : }
3201 12 : } else {
3202 12 : ulong votes_len = 0;
3203 12 : err = fd_bincode_uint64_encode( votes_len, ctx );
3204 12 : if( FD_UNLIKELY( err ) ) return err;
3205 12 : }
3206 18 : err = fd_bincode_bool_encode( self->has_root_slot, ctx );
3207 18 : if( FD_UNLIKELY( err ) ) return err;
3208 18 : if( self->has_root_slot ) {
3209 6 : err = fd_bincode_uint64_encode( self->root_slot, ctx );
3210 6 : if( FD_UNLIKELY( err ) ) return err;
3211 6 : }
3212 18 : err = fd_vote_authorized_voters_encode( &self->authorized_voters, ctx );
3213 18 : if( FD_UNLIKELY( err ) ) return err;
3214 18 : err = fd_vote_prior_voters_encode( &self->prior_voters, ctx );
3215 18 : if( FD_UNLIKELY( err ) ) return err;
3216 18 : if( self->epoch_credits ) {
3217 6 : ulong epoch_credits_len = deq_fd_vote_epoch_credits_t_cnt( self->epoch_credits );
3218 6 : err = fd_bincode_uint64_encode( epoch_credits_len, ctx );
3219 6 : if( FD_UNLIKELY( err ) ) return err;
3220 201 : for( deq_fd_vote_epoch_credits_t_iter_t iter = deq_fd_vote_epoch_credits_t_iter_init( self->epoch_credits ); !deq_fd_vote_epoch_credits_t_iter_done( self->epoch_credits, iter ); iter = deq_fd_vote_epoch_credits_t_iter_next( self->epoch_credits, iter ) ) {
3221 195 : fd_vote_epoch_credits_t const * ele = deq_fd_vote_epoch_credits_t_iter_ele_const( self->epoch_credits, iter );
3222 195 : err = fd_vote_epoch_credits_encode( ele, ctx );
3223 195 : if( FD_UNLIKELY( err ) ) return err;
3224 195 : }
3225 12 : } else {
3226 12 : ulong epoch_credits_len = 0;
3227 12 : err = fd_bincode_uint64_encode( epoch_credits_len, ctx );
3228 12 : if( FD_UNLIKELY( err ) ) return err;
3229 12 : }
3230 18 : err = fd_vote_block_timestamp_encode( &self->last_timestamp, ctx );
3231 18 : if( FD_UNLIKELY( err ) ) return err;
3232 18 : return FD_BINCODE_SUCCESS;
3233 18 : }
3234 15 : static int fd_vote_state_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3235 15 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3236 15 : int err = 0;
3237 15 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
3238 15 : if( FD_UNLIKELY( err ) ) return err;
3239 15 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
3240 15 : if( FD_UNLIKELY( err ) ) return err;
3241 15 : err = fd_bincode_uint8_decode_footprint( ctx );
3242 15 : if( FD_UNLIKELY( err ) ) return err;
3243 15 : ulong votes_len;
3244 15 : err = fd_bincode_uint64_decode( &votes_len, ctx );
3245 15 : if( FD_UNLIKELY( err ) ) return err;
3246 15 : ulong votes_max = fd_ulong_max( votes_len, 32 );
3247 15 : *total_sz += deq_fd_landed_vote_t_align() + deq_fd_landed_vote_t_footprint( votes_max );
3248 15 : ulong votes_sz;
3249 15 : if( FD_UNLIKELY( __builtin_umull_overflow( votes_len, 13, &votes_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
3250 15 : err = fd_bincode_bytes_decode_footprint( votes_sz, ctx );
3251 15 : if( FD_UNLIKELY( err ) ) return err;
3252 15 : {
3253 15 : uchar o;
3254 15 : err = fd_bincode_bool_decode( &o, ctx );
3255 15 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3256 15 : if( o ) {
3257 15 : err = fd_bincode_uint64_decode_footprint( ctx );
3258 15 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3259 15 : }
3260 15 : }
3261 15 : err = fd_vote_authorized_voters_decode_footprint_inner( ctx, total_sz );
3262 15 : if( FD_UNLIKELY( err ) ) return err;
3263 15 : err = fd_vote_prior_voters_decode_footprint_inner( ctx, total_sz );
3264 15 : if( FD_UNLIKELY( err ) ) return err;
3265 15 : ulong epoch_credits_len;
3266 15 : err = fd_bincode_uint64_decode( &epoch_credits_len, ctx );
3267 15 : if( FD_UNLIKELY( err ) ) return err;
3268 15 : ulong epoch_credits_max = fd_ulong_max( epoch_credits_len, 64 );
3269 15 : *total_sz += deq_fd_vote_epoch_credits_t_align() + deq_fd_vote_epoch_credits_t_footprint( epoch_credits_max );
3270 15 : ulong epoch_credits_sz;
3271 15 : if( FD_UNLIKELY( __builtin_umull_overflow( epoch_credits_len, 24, &epoch_credits_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
3272 15 : err = fd_bincode_bytes_decode_footprint( epoch_credits_sz, ctx );
3273 15 : if( FD_UNLIKELY( err ) ) return err;
3274 15 : err = fd_vote_block_timestamp_decode_footprint_inner( ctx, total_sz );
3275 15 : if( FD_UNLIKELY( err ) ) return err;
3276 15 : return 0;
3277 15 : }
3278 0 : int fd_vote_state_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3279 0 : *total_sz += sizeof(fd_vote_state_t);
3280 0 : void const * start_data = ctx->data;
3281 0 : int err = fd_vote_state_decode_footprint_inner( ctx, total_sz );
3282 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3283 0 : ctx->data = start_data;
3284 0 : return err;
3285 0 : }
3286 15 : static void fd_vote_state_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3287 15 : fd_vote_state_t * self = (fd_vote_state_t *)struct_mem;
3288 15 : fd_pubkey_decode_inner( &self->node_pubkey, alloc_mem, ctx );
3289 15 : fd_pubkey_decode_inner( &self->authorized_withdrawer, alloc_mem, ctx );
3290 15 : fd_bincode_uint8_decode_unsafe( &self->commission, ctx );
3291 15 : ulong votes_len;
3292 15 : fd_bincode_uint64_decode_unsafe( &votes_len, ctx );
3293 15 : ulong votes_max = fd_ulong_max( votes_len, 32 );
3294 15 : self->votes = deq_fd_landed_vote_t_join_new( alloc_mem, votes_max );
3295 210 : for( ulong i=0; i < votes_len; i++ ) {
3296 195 : fd_landed_vote_t * elem = deq_fd_landed_vote_t_push_tail_nocopy( self->votes );
3297 195 : fd_landed_vote_new( elem );
3298 195 : fd_landed_vote_decode_inner( elem, alloc_mem, ctx );
3299 195 : }
3300 15 : {
3301 15 : uchar o;
3302 15 : fd_bincode_bool_decode_unsafe( &o, ctx );
3303 15 : self->has_root_slot = !!o;
3304 15 : if( o ) {
3305 15 : fd_bincode_uint64_decode_unsafe( &self->root_slot, ctx );
3306 15 : }
3307 15 : }
3308 15 : fd_vote_authorized_voters_decode_inner( &self->authorized_voters, alloc_mem, ctx );
3309 15 : fd_vote_prior_voters_decode_inner( &self->prior_voters, alloc_mem, ctx );
3310 15 : ulong epoch_credits_len;
3311 15 : fd_bincode_uint64_decode_unsafe( &epoch_credits_len, ctx );
3312 15 : ulong epoch_credits_max = fd_ulong_max( epoch_credits_len, 64 );
3313 15 : self->epoch_credits = deq_fd_vote_epoch_credits_t_join_new( alloc_mem, epoch_credits_max );
3314 408 : for( ulong i=0; i < epoch_credits_len; i++ ) {
3315 393 : fd_vote_epoch_credits_t * elem = deq_fd_vote_epoch_credits_t_push_tail_nocopy( self->epoch_credits );
3316 393 : fd_vote_epoch_credits_new( elem );
3317 393 : fd_vote_epoch_credits_decode_inner( elem, alloc_mem, ctx );
3318 393 : }
3319 15 : fd_vote_block_timestamp_decode_inner( &self->last_timestamp, alloc_mem, ctx );
3320 15 : }
3321 0 : void * fd_vote_state_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3322 0 : fd_vote_state_t * self = (fd_vote_state_t *)mem;
3323 0 : fd_vote_state_new( self );
3324 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_state_t);
3325 0 : void * * alloc_mem = &alloc_region;
3326 0 : fd_vote_state_decode_inner( mem, alloc_mem, ctx );
3327 0 : return self;
3328 0 : }
3329 12 : void fd_vote_state_new(fd_vote_state_t * self) {
3330 12 : fd_memset( self, 0, sizeof(fd_vote_state_t) );
3331 12 : fd_pubkey_new( &self->node_pubkey );
3332 12 : fd_pubkey_new( &self->authorized_withdrawer );
3333 12 : fd_vote_authorized_voters_new( &self->authorized_voters );
3334 12 : fd_vote_prior_voters_new( &self->prior_voters );
3335 12 : fd_vote_block_timestamp_new( &self->last_timestamp );
3336 12 : }
3337 9 : void fd_vote_state_walk( void * w, fd_vote_state_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
3338 9 : (void) varint;
3339 9 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_state", level++, 0 );
3340 9 : fd_pubkey_walk( w, &self->node_pubkey, fun, "node_pubkey", level, 0 );
3341 9 : fd_pubkey_walk( w, &self->authorized_withdrawer, fun, "authorized_withdrawer", level, 0 );
3342 9 : fun( w, &self->commission, "commission", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
3343 :
3344 : /* Walk deque */
3345 9 : fun( w, self->votes, "votes", FD_FLAMENCO_TYPE_ARR, "votes", level++, 0 );
3346 9 : if( self->votes ) {
3347 9 : for( deq_fd_landed_vote_t_iter_t iter = deq_fd_landed_vote_t_iter_init( self->votes );
3348 108 : !deq_fd_landed_vote_t_iter_done( self->votes, iter );
3349 99 : iter = deq_fd_landed_vote_t_iter_next( self->votes, iter ) ) {
3350 99 : fd_landed_vote_t * ele = deq_fd_landed_vote_t_iter_ele( self->votes, iter );
3351 99 : fd_landed_vote_walk(w, ele, fun, "votes", level, 0 );
3352 99 : }
3353 9 : }
3354 9 : fun( w, self->votes, "votes", FD_FLAMENCO_TYPE_ARR_END, "votes", level--, 0 );
3355 : /* Done walking deque */
3356 :
3357 9 : if( !self->has_root_slot ) {
3358 0 : fun( w, NULL, "root_slot", FD_FLAMENCO_TYPE_NULL, "ulong", level, 0 );
3359 9 : } else {
3360 9 : fun( w, &self->root_slot, "root_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
3361 9 : }
3362 9 : fd_vote_authorized_voters_walk( w, &self->authorized_voters, fun, "authorized_voters", level, 0 );
3363 9 : fd_vote_prior_voters_walk( w, &self->prior_voters, fun, "prior_voters", level, 0 );
3364 :
3365 : /* Walk deque */
3366 9 : fun( w, self->epoch_credits, "epoch_credits", FD_FLAMENCO_TYPE_ARR, "epoch_credits", level++, 0 );
3367 9 : if( self->epoch_credits ) {
3368 9 : for( deq_fd_vote_epoch_credits_t_iter_t iter = deq_fd_vote_epoch_credits_t_iter_init( self->epoch_credits );
3369 207 : !deq_fd_vote_epoch_credits_t_iter_done( self->epoch_credits, iter );
3370 198 : iter = deq_fd_vote_epoch_credits_t_iter_next( self->epoch_credits, iter ) ) {
3371 198 : fd_vote_epoch_credits_t * ele = deq_fd_vote_epoch_credits_t_iter_ele( self->epoch_credits, iter );
3372 198 : fd_vote_epoch_credits_walk(w, ele, fun, "epoch_credits", level, 0 );
3373 198 : }
3374 9 : }
3375 9 : fun( w, self->epoch_credits, "epoch_credits", FD_FLAMENCO_TYPE_ARR_END, "epoch_credits", level--, 0 );
3376 : /* Done walking deque */
3377 :
3378 9 : fd_vote_block_timestamp_walk( w, &self->last_timestamp, fun, "last_timestamp", level, 0 );
3379 9 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_state", level--, 0 );
3380 9 : }
3381 0 : ulong fd_vote_state_size( fd_vote_state_t const * self ) {
3382 0 : ulong size = 0;
3383 0 : size += fd_pubkey_size( &self->node_pubkey );
3384 0 : size += fd_pubkey_size( &self->authorized_withdrawer );
3385 0 : size += sizeof(char);
3386 0 : if( self->votes ) {
3387 0 : size += sizeof(ulong);
3388 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 ) ) {
3389 0 : fd_landed_vote_t * ele = deq_fd_landed_vote_t_iter_ele( self->votes, iter );
3390 0 : size += fd_landed_vote_size( ele );
3391 0 : }
3392 0 : } else {
3393 0 : size += sizeof(ulong);
3394 0 : }
3395 0 : size += sizeof(char);
3396 0 : if( self->has_root_slot ) {
3397 0 : size += sizeof(ulong);
3398 0 : }
3399 0 : size += fd_vote_authorized_voters_size( &self->authorized_voters );
3400 0 : size += fd_vote_prior_voters_size( &self->prior_voters );
3401 0 : if( self->epoch_credits ) {
3402 0 : size += sizeof(ulong);
3403 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 ) ) {
3404 0 : fd_vote_epoch_credits_t * ele = deq_fd_vote_epoch_credits_t_iter_ele( self->epoch_credits, iter );
3405 0 : size += fd_vote_epoch_credits_size( ele );
3406 0 : }
3407 0 : } else {
3408 0 : size += sizeof(ulong);
3409 0 : }
3410 0 : size += fd_vote_block_timestamp_size( &self->last_timestamp );
3411 0 : return size;
3412 0 : }
3413 :
3414 0 : FD_FN_PURE uchar fd_vote_state_versioned_is_v0_23_5(fd_vote_state_versioned_t const * self) {
3415 0 : return self->discriminant == 0;
3416 0 : }
3417 0 : FD_FN_PURE uchar fd_vote_state_versioned_is_v1_14_11(fd_vote_state_versioned_t const * self) {
3418 0 : return self->discriminant == 1;
3419 0 : }
3420 0 : FD_FN_PURE uchar fd_vote_state_versioned_is_current(fd_vote_state_versioned_t const * self) {
3421 0 : return self->discriminant == 2;
3422 0 : }
3423 : void fd_vote_state_versioned_inner_new( fd_vote_state_versioned_inner_t * self, uint discriminant );
3424 15 : int fd_vote_state_versioned_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3425 15 : int err;
3426 15 : switch (discriminant) {
3427 0 : case 0: {
3428 0 : err = fd_vote_state_0_23_5_decode_footprint_inner( ctx, total_sz );
3429 0 : if( FD_UNLIKELY( err ) ) return err;
3430 0 : return FD_BINCODE_SUCCESS;
3431 0 : }
3432 0 : case 1: {
3433 0 : err = fd_vote_state_1_14_11_decode_footprint_inner( ctx, total_sz );
3434 0 : if( FD_UNLIKELY( err ) ) return err;
3435 0 : return FD_BINCODE_SUCCESS;
3436 0 : }
3437 15 : case 2: {
3438 15 : err = fd_vote_state_decode_footprint_inner( ctx, total_sz );
3439 15 : if( FD_UNLIKELY( err ) ) return err;
3440 15 : return FD_BINCODE_SUCCESS;
3441 15 : }
3442 0 : default: return FD_BINCODE_ERR_ENCODING;
3443 15 : }
3444 15 : }
3445 15 : static int fd_vote_state_versioned_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3446 15 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3447 15 : uint discriminant = 0;
3448 15 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
3449 15 : if( FD_UNLIKELY( err ) ) return err;
3450 15 : return fd_vote_state_versioned_inner_decode_footprint( discriminant, ctx, total_sz );
3451 15 : }
3452 15 : int fd_vote_state_versioned_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3453 15 : *total_sz += sizeof(fd_vote_state_versioned_t);
3454 15 : void const * start_data = ctx->data;
3455 15 : int err = fd_vote_state_versioned_decode_footprint_inner( ctx, total_sz );
3456 15 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3457 15 : ctx->data = start_data;
3458 15 : return err;
3459 15 : }
3460 15 : static void fd_vote_state_versioned_inner_decode_inner( fd_vote_state_versioned_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
3461 15 : switch (discriminant) {
3462 0 : case 0: {
3463 0 : fd_vote_state_0_23_5_decode_inner( &self->v0_23_5, alloc_mem, ctx );
3464 0 : break;
3465 0 : }
3466 0 : case 1: {
3467 0 : fd_vote_state_1_14_11_decode_inner( &self->v1_14_11, alloc_mem, ctx );
3468 0 : break;
3469 0 : }
3470 15 : case 2: {
3471 15 : fd_vote_state_decode_inner( &self->current, alloc_mem, ctx );
3472 15 : break;
3473 0 : }
3474 15 : }
3475 15 : }
3476 15 : static void fd_vote_state_versioned_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3477 15 : fd_vote_state_versioned_t * self = (fd_vote_state_versioned_t *)struct_mem;
3478 15 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
3479 15 : fd_vote_state_versioned_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
3480 15 : }
3481 15 : void * fd_vote_state_versioned_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3482 15 : fd_vote_state_versioned_t * self = (fd_vote_state_versioned_t *)mem;
3483 15 : fd_vote_state_versioned_new( self );
3484 15 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_state_versioned_t);
3485 15 : void * * alloc_mem = &alloc_region;
3486 15 : fd_vote_state_versioned_decode_inner( mem, alloc_mem, ctx );
3487 15 : return self;
3488 15 : }
3489 27 : void fd_vote_state_versioned_inner_new( fd_vote_state_versioned_inner_t * self, uint discriminant ) {
3490 27 : switch( discriminant ) {
3491 0 : case 0: {
3492 0 : fd_vote_state_0_23_5_new( &self->v0_23_5 );
3493 0 : break;
3494 0 : }
3495 0 : case 1: {
3496 0 : fd_vote_state_1_14_11_new( &self->v1_14_11 );
3497 0 : break;
3498 0 : }
3499 12 : case 2: {
3500 12 : fd_vote_state_new( &self->current );
3501 12 : break;
3502 0 : }
3503 15 : default: break; // FD_LOG_ERR(( "unhandled type"));
3504 27 : }
3505 27 : }
3506 27 : void fd_vote_state_versioned_new_disc( fd_vote_state_versioned_t * self, uint discriminant ) {
3507 27 : self->discriminant = discriminant;
3508 27 : fd_vote_state_versioned_inner_new( &self->inner, self->discriminant );
3509 27 : }
3510 15 : void fd_vote_state_versioned_new( fd_vote_state_versioned_t * self ) {
3511 15 : fd_memset( self, 0, sizeof(fd_vote_state_versioned_t) );
3512 15 : fd_vote_state_versioned_new_disc( self, UINT_MAX );
3513 15 : }
3514 :
3515 9 : void fd_vote_state_versioned_walk( void * w, fd_vote_state_versioned_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
3516 9 : (void) varint;
3517 9 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_vote_state_versioned", level++, 0);
3518 9 : switch( self->discriminant ) {
3519 0 : case 0: {
3520 0 : fun( w, self, "v0_23_5", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
3521 0 : fd_vote_state_0_23_5_walk( w, &self->inner.v0_23_5, fun, "v0_23_5", level, 0 );
3522 0 : break;
3523 0 : }
3524 0 : case 1: {
3525 0 : fun( w, self, "v1_14_11", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
3526 0 : fd_vote_state_1_14_11_walk( w, &self->inner.v1_14_11, fun, "v1_14_11", level, 0 );
3527 0 : break;
3528 0 : }
3529 9 : case 2: {
3530 9 : fun( w, self, "current", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
3531 9 : fd_vote_state_walk( w, &self->inner.current, fun, "current", level, 0 );
3532 9 : break;
3533 0 : }
3534 9 : }
3535 9 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_vote_state_versioned", level--, 0 );
3536 9 : }
3537 0 : ulong fd_vote_state_versioned_size( fd_vote_state_versioned_t const * self ) {
3538 0 : ulong size = 0;
3539 0 : size += sizeof(uint);
3540 0 : switch (self->discriminant) {
3541 0 : case 0: {
3542 0 : size += fd_vote_state_0_23_5_size( &self->inner.v0_23_5 );
3543 0 : break;
3544 0 : }
3545 0 : case 1: {
3546 0 : size += fd_vote_state_1_14_11_size( &self->inner.v1_14_11 );
3547 0 : break;
3548 0 : }
3549 0 : case 2: {
3550 0 : size += fd_vote_state_size( &self->inner.current );
3551 0 : break;
3552 0 : }
3553 0 : }
3554 0 : return size;
3555 0 : }
3556 :
3557 18 : int fd_vote_state_versioned_inner_encode( fd_vote_state_versioned_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
3558 18 : int err;
3559 18 : switch (discriminant) {
3560 0 : case 0: {
3561 0 : err = fd_vote_state_0_23_5_encode( &self->v0_23_5, ctx );
3562 0 : if( FD_UNLIKELY( err ) ) return err;
3563 0 : break;
3564 0 : }
3565 0 : case 1: {
3566 0 : err = fd_vote_state_1_14_11_encode( &self->v1_14_11, ctx );
3567 0 : if( FD_UNLIKELY( err ) ) return err;
3568 0 : break;
3569 0 : }
3570 18 : case 2: {
3571 18 : err = fd_vote_state_encode( &self->current, ctx );
3572 18 : if( FD_UNLIKELY( err ) ) return err;
3573 18 : break;
3574 18 : }
3575 18 : }
3576 18 : return FD_BINCODE_SUCCESS;
3577 18 : }
3578 18 : int fd_vote_state_versioned_encode( fd_vote_state_versioned_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3579 18 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
3580 18 : if( FD_UNLIKELY( err ) ) return err;
3581 18 : return fd_vote_state_versioned_inner_encode( &self->inner, self->discriminant, ctx );
3582 18 : }
3583 :
3584 0 : int fd_vote_state_update_encode( fd_vote_state_update_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3585 0 : int err;
3586 0 : if( self->lockouts ) {
3587 0 : ulong lockouts_len = deq_fd_vote_lockout_t_cnt( self->lockouts );
3588 0 : err = fd_bincode_uint64_encode( lockouts_len, ctx );
3589 0 : if( FD_UNLIKELY( err ) ) return err;
3590 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 ) ) {
3591 0 : fd_vote_lockout_t const * ele = deq_fd_vote_lockout_t_iter_ele_const( self->lockouts, iter );
3592 0 : err = fd_vote_lockout_encode( ele, ctx );
3593 0 : if( FD_UNLIKELY( err ) ) return err;
3594 0 : }
3595 0 : } else {
3596 0 : ulong lockouts_len = 0;
3597 0 : err = fd_bincode_uint64_encode( lockouts_len, ctx );
3598 0 : if( FD_UNLIKELY( err ) ) return err;
3599 0 : }
3600 0 : err = fd_bincode_bool_encode( self->has_root, ctx );
3601 0 : if( FD_UNLIKELY( err ) ) return err;
3602 0 : if( self->has_root ) {
3603 0 : err = fd_bincode_uint64_encode( self->root, ctx );
3604 0 : if( FD_UNLIKELY( err ) ) return err;
3605 0 : }
3606 0 : err = fd_hash_encode( &self->hash, ctx );
3607 0 : if( FD_UNLIKELY( err ) ) return err;
3608 0 : err = fd_bincode_bool_encode( self->has_timestamp, ctx );
3609 0 : if( FD_UNLIKELY( err ) ) return err;
3610 0 : if( self->has_timestamp ) {
3611 0 : err = fd_bincode_int64_encode( self->timestamp, ctx );
3612 0 : if( FD_UNLIKELY( err ) ) return err;
3613 0 : }
3614 0 : return FD_BINCODE_SUCCESS;
3615 0 : }
3616 0 : static int fd_vote_state_update_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3617 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3618 0 : int err = 0;
3619 0 : ulong lockouts_len;
3620 0 : err = fd_bincode_uint64_decode( &lockouts_len, ctx );
3621 0 : if( FD_UNLIKELY( err ) ) return err;
3622 0 : ulong lockouts_max = fd_ulong_max( lockouts_len, 32 );
3623 0 : *total_sz += deq_fd_vote_lockout_t_align() + deq_fd_vote_lockout_t_footprint( lockouts_max );
3624 0 : ulong lockouts_sz;
3625 0 : if( FD_UNLIKELY( __builtin_umull_overflow( lockouts_len, 12, &lockouts_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
3626 0 : err = fd_bincode_bytes_decode_footprint( lockouts_sz, ctx );
3627 0 : if( FD_UNLIKELY( err ) ) return err;
3628 0 : {
3629 0 : uchar o;
3630 0 : err = fd_bincode_bool_decode( &o, ctx );
3631 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3632 0 : if( o ) {
3633 0 : err = fd_bincode_uint64_decode_footprint( ctx );
3634 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3635 0 : }
3636 0 : }
3637 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
3638 0 : if( FD_UNLIKELY( err ) ) return err;
3639 0 : {
3640 0 : uchar o;
3641 0 : err = fd_bincode_bool_decode( &o, ctx );
3642 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3643 0 : if( o ) {
3644 0 : err = fd_bincode_int64_decode_footprint( ctx );
3645 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3646 0 : }
3647 0 : }
3648 0 : return 0;
3649 0 : }
3650 0 : int fd_vote_state_update_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3651 0 : *total_sz += sizeof(fd_vote_state_update_t);
3652 0 : void const * start_data = ctx->data;
3653 0 : int err = fd_vote_state_update_decode_footprint_inner( ctx, total_sz );
3654 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3655 0 : ctx->data = start_data;
3656 0 : return err;
3657 0 : }
3658 0 : static void fd_vote_state_update_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3659 0 : fd_vote_state_update_t * self = (fd_vote_state_update_t *)struct_mem;
3660 0 : ulong lockouts_len;
3661 0 : fd_bincode_uint64_decode_unsafe( &lockouts_len, ctx );
3662 0 : ulong lockouts_max = fd_ulong_max( lockouts_len, 32 );
3663 0 : self->lockouts = deq_fd_vote_lockout_t_join_new( alloc_mem, lockouts_max );
3664 0 : for( ulong i=0; i < lockouts_len; i++ ) {
3665 0 : fd_vote_lockout_t * elem = deq_fd_vote_lockout_t_push_tail_nocopy( self->lockouts );
3666 0 : fd_vote_lockout_new( elem );
3667 0 : fd_vote_lockout_decode_inner( elem, alloc_mem, ctx );
3668 0 : }
3669 0 : {
3670 0 : uchar o;
3671 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
3672 0 : self->has_root = !!o;
3673 0 : if( o ) {
3674 0 : fd_bincode_uint64_decode_unsafe( &self->root, ctx );
3675 0 : }
3676 0 : }
3677 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
3678 0 : {
3679 0 : uchar o;
3680 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
3681 0 : self->has_timestamp = !!o;
3682 0 : if( o ) {
3683 0 : fd_bincode_int64_decode_unsafe( &self->timestamp, ctx );
3684 0 : }
3685 0 : }
3686 0 : }
3687 0 : void * fd_vote_state_update_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3688 0 : fd_vote_state_update_t * self = (fd_vote_state_update_t *)mem;
3689 0 : fd_vote_state_update_new( self );
3690 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_state_update_t);
3691 0 : void * * alloc_mem = &alloc_region;
3692 0 : fd_vote_state_update_decode_inner( mem, alloc_mem, ctx );
3693 0 : return self;
3694 0 : }
3695 0 : void fd_vote_state_update_new(fd_vote_state_update_t * self) {
3696 0 : fd_memset( self, 0, sizeof(fd_vote_state_update_t) );
3697 0 : fd_hash_new( &self->hash );
3698 0 : }
3699 0 : void fd_vote_state_update_walk( void * w, fd_vote_state_update_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
3700 0 : (void) varint;
3701 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_state_update", level++, 0 );
3702 :
3703 : /* Walk deque */
3704 0 : fun( w, self->lockouts, "lockouts", FD_FLAMENCO_TYPE_ARR, "lockouts", level++, 0 );
3705 0 : if( self->lockouts ) {
3706 0 : for( deq_fd_vote_lockout_t_iter_t iter = deq_fd_vote_lockout_t_iter_init( self->lockouts );
3707 0 : !deq_fd_vote_lockout_t_iter_done( self->lockouts, iter );
3708 0 : iter = deq_fd_vote_lockout_t_iter_next( self->lockouts, iter ) ) {
3709 0 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->lockouts, iter );
3710 0 : fd_vote_lockout_walk(w, ele, fun, "lockouts", level, 0 );
3711 0 : }
3712 0 : }
3713 0 : fun( w, self->lockouts, "lockouts", FD_FLAMENCO_TYPE_ARR_END, "lockouts", level--, 0 );
3714 : /* Done walking deque */
3715 :
3716 0 : if( !self->has_root ) {
3717 0 : fun( w, NULL, "root", FD_FLAMENCO_TYPE_NULL, "ulong", level, 0 );
3718 0 : } else {
3719 0 : fun( w, &self->root, "root", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
3720 0 : }
3721 0 : fd_hash_walk( w, &self->hash, fun, "hash", level, 0 );
3722 0 : if( !self->has_timestamp ) {
3723 0 : fun( w, NULL, "timestamp", FD_FLAMENCO_TYPE_NULL, "long", level, 0 );
3724 0 : } else {
3725 0 : fun( w, &self->timestamp, "timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level, 0 );
3726 0 : }
3727 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_state_update", level--, 0 );
3728 0 : }
3729 0 : ulong fd_vote_state_update_size( fd_vote_state_update_t const * self ) {
3730 0 : ulong size = 0;
3731 0 : if( self->lockouts ) {
3732 0 : size += sizeof(ulong);
3733 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 ) ) {
3734 0 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->lockouts, iter );
3735 0 : size += fd_vote_lockout_size( ele );
3736 0 : }
3737 0 : } else {
3738 0 : size += sizeof(ulong);
3739 0 : }
3740 0 : size += sizeof(char);
3741 0 : if( self->has_root ) {
3742 0 : size += sizeof(ulong);
3743 0 : }
3744 0 : size += fd_hash_size( &self->hash );
3745 0 : size += sizeof(char);
3746 0 : if( self->has_timestamp ) {
3747 0 : size += sizeof(long);
3748 0 : }
3749 0 : return size;
3750 0 : }
3751 :
3752 0 : int fd_compact_vote_state_update_encode( fd_compact_vote_state_update_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3753 0 : int err;
3754 0 : err = fd_bincode_uint64_encode( self->root, ctx );
3755 0 : if( FD_UNLIKELY( err ) ) return err;
3756 0 : err = fd_bincode_compact_u16_encode( &self->lockouts_len, ctx );
3757 0 : if( FD_UNLIKELY(err) ) return err;
3758 0 : if( self->lockouts_len ) {
3759 0 : for( ulong i=0; i < self->lockouts_len; i++ ) {
3760 0 : err = fd_lockout_offset_encode( self->lockouts + i, ctx );
3761 0 : if( FD_UNLIKELY( err ) ) return err;
3762 0 : }
3763 0 : }
3764 0 : err = fd_hash_encode( &self->hash, ctx );
3765 0 : if( FD_UNLIKELY( err ) ) return err;
3766 0 : err = fd_bincode_bool_encode( self->has_timestamp, ctx );
3767 0 : if( FD_UNLIKELY( err ) ) return err;
3768 0 : if( self->has_timestamp ) {
3769 0 : err = fd_bincode_int64_encode( self->timestamp, ctx );
3770 0 : if( FD_UNLIKELY( err ) ) return err;
3771 0 : }
3772 0 : return FD_BINCODE_SUCCESS;
3773 0 : }
3774 0 : static int fd_compact_vote_state_update_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3775 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3776 0 : int err = 0;
3777 0 : err = fd_bincode_uint64_decode_footprint( ctx );
3778 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3779 0 : ushort lockouts_len;
3780 0 : err = fd_bincode_compact_u16_decode( &lockouts_len, ctx );
3781 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3782 0 : if( lockouts_len ) {
3783 0 : *total_sz += FD_LOCKOUT_OFFSET_ALIGN + sizeof(fd_lockout_offset_t)*lockouts_len;
3784 0 : for( ulong i=0; i < lockouts_len; i++ ) {
3785 0 : err = fd_lockout_offset_decode_footprint_inner( ctx, total_sz );
3786 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3787 0 : }
3788 0 : }
3789 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
3790 0 : if( FD_UNLIKELY( err ) ) return err;
3791 0 : {
3792 0 : uchar o;
3793 0 : err = fd_bincode_bool_decode( &o, ctx );
3794 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3795 0 : if( o ) {
3796 0 : err = fd_bincode_int64_decode_footprint( ctx );
3797 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3798 0 : }
3799 0 : }
3800 0 : return 0;
3801 0 : }
3802 0 : int fd_compact_vote_state_update_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3803 0 : *total_sz += sizeof(fd_compact_vote_state_update_t);
3804 0 : void const * start_data = ctx->data;
3805 0 : int err = fd_compact_vote_state_update_decode_footprint_inner( ctx, total_sz );
3806 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3807 0 : ctx->data = start_data;
3808 0 : return err;
3809 0 : }
3810 0 : static void fd_compact_vote_state_update_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3811 0 : fd_compact_vote_state_update_t * self = (fd_compact_vote_state_update_t *)struct_mem;
3812 0 : fd_bincode_uint64_decode_unsafe( &self->root, ctx );
3813 0 : fd_bincode_compact_u16_decode_unsafe( &self->lockouts_len, ctx );
3814 0 : if( self->lockouts_len ) {
3815 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_LOCKOUT_OFFSET_ALIGN );
3816 0 : self->lockouts = *alloc_mem;
3817 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_lockout_offset_t)*self->lockouts_len;
3818 0 : for( ulong i=0; i < self->lockouts_len; i++ ) {
3819 0 : fd_lockout_offset_new( self->lockouts + i );
3820 0 : fd_lockout_offset_decode_inner( self->lockouts + i, alloc_mem, ctx );
3821 0 : }
3822 0 : } else
3823 0 : self->lockouts = NULL;
3824 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
3825 0 : {
3826 0 : uchar o;
3827 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
3828 0 : self->has_timestamp = !!o;
3829 0 : if( o ) {
3830 0 : fd_bincode_int64_decode_unsafe( &self->timestamp, ctx );
3831 0 : }
3832 0 : }
3833 0 : }
3834 0 : void * fd_compact_vote_state_update_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3835 0 : fd_compact_vote_state_update_t * self = (fd_compact_vote_state_update_t *)mem;
3836 0 : fd_compact_vote_state_update_new( self );
3837 0 : void * alloc_region = (uchar *)mem + sizeof(fd_compact_vote_state_update_t);
3838 0 : void * * alloc_mem = &alloc_region;
3839 0 : fd_compact_vote_state_update_decode_inner( mem, alloc_mem, ctx );
3840 0 : return self;
3841 0 : }
3842 0 : void fd_compact_vote_state_update_new(fd_compact_vote_state_update_t * self) {
3843 0 : fd_memset( self, 0, sizeof(fd_compact_vote_state_update_t) );
3844 0 : fd_hash_new( &self->hash );
3845 0 : }
3846 0 : void fd_compact_vote_state_update_walk( void * w, fd_compact_vote_state_update_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
3847 0 : (void) varint;
3848 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_compact_vote_state_update", level++, 0 );
3849 0 : fun( w, &self->root, "root", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
3850 0 : fun( w, &self->lockouts_len, "lockouts_len", FD_FLAMENCO_TYPE_USHORT, "ushort", level, 1 );
3851 0 : if( self->lockouts_len ) {
3852 0 : fun( w, NULL, "lockouts", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
3853 0 : for( ulong i=0; i < self->lockouts_len; i++ )
3854 0 : fd_lockout_offset_walk(w, self->lockouts + i, fun, "lockout_offset", level, 0 );
3855 0 : fun( w, NULL, "lockouts", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
3856 0 : }
3857 0 : fd_hash_walk( w, &self->hash, fun, "hash", level, 0 );
3858 0 : if( !self->has_timestamp ) {
3859 0 : fun( w, NULL, "timestamp", FD_FLAMENCO_TYPE_NULL, "long", level, 0 );
3860 0 : } else {
3861 0 : fun( w, &self->timestamp, "timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level, 0 );
3862 0 : }
3863 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_compact_vote_state_update", level--, 0 );
3864 0 : }
3865 0 : ulong fd_compact_vote_state_update_size( fd_compact_vote_state_update_t const * self ) {
3866 0 : ulong size = 0;
3867 0 : size += sizeof(ulong);
3868 0 : do {
3869 0 : ushort tmp = (ushort)self->lockouts_len;
3870 0 : size += fd_bincode_compact_u16_size( &tmp );
3871 0 : for( ulong i=0; i < self->lockouts_len; i++ )
3872 0 : size += fd_lockout_offset_size( self->lockouts + i );
3873 0 : } while(0);
3874 0 : size += fd_hash_size( &self->hash );
3875 0 : size += sizeof(char);
3876 0 : if( self->has_timestamp ) {
3877 0 : size += sizeof(long);
3878 0 : }
3879 0 : return size;
3880 0 : }
3881 :
3882 0 : int fd_compact_vote_state_update_switch_encode( fd_compact_vote_state_update_switch_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3883 0 : int err;
3884 0 : err = fd_compact_vote_state_update_encode( &self->compact_vote_state_update, ctx );
3885 0 : if( FD_UNLIKELY( err ) ) return err;
3886 0 : err = fd_hash_encode( &self->hash, ctx );
3887 0 : if( FD_UNLIKELY( err ) ) return err;
3888 0 : return FD_BINCODE_SUCCESS;
3889 0 : }
3890 0 : static int fd_compact_vote_state_update_switch_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3891 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3892 0 : int err = 0;
3893 0 : err = fd_compact_vote_state_update_decode_footprint_inner( ctx, total_sz );
3894 0 : if( FD_UNLIKELY( err ) ) return err;
3895 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
3896 0 : if( FD_UNLIKELY( err ) ) return err;
3897 0 : return 0;
3898 0 : }
3899 0 : int fd_compact_vote_state_update_switch_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3900 0 : *total_sz += sizeof(fd_compact_vote_state_update_switch_t);
3901 0 : void const * start_data = ctx->data;
3902 0 : int err = fd_compact_vote_state_update_switch_decode_footprint_inner( ctx, total_sz );
3903 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3904 0 : ctx->data = start_data;
3905 0 : return err;
3906 0 : }
3907 0 : static void fd_compact_vote_state_update_switch_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3908 0 : fd_compact_vote_state_update_switch_t * self = (fd_compact_vote_state_update_switch_t *)struct_mem;
3909 0 : fd_compact_vote_state_update_decode_inner( &self->compact_vote_state_update, alloc_mem, ctx );
3910 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
3911 0 : }
3912 0 : void * fd_compact_vote_state_update_switch_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3913 0 : fd_compact_vote_state_update_switch_t * self = (fd_compact_vote_state_update_switch_t *)mem;
3914 0 : fd_compact_vote_state_update_switch_new( self );
3915 0 : void * alloc_region = (uchar *)mem + sizeof(fd_compact_vote_state_update_switch_t);
3916 0 : void * * alloc_mem = &alloc_region;
3917 0 : fd_compact_vote_state_update_switch_decode_inner( mem, alloc_mem, ctx );
3918 0 : return self;
3919 0 : }
3920 0 : void fd_compact_vote_state_update_switch_new(fd_compact_vote_state_update_switch_t * self) {
3921 0 : fd_memset( self, 0, sizeof(fd_compact_vote_state_update_switch_t) );
3922 0 : fd_compact_vote_state_update_new( &self->compact_vote_state_update );
3923 0 : fd_hash_new( &self->hash );
3924 0 : }
3925 0 : void fd_compact_vote_state_update_switch_walk( void * w, fd_compact_vote_state_update_switch_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
3926 0 : (void) varint;
3927 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_compact_vote_state_update_switch", level++, 0 );
3928 0 : fd_compact_vote_state_update_walk( w, &self->compact_vote_state_update, fun, "compact_vote_state_update", level, 0 );
3929 0 : fd_hash_walk( w, &self->hash, fun, "hash", level, 0 );
3930 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_compact_vote_state_update_switch", level--, 0 );
3931 0 : }
3932 0 : ulong fd_compact_vote_state_update_switch_size( fd_compact_vote_state_update_switch_t const * self ) {
3933 0 : ulong size = 0;
3934 0 : size += fd_compact_vote_state_update_size( &self->compact_vote_state_update );
3935 0 : size += fd_hash_size( &self->hash );
3936 0 : return size;
3937 0 : }
3938 :
3939 0 : int fd_compact_tower_sync_encode( fd_compact_tower_sync_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3940 0 : int err;
3941 0 : err = fd_bincode_uint64_encode( self->root, ctx );
3942 0 : if( FD_UNLIKELY( err ) ) return err;
3943 0 : if( self->lockout_offsets ) {
3944 0 : ushort lockout_offsets_len = (ushort)deq_fd_lockout_offset_t_cnt( self->lockout_offsets );
3945 0 : err = fd_bincode_compact_u16_encode( &lockout_offsets_len, ctx );
3946 0 : if( FD_UNLIKELY( err ) ) return err;
3947 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 ) ) {
3948 0 : fd_lockout_offset_t const * ele = deq_fd_lockout_offset_t_iter_ele_const( self->lockout_offsets, iter );
3949 0 : err = fd_lockout_offset_encode( ele, ctx );
3950 0 : if( FD_UNLIKELY( err ) ) return err;
3951 0 : }
3952 0 : } else {
3953 0 : ushort lockout_offsets_len = 0;
3954 0 : err = fd_bincode_compact_u16_encode( &lockout_offsets_len, ctx );
3955 0 : if( FD_UNLIKELY( err ) ) return err;
3956 0 : }
3957 0 : err = fd_hash_encode( &self->hash, ctx );
3958 0 : if( FD_UNLIKELY( err ) ) return err;
3959 0 : err = fd_bincode_bool_encode( self->has_timestamp, ctx );
3960 0 : if( FD_UNLIKELY( err ) ) return err;
3961 0 : if( self->has_timestamp ) {
3962 0 : err = fd_bincode_int64_encode( self->timestamp, ctx );
3963 0 : if( FD_UNLIKELY( err ) ) return err;
3964 0 : }
3965 0 : err = fd_hash_encode( &self->block_id, ctx );
3966 0 : if( FD_UNLIKELY( err ) ) return err;
3967 0 : return FD_BINCODE_SUCCESS;
3968 0 : }
3969 0 : static int fd_compact_tower_sync_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3970 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3971 0 : int err = 0;
3972 0 : err = fd_bincode_uint64_decode_footprint( ctx );
3973 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3974 0 : ushort lockout_offsets_len;
3975 0 : err = fd_bincode_compact_u16_decode( &lockout_offsets_len, ctx );
3976 0 : if( FD_UNLIKELY( err ) ) return err;
3977 0 : ulong lockout_offsets_max = fd_ulong_max( lockout_offsets_len, 32 );
3978 0 : *total_sz += deq_fd_lockout_offset_t_align() + deq_fd_lockout_offset_t_footprint( lockout_offsets_max );
3979 0 : for( ulong i = 0; i < lockout_offsets_len; ++i ) {
3980 0 : err = fd_lockout_offset_decode_footprint_inner( ctx, total_sz );
3981 0 : if( FD_UNLIKELY( err ) ) return err;
3982 0 : }
3983 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
3984 0 : if( FD_UNLIKELY( err ) ) return err;
3985 0 : {
3986 0 : uchar o;
3987 0 : err = fd_bincode_bool_decode( &o, ctx );
3988 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3989 0 : if( o ) {
3990 0 : err = fd_bincode_int64_decode_footprint( ctx );
3991 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3992 0 : }
3993 0 : }
3994 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
3995 0 : if( FD_UNLIKELY( err ) ) return err;
3996 0 : return 0;
3997 0 : }
3998 0 : int fd_compact_tower_sync_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3999 0 : *total_sz += sizeof(fd_compact_tower_sync_t);
4000 0 : void const * start_data = ctx->data;
4001 0 : int err = fd_compact_tower_sync_decode_footprint_inner( ctx, total_sz );
4002 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4003 0 : ctx->data = start_data;
4004 0 : return err;
4005 0 : }
4006 0 : static void fd_compact_tower_sync_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4007 0 : fd_compact_tower_sync_t * self = (fd_compact_tower_sync_t *)struct_mem;
4008 0 : fd_bincode_uint64_decode_unsafe( &self->root, ctx );
4009 0 : ushort lockout_offsets_len;
4010 0 : fd_bincode_compact_u16_decode_unsafe( &lockout_offsets_len, ctx );
4011 0 : ulong lockout_offsets_max = fd_ulong_max( lockout_offsets_len, 32 );
4012 0 : self->lockout_offsets = deq_fd_lockout_offset_t_join_new( alloc_mem, lockout_offsets_max );
4013 0 : for( ulong i=0; i < lockout_offsets_len; i++ ) {
4014 0 : fd_lockout_offset_t * elem = deq_fd_lockout_offset_t_push_tail_nocopy( self->lockout_offsets );
4015 0 : fd_lockout_offset_new( elem );
4016 0 : fd_lockout_offset_decode_inner( elem, alloc_mem, ctx );
4017 0 : }
4018 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
4019 0 : {
4020 0 : uchar o;
4021 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
4022 0 : self->has_timestamp = !!o;
4023 0 : if( o ) {
4024 0 : fd_bincode_int64_decode_unsafe( &self->timestamp, ctx );
4025 0 : }
4026 0 : }
4027 0 : fd_hash_decode_inner( &self->block_id, alloc_mem, ctx );
4028 0 : }
4029 0 : void * fd_compact_tower_sync_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4030 0 : fd_compact_tower_sync_t * self = (fd_compact_tower_sync_t *)mem;
4031 0 : fd_compact_tower_sync_new( self );
4032 0 : void * alloc_region = (uchar *)mem + sizeof(fd_compact_tower_sync_t);
4033 0 : void * * alloc_mem = &alloc_region;
4034 0 : fd_compact_tower_sync_decode_inner( mem, alloc_mem, ctx );
4035 0 : return self;
4036 0 : }
4037 0 : void fd_compact_tower_sync_new(fd_compact_tower_sync_t * self) {
4038 0 : fd_memset( self, 0, sizeof(fd_compact_tower_sync_t) );
4039 0 : fd_hash_new( &self->hash );
4040 0 : fd_hash_new( &self->block_id );
4041 0 : }
4042 0 : void fd_compact_tower_sync_walk( void * w, fd_compact_tower_sync_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
4043 0 : (void) varint;
4044 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_compact_tower_sync", level++, 0 );
4045 0 : fun( w, &self->root, "root", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
4046 :
4047 : /* Walk deque */
4048 0 : fun( w, self->lockout_offsets, "lockout_offsets", FD_FLAMENCO_TYPE_ARR, "lockout_offsets", level++, 0 );
4049 0 : if( self->lockout_offsets ) {
4050 0 : for( deq_fd_lockout_offset_t_iter_t iter = deq_fd_lockout_offset_t_iter_init( self->lockout_offsets );
4051 0 : !deq_fd_lockout_offset_t_iter_done( self->lockout_offsets, iter );
4052 0 : iter = deq_fd_lockout_offset_t_iter_next( self->lockout_offsets, iter ) ) {
4053 0 : fd_lockout_offset_t * ele = deq_fd_lockout_offset_t_iter_ele( self->lockout_offsets, iter );
4054 0 : fd_lockout_offset_walk(w, ele, fun, "lockout_offsets", level, 0 );
4055 0 : }
4056 0 : }
4057 0 : fun( w, self->lockout_offsets, "lockout_offsets", FD_FLAMENCO_TYPE_ARR_END, "lockout_offsets", level--, 0 );
4058 : /* Done walking deque */
4059 :
4060 0 : fd_hash_walk( w, &self->hash, fun, "hash", level, 0 );
4061 0 : if( !self->has_timestamp ) {
4062 0 : fun( w, NULL, "timestamp", FD_FLAMENCO_TYPE_NULL, "long", level, 0 );
4063 0 : } else {
4064 0 : fun( w, &self->timestamp, "timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level, 0 );
4065 0 : }
4066 0 : fd_hash_walk( w, &self->block_id, fun, "block_id", level, 0 );
4067 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_compact_tower_sync", level--, 0 );
4068 0 : }
4069 0 : ulong fd_compact_tower_sync_size( fd_compact_tower_sync_t const * self ) {
4070 0 : ulong size = 0;
4071 0 : size += sizeof(ulong);
4072 0 : if( self->lockout_offsets ) {
4073 0 : ushort lockout_offsets_len = (ushort)deq_fd_lockout_offset_t_cnt( self->lockout_offsets );
4074 0 : size += fd_bincode_compact_u16_size( &lockout_offsets_len );
4075 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 ) ) {
4076 0 : fd_lockout_offset_t * ele = deq_fd_lockout_offset_t_iter_ele( self->lockout_offsets, iter );
4077 0 : size += fd_lockout_offset_size( ele );
4078 0 : }
4079 0 : } else {
4080 0 : size += 1;
4081 0 : }
4082 0 : size += fd_hash_size( &self->hash );
4083 0 : size += sizeof(char);
4084 0 : if( self->has_timestamp ) {
4085 0 : size += sizeof(long);
4086 0 : }
4087 0 : size += fd_hash_size( &self->block_id );
4088 0 : return size;
4089 0 : }
4090 :
4091 0 : void fd_tower_sync_new(fd_tower_sync_t * self) {
4092 0 : fd_memset( self, 0, sizeof(fd_tower_sync_t) );
4093 0 : fd_hash_new( &self->hash );
4094 0 : fd_hash_new( &self->block_id );
4095 0 : }
4096 0 : void fd_tower_sync_walk( void * w, fd_tower_sync_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
4097 0 : (void) varint;
4098 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_tower_sync", level++, 0 );
4099 :
4100 : /* Walk deque */
4101 0 : fun( w, self->lockouts, "lockouts", FD_FLAMENCO_TYPE_ARR, "lockouts", level++, 0 );
4102 0 : if( self->lockouts ) {
4103 0 : for( deq_fd_vote_lockout_t_iter_t iter = deq_fd_vote_lockout_t_iter_init( self->lockouts );
4104 0 : !deq_fd_vote_lockout_t_iter_done( self->lockouts, iter );
4105 0 : iter = deq_fd_vote_lockout_t_iter_next( self->lockouts, iter ) ) {
4106 0 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->lockouts, iter );
4107 0 : fd_vote_lockout_walk(w, ele, fun, "lockouts", level, 0 );
4108 0 : }
4109 0 : }
4110 0 : fun( w, self->lockouts, "lockouts", FD_FLAMENCO_TYPE_ARR_END, "lockouts", level--, 0 );
4111 : /* Done walking deque */
4112 :
4113 0 : fun( w, &self->lockouts_cnt, "lockouts_cnt", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
4114 0 : if( !self->has_root ) {
4115 0 : fun( w, NULL, "root", FD_FLAMENCO_TYPE_NULL, "ulong", level, 0 );
4116 0 : } else {
4117 0 : fun( w, &self->root, "root", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
4118 0 : }
4119 0 : fd_hash_walk( w, &self->hash, fun, "hash", level, 0 );
4120 0 : if( !self->has_timestamp ) {
4121 0 : fun( w, NULL, "timestamp", FD_FLAMENCO_TYPE_NULL, "long", level, 0 );
4122 0 : } else {
4123 0 : fun( w, &self->timestamp, "timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level, 0 );
4124 0 : }
4125 0 : fd_hash_walk( w, &self->block_id, fun, "block_id", level, 0 );
4126 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_tower_sync", level--, 0 );
4127 0 : }
4128 0 : ulong fd_tower_sync_size( fd_tower_sync_t const * self ) {
4129 0 : ulong size = 0;
4130 0 : if( self->lockouts ) {
4131 0 : size += sizeof(ulong);
4132 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 ) ) {
4133 0 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->lockouts, iter );
4134 0 : size += fd_vote_lockout_size( ele );
4135 0 : }
4136 0 : } else {
4137 0 : size += sizeof(ulong);
4138 0 : }
4139 0 : size += sizeof(ulong);
4140 0 : size += sizeof(char);
4141 0 : if( self->has_root ) {
4142 0 : size += sizeof(ulong);
4143 0 : }
4144 0 : size += fd_hash_size( &self->hash );
4145 0 : size += sizeof(char);
4146 0 : if( self->has_timestamp ) {
4147 0 : size += sizeof(long);
4148 0 : }
4149 0 : size += fd_hash_size( &self->block_id );
4150 0 : return size;
4151 0 : }
4152 :
4153 0 : int fd_tower_sync_switch_encode( fd_tower_sync_switch_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4154 0 : int err;
4155 0 : err = fd_tower_sync_encode( &self->tower_sync, ctx );
4156 0 : if( FD_UNLIKELY( err ) ) return err;
4157 0 : err = fd_hash_encode( &self->hash, ctx );
4158 0 : if( FD_UNLIKELY( err ) ) return err;
4159 0 : return FD_BINCODE_SUCCESS;
4160 0 : }
4161 0 : static int fd_tower_sync_switch_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4162 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4163 0 : int err = 0;
4164 0 : err = fd_tower_sync_decode_footprint_inner( ctx, total_sz );
4165 0 : if( FD_UNLIKELY( err ) ) return err;
4166 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
4167 0 : if( FD_UNLIKELY( err ) ) return err;
4168 0 : return 0;
4169 0 : }
4170 0 : int fd_tower_sync_switch_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4171 0 : *total_sz += sizeof(fd_tower_sync_switch_t);
4172 0 : void const * start_data = ctx->data;
4173 0 : int err = fd_tower_sync_switch_decode_footprint_inner( ctx, total_sz );
4174 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4175 0 : ctx->data = start_data;
4176 0 : return err;
4177 0 : }
4178 0 : static void fd_tower_sync_switch_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4179 0 : fd_tower_sync_switch_t * self = (fd_tower_sync_switch_t *)struct_mem;
4180 0 : fd_tower_sync_decode_inner( &self->tower_sync, alloc_mem, ctx );
4181 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
4182 0 : }
4183 0 : void * fd_tower_sync_switch_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4184 0 : fd_tower_sync_switch_t * self = (fd_tower_sync_switch_t *)mem;
4185 0 : fd_tower_sync_switch_new( self );
4186 0 : void * alloc_region = (uchar *)mem + sizeof(fd_tower_sync_switch_t);
4187 0 : void * * alloc_mem = &alloc_region;
4188 0 : fd_tower_sync_switch_decode_inner( mem, alloc_mem, ctx );
4189 0 : return self;
4190 0 : }
4191 0 : void fd_tower_sync_switch_new(fd_tower_sync_switch_t * self) {
4192 0 : fd_memset( self, 0, sizeof(fd_tower_sync_switch_t) );
4193 0 : fd_tower_sync_new( &self->tower_sync );
4194 0 : fd_hash_new( &self->hash );
4195 0 : }
4196 0 : void fd_tower_sync_switch_walk( void * w, fd_tower_sync_switch_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
4197 0 : (void) varint;
4198 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_tower_sync_switch", level++, 0 );
4199 0 : fd_tower_sync_walk( w, &self->tower_sync, fun, "tower_sync", level, 0 );
4200 0 : fd_hash_walk( w, &self->hash, fun, "hash", level, 0 );
4201 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_tower_sync_switch", level--, 0 );
4202 0 : }
4203 0 : ulong fd_tower_sync_switch_size( fd_tower_sync_switch_t const * self ) {
4204 0 : ulong size = 0;
4205 0 : size += fd_tower_sync_size( &self->tower_sync );
4206 0 : size += fd_hash_size( &self->hash );
4207 0 : return size;
4208 0 : }
4209 :
4210 0 : int fd_slot_history_encode( fd_slot_history_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4211 0 : int err;
4212 0 : err = fd_bincode_bool_encode( self->has_bits, ctx );
4213 0 : if( FD_UNLIKELY( err ) ) return err;
4214 0 : if( self->has_bits ) {
4215 0 : err = fd_bincode_uint64_encode( self->bits_bitvec_len, ctx );
4216 0 : if( FD_UNLIKELY(err) ) return err;
4217 0 : if( self->bits_bitvec_len ) {
4218 0 : for( ulong i=0; i < self->bits_bitvec_len; i++ ) {
4219 0 : err = fd_bincode_uint64_encode( self->bits_bitvec[i], ctx );
4220 0 : }
4221 0 : }
4222 0 : if( FD_UNLIKELY( err ) ) return err;
4223 0 : }
4224 0 : err = fd_bincode_uint64_encode( self->bits_len, ctx );
4225 0 : if( FD_UNLIKELY( err ) ) return err;
4226 0 : err = fd_bincode_uint64_encode( self->next_slot, ctx );
4227 0 : if( FD_UNLIKELY( err ) ) return err;
4228 0 : return FD_BINCODE_SUCCESS;
4229 0 : }
4230 0 : int fd_slot_history_encode_global( fd_slot_history_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4231 0 : int err;
4232 0 : err = fd_bincode_bool_encode( self->has_bits, ctx );
4233 0 : if( FD_UNLIKELY( err ) ) return err;
4234 0 : if( self->has_bits ) {
4235 0 : if( FD_UNLIKELY( err ) ) return err;
4236 0 : err = fd_bincode_uint64_encode( self->bits_bitvec_len, ctx );
4237 0 : if( FD_UNLIKELY( err ) ) return err;
4238 0 : if( self->bits_bitvec_len ) {
4239 0 : uchar * bits_bitvec_laddr = (uchar*)self + self->bits_bitvec_offset;
4240 0 : ulong * bits_bitvec = (ulong *)bits_bitvec_laddr;
4241 0 : for( ulong i=0; i < self->bits_bitvec_len; i++ ) {
4242 0 : err = fd_bincode_uint64_encode( bits_bitvec[i], ctx );
4243 0 : if( FD_UNLIKELY( err ) ) return err;
4244 0 : }
4245 0 : }
4246 0 : if( FD_UNLIKELY( err ) ) return err;
4247 0 : }
4248 0 : err = fd_bincode_uint64_encode( self->bits_len, ctx );
4249 0 : if( FD_UNLIKELY( err ) ) return err;
4250 0 : err = fd_bincode_uint64_encode( self->next_slot, ctx );
4251 0 : if( FD_UNLIKELY( err ) ) return err;
4252 0 : return FD_BINCODE_SUCCESS;
4253 0 : }
4254 3 : static int fd_slot_history_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4255 3 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4256 3 : int err = 0;
4257 3 : {
4258 3 : uchar o;
4259 3 : ulong inner_len = 0UL;
4260 3 : err = fd_bincode_bool_decode( &o, ctx );
4261 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4262 3 : if( o ) {
4263 3 : ulong bits_bitvec_len;
4264 3 : err = fd_bincode_uint64_decode( &bits_bitvec_len, ctx );
4265 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4266 3 : if( bits_bitvec_len ) {
4267 3 : *total_sz += 8UL + sizeof(ulong)*bits_bitvec_len;
4268 49155 : for( ulong i=0; i < bits_bitvec_len; i++ ) {
4269 49152 : err = fd_bincode_uint64_decode_footprint( ctx );
4270 49152 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4271 49152 : }
4272 3 : }
4273 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4274 3 : inner_len = bits_bitvec_len;
4275 3 : if( inner_len==0 ) return FD_BINCODE_ERR_ENCODING;
4276 3 : }
4277 3 : ulong len;
4278 3 : err = fd_bincode_uint64_decode( &len, ctx );
4279 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4280 3 : if( len > inner_len * sizeof(ulong) * 8UL ) return FD_BINCODE_ERR_ENCODING;
4281 3 : }
4282 3 : err = fd_bincode_uint64_decode_footprint( ctx );
4283 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4284 3 : return 0;
4285 3 : }
4286 3 : int fd_slot_history_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4287 3 : *total_sz += sizeof(fd_slot_history_t);
4288 3 : void const * start_data = ctx->data;
4289 3 : int err = fd_slot_history_decode_footprint_inner( ctx, total_sz );
4290 3 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4291 3 : ctx->data = start_data;
4292 3 : return err;
4293 3 : }
4294 0 : static void fd_slot_history_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4295 0 : fd_slot_history_t * self = (fd_slot_history_t *)struct_mem;
4296 0 : {
4297 0 : uchar o;
4298 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
4299 0 : self->has_bits = !!o;
4300 0 : if( o ) {
4301 0 : fd_bincode_uint64_decode_unsafe( &self->bits_bitvec_len, ctx );
4302 0 : if( self->bits_bitvec_len ) {
4303 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), 8UL );
4304 0 : self->bits_bitvec = *alloc_mem;
4305 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(ulong)*self->bits_bitvec_len;
4306 0 : for( ulong i=0; i < self->bits_bitvec_len; i++ ) {
4307 0 : fd_bincode_uint64_decode_unsafe( self->bits_bitvec + i, ctx );
4308 0 : }
4309 0 : } else
4310 0 : self->bits_bitvec = NULL;
4311 0 : } else {
4312 0 : self->bits_bitvec = NULL;
4313 0 : }
4314 0 : fd_bincode_uint64_decode_unsafe( &self->bits_len, ctx );
4315 0 : }
4316 0 : fd_bincode_uint64_decode_unsafe( &self->next_slot, ctx );
4317 0 : }
4318 0 : void * fd_slot_history_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4319 0 : fd_slot_history_t * self = (fd_slot_history_t *)mem;
4320 0 : fd_slot_history_new( self );
4321 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_history_t);
4322 0 : void * * alloc_mem = &alloc_region;
4323 0 : fd_slot_history_decode_inner( mem, alloc_mem, ctx );
4324 0 : return self;
4325 0 : }
4326 0 : static void fd_slot_history_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4327 0 : fd_slot_history_global_t * self = (fd_slot_history_global_t *)struct_mem;
4328 0 : {
4329 0 : uchar o;
4330 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
4331 0 : self->has_bits = !!o;
4332 0 : if( o ) {
4333 0 : fd_bincode_uint64_decode_unsafe( &self->bits_bitvec_len, ctx );
4334 0 : if( self->bits_bitvec_len ) {
4335 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), 8UL );
4336 0 : self->bits_bitvec_offset = (ulong)*alloc_mem - (ulong)struct_mem;
4337 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
4338 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(ulong)*self->bits_bitvec_len;
4339 0 : for( ulong i=0; i < self->bits_bitvec_len; i++ ) {
4340 0 : fd_bincode_uint64_decode_unsafe( (ulong*)(cur_mem + sizeof(ulong) * i), ctx );
4341 0 : }
4342 0 : } else {
4343 0 : self->bits_bitvec_offset = 0UL;
4344 0 : }
4345 0 : }
4346 0 : fd_bincode_uint64_decode_unsafe( &self->bits_len, ctx );
4347 0 : }
4348 0 : fd_bincode_uint64_decode_unsafe( &self->next_slot, ctx );
4349 0 : }
4350 0 : void * fd_slot_history_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4351 0 : fd_slot_history_global_t * self = (fd_slot_history_global_t *)mem;
4352 0 : fd_slot_history_new( (fd_slot_history_t *)self );
4353 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_history_global_t);
4354 0 : void * * alloc_mem = &alloc_region;
4355 0 : fd_slot_history_decode_inner_global( mem, alloc_mem, ctx );
4356 0 : return self;
4357 0 : }
4358 0 : void fd_slot_history_new(fd_slot_history_t * self) {
4359 0 : fd_memset( self, 0, sizeof(fd_slot_history_t) );
4360 0 : }
4361 0 : void fd_slot_history_walk( void * w, fd_slot_history_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
4362 0 : (void) varint;
4363 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_slot_history", level++, 0 );
4364 0 : if( !self->has_bits ) {
4365 0 : fun( w, NULL, "bits", FD_FLAMENCO_TYPE_NULL, "ulong", level, 0 );
4366 0 : } else {
4367 0 : if( self->bits_bitvec_len ) {
4368 0 : fun( w, NULL, "bits_bitvec", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
4369 0 : for( ulong i=0; i < self->bits_bitvec_len; i++ )
4370 0 : fun( w, self->bits_bitvec + i, "bits_bitvec", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
4371 0 : fun( w, NULL, "bits_bitvec", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
4372 0 : }
4373 0 : }
4374 0 : fun( w, &self->bits_len, "bits_len", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
4375 0 : fun( w, &self->next_slot, "next_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
4376 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_slot_history", level--, 0 );
4377 0 : }
4378 0 : ulong fd_slot_history_size( fd_slot_history_t const * self ) {
4379 0 : ulong size = 0;
4380 0 : size += sizeof(char);
4381 0 : if( self->has_bits ) {
4382 0 : do {
4383 0 : size += sizeof(ulong);
4384 0 : size += self->bits_bitvec_len * sizeof(ulong);
4385 0 : } while(0);
4386 0 : }
4387 0 : size += sizeof(ulong);
4388 0 : size += sizeof(ulong);
4389 0 : return size;
4390 0 : }
4391 :
4392 0 : ulong fd_slot_history_size_global( fd_slot_history_global_t const * self ) {
4393 0 : ulong size = 0;
4394 0 : do {
4395 0 : size += sizeof(char);
4396 0 : if( self->has_bits ) {
4397 0 : do {
4398 0 : size += sizeof(ulong);
4399 0 : ulong * bits_bitvec = self->bits_bitvec_offset ? (ulong *)fd_type_pun( (uchar *)self + self->bits_bitvec_offset ) : NULL;
4400 0 : size += self->bits_bitvec_len * sizeof(ulong);
4401 0 : } while(0);
4402 0 : }
4403 0 : } while(0);
4404 0 : size += sizeof(ulong);
4405 0 : return size;
4406 0 : }
4407 :
4408 0 : int fd_slot_hash_encode( fd_slot_hash_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4409 0 : int err;
4410 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
4411 0 : if( FD_UNLIKELY( err ) ) return err;
4412 0 : err = fd_hash_encode( &self->hash, ctx );
4413 0 : if( FD_UNLIKELY( err ) ) return err;
4414 0 : return FD_BINCODE_SUCCESS;
4415 0 : }
4416 3 : static inline int fd_slot_hash_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4417 3 : if( (ulong)ctx->data + 40UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4418 3 : ctx->data = (void *)( (ulong)ctx->data + 40UL );
4419 3 : return 0;
4420 3 : }
4421 3 : static void fd_slot_hash_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4422 3 : fd_slot_hash_t * self = (fd_slot_hash_t *)struct_mem;
4423 3 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
4424 3 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
4425 3 : }
4426 0 : void * fd_slot_hash_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4427 0 : fd_slot_hash_t * self = (fd_slot_hash_t *)mem;
4428 0 : fd_slot_hash_new( self );
4429 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_hash_t);
4430 0 : void * * alloc_mem = &alloc_region;
4431 0 : fd_slot_hash_decode_inner( mem, alloc_mem, ctx );
4432 0 : return self;
4433 0 : }
4434 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, uint varint ) {
4435 3 : (void) varint;
4436 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_slot_hash", level++, 0 );
4437 3 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
4438 3 : fd_hash_walk( w, &self->hash, fun, "hash", level, 0 );
4439 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_slot_hash", level--, 0 );
4440 3 : }
4441 0 : int fd_slot_hashes_encode( fd_slot_hashes_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4442 0 : int err;
4443 0 : if( self->hashes ) {
4444 0 : ulong hashes_len = deq_fd_slot_hash_t_cnt( self->hashes );
4445 0 : err = fd_bincode_uint64_encode( hashes_len, ctx );
4446 0 : if( FD_UNLIKELY( err ) ) return err;
4447 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 ) ) {
4448 0 : fd_slot_hash_t const * ele = deq_fd_slot_hash_t_iter_ele_const( self->hashes, iter );
4449 0 : err = fd_slot_hash_encode( ele, ctx );
4450 0 : if( FD_UNLIKELY( err ) ) return err;
4451 0 : }
4452 0 : } else {
4453 0 : ulong hashes_len = 0;
4454 0 : err = fd_bincode_uint64_encode( hashes_len, ctx );
4455 0 : if( FD_UNLIKELY( err ) ) return err;
4456 0 : }
4457 0 : return FD_BINCODE_SUCCESS;
4458 0 : }
4459 0 : int fd_slot_hashes_encode_global( fd_slot_hashes_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4460 0 : int err;
4461 0 : if( self->hashes_offset ) {
4462 0 : uchar * hashes_laddr = (uchar*)self + self->hashes_offset;
4463 0 : fd_slot_hash_t * hashes = deq_fd_slot_hash_t_join( hashes_laddr );
4464 0 : ulong hashes_len = deq_fd_slot_hash_t_cnt( hashes );
4465 0 : err = fd_bincode_uint64_encode( hashes_len, ctx );
4466 0 : if( FD_UNLIKELY( err ) ) return err;
4467 0 : for( deq_fd_slot_hash_t_iter_t iter = deq_fd_slot_hash_t_iter_init( hashes ); !deq_fd_slot_hash_t_iter_done( hashes, iter ); iter = deq_fd_slot_hash_t_iter_next( hashes, iter ) ) {
4468 0 : fd_slot_hash_t const * ele = deq_fd_slot_hash_t_iter_ele_const( hashes, iter );
4469 0 : err = fd_slot_hash_encode( ele, ctx );
4470 0 : if( FD_UNLIKELY( err ) ) return err;
4471 0 : }
4472 0 : } else {
4473 0 : ulong hashes_len = 0;
4474 0 : err = fd_bincode_uint64_encode( hashes_len, ctx );
4475 0 : if( FD_UNLIKELY( err ) ) return err;
4476 0 : }
4477 0 : return FD_BINCODE_SUCCESS;
4478 0 : }
4479 3 : static int fd_slot_hashes_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4480 3 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4481 3 : int err = 0;
4482 3 : ulong hashes_len;
4483 3 : err = fd_bincode_uint64_decode( &hashes_len, ctx );
4484 3 : if( FD_UNLIKELY( err ) ) return err;
4485 3 : ulong hashes_max = fd_ulong_max( hashes_len, 512 );
4486 3 : *total_sz += deq_fd_slot_hash_t_align() + deq_fd_slot_hash_t_footprint( hashes_max );
4487 3 : ulong hashes_sz;
4488 3 : if( FD_UNLIKELY( __builtin_umull_overflow( hashes_len, 40, &hashes_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
4489 3 : err = fd_bincode_bytes_decode_footprint( hashes_sz, ctx );
4490 3 : if( FD_UNLIKELY( err ) ) return err;
4491 3 : return 0;
4492 3 : }
4493 3 : int fd_slot_hashes_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4494 3 : *total_sz += sizeof(fd_slot_hashes_t);
4495 3 : void const * start_data = ctx->data;
4496 3 : int err = fd_slot_hashes_decode_footprint_inner( ctx, total_sz );
4497 3 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4498 3 : ctx->data = start_data;
4499 3 : return err;
4500 3 : }
4501 0 : static void fd_slot_hashes_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4502 0 : fd_slot_hashes_t * self = (fd_slot_hashes_t *)struct_mem;
4503 0 : ulong hashes_len;
4504 0 : fd_bincode_uint64_decode_unsafe( &hashes_len, ctx );
4505 0 : ulong hashes_max = fd_ulong_max( hashes_len, 512 );
4506 0 : self->hashes = deq_fd_slot_hash_t_join_new( alloc_mem, hashes_max );
4507 0 : for( ulong i=0; i < hashes_len; i++ ) {
4508 0 : fd_slot_hash_t * elem = deq_fd_slot_hash_t_push_tail_nocopy( self->hashes );
4509 0 : fd_slot_hash_new( elem );
4510 0 : fd_slot_hash_decode_inner( elem, alloc_mem, ctx );
4511 0 : }
4512 0 : }
4513 0 : void * fd_slot_hashes_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4514 0 : fd_slot_hashes_t * self = (fd_slot_hashes_t *)mem;
4515 0 : fd_slot_hashes_new( self );
4516 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_hashes_t);
4517 0 : void * * alloc_mem = &alloc_region;
4518 0 : fd_slot_hashes_decode_inner( mem, alloc_mem, ctx );
4519 0 : return self;
4520 0 : }
4521 0 : static void fd_slot_hashes_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4522 0 : fd_slot_hashes_global_t * self = (fd_slot_hashes_global_t *)struct_mem;
4523 0 : ulong hashes_len;
4524 0 : fd_bincode_uint64_decode_unsafe( &hashes_len, ctx );
4525 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, deq_fd_slot_hash_t_align() );
4526 0 : ulong hashes_max = fd_ulong_max( hashes_len, 512 );
4527 0 : fd_slot_hash_t * hashes = deq_fd_slot_hash_t_join_new( alloc_mem, hashes_max );
4528 0 : for( ulong i=0; i < hashes_len; i++ ) {
4529 0 : fd_slot_hash_t * elem = deq_fd_slot_hash_t_push_tail_nocopy( hashes );
4530 0 : fd_slot_hash_new( (fd_slot_hash_t*)fd_type_pun( elem ) );
4531 0 : fd_slot_hash_decode_inner( elem, alloc_mem, ctx );
4532 0 : }
4533 0 : self->hashes_offset = (ulong)deq_fd_slot_hash_t_leave( hashes ) - (ulong)struct_mem;
4534 0 : }
4535 0 : void * fd_slot_hashes_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4536 0 : fd_slot_hashes_global_t * self = (fd_slot_hashes_global_t *)mem;
4537 0 : fd_slot_hashes_new( (fd_slot_hashes_t *)self );
4538 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_hashes_global_t);
4539 0 : void * * alloc_mem = &alloc_region;
4540 0 : fd_slot_hashes_decode_inner_global( mem, alloc_mem, ctx );
4541 0 : return self;
4542 0 : }
4543 0 : void fd_slot_hashes_new(fd_slot_hashes_t * self) {
4544 0 : fd_memset( self, 0, sizeof(fd_slot_hashes_t) );
4545 0 : }
4546 0 : void fd_slot_hashes_walk( void * w, fd_slot_hashes_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
4547 0 : (void) varint;
4548 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_slot_hashes", level++, 0 );
4549 :
4550 : /* Walk deque */
4551 0 : fun( w, self->hashes, "hashes", FD_FLAMENCO_TYPE_ARR, "hashes", level++, 0 );
4552 0 : if( self->hashes ) {
4553 0 : for( deq_fd_slot_hash_t_iter_t iter = deq_fd_slot_hash_t_iter_init( self->hashes );
4554 0 : !deq_fd_slot_hash_t_iter_done( self->hashes, iter );
4555 0 : iter = deq_fd_slot_hash_t_iter_next( self->hashes, iter ) ) {
4556 0 : fd_slot_hash_t * ele = deq_fd_slot_hash_t_iter_ele( self->hashes, iter );
4557 0 : fd_slot_hash_walk(w, ele, fun, "hashes", level, 0 );
4558 0 : }
4559 0 : }
4560 0 : fun( w, self->hashes, "hashes", FD_FLAMENCO_TYPE_ARR_END, "hashes", level--, 0 );
4561 : /* Done walking deque */
4562 :
4563 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_slot_hashes", level--, 0 );
4564 0 : }
4565 0 : ulong fd_slot_hashes_size( fd_slot_hashes_t const * self ) {
4566 0 : ulong size = 0;
4567 0 : if( self->hashes ) {
4568 0 : size += sizeof(ulong);
4569 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 ) ) {
4570 0 : fd_slot_hash_t * ele = deq_fd_slot_hash_t_iter_ele( self->hashes, iter );
4571 0 : size += fd_slot_hash_size( ele );
4572 0 : }
4573 0 : } else {
4574 0 : size += sizeof(ulong);
4575 0 : }
4576 0 : return size;
4577 0 : }
4578 :
4579 0 : ulong fd_slot_hashes_size_global( fd_slot_hashes_global_t const * self ) {
4580 0 : ulong size = 0;
4581 0 : if( self->hashes_offset!=0 ) {
4582 0 : fd_slot_hash_t * hashes = (fd_slot_hash_t *)deq_fd_slot_hash_t_join( fd_type_pun( (uchar *)self + self->hashes_offset ) );
4583 0 : size += sizeof(ulong);
4584 0 : for( deq_fd_slot_hash_t_iter_t iter = deq_fd_slot_hash_t_iter_init( hashes ); !deq_fd_slot_hash_t_iter_done( hashes, iter ); iter = deq_fd_slot_hash_t_iter_next( hashes, iter ) ) {
4585 0 : fd_slot_hash_t * ele = deq_fd_slot_hash_t_iter_ele( hashes, iter );
4586 0 : size += fd_slot_hash_size( ele );
4587 0 : }
4588 0 : } else {
4589 0 : size += sizeof(ulong);
4590 0 : }
4591 0 : return size;
4592 0 : }
4593 :
4594 0 : int fd_block_block_hash_entry_encode( fd_block_block_hash_entry_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4595 0 : int err;
4596 0 : err = fd_hash_encode( &self->blockhash, ctx );
4597 0 : if( FD_UNLIKELY( err ) ) return err;
4598 0 : err = fd_fee_calculator_encode( &self->fee_calculator, ctx );
4599 0 : if( FD_UNLIKELY( err ) ) return err;
4600 0 : return FD_BINCODE_SUCCESS;
4601 0 : }
4602 0 : static inline int fd_block_block_hash_entry_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4603 0 : if( (ulong)ctx->data + 40UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4604 0 : ctx->data = (void *)( (ulong)ctx->data + 40UL );
4605 0 : return 0;
4606 0 : }
4607 0 : static void fd_block_block_hash_entry_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4608 0 : fd_block_block_hash_entry_t * self = (fd_block_block_hash_entry_t *)struct_mem;
4609 0 : fd_hash_decode_inner( &self->blockhash, alloc_mem, ctx );
4610 0 : fd_fee_calculator_decode_inner( &self->fee_calculator, alloc_mem, ctx );
4611 0 : }
4612 0 : void * fd_block_block_hash_entry_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4613 0 : fd_block_block_hash_entry_t * self = (fd_block_block_hash_entry_t *)mem;
4614 0 : fd_block_block_hash_entry_new( self );
4615 0 : void * alloc_region = (uchar *)mem + sizeof(fd_block_block_hash_entry_t);
4616 0 : void * * alloc_mem = &alloc_region;
4617 0 : fd_block_block_hash_entry_decode_inner( mem, alloc_mem, ctx );
4618 0 : return self;
4619 0 : }
4620 0 : void fd_block_block_hash_entry_walk( void * w, fd_block_block_hash_entry_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
4621 0 : (void) varint;
4622 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_block_block_hash_entry", level++, 0 );
4623 0 : fd_hash_walk( w, &self->blockhash, fun, "blockhash", level, 0 );
4624 0 : fd_fee_calculator_walk( w, &self->fee_calculator, fun, "fee_calculator", level, 0 );
4625 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_block_block_hash_entry", level--, 0 );
4626 0 : }
4627 0 : int fd_recent_block_hashes_encode( fd_recent_block_hashes_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4628 0 : int err;
4629 0 : if( self->hashes ) {
4630 0 : ulong hashes_len = deq_fd_block_block_hash_entry_t_cnt( self->hashes );
4631 0 : err = fd_bincode_uint64_encode( hashes_len, ctx );
4632 0 : if( FD_UNLIKELY( err ) ) return err;
4633 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 ) ) {
4634 0 : fd_block_block_hash_entry_t const * ele = deq_fd_block_block_hash_entry_t_iter_ele_const( self->hashes, iter );
4635 0 : err = fd_block_block_hash_entry_encode( ele, ctx );
4636 0 : if( FD_UNLIKELY( err ) ) return err;
4637 0 : }
4638 0 : } else {
4639 0 : ulong hashes_len = 0;
4640 0 : err = fd_bincode_uint64_encode( hashes_len, ctx );
4641 0 : if( FD_UNLIKELY( err ) ) return err;
4642 0 : }
4643 0 : return FD_BINCODE_SUCCESS;
4644 0 : }
4645 0 : int fd_recent_block_hashes_encode_global( fd_recent_block_hashes_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4646 0 : int err;
4647 0 : if( self->hashes_offset ) {
4648 0 : uchar * hashes_laddr = (uchar*)self + self->hashes_offset;
4649 0 : fd_block_block_hash_entry_t * hashes = deq_fd_block_block_hash_entry_t_join( hashes_laddr );
4650 0 : ulong hashes_len = deq_fd_block_block_hash_entry_t_cnt( hashes );
4651 0 : err = fd_bincode_uint64_encode( hashes_len, ctx );
4652 0 : if( FD_UNLIKELY( err ) ) return err;
4653 0 : for( deq_fd_block_block_hash_entry_t_iter_t iter = deq_fd_block_block_hash_entry_t_iter_init( hashes ); !deq_fd_block_block_hash_entry_t_iter_done( hashes, iter ); iter = deq_fd_block_block_hash_entry_t_iter_next( hashes, iter ) ) {
4654 0 : fd_block_block_hash_entry_t const * ele = deq_fd_block_block_hash_entry_t_iter_ele_const( hashes, iter );
4655 0 : err = fd_block_block_hash_entry_encode( ele, ctx );
4656 0 : if( FD_UNLIKELY( err ) ) return err;
4657 0 : }
4658 0 : } else {
4659 0 : ulong hashes_len = 0;
4660 0 : err = fd_bincode_uint64_encode( hashes_len, ctx );
4661 0 : if( FD_UNLIKELY( err ) ) return err;
4662 0 : }
4663 0 : return FD_BINCODE_SUCCESS;
4664 0 : }
4665 0 : static int fd_recent_block_hashes_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4666 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4667 0 : int err = 0;
4668 0 : ulong hashes_len;
4669 0 : err = fd_bincode_uint64_decode( &hashes_len, ctx );
4670 0 : if( FD_UNLIKELY( err ) ) return err;
4671 0 : ulong hashes_max = fd_ulong_max( hashes_len, 151 );
4672 0 : *total_sz += deq_fd_block_block_hash_entry_t_align() + deq_fd_block_block_hash_entry_t_footprint( hashes_max );
4673 0 : ulong hashes_sz;
4674 0 : if( FD_UNLIKELY( __builtin_umull_overflow( hashes_len, 40, &hashes_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
4675 0 : err = fd_bincode_bytes_decode_footprint( hashes_sz, ctx );
4676 0 : if( FD_UNLIKELY( err ) ) return err;
4677 0 : return 0;
4678 0 : }
4679 0 : int fd_recent_block_hashes_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4680 0 : *total_sz += sizeof(fd_recent_block_hashes_t);
4681 0 : void const * start_data = ctx->data;
4682 0 : int err = fd_recent_block_hashes_decode_footprint_inner( ctx, total_sz );
4683 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4684 0 : ctx->data = start_data;
4685 0 : return err;
4686 0 : }
4687 0 : static void fd_recent_block_hashes_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4688 0 : fd_recent_block_hashes_t * self = (fd_recent_block_hashes_t *)struct_mem;
4689 0 : ulong hashes_len;
4690 0 : fd_bincode_uint64_decode_unsafe( &hashes_len, ctx );
4691 0 : ulong hashes_max = fd_ulong_max( hashes_len, 151 );
4692 0 : self->hashes = deq_fd_block_block_hash_entry_t_join_new( alloc_mem, hashes_max );
4693 0 : for( ulong i=0; i < hashes_len; i++ ) {
4694 0 : fd_block_block_hash_entry_t * elem = deq_fd_block_block_hash_entry_t_push_tail_nocopy( self->hashes );
4695 0 : fd_block_block_hash_entry_new( elem );
4696 0 : fd_block_block_hash_entry_decode_inner( elem, alloc_mem, ctx );
4697 0 : }
4698 0 : }
4699 0 : void * fd_recent_block_hashes_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4700 0 : fd_recent_block_hashes_t * self = (fd_recent_block_hashes_t *)mem;
4701 0 : fd_recent_block_hashes_new( self );
4702 0 : void * alloc_region = (uchar *)mem + sizeof(fd_recent_block_hashes_t);
4703 0 : void * * alloc_mem = &alloc_region;
4704 0 : fd_recent_block_hashes_decode_inner( mem, alloc_mem, ctx );
4705 0 : return self;
4706 0 : }
4707 0 : static void fd_recent_block_hashes_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4708 0 : fd_recent_block_hashes_global_t * self = (fd_recent_block_hashes_global_t *)struct_mem;
4709 0 : ulong hashes_len;
4710 0 : fd_bincode_uint64_decode_unsafe( &hashes_len, ctx );
4711 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, deq_fd_block_block_hash_entry_t_align() );
4712 0 : ulong hashes_max = fd_ulong_max( hashes_len, 151 );
4713 0 : fd_block_block_hash_entry_t * hashes = deq_fd_block_block_hash_entry_t_join_new( alloc_mem, hashes_max );
4714 0 : for( ulong i=0; i < hashes_len; i++ ) {
4715 0 : fd_block_block_hash_entry_t * elem = deq_fd_block_block_hash_entry_t_push_tail_nocopy( hashes );
4716 0 : fd_block_block_hash_entry_new( (fd_block_block_hash_entry_t*)fd_type_pun( elem ) );
4717 0 : fd_block_block_hash_entry_decode_inner( elem, alloc_mem, ctx );
4718 0 : }
4719 0 : self->hashes_offset = (ulong)deq_fd_block_block_hash_entry_t_leave( hashes ) - (ulong)struct_mem;
4720 0 : }
4721 0 : void * fd_recent_block_hashes_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4722 0 : fd_recent_block_hashes_global_t * self = (fd_recent_block_hashes_global_t *)mem;
4723 0 : fd_recent_block_hashes_new( (fd_recent_block_hashes_t *)self );
4724 0 : void * alloc_region = (uchar *)mem + sizeof(fd_recent_block_hashes_global_t);
4725 0 : void * * alloc_mem = &alloc_region;
4726 0 : fd_recent_block_hashes_decode_inner_global( mem, alloc_mem, ctx );
4727 0 : return self;
4728 0 : }
4729 0 : void fd_recent_block_hashes_new(fd_recent_block_hashes_t * self) {
4730 0 : fd_memset( self, 0, sizeof(fd_recent_block_hashes_t) );
4731 0 : }
4732 0 : void fd_recent_block_hashes_walk( void * w, fd_recent_block_hashes_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
4733 0 : (void) varint;
4734 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_recent_block_hashes", level++, 0 );
4735 :
4736 : /* Walk deque */
4737 0 : fun( w, self->hashes, "hashes", FD_FLAMENCO_TYPE_ARR, "hashes", level++, 0 );
4738 0 : if( self->hashes ) {
4739 0 : for( deq_fd_block_block_hash_entry_t_iter_t iter = deq_fd_block_block_hash_entry_t_iter_init( self->hashes );
4740 0 : !deq_fd_block_block_hash_entry_t_iter_done( self->hashes, iter );
4741 0 : iter = deq_fd_block_block_hash_entry_t_iter_next( self->hashes, iter ) ) {
4742 0 : fd_block_block_hash_entry_t * ele = deq_fd_block_block_hash_entry_t_iter_ele( self->hashes, iter );
4743 0 : fd_block_block_hash_entry_walk(w, ele, fun, "hashes", level, 0 );
4744 0 : }
4745 0 : }
4746 0 : fun( w, self->hashes, "hashes", FD_FLAMENCO_TYPE_ARR_END, "hashes", level--, 0 );
4747 : /* Done walking deque */
4748 :
4749 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_recent_block_hashes", level--, 0 );
4750 0 : }
4751 0 : ulong fd_recent_block_hashes_size( fd_recent_block_hashes_t const * self ) {
4752 0 : ulong size = 0;
4753 0 : if( self->hashes ) {
4754 0 : size += sizeof(ulong);
4755 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 ) ) {
4756 0 : fd_block_block_hash_entry_t * ele = deq_fd_block_block_hash_entry_t_iter_ele( self->hashes, iter );
4757 0 : size += fd_block_block_hash_entry_size( ele );
4758 0 : }
4759 0 : } else {
4760 0 : size += sizeof(ulong);
4761 0 : }
4762 0 : return size;
4763 0 : }
4764 :
4765 0 : ulong fd_recent_block_hashes_size_global( fd_recent_block_hashes_global_t const * self ) {
4766 0 : ulong size = 0;
4767 0 : if( self->hashes_offset!=0 ) {
4768 0 : fd_block_block_hash_entry_t * hashes = (fd_block_block_hash_entry_t *)deq_fd_block_block_hash_entry_t_join( fd_type_pun( (uchar *)self + self->hashes_offset ) );
4769 0 : size += sizeof(ulong);
4770 0 : for( deq_fd_block_block_hash_entry_t_iter_t iter = deq_fd_block_block_hash_entry_t_iter_init( hashes ); !deq_fd_block_block_hash_entry_t_iter_done( hashes, iter ); iter = deq_fd_block_block_hash_entry_t_iter_next( hashes, iter ) ) {
4771 0 : fd_block_block_hash_entry_t * ele = deq_fd_block_block_hash_entry_t_iter_ele( hashes, iter );
4772 0 : size += fd_block_block_hash_entry_size( ele );
4773 0 : }
4774 0 : } else {
4775 0 : size += sizeof(ulong);
4776 0 : }
4777 0 : return size;
4778 0 : }
4779 :
4780 0 : int fd_slot_meta_encode( fd_slot_meta_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4781 0 : int err;
4782 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
4783 0 : if( FD_UNLIKELY( err ) ) return err;
4784 0 : err = fd_bincode_uint64_encode( self->consumed, ctx );
4785 0 : if( FD_UNLIKELY( err ) ) return err;
4786 0 : err = fd_bincode_uint64_encode( self->received, ctx );
4787 0 : if( FD_UNLIKELY( err ) ) return err;
4788 0 : err = fd_bincode_uint64_encode( (ulong)self->first_shred_timestamp, ctx );
4789 0 : if( FD_UNLIKELY( err ) ) return err;
4790 0 : err = fd_bincode_uint64_encode( self->last_index, ctx );
4791 0 : if( FD_UNLIKELY( err ) ) return err;
4792 0 : err = fd_bincode_uint64_encode( self->parent_slot, ctx );
4793 0 : if( FD_UNLIKELY( err ) ) return err;
4794 0 : err = fd_bincode_uint64_encode( self->next_slot_len, ctx );
4795 0 : if( FD_UNLIKELY(err) ) return err;
4796 0 : if( self->next_slot_len ) {
4797 0 : for( ulong i=0; i < self->next_slot_len; i++ ) {
4798 0 : err = fd_bincode_uint64_encode( self->next_slot[i], ctx );
4799 0 : }
4800 0 : }
4801 0 : err = fd_bincode_uint8_encode( (uchar)(self->is_connected), ctx );
4802 0 : if( FD_UNLIKELY( err ) ) return err;
4803 0 : err = fd_bincode_uint64_encode( self->entry_end_indexes_len, ctx );
4804 0 : if( FD_UNLIKELY(err) ) return err;
4805 0 : if( self->entry_end_indexes_len ) {
4806 0 : for( ulong i=0; i < self->entry_end_indexes_len; i++ ) {
4807 0 : err = fd_bincode_uint32_encode( self->entry_end_indexes[i], ctx );
4808 0 : }
4809 0 : }
4810 0 : return FD_BINCODE_SUCCESS;
4811 0 : }
4812 0 : static int fd_slot_meta_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4813 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4814 0 : int err = 0;
4815 0 : err = fd_bincode_uint64_decode_footprint( ctx );
4816 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4817 0 : err = fd_bincode_uint64_decode_footprint( ctx );
4818 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4819 0 : err = fd_bincode_uint64_decode_footprint( ctx );
4820 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4821 0 : err = fd_bincode_uint64_decode_footprint( ctx );
4822 0 : if( FD_UNLIKELY( err ) ) return err;
4823 0 : err = fd_bincode_uint64_decode_footprint( ctx );
4824 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4825 0 : err = fd_bincode_uint64_decode_footprint( ctx );
4826 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4827 0 : ulong next_slot_len;
4828 0 : err = fd_bincode_uint64_decode( &next_slot_len, ctx );
4829 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4830 0 : if( next_slot_len ) {
4831 0 : *total_sz += 8UL + sizeof(ulong)*next_slot_len;
4832 0 : for( ulong i=0; i < next_slot_len; i++ ) {
4833 0 : err = fd_bincode_uint64_decode_footprint( ctx );
4834 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4835 0 : }
4836 0 : }
4837 0 : err = fd_bincode_uint8_decode_footprint( ctx );
4838 0 : if( FD_UNLIKELY( err ) ) return err;
4839 0 : ulong entry_end_indexes_len;
4840 0 : err = fd_bincode_uint64_decode( &entry_end_indexes_len, ctx );
4841 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4842 0 : if( entry_end_indexes_len ) {
4843 0 : *total_sz += 8UL + sizeof(uint)*entry_end_indexes_len;
4844 0 : for( ulong i=0; i < entry_end_indexes_len; i++ ) {
4845 0 : err = fd_bincode_uint32_decode_footprint( ctx );
4846 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4847 0 : }
4848 0 : }
4849 0 : return 0;
4850 0 : }
4851 0 : int fd_slot_meta_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4852 0 : *total_sz += sizeof(fd_slot_meta_t);
4853 0 : void const * start_data = ctx->data;
4854 0 : int err = fd_slot_meta_decode_footprint_inner( ctx, total_sz );
4855 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4856 0 : ctx->data = start_data;
4857 0 : return err;
4858 0 : }
4859 0 : static void fd_slot_meta_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4860 0 : fd_slot_meta_t * self = (fd_slot_meta_t *)struct_mem;
4861 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
4862 0 : fd_bincode_uint64_decode_unsafe( &self->consumed, ctx );
4863 0 : fd_bincode_uint64_decode_unsafe( &self->received, ctx );
4864 0 : fd_bincode_uint64_decode_unsafe( (ulong *) &self->first_shred_timestamp, ctx );
4865 0 : fd_bincode_uint64_decode_unsafe( &self->last_index, ctx );
4866 0 : fd_bincode_uint64_decode_unsafe( &self->parent_slot, ctx );
4867 0 : fd_bincode_uint64_decode_unsafe( &self->next_slot_len, ctx );
4868 0 : if( self->next_slot_len ) {
4869 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), 8UL );
4870 0 : self->next_slot = *alloc_mem;
4871 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(ulong)*self->next_slot_len;
4872 0 : for( ulong i=0; i < self->next_slot_len; i++ ) {
4873 0 : fd_bincode_uint64_decode_unsafe( self->next_slot + i, ctx );
4874 0 : }
4875 0 : } else
4876 0 : self->next_slot = NULL;
4877 0 : fd_bincode_uint8_decode_unsafe( &self->is_connected, ctx );
4878 0 : fd_bincode_uint64_decode_unsafe( &self->entry_end_indexes_len, ctx );
4879 0 : if( self->entry_end_indexes_len ) {
4880 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), 8UL );
4881 0 : self->entry_end_indexes = *alloc_mem;
4882 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(uint)*self->entry_end_indexes_len;
4883 0 : for( ulong i=0; i < self->entry_end_indexes_len; i++ ) {
4884 0 : fd_bincode_uint32_decode_unsafe( self->entry_end_indexes + i, ctx );
4885 0 : }
4886 0 : } else
4887 0 : self->entry_end_indexes = NULL;
4888 0 : }
4889 0 : void * fd_slot_meta_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4890 0 : fd_slot_meta_t * self = (fd_slot_meta_t *)mem;
4891 0 : fd_slot_meta_new( self );
4892 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_meta_t);
4893 0 : void * * alloc_mem = &alloc_region;
4894 0 : fd_slot_meta_decode_inner( mem, alloc_mem, ctx );
4895 0 : return self;
4896 0 : }
4897 0 : void fd_slot_meta_new(fd_slot_meta_t * self) {
4898 0 : fd_memset( self, 0, sizeof(fd_slot_meta_t) );
4899 0 : }
4900 0 : void fd_slot_meta_walk( void * w, fd_slot_meta_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
4901 0 : (void) varint;
4902 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_slot_meta", level++, 0 );
4903 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
4904 0 : fun( w, &self->consumed, "consumed", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
4905 0 : fun( w, &self->received, "received", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
4906 0 : fun( w, &self->first_shred_timestamp, "first_shred_timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level, 0 );
4907 0 : fun( w, &self->last_index, "last_index", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
4908 0 : fun( w, &self->parent_slot, "parent_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
4909 0 : if( self->next_slot_len ) {
4910 0 : fun( w, NULL, "next_slot", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
4911 0 : for( ulong i=0; i < self->next_slot_len; i++ )
4912 0 : fun( w, self->next_slot + i, "next_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
4913 0 : fun( w, NULL, "next_slot", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
4914 0 : }
4915 0 : fun( w, &self->is_connected, "is_connected", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
4916 0 : if( self->entry_end_indexes_len ) {
4917 0 : fun( w, NULL, "entry_end_indexes", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
4918 0 : for( ulong i=0; i < self->entry_end_indexes_len; i++ )
4919 0 : fun( w, self->entry_end_indexes + i, "entry_end_indexes", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
4920 0 : fun( w, NULL, "entry_end_indexes", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
4921 0 : }
4922 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_slot_meta", level--, 0 );
4923 0 : }
4924 0 : ulong fd_slot_meta_size( fd_slot_meta_t const * self ) {
4925 0 : ulong size = 0;
4926 0 : size += sizeof(ulong);
4927 0 : size += sizeof(ulong);
4928 0 : size += sizeof(ulong);
4929 0 : size += sizeof(long);
4930 0 : size += sizeof(ulong);
4931 0 : size += sizeof(ulong);
4932 0 : do {
4933 0 : size += sizeof(ulong);
4934 0 : size += self->next_slot_len * sizeof(ulong);
4935 0 : } while(0);
4936 0 : size += sizeof(char);
4937 0 : do {
4938 0 : size += sizeof(ulong);
4939 0 : size += self->entry_end_indexes_len * sizeof(uint);
4940 0 : } while(0);
4941 0 : return size;
4942 0 : }
4943 :
4944 0 : int fd_clock_timestamp_vote_encode( fd_clock_timestamp_vote_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4945 0 : int err;
4946 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
4947 0 : if( FD_UNLIKELY( err ) ) return err;
4948 0 : err = fd_bincode_uint64_encode( (ulong)self->timestamp, ctx );
4949 0 : if( FD_UNLIKELY( err ) ) return err;
4950 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
4951 0 : if( FD_UNLIKELY( err ) ) return err;
4952 0 : return FD_BINCODE_SUCCESS;
4953 0 : }
4954 0 : static inline int fd_clock_timestamp_vote_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4955 0 : if( (ulong)ctx->data + 48UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4956 0 : ctx->data = (void *)( (ulong)ctx->data + 48UL );
4957 0 : return 0;
4958 0 : }
4959 0 : static void fd_clock_timestamp_vote_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4960 0 : fd_clock_timestamp_vote_t * self = (fd_clock_timestamp_vote_t *)struct_mem;
4961 0 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
4962 0 : fd_bincode_uint64_decode_unsafe( (ulong *) &self->timestamp, ctx );
4963 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
4964 0 : }
4965 0 : void * fd_clock_timestamp_vote_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4966 0 : fd_clock_timestamp_vote_t * self = (fd_clock_timestamp_vote_t *)mem;
4967 0 : fd_clock_timestamp_vote_new( self );
4968 0 : void * alloc_region = (uchar *)mem + sizeof(fd_clock_timestamp_vote_t);
4969 0 : void * * alloc_mem = &alloc_region;
4970 0 : fd_clock_timestamp_vote_decode_inner( mem, alloc_mem, ctx );
4971 0 : return self;
4972 0 : }
4973 0 : 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, uint varint ) {
4974 0 : (void) varint;
4975 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_clock_timestamp_vote", level++, 0 );
4976 0 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level, 0 );
4977 0 : fun( w, &self->timestamp, "timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level, 0 );
4978 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
4979 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_clock_timestamp_vote", level--, 0 );
4980 0 : }
4981 0 : int fd_clock_timestamp_votes_encode( fd_clock_timestamp_votes_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4982 0 : int err;
4983 0 : if( self->votes_root ) {
4984 0 : ulong votes_len = fd_clock_timestamp_vote_t_map_size( self->votes_pool, self->votes_root );
4985 0 : err = fd_bincode_uint64_encode( votes_len, ctx );
4986 0 : if( FD_UNLIKELY( err ) ) return err;
4987 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 ) ) {
4988 0 : err = fd_clock_timestamp_vote_encode( &n->elem, ctx );
4989 0 : if( FD_UNLIKELY( err ) ) return err;
4990 0 : }
4991 0 : } else {
4992 0 : ulong votes_len = 0;
4993 0 : err = fd_bincode_uint64_encode( votes_len, ctx );
4994 0 : if( FD_UNLIKELY( err ) ) return err;
4995 0 : }
4996 0 : return FD_BINCODE_SUCCESS;
4997 0 : }
4998 0 : int fd_clock_timestamp_votes_encode_global( fd_clock_timestamp_votes_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4999 0 : int err;
5000 0 : fd_clock_timestamp_vote_t_mapnode_t * votes_root = fd_clock_timestamp_vote_t_map_join( (uchar *)self + self->votes_root_offset );
5001 0 : fd_clock_timestamp_vote_t_mapnode_t * votes_pool = fd_clock_timestamp_vote_t_map_join( (uchar *)self + self->votes_pool_offset );
5002 0 : if( votes_root ) {
5003 0 : ulong votes_len = fd_clock_timestamp_vote_t_map_size( votes_pool, votes_root );
5004 0 : err = fd_bincode_uint64_encode( votes_len, ctx );
5005 0 : if( FD_UNLIKELY( err ) ) return err;
5006 0 : for( fd_clock_timestamp_vote_t_mapnode_t * n = fd_clock_timestamp_vote_t_map_minimum( votes_pool, votes_root ); n; n = fd_clock_timestamp_vote_t_map_successor( votes_pool, n ) ) {
5007 0 : err = fd_clock_timestamp_vote_encode( &n->elem, ctx );
5008 0 : if( FD_UNLIKELY( err ) ) return err;
5009 0 : }
5010 0 : } else {
5011 0 : ulong votes_len = 0;
5012 0 : err = fd_bincode_uint64_encode( votes_len, ctx );
5013 0 : if( FD_UNLIKELY( err ) ) return err;
5014 0 : }
5015 0 : return FD_BINCODE_SUCCESS;
5016 0 : }
5017 0 : static int fd_clock_timestamp_votes_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5018 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5019 0 : int err = 0;
5020 0 : ulong votes_len = 0UL;
5021 0 : err = fd_bincode_uint64_decode( &votes_len, ctx );
5022 0 : ulong votes_cnt = fd_ulong_max( votes_len, 15000 );
5023 0 : *total_sz += fd_clock_timestamp_vote_t_map_align() + fd_clock_timestamp_vote_t_map_footprint( votes_cnt );
5024 0 : if( FD_UNLIKELY( err ) ) return err;
5025 0 : for( ulong i=0; i < votes_len; i++ ) {
5026 0 : err = fd_clock_timestamp_vote_decode_footprint_inner( ctx, total_sz );
5027 0 : if( FD_UNLIKELY( err ) ) return err;
5028 0 : }
5029 0 : return 0;
5030 0 : }
5031 0 : int fd_clock_timestamp_votes_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5032 0 : *total_sz += sizeof(fd_clock_timestamp_votes_t);
5033 0 : void const * start_data = ctx->data;
5034 0 : int err = fd_clock_timestamp_votes_decode_footprint_inner( ctx, total_sz );
5035 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5036 0 : ctx->data = start_data;
5037 0 : return err;
5038 0 : }
5039 0 : static void fd_clock_timestamp_votes_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5040 0 : fd_clock_timestamp_votes_t * self = (fd_clock_timestamp_votes_t *)struct_mem;
5041 0 : ulong votes_len;
5042 0 : fd_bincode_uint64_decode_unsafe( &votes_len, ctx );
5043 0 : self->votes_pool = fd_clock_timestamp_vote_t_map_join_new( alloc_mem, fd_ulong_max( votes_len, 15000 ) );
5044 0 : self->votes_root = NULL;
5045 0 : for( ulong i=0; i < votes_len; i++ ) {
5046 0 : fd_clock_timestamp_vote_t_mapnode_t * node = fd_clock_timestamp_vote_t_map_acquire( self->votes_pool );
5047 0 : fd_clock_timestamp_vote_new( &node->elem );
5048 0 : fd_clock_timestamp_vote_decode_inner( &node->elem, alloc_mem, ctx );
5049 0 : fd_clock_timestamp_vote_t_mapnode_t * out = NULL;;
5050 0 : fd_clock_timestamp_vote_t_map_insert_or_replace( self->votes_pool, &self->votes_root, node, &out );
5051 0 : if( out != NULL ) {
5052 0 : fd_clock_timestamp_vote_t_map_release( self->votes_pool, out );
5053 0 : }
5054 0 : }
5055 0 : }
5056 0 : void * fd_clock_timestamp_votes_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5057 0 : fd_clock_timestamp_votes_t * self = (fd_clock_timestamp_votes_t *)mem;
5058 0 : fd_clock_timestamp_votes_new( self );
5059 0 : void * alloc_region = (uchar *)mem + sizeof(fd_clock_timestamp_votes_t);
5060 0 : void * * alloc_mem = &alloc_region;
5061 0 : fd_clock_timestamp_votes_decode_inner( mem, alloc_mem, ctx );
5062 0 : return self;
5063 0 : }
5064 0 : static void fd_clock_timestamp_votes_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5065 0 : fd_clock_timestamp_votes_global_t * self = (fd_clock_timestamp_votes_global_t *)struct_mem;
5066 0 : ulong votes_len;
5067 0 : fd_bincode_uint64_decode_unsafe( &votes_len, ctx );
5068 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, fd_clock_timestamp_vote_t_map_align() );
5069 0 : 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 ) );
5070 0 : fd_clock_timestamp_vote_t_mapnode_t * votes_root = NULL;
5071 0 : for( ulong i=0; i < votes_len; i++ ) {
5072 0 : fd_clock_timestamp_vote_t_mapnode_t * node = fd_clock_timestamp_vote_t_map_acquire( votes_pool );
5073 0 : fd_clock_timestamp_vote_new( (fd_clock_timestamp_vote_t *)fd_type_pun(&node->elem) );
5074 0 : fd_clock_timestamp_vote_decode_inner( &node->elem, alloc_mem, ctx );
5075 0 : fd_clock_timestamp_vote_t_map_insert( votes_pool, &votes_root, node );
5076 0 : }
5077 0 : self->votes_pool_offset = (ulong)fd_clock_timestamp_vote_t_map_leave( votes_pool ) - (ulong)struct_mem;
5078 0 : self->votes_root_offset = (ulong)votes_root - (ulong)struct_mem;
5079 0 : }
5080 0 : void * fd_clock_timestamp_votes_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5081 0 : fd_clock_timestamp_votes_global_t * self = (fd_clock_timestamp_votes_global_t *)mem;
5082 0 : fd_clock_timestamp_votes_new( (fd_clock_timestamp_votes_t *)self );
5083 0 : void * alloc_region = (uchar *)mem + sizeof(fd_clock_timestamp_votes_global_t);
5084 0 : void * * alloc_mem = &alloc_region;
5085 0 : fd_clock_timestamp_votes_decode_inner_global( mem, alloc_mem, ctx );
5086 0 : return self;
5087 0 : }
5088 0 : void fd_clock_timestamp_votes_new(fd_clock_timestamp_votes_t * self) {
5089 0 : fd_memset( self, 0, sizeof(fd_clock_timestamp_votes_t) );
5090 0 : }
5091 0 : 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, uint varint ) {
5092 0 : (void) varint;
5093 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_clock_timestamp_votes", level++, 0 );
5094 0 : if( self->votes_root ) {
5095 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 ) ) {
5096 0 : fd_clock_timestamp_vote_walk(w, &n->elem, fun, "votes", level, 0 );
5097 0 : }
5098 0 : }
5099 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_clock_timestamp_votes", level--, 0 );
5100 0 : }
5101 0 : ulong fd_clock_timestamp_votes_size( fd_clock_timestamp_votes_t const * self ) {
5102 0 : ulong size = 0;
5103 0 : if( self->votes_root ) {
5104 0 : size += sizeof(ulong);
5105 0 : ulong max = fd_clock_timestamp_vote_t_map_max( self->votes_pool );
5106 0 : size += fd_clock_timestamp_vote_t_map_footprint( max );
5107 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 ) ) {
5108 0 : size += fd_clock_timestamp_vote_size( &n->elem ) - sizeof(fd_clock_timestamp_vote_t);
5109 0 : }
5110 0 : } else {
5111 0 : size += sizeof(ulong);
5112 0 : }
5113 0 : return size;
5114 0 : }
5115 :
5116 0 : ulong fd_clock_timestamp_votes_size_global( fd_clock_timestamp_votes_global_t const * self ) {
5117 0 : ulong size = 0;
5118 0 : fd_clock_timestamp_vote_t_mapnode_t * votes_pool = !!self->votes_pool_offset ? (fd_clock_timestamp_vote_t_mapnode_t *)fd_clock_timestamp_vote_t_map_join( fd_type_pun( (uchar *)self + self->votes_pool_offset ) ) : NULL;
5119 0 : fd_clock_timestamp_vote_t_mapnode_t * votes_root = !!self->votes_root_offset ? (fd_clock_timestamp_vote_t_mapnode_t *)fd_type_pun( (uchar *)self + self->votes_root_offset ) : NULL;
5120 0 : if( votes_root ) {
5121 0 : size += sizeof(ulong);
5122 0 : ulong max = fd_clock_timestamp_vote_t_map_max( votes_pool );
5123 0 : size += fd_clock_timestamp_vote_t_map_footprint( max );
5124 0 : for( fd_clock_timestamp_vote_t_mapnode_t * n = fd_clock_timestamp_vote_t_map_minimum( votes_pool, votes_root ); n; n = fd_clock_timestamp_vote_t_map_successor( votes_pool, n ) ) {
5125 0 : size += fd_clock_timestamp_vote_size( &n->elem ) - sizeof(fd_clock_timestamp_vote_t);
5126 0 : }
5127 0 : } else {
5128 0 : size += sizeof(ulong);
5129 0 : }
5130 0 : return size;
5131 0 : }
5132 :
5133 0 : int fd_sysvar_fees_encode( fd_sysvar_fees_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5134 0 : int err;
5135 0 : err = fd_fee_calculator_encode( &self->fee_calculator, ctx );
5136 0 : if( FD_UNLIKELY( err ) ) return err;
5137 0 : return FD_BINCODE_SUCCESS;
5138 0 : }
5139 0 : static inline int fd_sysvar_fees_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5140 0 : if( (ulong)ctx->data + 8UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5141 0 : ctx->data = (void *)( (ulong)ctx->data + 8UL );
5142 0 : return 0;
5143 0 : }
5144 0 : static void fd_sysvar_fees_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5145 0 : fd_sysvar_fees_t * self = (fd_sysvar_fees_t *)struct_mem;
5146 0 : fd_fee_calculator_decode_inner( &self->fee_calculator, alloc_mem, ctx );
5147 0 : }
5148 0 : void * fd_sysvar_fees_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5149 0 : fd_sysvar_fees_t * self = (fd_sysvar_fees_t *)mem;
5150 0 : fd_sysvar_fees_new( self );
5151 0 : void * alloc_region = (uchar *)mem + sizeof(fd_sysvar_fees_t);
5152 0 : void * * alloc_mem = &alloc_region;
5153 0 : fd_sysvar_fees_decode_inner( mem, alloc_mem, ctx );
5154 0 : return self;
5155 0 : }
5156 0 : void fd_sysvar_fees_walk( void * w, fd_sysvar_fees_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
5157 0 : (void) varint;
5158 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_sysvar_fees", level++, 0 );
5159 0 : fd_fee_calculator_walk( w, &self->fee_calculator, fun, "fee_calculator", level, 0 );
5160 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_sysvar_fees", level--, 0 );
5161 0 : }
5162 0 : int fd_sysvar_epoch_rewards_encode( fd_sysvar_epoch_rewards_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5163 0 : int err;
5164 0 : err = fd_bincode_uint64_encode( self->distribution_starting_block_height, ctx );
5165 0 : if( FD_UNLIKELY( err ) ) return err;
5166 0 : err = fd_bincode_uint64_encode( self->num_partitions, ctx );
5167 0 : if( FD_UNLIKELY( err ) ) return err;
5168 0 : err = fd_hash_encode( &self->parent_blockhash, ctx );
5169 0 : if( FD_UNLIKELY( err ) ) return err;
5170 0 : err = fd_bincode_uint128_encode( self->total_points, ctx );
5171 0 : if( FD_UNLIKELY( err ) ) return err;
5172 0 : err = fd_bincode_uint64_encode( self->total_rewards, ctx );
5173 0 : if( FD_UNLIKELY( err ) ) return err;
5174 0 : err = fd_bincode_uint64_encode( self->distributed_rewards, ctx );
5175 0 : if( FD_UNLIKELY( err ) ) return err;
5176 0 : err = fd_bincode_bool_encode( (uchar)(self->active), ctx );
5177 0 : if( FD_UNLIKELY( err ) ) return err;
5178 0 : return FD_BINCODE_SUCCESS;
5179 0 : }
5180 3 : static int fd_sysvar_epoch_rewards_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5181 3 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5182 3 : int err = 0;
5183 3 : err = fd_bincode_uint64_decode_footprint( ctx );
5184 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5185 3 : err = fd_bincode_uint64_decode_footprint( ctx );
5186 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5187 3 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
5188 3 : if( FD_UNLIKELY( err ) ) return err;
5189 3 : err = fd_bincode_uint128_decode_footprint( ctx );
5190 3 : if( FD_UNLIKELY( err ) ) return err;
5191 3 : err = fd_bincode_uint64_decode_footprint( ctx );
5192 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5193 3 : err = fd_bincode_uint64_decode_footprint( ctx );
5194 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5195 3 : err = fd_bincode_bool_decode_footprint( ctx );
5196 3 : if( FD_UNLIKELY( err ) ) return err;
5197 3 : return 0;
5198 3 : }
5199 3 : int fd_sysvar_epoch_rewards_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5200 3 : *total_sz += sizeof(fd_sysvar_epoch_rewards_t);
5201 3 : void const * start_data = ctx->data;
5202 3 : int err = fd_sysvar_epoch_rewards_decode_footprint_inner( ctx, total_sz );
5203 3 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5204 3 : ctx->data = start_data;
5205 3 : return err;
5206 3 : }
5207 0 : static void fd_sysvar_epoch_rewards_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5208 0 : fd_sysvar_epoch_rewards_t * self = (fd_sysvar_epoch_rewards_t *)struct_mem;
5209 0 : fd_bincode_uint64_decode_unsafe( &self->distribution_starting_block_height, ctx );
5210 0 : fd_bincode_uint64_decode_unsafe( &self->num_partitions, ctx );
5211 0 : fd_hash_decode_inner( &self->parent_blockhash, alloc_mem, ctx );
5212 0 : fd_bincode_uint128_decode_unsafe( &self->total_points, ctx );
5213 0 : fd_bincode_uint64_decode_unsafe( &self->total_rewards, ctx );
5214 0 : fd_bincode_uint64_decode_unsafe( &self->distributed_rewards, ctx );
5215 0 : fd_bincode_bool_decode_unsafe( &self->active, ctx );
5216 0 : }
5217 0 : void * fd_sysvar_epoch_rewards_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5218 0 : fd_sysvar_epoch_rewards_t * self = (fd_sysvar_epoch_rewards_t *)mem;
5219 0 : fd_sysvar_epoch_rewards_new( self );
5220 0 : void * alloc_region = (uchar *)mem + sizeof(fd_sysvar_epoch_rewards_t);
5221 0 : void * * alloc_mem = &alloc_region;
5222 0 : fd_sysvar_epoch_rewards_decode_inner( mem, alloc_mem, ctx );
5223 0 : return self;
5224 0 : }
5225 0 : void fd_sysvar_epoch_rewards_new(fd_sysvar_epoch_rewards_t * self) {
5226 0 : fd_memset( self, 0, sizeof(fd_sysvar_epoch_rewards_t) );
5227 0 : fd_hash_new( &self->parent_blockhash );
5228 0 : }
5229 0 : void fd_sysvar_epoch_rewards_walk( void * w, fd_sysvar_epoch_rewards_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
5230 0 : (void) varint;
5231 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_sysvar_epoch_rewards", level++, 0 );
5232 0 : fun( w, &self->distribution_starting_block_height, "distribution_starting_block_height", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
5233 0 : fun( w, &self->num_partitions, "num_partitions", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
5234 0 : fd_hash_walk( w, &self->parent_blockhash, fun, "parent_blockhash", level, 0 );
5235 0 : fun( w, &self->total_points, "total_points", FD_FLAMENCO_TYPE_UINT128, "uint128", level, 0 );
5236 0 : fun( w, &self->total_rewards, "total_rewards", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
5237 0 : fun( w, &self->distributed_rewards, "distributed_rewards", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
5238 0 : fun( w, &self->active, "active", FD_FLAMENCO_TYPE_BOOL, "bool", level, 0 );
5239 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_sysvar_epoch_rewards", level--, 0 );
5240 0 : }
5241 0 : int fd_config_keys_pair_encode( fd_config_keys_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5242 0 : int err;
5243 0 : err = fd_pubkey_encode( &self->key, ctx );
5244 0 : if( FD_UNLIKELY( err ) ) return err;
5245 0 : err = fd_bincode_bool_encode( (uchar)(self->signer), ctx );
5246 0 : if( FD_UNLIKELY( err ) ) return err;
5247 0 : return FD_BINCODE_SUCCESS;
5248 0 : }
5249 0 : static int fd_config_keys_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5250 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5251 0 : int err = 0;
5252 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
5253 0 : if( FD_UNLIKELY( err ) ) return err;
5254 0 : err = fd_bincode_bool_decode_footprint( ctx );
5255 0 : if( FD_UNLIKELY( err ) ) return err;
5256 0 : return 0;
5257 0 : }
5258 0 : int fd_config_keys_pair_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5259 0 : *total_sz += sizeof(fd_config_keys_pair_t);
5260 0 : void const * start_data = ctx->data;
5261 0 : int err = fd_config_keys_pair_decode_footprint_inner( ctx, total_sz );
5262 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5263 0 : ctx->data = start_data;
5264 0 : return err;
5265 0 : }
5266 0 : static void fd_config_keys_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5267 0 : fd_config_keys_pair_t * self = (fd_config_keys_pair_t *)struct_mem;
5268 0 : fd_pubkey_decode_inner( &self->key, alloc_mem, ctx );
5269 0 : fd_bincode_bool_decode_unsafe( &self->signer, ctx );
5270 0 : }
5271 0 : void * fd_config_keys_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5272 0 : fd_config_keys_pair_t * self = (fd_config_keys_pair_t *)mem;
5273 0 : fd_config_keys_pair_new( self );
5274 0 : void * alloc_region = (uchar *)mem + sizeof(fd_config_keys_pair_t);
5275 0 : void * * alloc_mem = &alloc_region;
5276 0 : fd_config_keys_pair_decode_inner( mem, alloc_mem, ctx );
5277 0 : return self;
5278 0 : }
5279 0 : void fd_config_keys_pair_new(fd_config_keys_pair_t * self) {
5280 0 : fd_memset( self, 0, sizeof(fd_config_keys_pair_t) );
5281 0 : fd_pubkey_new( &self->key );
5282 0 : }
5283 0 : void fd_config_keys_pair_walk( void * w, fd_config_keys_pair_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
5284 0 : (void) varint;
5285 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_config_keys_pair", level++, 0 );
5286 0 : fd_pubkey_walk( w, &self->key, fun, "key", level, 0 );
5287 0 : fun( w, &self->signer, "signer", FD_FLAMENCO_TYPE_BOOL, "bool", level, 0 );
5288 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_config_keys_pair", level--, 0 );
5289 0 : }
5290 12 : int fd_stake_config_encode( fd_stake_config_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5291 12 : int err;
5292 12 : err = fd_bincode_compact_u16_encode( &self->config_keys_len, ctx );
5293 12 : if( FD_UNLIKELY(err) ) return err;
5294 12 : if( self->config_keys_len ) {
5295 0 : for( ulong i=0; i < self->config_keys_len; i++ ) {
5296 0 : err = fd_config_keys_pair_encode( self->config_keys + i, ctx );
5297 0 : if( FD_UNLIKELY( err ) ) return err;
5298 0 : }
5299 0 : }
5300 12 : err = fd_bincode_double_encode( self->warmup_cooldown_rate, ctx );
5301 12 : if( FD_UNLIKELY( err ) ) return err;
5302 12 : err = fd_bincode_uint8_encode( (uchar)(self->slash_penalty), ctx );
5303 12 : if( FD_UNLIKELY( err ) ) return err;
5304 12 : return FD_BINCODE_SUCCESS;
5305 12 : }
5306 0 : static int fd_stake_config_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5307 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5308 0 : int err = 0;
5309 0 : ushort config_keys_len;
5310 0 : err = fd_bincode_compact_u16_decode( &config_keys_len, ctx );
5311 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5312 0 : if( config_keys_len ) {
5313 0 : *total_sz += FD_CONFIG_KEYS_PAIR_ALIGN + sizeof(fd_config_keys_pair_t)*config_keys_len;
5314 0 : for( ulong i=0; i < config_keys_len; i++ ) {
5315 0 : err = fd_config_keys_pair_decode_footprint_inner( ctx, total_sz );
5316 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5317 0 : }
5318 0 : }
5319 0 : err = fd_bincode_double_decode_footprint( ctx );
5320 0 : if( FD_UNLIKELY( err ) ) return err;
5321 0 : err = fd_bincode_uint8_decode_footprint( ctx );
5322 0 : if( FD_UNLIKELY( err ) ) return err;
5323 0 : return 0;
5324 0 : }
5325 0 : int fd_stake_config_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5326 0 : *total_sz += sizeof(fd_stake_config_t);
5327 0 : void const * start_data = ctx->data;
5328 0 : int err = fd_stake_config_decode_footprint_inner( ctx, total_sz );
5329 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5330 0 : ctx->data = start_data;
5331 0 : return err;
5332 0 : }
5333 0 : static void fd_stake_config_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5334 0 : fd_stake_config_t * self = (fd_stake_config_t *)struct_mem;
5335 0 : fd_bincode_compact_u16_decode_unsafe( &self->config_keys_len, ctx );
5336 0 : if( self->config_keys_len ) {
5337 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_CONFIG_KEYS_PAIR_ALIGN );
5338 0 : self->config_keys = *alloc_mem;
5339 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_config_keys_pair_t)*self->config_keys_len;
5340 0 : for( ulong i=0; i < self->config_keys_len; i++ ) {
5341 0 : fd_config_keys_pair_new( self->config_keys + i );
5342 0 : fd_config_keys_pair_decode_inner( self->config_keys + i, alloc_mem, ctx );
5343 0 : }
5344 0 : } else
5345 0 : self->config_keys = NULL;
5346 0 : fd_bincode_double_decode_unsafe( &self->warmup_cooldown_rate, ctx );
5347 0 : fd_bincode_uint8_decode_unsafe( &self->slash_penalty, ctx );
5348 0 : }
5349 0 : void * fd_stake_config_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5350 0 : fd_stake_config_t * self = (fd_stake_config_t *)mem;
5351 0 : fd_stake_config_new( self );
5352 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_config_t);
5353 0 : void * * alloc_mem = &alloc_region;
5354 0 : fd_stake_config_decode_inner( mem, alloc_mem, ctx );
5355 0 : return self;
5356 0 : }
5357 0 : void fd_stake_config_new(fd_stake_config_t * self) {
5358 0 : fd_memset( self, 0, sizeof(fd_stake_config_t) );
5359 0 : }
5360 0 : void fd_stake_config_walk( void * w, fd_stake_config_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
5361 0 : (void) varint;
5362 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_config", level++, 0 );
5363 0 : fun( w, &self->config_keys_len, "config_keys_len", FD_FLAMENCO_TYPE_USHORT, "ushort", level, 1 );
5364 0 : if( self->config_keys_len ) {
5365 0 : fun( w, NULL, "config_keys", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
5366 0 : for( ulong i=0; i < self->config_keys_len; i++ )
5367 0 : fd_config_keys_pair_walk(w, self->config_keys + i, fun, "config_keys_pair", level, 0 );
5368 0 : fun( w, NULL, "config_keys", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
5369 0 : }
5370 0 : fun( w, &self->warmup_cooldown_rate, "warmup_cooldown_rate", FD_FLAMENCO_TYPE_DOUBLE, "double", level, 0 );
5371 0 : fun( w, &self->slash_penalty, "slash_penalty", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
5372 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_config", level--, 0 );
5373 0 : }
5374 0 : ulong fd_stake_config_size( fd_stake_config_t const * self ) {
5375 0 : ulong size = 0;
5376 0 : do {
5377 0 : ushort tmp = (ushort)self->config_keys_len;
5378 0 : size += fd_bincode_compact_u16_size( &tmp );
5379 0 : for( ulong i=0; i < self->config_keys_len; i++ )
5380 0 : size += fd_config_keys_pair_size( self->config_keys + i );
5381 0 : } while(0);
5382 0 : size += sizeof(double);
5383 0 : size += sizeof(char);
5384 0 : return size;
5385 0 : }
5386 :
5387 0 : int fd_feature_entry_encode( fd_feature_entry_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5388 0 : int err;
5389 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
5390 0 : if( FD_UNLIKELY( err ) ) return err;
5391 0 : err = fd_bincode_uint64_encode( self->description_len, ctx );
5392 0 : if( FD_UNLIKELY(err) ) return err;
5393 0 : if( self->description_len ) {
5394 0 : err = fd_bincode_bytes_encode( self->description, self->description_len, ctx );
5395 0 : if( FD_UNLIKELY( err ) ) return err;
5396 0 : }
5397 0 : err = fd_bincode_uint64_encode( self->since_slot, ctx );
5398 0 : if( FD_UNLIKELY( err ) ) return err;
5399 0 : return FD_BINCODE_SUCCESS;
5400 0 : }
5401 0 : static int fd_feature_entry_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5402 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5403 0 : int err = 0;
5404 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
5405 0 : if( FD_UNLIKELY( err ) ) return err;
5406 0 : ulong description_len;
5407 0 : err = fd_bincode_uint64_decode( &description_len, ctx );
5408 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5409 0 : *total_sz += description_len;
5410 0 : if( description_len ) {
5411 0 : err = fd_bincode_bytes_decode_footprint( description_len, ctx );
5412 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5413 0 : err = !fd_utf8_verify( (char const *) ctx->data - description_len, description_len );
5414 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5415 0 : }
5416 0 : err = fd_bincode_uint64_decode_footprint( ctx );
5417 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5418 0 : return 0;
5419 0 : }
5420 0 : int fd_feature_entry_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5421 0 : *total_sz += sizeof(fd_feature_entry_t);
5422 0 : void const * start_data = ctx->data;
5423 0 : int err = fd_feature_entry_decode_footprint_inner( ctx, total_sz );
5424 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5425 0 : ctx->data = start_data;
5426 0 : return err;
5427 0 : }
5428 0 : static void fd_feature_entry_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5429 0 : fd_feature_entry_t * self = (fd_feature_entry_t *)struct_mem;
5430 0 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
5431 0 : fd_bincode_uint64_decode_unsafe( &self->description_len, ctx );
5432 0 : if( self->description_len ) {
5433 0 : self->description = *alloc_mem;
5434 0 : fd_bincode_bytes_decode_unsafe( self->description, self->description_len, ctx );
5435 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->description_len;
5436 0 : } else
5437 0 : self->description = NULL;
5438 0 : fd_bincode_uint64_decode_unsafe( &self->since_slot, ctx );
5439 0 : }
5440 0 : void * fd_feature_entry_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5441 0 : fd_feature_entry_t * self = (fd_feature_entry_t *)mem;
5442 0 : fd_feature_entry_new( self );
5443 0 : void * alloc_region = (uchar *)mem + sizeof(fd_feature_entry_t);
5444 0 : void * * alloc_mem = &alloc_region;
5445 0 : fd_feature_entry_decode_inner( mem, alloc_mem, ctx );
5446 0 : return self;
5447 0 : }
5448 0 : void fd_feature_entry_new(fd_feature_entry_t * self) {
5449 0 : fd_memset( self, 0, sizeof(fd_feature_entry_t) );
5450 0 : fd_pubkey_new( &self->pubkey );
5451 0 : }
5452 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, uint varint ) {
5453 0 : (void) varint;
5454 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_feature_entry", level++, 0 );
5455 0 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level, 0 );
5456 0 : if( self->description_len ) {
5457 0 : fun( w, NULL, "description", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
5458 0 : for( ulong i=0; i < self->description_len; i++ )
5459 0 : fun( w, self->description + i, "description", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
5460 0 : fun( w, NULL, "description", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
5461 0 : }
5462 0 : fun( w, &self->since_slot, "since_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
5463 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_feature_entry", level--, 0 );
5464 0 : }
5465 0 : ulong fd_feature_entry_size( fd_feature_entry_t const * self ) {
5466 0 : ulong size = 0;
5467 0 : size += fd_pubkey_size( &self->pubkey );
5468 0 : do {
5469 0 : size += sizeof(ulong);
5470 0 : size += self->description_len;
5471 0 : } while(0);
5472 0 : size += sizeof(ulong);
5473 0 : return size;
5474 0 : }
5475 :
5476 0 : FD_FN_PURE uchar fd_cluster_type_is_Testnet(fd_cluster_type_t const * self) {
5477 0 : return self->discriminant == 0;
5478 0 : }
5479 0 : FD_FN_PURE uchar fd_cluster_type_is_MainnetBeta(fd_cluster_type_t const * self) {
5480 0 : return self->discriminant == 1;
5481 0 : }
5482 0 : FD_FN_PURE uchar fd_cluster_type_is_Devnet(fd_cluster_type_t const * self) {
5483 0 : return self->discriminant == 2;
5484 0 : }
5485 0 : FD_FN_PURE uchar fd_cluster_type_is_Development(fd_cluster_type_t const * self) {
5486 0 : return self->discriminant == 3;
5487 0 : }
5488 0 : int fd_cluster_type_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5489 0 : int err;
5490 0 : switch (discriminant) {
5491 0 : case 0: {
5492 0 : return FD_BINCODE_SUCCESS;
5493 0 : }
5494 0 : case 1: {
5495 0 : return FD_BINCODE_SUCCESS;
5496 0 : }
5497 0 : case 2: {
5498 0 : return FD_BINCODE_SUCCESS;
5499 0 : }
5500 0 : case 3: {
5501 0 : return FD_BINCODE_SUCCESS;
5502 0 : }
5503 0 : default: return FD_BINCODE_ERR_ENCODING;
5504 0 : }
5505 0 : }
5506 0 : static int fd_cluster_type_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5507 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5508 0 : uint discriminant = 0;
5509 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
5510 0 : if( FD_UNLIKELY( err ) ) return err;
5511 0 : return fd_cluster_type_inner_decode_footprint( discriminant, ctx, total_sz );
5512 0 : }
5513 0 : int fd_cluster_type_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5514 0 : *total_sz += sizeof(fd_cluster_type_t);
5515 0 : void const * start_data = ctx->data;
5516 0 : int err = fd_cluster_type_decode_footprint_inner( ctx, total_sz );
5517 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5518 0 : ctx->data = start_data;
5519 0 : return err;
5520 0 : }
5521 0 : static void fd_cluster_type_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5522 0 : fd_cluster_type_t * self = (fd_cluster_type_t *)struct_mem;
5523 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
5524 0 : }
5525 0 : void * fd_cluster_type_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5526 0 : fd_cluster_type_t * self = (fd_cluster_type_t *)mem;
5527 0 : fd_cluster_type_new( self );
5528 0 : void * alloc_region = (uchar *)mem + sizeof(fd_cluster_type_t);
5529 0 : void * * alloc_mem = &alloc_region;
5530 0 : fd_cluster_type_decode_inner( mem, alloc_mem, ctx );
5531 0 : return self;
5532 0 : }
5533 :
5534 0 : void fd_cluster_type_walk( void * w, fd_cluster_type_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
5535 0 : (void) varint;
5536 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_cluster_type", level++, 0);
5537 0 : switch( self->discriminant ) {
5538 0 : case 0: {
5539 0 : fun( w, self, "Testnet", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
5540 0 : break;
5541 0 : }
5542 0 : case 1: {
5543 0 : fun( w, self, "MainnetBeta", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
5544 0 : break;
5545 0 : }
5546 0 : case 2: {
5547 0 : fun( w, self, "Devnet", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
5548 0 : break;
5549 0 : }
5550 0 : case 3: {
5551 0 : fun( w, self, "Development", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
5552 0 : break;
5553 0 : }
5554 0 : }
5555 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_cluster_type", level--, 0 );
5556 0 : }
5557 0 : ulong fd_cluster_type_size( fd_cluster_type_t const * self ) {
5558 0 : ulong size = 0;
5559 0 : size += sizeof(uint);
5560 0 : switch (self->discriminant) {
5561 0 : }
5562 0 : return size;
5563 0 : }
5564 :
5565 0 : int fd_cluster_type_encode( fd_cluster_type_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5566 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
5567 0 : if( FD_UNLIKELY( err ) ) return err;
5568 0 : return err;
5569 0 : }
5570 :
5571 0 : int fd_cluster_version_encode( fd_cluster_version_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5572 0 : int err;
5573 0 : err = fd_bincode_uint32_encode( self->major, ctx );
5574 0 : if( FD_UNLIKELY( err ) ) return err;
5575 0 : err = fd_bincode_uint32_encode( self->minor, ctx );
5576 0 : if( FD_UNLIKELY( err ) ) return err;
5577 0 : err = fd_bincode_uint32_encode( self->patch, ctx );
5578 0 : if( FD_UNLIKELY( err ) ) return err;
5579 0 : return FD_BINCODE_SUCCESS;
5580 0 : }
5581 0 : static inline int fd_cluster_version_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5582 0 : if( (ulong)ctx->data + 12UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5583 0 : ctx->data = (void *)( (ulong)ctx->data + 12UL );
5584 0 : return 0;
5585 0 : }
5586 0 : static void fd_cluster_version_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5587 0 : fd_cluster_version_t * self = (fd_cluster_version_t *)struct_mem;
5588 0 : fd_bincode_uint32_decode_unsafe( &self->major, ctx );
5589 0 : fd_bincode_uint32_decode_unsafe( &self->minor, ctx );
5590 0 : fd_bincode_uint32_decode_unsafe( &self->patch, ctx );
5591 0 : }
5592 0 : void * fd_cluster_version_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5593 0 : fd_cluster_version_t * self = (fd_cluster_version_t *)mem;
5594 0 : fd_cluster_version_new( self );
5595 0 : void * alloc_region = (uchar *)mem + sizeof(fd_cluster_version_t);
5596 0 : void * * alloc_mem = &alloc_region;
5597 0 : fd_cluster_version_decode_inner( mem, alloc_mem, ctx );
5598 0 : return self;
5599 0 : }
5600 0 : void fd_cluster_version_walk( void * w, fd_cluster_version_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
5601 0 : (void) varint;
5602 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_cluster_version", level++, 0 );
5603 0 : fun( w, &self->major, "major", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
5604 0 : fun( w, &self->minor, "minor", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
5605 0 : fun( w, &self->patch, "patch", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
5606 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_cluster_version", level--, 0 );
5607 0 : }
5608 0 : int fd_stake_reward_encode( fd_stake_reward_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5609 0 : int err;
5610 0 : err = fd_pubkey_encode( &self->stake_pubkey, ctx );
5611 0 : if( FD_UNLIKELY( err ) ) return err;
5612 0 : err = fd_bincode_uint64_encode( self->credits_observed, ctx );
5613 0 : if( FD_UNLIKELY( err ) ) return err;
5614 0 : err = fd_bincode_uint64_encode( self->lamports, ctx );
5615 0 : if( FD_UNLIKELY( err ) ) return err;
5616 0 : err = fd_bincode_uint8_encode( (uchar)(self->valid), ctx );
5617 0 : if( FD_UNLIKELY( err ) ) return err;
5618 0 : return FD_BINCODE_SUCCESS;
5619 0 : }
5620 0 : static inline int fd_stake_reward_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5621 0 : if( (ulong)ctx->data + 49UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5622 0 : ctx->data = (void *)( (ulong)ctx->data + 49UL );
5623 0 : return 0;
5624 0 : }
5625 0 : static void fd_stake_reward_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5626 0 : fd_stake_reward_t * self = (fd_stake_reward_t *)struct_mem;
5627 0 : fd_pubkey_decode_inner( &self->stake_pubkey, alloc_mem, ctx );
5628 0 : fd_bincode_uint64_decode_unsafe( &self->credits_observed, ctx );
5629 0 : fd_bincode_uint64_decode_unsafe( &self->lamports, ctx );
5630 0 : fd_bincode_uint8_decode_unsafe( &self->valid, ctx );
5631 0 : }
5632 0 : void * fd_stake_reward_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5633 0 : fd_stake_reward_t * self = (fd_stake_reward_t *)mem;
5634 0 : fd_stake_reward_new( self );
5635 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_reward_t);
5636 0 : void * * alloc_mem = &alloc_region;
5637 0 : fd_stake_reward_decode_inner( mem, alloc_mem, ctx );
5638 0 : return self;
5639 0 : }
5640 0 : void fd_stake_reward_walk( void * w, fd_stake_reward_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
5641 0 : (void) varint;
5642 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_reward", level++, 0 );
5643 0 : fd_pubkey_walk( w, &self->stake_pubkey, fun, "stake_pubkey", level, 0 );
5644 0 : fun( w, &self->credits_observed, "credits_observed", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
5645 0 : fun( w, &self->lamports, "lamports", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
5646 0 : fun( w, &self->valid, "valid", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
5647 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_reward", level--, 0 );
5648 0 : }
5649 0 : int fd_vote_reward_encode( fd_vote_reward_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5650 0 : int err;
5651 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
5652 0 : if( FD_UNLIKELY( err ) ) return err;
5653 0 : err = fd_bincode_uint64_encode( self->vote_rewards, ctx );
5654 0 : if( FD_UNLIKELY( err ) ) return err;
5655 0 : err = fd_bincode_uint8_encode( (uchar)(self->commission), ctx );
5656 0 : if( FD_UNLIKELY( err ) ) return err;
5657 0 : err = fd_bincode_uint8_encode( (uchar)(self->needs_store), ctx );
5658 0 : if( FD_UNLIKELY( err ) ) return err;
5659 0 : return FD_BINCODE_SUCCESS;
5660 0 : }
5661 0 : static inline int fd_vote_reward_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5662 0 : if( (ulong)ctx->data + 42UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5663 0 : ctx->data = (void *)( (ulong)ctx->data + 42UL );
5664 0 : return 0;
5665 0 : }
5666 0 : static void fd_vote_reward_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5667 0 : fd_vote_reward_t * self = (fd_vote_reward_t *)struct_mem;
5668 0 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
5669 0 : fd_bincode_uint64_decode_unsafe( &self->vote_rewards, ctx );
5670 0 : fd_bincode_uint8_decode_unsafe( &self->commission, ctx );
5671 0 : fd_bincode_uint8_decode_unsafe( &self->needs_store, ctx );
5672 0 : }
5673 0 : void * fd_vote_reward_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5674 0 : fd_vote_reward_t * self = (fd_vote_reward_t *)mem;
5675 0 : fd_vote_reward_new( self );
5676 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_reward_t);
5677 0 : void * * alloc_mem = &alloc_region;
5678 0 : fd_vote_reward_decode_inner( mem, alloc_mem, ctx );
5679 0 : return self;
5680 0 : }
5681 0 : void fd_vote_reward_walk( void * w, fd_vote_reward_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
5682 0 : (void) varint;
5683 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_reward", level++, 0 );
5684 0 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level, 0 );
5685 0 : fun( w, &self->vote_rewards, "vote_rewards", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
5686 0 : fun( w, &self->commission, "commission", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
5687 0 : fun( w, &self->needs_store, "needs_store", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
5688 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_reward", level--, 0 );
5689 0 : }
5690 0 : int fd_point_value_encode( fd_point_value_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5691 0 : int err;
5692 0 : err = fd_bincode_uint64_encode( self->rewards, ctx );
5693 0 : if( FD_UNLIKELY( err ) ) return err;
5694 0 : err = fd_bincode_uint128_encode( self->points, ctx );
5695 0 : if( FD_UNLIKELY( err ) ) return err;
5696 0 : return FD_BINCODE_SUCCESS;
5697 0 : }
5698 0 : static inline int fd_point_value_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5699 0 : if( (ulong)ctx->data + 24UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5700 0 : ctx->data = (void *)( (ulong)ctx->data + 24UL );
5701 0 : return 0;
5702 0 : }
5703 0 : static void fd_point_value_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5704 0 : fd_point_value_t * self = (fd_point_value_t *)struct_mem;
5705 0 : fd_bincode_uint64_decode_unsafe( &self->rewards, ctx );
5706 0 : fd_bincode_uint128_decode_unsafe( &self->points, ctx );
5707 0 : }
5708 0 : void * fd_point_value_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5709 0 : fd_point_value_t * self = (fd_point_value_t *)mem;
5710 0 : fd_point_value_new( self );
5711 0 : void * alloc_region = (uchar *)mem + sizeof(fd_point_value_t);
5712 0 : void * * alloc_mem = &alloc_region;
5713 0 : fd_point_value_decode_inner( mem, alloc_mem, ctx );
5714 0 : return self;
5715 0 : }
5716 0 : void fd_point_value_walk( void * w, fd_point_value_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
5717 0 : (void) varint;
5718 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_point_value", level++, 0 );
5719 0 : fun( w, &self->rewards, "rewards", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
5720 0 : fun( w, &self->points, "points", FD_FLAMENCO_TYPE_UINT128, "uint128", level, 0 );
5721 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_point_value", level--, 0 );
5722 0 : }
5723 0 : int fd_partitioned_stake_rewards_encode( fd_partitioned_stake_rewards_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5724 0 : int err;
5725 0 : if( self->partitions ) {
5726 0 : err = fd_bincode_uint64_encode( self->partitions_len, ctx );
5727 0 : if( FD_UNLIKELY( err ) ) return err;
5728 0 : for( ulong i=0; i < 4096; i++ ) {
5729 0 : err = fd_bincode_uint64_encode( self->partitions_lengths[ i ], ctx );
5730 0 : if( FD_UNLIKELY( err ) ) return err;
5731 0 : }
5732 0 : for( ulong i=0; i < self->partitions_len; i++ ) {
5733 0 : for( fd_partitioned_stake_rewards_dlist_iter_t iter = fd_partitioned_stake_rewards_dlist_iter_fwd_init( &self->partitions[ i ], self->pool );
5734 0 : !fd_partitioned_stake_rewards_dlist_iter_done( iter, &self->partitions[ i ], self->pool );
5735 0 : iter = fd_partitioned_stake_rewards_dlist_iter_fwd_next( iter, &self->partitions[ i ], self->pool ) ) {
5736 0 : fd_stake_reward_t * ele = fd_partitioned_stake_rewards_dlist_iter_ele( iter, &self->partitions[ i ], self->pool );
5737 0 : err = fd_stake_reward_encode( ele, ctx );
5738 0 : if( FD_UNLIKELY( err ) ) return err;
5739 0 : }
5740 0 : }
5741 0 : } else {
5742 0 : err = fd_bincode_uint64_encode( self->partitions_len, ctx );
5743 0 : if( FD_UNLIKELY( err ) ) return err;
5744 0 : }
5745 0 : return FD_BINCODE_SUCCESS;
5746 0 : }
5747 0 : int fd_partitioned_stake_rewards_encode_global( fd_partitioned_stake_rewards_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5748 0 : int err;
5749 0 : return FD_BINCODE_SUCCESS;
5750 0 : }
5751 0 : static int fd_partitioned_stake_rewards_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5752 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5753 0 : int err = 0;
5754 0 : ulong partitions_len;
5755 0 : err = fd_bincode_uint64_decode( &partitions_len, ctx );
5756 0 : if( FD_UNLIKELY( err ) ) return err;
5757 0 : ulong total_count = 0UL;
5758 0 : ulong partitions_lengths[4096];
5759 0 : for( ulong i=0; i<4096; i++ ) {
5760 0 : err = fd_bincode_uint64_decode( partitions_lengths + i, ctx );
5761 0 : total_count+=partitions_lengths[ i ];
5762 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5763 0 : }
5764 0 : *total_sz += fd_partitioned_stake_rewards_pool_align() + fd_partitioned_stake_rewards_pool_footprint( total_count );
5765 0 : *total_sz += fd_partitioned_stake_rewards_dlist_align() + fd_partitioned_stake_rewards_dlist_footprint()*partitions_len;
5766 0 : for( ulong i=0; i < partitions_len; i++ ) {
5767 0 : err = fd_stake_reward_decode_footprint_inner( ctx, total_sz );
5768 0 : if( FD_UNLIKELY ( err ) ) return err;
5769 0 : }
5770 0 : return 0;
5771 0 : }
5772 0 : int fd_partitioned_stake_rewards_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5773 0 : *total_sz += sizeof(fd_partitioned_stake_rewards_t);
5774 0 : void const * start_data = ctx->data;
5775 0 : int err = fd_partitioned_stake_rewards_decode_footprint_inner( ctx, total_sz );
5776 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5777 0 : ctx->data = start_data;
5778 0 : return err;
5779 0 : }
5780 0 : static void fd_partitioned_stake_rewards_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5781 0 : fd_partitioned_stake_rewards_t * self = (fd_partitioned_stake_rewards_t *)struct_mem;
5782 0 : fd_bincode_uint64_decode_unsafe( &self->partitions_len, ctx );
5783 0 : ulong total_count = 0UL;
5784 0 : for( ulong i=0; i < 4096; i++ ) {
5785 0 : fd_bincode_uint64_decode_unsafe( self->partitions_lengths + i, ctx );
5786 0 : total_count += self->partitions_lengths[ i ];
5787 0 : }
5788 0 : self->pool = fd_partitioned_stake_rewards_pool_join_new( alloc_mem, total_count );
5789 0 : self->partitions = fd_partitioned_stake_rewards_dlist_join_new( alloc_mem, self->partitions_len );
5790 0 : for( ulong i=0; i < self->partitions_len; i++ ) {
5791 0 : fd_partitioned_stake_rewards_dlist_new( &self->partitions[ i ] );
5792 0 : for( ulong j=0; j < self->partitions_lengths[ i ]; j++ ) {
5793 0 : fd_stake_reward_t * ele = fd_partitioned_stake_rewards_pool_ele_acquire( self->pool );
5794 0 : fd_stake_reward_new( ele );
5795 0 : fd_stake_reward_decode_inner( ele, alloc_mem, ctx );
5796 0 : fd_partitioned_stake_rewards_dlist_ele_push_tail( &self->partitions[ i ], ele, self->pool );
5797 0 : }
5798 0 : }
5799 0 : }
5800 0 : void * fd_partitioned_stake_rewards_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5801 0 : fd_partitioned_stake_rewards_t * self = (fd_partitioned_stake_rewards_t *)mem;
5802 0 : fd_partitioned_stake_rewards_new( self );
5803 0 : void * alloc_region = (uchar *)mem + sizeof(fd_partitioned_stake_rewards_t);
5804 0 : void * * alloc_mem = &alloc_region;
5805 0 : fd_partitioned_stake_rewards_decode_inner( mem, alloc_mem, ctx );
5806 0 : return self;
5807 0 : }
5808 0 : static void fd_partitioned_stake_rewards_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5809 0 : fd_partitioned_stake_rewards_global_t * self = (fd_partitioned_stake_rewards_global_t *)struct_mem;
5810 0 : fd_bincode_uint64_decode_unsafe( &self->partitions_len, ctx );
5811 0 : ulong total_count = 0UL;
5812 0 : for( ulong i=0; i < 4096; i++ ) {
5813 0 : fd_bincode_uint64_decode_unsafe( self->partitions_lengths + i, ctx );
5814 0 : total_count += self->partitions_lengths[ i ];
5815 0 : }
5816 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, fd_partitioned_stake_rewards_pool_align() );
5817 0 : fd_stake_reward_t * pool = fd_partitioned_stake_rewards_pool_join_new( alloc_mem, total_count );
5818 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, fd_partitioned_stake_rewards_dlist_align() );
5819 0 : fd_partitioned_stake_rewards_dlist_t * partitions = fd_partitioned_stake_rewards_dlist_join_new( alloc_mem, self->partitions_len );
5820 0 : for( ulong i=0; i < self->partitions_len; i++ ) {
5821 0 : fd_partitioned_stake_rewards_dlist_new( &partitions[ i ] );
5822 0 : for( ulong j=0; j < self->partitions_lengths[ i ]; j++ ) {
5823 0 : fd_stake_reward_t * ele = fd_partitioned_stake_rewards_pool_ele_acquire( pool );
5824 0 : fd_stake_reward_new( ele );
5825 0 : fd_stake_reward_decode_inner( ele, alloc_mem, ctx );
5826 0 : fd_partitioned_stake_rewards_dlist_ele_push_tail( &partitions[ i ], ele, pool );
5827 0 : }
5828 0 : }
5829 0 : self->pool_offset = (ulong)fd_partitioned_stake_rewards_pool_leave( pool ) - (ulong)struct_mem;
5830 0 : self->partitions_offset = (ulong)fd_partitioned_stake_rewards_dlist_leave( partitions ) - (ulong)struct_mem;
5831 0 : }
5832 0 : void * fd_partitioned_stake_rewards_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5833 0 : fd_partitioned_stake_rewards_global_t * self = (fd_partitioned_stake_rewards_global_t *)mem;
5834 0 : fd_partitioned_stake_rewards_new( (fd_partitioned_stake_rewards_t *)self );
5835 0 : void * alloc_region = (uchar *)mem + sizeof(fd_partitioned_stake_rewards_global_t);
5836 0 : void * * alloc_mem = &alloc_region;
5837 0 : fd_partitioned_stake_rewards_decode_inner_global( mem, alloc_mem, ctx );
5838 0 : return self;
5839 0 : }
5840 0 : void fd_partitioned_stake_rewards_new(fd_partitioned_stake_rewards_t * self) {
5841 0 : fd_memset( self, 0, sizeof(fd_partitioned_stake_rewards_t) );
5842 0 : }
5843 0 : void fd_partitioned_stake_rewards_walk( void * w, fd_partitioned_stake_rewards_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
5844 0 : (void) varint;
5845 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_partitioned_stake_rewards", level++, 0 );
5846 0 : if( self->partitions ) {
5847 0 : for( ulong i=0; i < self->partitions_len; i++ ) {
5848 0 : for( fd_partitioned_stake_rewards_dlist_iter_t iter = fd_partitioned_stake_rewards_dlist_iter_fwd_init( &self->partitions[ i ], self->pool );
5849 0 : !fd_partitioned_stake_rewards_dlist_iter_done( iter, &self->partitions[ i ], self->pool );
5850 0 : iter = fd_partitioned_stake_rewards_dlist_iter_fwd_next( iter, &self->partitions[ i ], self->pool ) ) {
5851 0 : fd_stake_reward_t * ele = fd_partitioned_stake_rewards_dlist_iter_ele( iter, &self->partitions[ i ], self->pool );
5852 0 : fd_stake_reward_walk( w, ele, fun, "fd_stake_reward_t", level, 0 );
5853 0 : }
5854 0 : }
5855 0 : }
5856 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_partitioned_stake_rewards", level--, 0 );
5857 0 : }
5858 0 : ulong fd_partitioned_stake_rewards_size( fd_partitioned_stake_rewards_t const * self ) {
5859 0 : ulong size = 0;
5860 0 : size += sizeof(ulong);
5861 0 : size += 4096 * sizeof(ulong);
5862 0 : if( self->partitions ) {
5863 0 : for( ulong i=0; i < self->partitions_len; i++ ) {
5864 0 : for( fd_partitioned_stake_rewards_dlist_iter_t iter = fd_partitioned_stake_rewards_dlist_iter_fwd_init( &self->partitions[ i ], self->pool );
5865 0 : !fd_partitioned_stake_rewards_dlist_iter_done( iter, &self->partitions[ i ], self->pool );
5866 0 : iter = fd_partitioned_stake_rewards_dlist_iter_fwd_next( iter, &self->partitions[ i ], self->pool ) ) {
5867 0 : fd_stake_reward_t * ele = fd_partitioned_stake_rewards_dlist_iter_ele( iter, &self->partitions[ i ], self->pool );
5868 0 : size += fd_stake_reward_size( ele );
5869 0 : }
5870 0 : }
5871 0 : }
5872 0 : return size;
5873 0 : }
5874 :
5875 0 : ulong fd_partitioned_stake_rewards_size_global( fd_partitioned_stake_rewards_global_t const * self ) {
5876 0 : ulong size = 0;
5877 0 : FD_LOG_CRIT(( "FIXME: not implemented" ));
5878 0 : return size;
5879 0 : }
5880 :
5881 0 : int fd_stake_reward_calculation_partitioned_encode( fd_stake_reward_calculation_partitioned_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5882 0 : int err;
5883 0 : err = fd_partitioned_stake_rewards_encode( &self->partitioned_stake_rewards, ctx );
5884 0 : if( FD_UNLIKELY( err ) ) return err;
5885 0 : err = fd_bincode_uint64_encode( self->total_stake_rewards_lamports, ctx );
5886 0 : if( FD_UNLIKELY( err ) ) return err;
5887 0 : return FD_BINCODE_SUCCESS;
5888 0 : }
5889 0 : static int fd_stake_reward_calculation_partitioned_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5890 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5891 0 : int err = 0;
5892 0 : err = fd_partitioned_stake_rewards_decode_footprint_inner( ctx, total_sz );
5893 0 : if( FD_UNLIKELY( err ) ) return err;
5894 0 : err = fd_bincode_uint64_decode_footprint( ctx );
5895 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5896 0 : return 0;
5897 0 : }
5898 0 : int fd_stake_reward_calculation_partitioned_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5899 0 : *total_sz += sizeof(fd_stake_reward_calculation_partitioned_t);
5900 0 : void const * start_data = ctx->data;
5901 0 : int err = fd_stake_reward_calculation_partitioned_decode_footprint_inner( ctx, total_sz );
5902 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5903 0 : ctx->data = start_data;
5904 0 : return err;
5905 0 : }
5906 0 : static void fd_stake_reward_calculation_partitioned_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5907 0 : fd_stake_reward_calculation_partitioned_t * self = (fd_stake_reward_calculation_partitioned_t *)struct_mem;
5908 0 : fd_partitioned_stake_rewards_decode_inner( &self->partitioned_stake_rewards, alloc_mem, ctx );
5909 0 : fd_bincode_uint64_decode_unsafe( &self->total_stake_rewards_lamports, ctx );
5910 0 : }
5911 0 : void * fd_stake_reward_calculation_partitioned_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5912 0 : fd_stake_reward_calculation_partitioned_t * self = (fd_stake_reward_calculation_partitioned_t *)mem;
5913 0 : fd_stake_reward_calculation_partitioned_new( self );
5914 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_reward_calculation_partitioned_t);
5915 0 : void * * alloc_mem = &alloc_region;
5916 0 : fd_stake_reward_calculation_partitioned_decode_inner( mem, alloc_mem, ctx );
5917 0 : return self;
5918 0 : }
5919 0 : void fd_stake_reward_calculation_partitioned_new(fd_stake_reward_calculation_partitioned_t * self) {
5920 0 : fd_memset( self, 0, sizeof(fd_stake_reward_calculation_partitioned_t) );
5921 0 : fd_partitioned_stake_rewards_new( &self->partitioned_stake_rewards );
5922 0 : }
5923 0 : void fd_stake_reward_calculation_partitioned_walk( void * w, fd_stake_reward_calculation_partitioned_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
5924 0 : (void) varint;
5925 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_reward_calculation_partitioned", level++, 0 );
5926 0 : fd_partitioned_stake_rewards_walk( w, &self->partitioned_stake_rewards, fun, "partitioned_stake_rewards", level, 0 );
5927 0 : fun( w, &self->total_stake_rewards_lamports, "total_stake_rewards_lamports", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
5928 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_reward_calculation_partitioned", level--, 0 );
5929 0 : }
5930 0 : ulong fd_stake_reward_calculation_partitioned_size( fd_stake_reward_calculation_partitioned_t const * self ) {
5931 0 : ulong size = 0;
5932 0 : size += fd_partitioned_stake_rewards_size( &self->partitioned_stake_rewards );
5933 0 : size += sizeof(ulong);
5934 0 : return size;
5935 0 : }
5936 :
5937 0 : int fd_stake_reward_calculation_encode( fd_stake_reward_calculation_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5938 0 : int err;
5939 0 : if( self->stake_rewards ) {
5940 0 : err = fd_bincode_uint64_encode( self->stake_rewards_len, ctx );
5941 0 : if( FD_UNLIKELY( err ) ) return err;
5942 0 : for( fd_stake_reward_calculation_dlist_iter_t iter = fd_stake_reward_calculation_dlist_iter_fwd_init( self->stake_rewards, self->pool );
5943 0 : !fd_stake_reward_calculation_dlist_iter_done( iter, self->stake_rewards, self->pool );
5944 0 : iter = fd_stake_reward_calculation_dlist_iter_fwd_next( iter, self->stake_rewards, self->pool ) ) {
5945 0 : fd_stake_reward_t * ele = fd_stake_reward_calculation_dlist_iter_ele( iter, self->stake_rewards, self->pool );
5946 0 : err = fd_stake_reward_encode( ele, ctx );
5947 0 : if( FD_UNLIKELY( err ) ) return err;
5948 0 : }
5949 0 : } else {
5950 0 : err = fd_bincode_uint64_encode( self->stake_rewards_len, ctx );
5951 0 : if( FD_UNLIKELY( err ) ) return err;
5952 0 : }
5953 0 : err = fd_bincode_uint64_encode( self->total_stake_rewards_lamports, ctx );
5954 0 : if( FD_UNLIKELY( err ) ) return err;
5955 0 : return FD_BINCODE_SUCCESS;
5956 0 : }
5957 0 : static int fd_stake_reward_calculation_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5958 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5959 0 : int err = 0;
5960 0 : ulong stake_rewards_len;
5961 0 : err = fd_bincode_uint64_decode( &stake_rewards_len, ctx );
5962 0 : if( FD_UNLIKELY( err ) ) return err;
5963 0 : *total_sz += fd_stake_reward_calculation_pool_align() + fd_stake_reward_calculation_pool_footprint( stake_rewards_len );
5964 0 : *total_sz += fd_stake_reward_calculation_dlist_align() + fd_stake_reward_calculation_dlist_footprint()*stake_rewards_len;
5965 0 : for( ulong i=0; i < stake_rewards_len; i++ ) {
5966 0 : err = fd_stake_reward_decode_footprint_inner( ctx, total_sz );
5967 0 : if( FD_UNLIKELY ( err ) ) return err;
5968 0 : }
5969 0 : err = fd_bincode_uint64_decode_footprint( ctx );
5970 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5971 0 : return 0;
5972 0 : }
5973 0 : int fd_stake_reward_calculation_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5974 0 : *total_sz += sizeof(fd_stake_reward_calculation_t);
5975 0 : void const * start_data = ctx->data;
5976 0 : int err = fd_stake_reward_calculation_decode_footprint_inner( ctx, total_sz );
5977 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5978 0 : ctx->data = start_data;
5979 0 : return err;
5980 0 : }
5981 0 : static void fd_stake_reward_calculation_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5982 0 : fd_stake_reward_calculation_t * self = (fd_stake_reward_calculation_t *)struct_mem;
5983 0 : fd_bincode_uint64_decode_unsafe( &self->stake_rewards_len, ctx );
5984 0 : self->pool = fd_stake_reward_calculation_pool_join_new( alloc_mem, self->stake_rewards_len );
5985 0 : self->stake_rewards = fd_stake_reward_calculation_dlist_join_new( alloc_mem, self->stake_rewards_len );
5986 0 : fd_stake_reward_calculation_dlist_new( self->stake_rewards );
5987 0 : for( ulong i=0; i < self->stake_rewards_len; i++ ) {
5988 0 : fd_stake_reward_t * ele = fd_stake_reward_calculation_pool_ele_acquire( self->pool );
5989 0 : fd_stake_reward_new( ele );
5990 0 : fd_stake_reward_decode_inner( ele, alloc_mem, ctx );
5991 0 : fd_stake_reward_calculation_dlist_ele_push_tail( self->stake_rewards, ele, self->pool );
5992 0 : }
5993 0 : fd_bincode_uint64_decode_unsafe( &self->total_stake_rewards_lamports, ctx );
5994 0 : }
5995 0 : void * fd_stake_reward_calculation_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5996 0 : fd_stake_reward_calculation_t * self = (fd_stake_reward_calculation_t *)mem;
5997 0 : fd_stake_reward_calculation_new( self );
5998 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_reward_calculation_t);
5999 0 : void * * alloc_mem = &alloc_region;
6000 0 : fd_stake_reward_calculation_decode_inner( mem, alloc_mem, ctx );
6001 0 : return self;
6002 0 : }
6003 0 : void fd_stake_reward_calculation_new(fd_stake_reward_calculation_t * self) {
6004 0 : fd_memset( self, 0, sizeof(fd_stake_reward_calculation_t) );
6005 0 : }
6006 0 : void fd_stake_reward_calculation_walk( void * w, fd_stake_reward_calculation_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
6007 0 : (void) varint;
6008 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_reward_calculation", level++, 0 );
6009 0 : if( self->stake_rewards ) {
6010 0 : for( fd_stake_reward_calculation_dlist_iter_t iter = fd_stake_reward_calculation_dlist_iter_fwd_init( self->stake_rewards, self->pool );
6011 0 : !fd_stake_reward_calculation_dlist_iter_done( iter, self->stake_rewards, self->pool );
6012 0 : iter = fd_stake_reward_calculation_dlist_iter_fwd_next( iter, self->stake_rewards, self->pool ) ) {
6013 0 : fd_stake_reward_t * ele = fd_stake_reward_calculation_dlist_iter_ele( iter, self->stake_rewards, self->pool );
6014 0 : fd_stake_reward_walk( w, ele, fun, "fd_stake_reward_t", level, 0 );
6015 0 : }
6016 0 : }
6017 0 : fun( w, &self->total_stake_rewards_lamports, "total_stake_rewards_lamports", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
6018 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_reward_calculation", level--, 0 );
6019 0 : }
6020 0 : ulong fd_stake_reward_calculation_size( fd_stake_reward_calculation_t const * self ) {
6021 0 : ulong size = 0;
6022 0 : size += sizeof(ulong);
6023 0 : if( self->stake_rewards ) {
6024 0 : for( fd_stake_reward_calculation_dlist_iter_t iter = fd_stake_reward_calculation_dlist_iter_fwd_init( self->stake_rewards, self->pool );
6025 0 : !fd_stake_reward_calculation_dlist_iter_done( iter, self->stake_rewards, self->pool );
6026 0 : iter = fd_stake_reward_calculation_dlist_iter_fwd_next( iter, self->stake_rewards, self->pool ) ) {
6027 0 : fd_stake_reward_t * ele = fd_stake_reward_calculation_dlist_iter_ele( iter, self->stake_rewards, self->pool );
6028 0 : size += fd_stake_reward_size( ele );
6029 0 : }
6030 0 : }
6031 0 : size += sizeof(ulong);
6032 0 : return size;
6033 0 : }
6034 :
6035 0 : int fd_calculate_stake_vote_rewards_result_encode( fd_calculate_stake_vote_rewards_result_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6036 0 : int err;
6037 0 : err = fd_stake_reward_calculation_encode( &self->stake_reward_calculation, ctx );
6038 0 : if( FD_UNLIKELY( err ) ) return err;
6039 0 : if( self->vote_reward_map_root ) {
6040 0 : ulong vote_reward_map_len = fd_vote_reward_t_map_size( self->vote_reward_map_pool, self->vote_reward_map_root );
6041 0 : err = fd_bincode_uint64_encode( vote_reward_map_len, ctx );
6042 0 : if( FD_UNLIKELY( err ) ) return err;
6043 0 : for( fd_vote_reward_t_mapnode_t * n = fd_vote_reward_t_map_minimum( self->vote_reward_map_pool, self->vote_reward_map_root ); n; n = fd_vote_reward_t_map_successor( self->vote_reward_map_pool, n ) ) {
6044 0 : err = fd_vote_reward_encode( &n->elem, ctx );
6045 0 : if( FD_UNLIKELY( err ) ) return err;
6046 0 : }
6047 0 : } else {
6048 0 : ulong vote_reward_map_len = 0;
6049 0 : err = fd_bincode_uint64_encode( vote_reward_map_len, ctx );
6050 0 : if( FD_UNLIKELY( err ) ) return err;
6051 0 : }
6052 0 : return FD_BINCODE_SUCCESS;
6053 0 : }
6054 0 : static int fd_calculate_stake_vote_rewards_result_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6055 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6056 0 : int err = 0;
6057 0 : err = fd_stake_reward_calculation_decode_footprint_inner( ctx, total_sz );
6058 0 : if( FD_UNLIKELY( err ) ) return err;
6059 0 : ulong vote_reward_map_len = 0UL;
6060 0 : err = fd_bincode_uint64_decode( &vote_reward_map_len, ctx );
6061 0 : ulong vote_reward_map_cnt = fd_ulong_max( vote_reward_map_len, 15000 );
6062 0 : *total_sz += fd_vote_reward_t_map_align() + fd_vote_reward_t_map_footprint( vote_reward_map_cnt );
6063 0 : if( FD_UNLIKELY( err ) ) return err;
6064 0 : for( ulong i=0; i < vote_reward_map_len; i++ ) {
6065 0 : err = fd_vote_reward_decode_footprint_inner( ctx, total_sz );
6066 0 : if( FD_UNLIKELY( err ) ) return err;
6067 0 : }
6068 0 : return 0;
6069 0 : }
6070 0 : int fd_calculate_stake_vote_rewards_result_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6071 0 : *total_sz += sizeof(fd_calculate_stake_vote_rewards_result_t);
6072 0 : void const * start_data = ctx->data;
6073 0 : int err = fd_calculate_stake_vote_rewards_result_decode_footprint_inner( ctx, total_sz );
6074 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6075 0 : ctx->data = start_data;
6076 0 : return err;
6077 0 : }
6078 0 : static void fd_calculate_stake_vote_rewards_result_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6079 0 : fd_calculate_stake_vote_rewards_result_t * self = (fd_calculate_stake_vote_rewards_result_t *)struct_mem;
6080 0 : fd_stake_reward_calculation_decode_inner( &self->stake_reward_calculation, alloc_mem, ctx );
6081 0 : ulong vote_reward_map_len;
6082 0 : fd_bincode_uint64_decode_unsafe( &vote_reward_map_len, ctx );
6083 0 : self->vote_reward_map_pool = fd_vote_reward_t_map_join_new( alloc_mem, fd_ulong_max( vote_reward_map_len, 15000 ) );
6084 0 : self->vote_reward_map_root = NULL;
6085 0 : for( ulong i=0; i < vote_reward_map_len; i++ ) {
6086 0 : fd_vote_reward_t_mapnode_t * node = fd_vote_reward_t_map_acquire( self->vote_reward_map_pool );
6087 0 : fd_vote_reward_new( &node->elem );
6088 0 : fd_vote_reward_decode_inner( &node->elem, alloc_mem, ctx );
6089 0 : fd_vote_reward_t_mapnode_t * out = NULL;;
6090 0 : fd_vote_reward_t_map_insert_or_replace( self->vote_reward_map_pool, &self->vote_reward_map_root, node, &out );
6091 0 : if( out != NULL ) {
6092 0 : fd_vote_reward_t_map_release( self->vote_reward_map_pool, out );
6093 0 : }
6094 0 : }
6095 0 : }
6096 0 : void * fd_calculate_stake_vote_rewards_result_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6097 0 : fd_calculate_stake_vote_rewards_result_t * self = (fd_calculate_stake_vote_rewards_result_t *)mem;
6098 0 : fd_calculate_stake_vote_rewards_result_new( self );
6099 0 : void * alloc_region = (uchar *)mem + sizeof(fd_calculate_stake_vote_rewards_result_t);
6100 0 : void * * alloc_mem = &alloc_region;
6101 0 : fd_calculate_stake_vote_rewards_result_decode_inner( mem, alloc_mem, ctx );
6102 0 : return self;
6103 0 : }
6104 0 : void fd_calculate_stake_vote_rewards_result_new(fd_calculate_stake_vote_rewards_result_t * self) {
6105 0 : fd_memset( self, 0, sizeof(fd_calculate_stake_vote_rewards_result_t) );
6106 0 : fd_stake_reward_calculation_new( &self->stake_reward_calculation );
6107 0 : }
6108 0 : void fd_calculate_stake_vote_rewards_result_walk( void * w, fd_calculate_stake_vote_rewards_result_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
6109 0 : (void) varint;
6110 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_calculate_stake_vote_rewards_result", level++, 0 );
6111 0 : fd_stake_reward_calculation_walk( w, &self->stake_reward_calculation, fun, "stake_reward_calculation", level, 0 );
6112 0 : if( self->vote_reward_map_root ) {
6113 0 : for( fd_vote_reward_t_mapnode_t * n = fd_vote_reward_t_map_minimum(self->vote_reward_map_pool, self->vote_reward_map_root ); n; n = fd_vote_reward_t_map_successor( self->vote_reward_map_pool, n ) ) {
6114 0 : fd_vote_reward_walk(w, &n->elem, fun, "vote_reward_map", level, 0 );
6115 0 : }
6116 0 : }
6117 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_calculate_stake_vote_rewards_result", level--, 0 );
6118 0 : }
6119 0 : ulong fd_calculate_stake_vote_rewards_result_size( fd_calculate_stake_vote_rewards_result_t const * self ) {
6120 0 : ulong size = 0;
6121 0 : size += fd_stake_reward_calculation_size( &self->stake_reward_calculation );
6122 0 : if( self->vote_reward_map_root ) {
6123 0 : size += sizeof(ulong);
6124 0 : ulong max = fd_vote_reward_t_map_max( self->vote_reward_map_pool );
6125 0 : size += fd_vote_reward_t_map_footprint( max );
6126 0 : for( fd_vote_reward_t_mapnode_t * n = fd_vote_reward_t_map_minimum( self->vote_reward_map_pool, self->vote_reward_map_root ); n; n = fd_vote_reward_t_map_successor( self->vote_reward_map_pool, n ) ) {
6127 0 : size += fd_vote_reward_size( &n->elem ) - sizeof(fd_vote_reward_t);
6128 0 : }
6129 0 : } else {
6130 0 : size += sizeof(ulong);
6131 0 : }
6132 0 : return size;
6133 0 : }
6134 :
6135 0 : int fd_calculate_validator_rewards_result_encode( fd_calculate_validator_rewards_result_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6136 0 : int err;
6137 0 : err = fd_calculate_stake_vote_rewards_result_encode( &self->calculate_stake_vote_rewards_result, ctx );
6138 0 : if( FD_UNLIKELY( err ) ) return err;
6139 0 : err = fd_point_value_encode( &self->point_value, ctx );
6140 0 : if( FD_UNLIKELY( err ) ) return err;
6141 0 : return FD_BINCODE_SUCCESS;
6142 0 : }
6143 0 : static int fd_calculate_validator_rewards_result_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6144 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6145 0 : int err = 0;
6146 0 : err = fd_calculate_stake_vote_rewards_result_decode_footprint_inner( ctx, total_sz );
6147 0 : if( FD_UNLIKELY( err ) ) return err;
6148 0 : err = fd_point_value_decode_footprint_inner( ctx, total_sz );
6149 0 : if( FD_UNLIKELY( err ) ) return err;
6150 0 : return 0;
6151 0 : }
6152 0 : int fd_calculate_validator_rewards_result_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6153 0 : *total_sz += sizeof(fd_calculate_validator_rewards_result_t);
6154 0 : void const * start_data = ctx->data;
6155 0 : int err = fd_calculate_validator_rewards_result_decode_footprint_inner( ctx, total_sz );
6156 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6157 0 : ctx->data = start_data;
6158 0 : return err;
6159 0 : }
6160 0 : static void fd_calculate_validator_rewards_result_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6161 0 : fd_calculate_validator_rewards_result_t * self = (fd_calculate_validator_rewards_result_t *)struct_mem;
6162 0 : fd_calculate_stake_vote_rewards_result_decode_inner( &self->calculate_stake_vote_rewards_result, alloc_mem, ctx );
6163 0 : fd_point_value_decode_inner( &self->point_value, alloc_mem, ctx );
6164 0 : }
6165 0 : void * fd_calculate_validator_rewards_result_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6166 0 : fd_calculate_validator_rewards_result_t * self = (fd_calculate_validator_rewards_result_t *)mem;
6167 0 : fd_calculate_validator_rewards_result_new( self );
6168 0 : void * alloc_region = (uchar *)mem + sizeof(fd_calculate_validator_rewards_result_t);
6169 0 : void * * alloc_mem = &alloc_region;
6170 0 : fd_calculate_validator_rewards_result_decode_inner( mem, alloc_mem, ctx );
6171 0 : return self;
6172 0 : }
6173 0 : void fd_calculate_validator_rewards_result_new(fd_calculate_validator_rewards_result_t * self) {
6174 0 : fd_memset( self, 0, sizeof(fd_calculate_validator_rewards_result_t) );
6175 0 : fd_calculate_stake_vote_rewards_result_new( &self->calculate_stake_vote_rewards_result );
6176 0 : fd_point_value_new( &self->point_value );
6177 0 : }
6178 0 : void fd_calculate_validator_rewards_result_walk( void * w, fd_calculate_validator_rewards_result_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
6179 0 : (void) varint;
6180 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_calculate_validator_rewards_result", level++, 0 );
6181 0 : fd_calculate_stake_vote_rewards_result_walk( w, &self->calculate_stake_vote_rewards_result, fun, "calculate_stake_vote_rewards_result", level, 0 );
6182 0 : fd_point_value_walk( w, &self->point_value, fun, "point_value", level, 0 );
6183 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_calculate_validator_rewards_result", level--, 0 );
6184 0 : }
6185 0 : ulong fd_calculate_validator_rewards_result_size( fd_calculate_validator_rewards_result_t const * self ) {
6186 0 : ulong size = 0;
6187 0 : size += fd_calculate_stake_vote_rewards_result_size( &self->calculate_stake_vote_rewards_result );
6188 0 : size += fd_point_value_size( &self->point_value );
6189 0 : return size;
6190 0 : }
6191 :
6192 0 : int fd_partitioned_rewards_calculation_encode( fd_partitioned_rewards_calculation_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6193 0 : int err;
6194 0 : if( self->vote_reward_map_root ) {
6195 0 : ulong vote_reward_map_len = fd_vote_reward_t_map_size( self->vote_reward_map_pool, self->vote_reward_map_root );
6196 0 : err = fd_bincode_uint64_encode( vote_reward_map_len, ctx );
6197 0 : if( FD_UNLIKELY( err ) ) return err;
6198 0 : for( fd_vote_reward_t_mapnode_t * n = fd_vote_reward_t_map_minimum( self->vote_reward_map_pool, self->vote_reward_map_root ); n; n = fd_vote_reward_t_map_successor( self->vote_reward_map_pool, n ) ) {
6199 0 : err = fd_vote_reward_encode( &n->elem, ctx );
6200 0 : if( FD_UNLIKELY( err ) ) return err;
6201 0 : }
6202 0 : } else {
6203 0 : ulong vote_reward_map_len = 0;
6204 0 : err = fd_bincode_uint64_encode( vote_reward_map_len, ctx );
6205 0 : if( FD_UNLIKELY( err ) ) return err;
6206 0 : }
6207 0 : err = fd_stake_reward_calculation_partitioned_encode( &self->stake_rewards_by_partition, ctx );
6208 0 : if( FD_UNLIKELY( err ) ) return err;
6209 0 : err = fd_bincode_uint64_encode( self->old_vote_balance_and_staked, ctx );
6210 0 : if( FD_UNLIKELY( err ) ) return err;
6211 0 : err = fd_bincode_uint64_encode( self->validator_rewards, ctx );
6212 0 : if( FD_UNLIKELY( err ) ) return err;
6213 0 : err = fd_bincode_double_encode( self->validator_rate, ctx );
6214 0 : if( FD_UNLIKELY( err ) ) return err;
6215 0 : err = fd_bincode_double_encode( self->foundation_rate, ctx );
6216 0 : if( FD_UNLIKELY( err ) ) return err;
6217 0 : err = fd_bincode_double_encode( self->prev_epoch_duration_in_years, ctx );
6218 0 : if( FD_UNLIKELY( err ) ) return err;
6219 0 : err = fd_bincode_uint64_encode( self->capitalization, ctx );
6220 0 : if( FD_UNLIKELY( err ) ) return err;
6221 0 : err = fd_point_value_encode( &self->point_value, ctx );
6222 0 : if( FD_UNLIKELY( err ) ) return err;
6223 0 : return FD_BINCODE_SUCCESS;
6224 0 : }
6225 0 : static int fd_partitioned_rewards_calculation_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6226 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6227 0 : int err = 0;
6228 0 : ulong vote_reward_map_len = 0UL;
6229 0 : err = fd_bincode_uint64_decode( &vote_reward_map_len, ctx );
6230 0 : ulong vote_reward_map_cnt = fd_ulong_max( vote_reward_map_len, 15000 );
6231 0 : *total_sz += fd_vote_reward_t_map_align() + fd_vote_reward_t_map_footprint( vote_reward_map_cnt );
6232 0 : if( FD_UNLIKELY( err ) ) return err;
6233 0 : for( ulong i=0; i < vote_reward_map_len; i++ ) {
6234 0 : err = fd_vote_reward_decode_footprint_inner( ctx, total_sz );
6235 0 : if( FD_UNLIKELY( err ) ) return err;
6236 0 : }
6237 0 : err = fd_stake_reward_calculation_partitioned_decode_footprint_inner( ctx, total_sz );
6238 0 : if( FD_UNLIKELY( err ) ) return err;
6239 0 : err = fd_bincode_uint64_decode_footprint( ctx );
6240 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6241 0 : err = fd_bincode_uint64_decode_footprint( ctx );
6242 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6243 0 : err = fd_bincode_double_decode_footprint( ctx );
6244 0 : if( FD_UNLIKELY( err ) ) return err;
6245 0 : err = fd_bincode_double_decode_footprint( ctx );
6246 0 : if( FD_UNLIKELY( err ) ) return err;
6247 0 : err = fd_bincode_double_decode_footprint( ctx );
6248 0 : if( FD_UNLIKELY( err ) ) return err;
6249 0 : err = fd_bincode_uint64_decode_footprint( ctx );
6250 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6251 0 : err = fd_point_value_decode_footprint_inner( ctx, total_sz );
6252 0 : if( FD_UNLIKELY( err ) ) return err;
6253 0 : return 0;
6254 0 : }
6255 0 : int fd_partitioned_rewards_calculation_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6256 0 : *total_sz += sizeof(fd_partitioned_rewards_calculation_t);
6257 0 : void const * start_data = ctx->data;
6258 0 : int err = fd_partitioned_rewards_calculation_decode_footprint_inner( ctx, total_sz );
6259 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6260 0 : ctx->data = start_data;
6261 0 : return err;
6262 0 : }
6263 0 : static void fd_partitioned_rewards_calculation_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6264 0 : fd_partitioned_rewards_calculation_t * self = (fd_partitioned_rewards_calculation_t *)struct_mem;
6265 0 : ulong vote_reward_map_len;
6266 0 : fd_bincode_uint64_decode_unsafe( &vote_reward_map_len, ctx );
6267 0 : self->vote_reward_map_pool = fd_vote_reward_t_map_join_new( alloc_mem, fd_ulong_max( vote_reward_map_len, 15000 ) );
6268 0 : self->vote_reward_map_root = NULL;
6269 0 : for( ulong i=0; i < vote_reward_map_len; i++ ) {
6270 0 : fd_vote_reward_t_mapnode_t * node = fd_vote_reward_t_map_acquire( self->vote_reward_map_pool );
6271 0 : fd_vote_reward_new( &node->elem );
6272 0 : fd_vote_reward_decode_inner( &node->elem, alloc_mem, ctx );
6273 0 : fd_vote_reward_t_mapnode_t * out = NULL;;
6274 0 : fd_vote_reward_t_map_insert_or_replace( self->vote_reward_map_pool, &self->vote_reward_map_root, node, &out );
6275 0 : if( out != NULL ) {
6276 0 : fd_vote_reward_t_map_release( self->vote_reward_map_pool, out );
6277 0 : }
6278 0 : }
6279 0 : fd_stake_reward_calculation_partitioned_decode_inner( &self->stake_rewards_by_partition, alloc_mem, ctx );
6280 0 : fd_bincode_uint64_decode_unsafe( &self->old_vote_balance_and_staked, ctx );
6281 0 : fd_bincode_uint64_decode_unsafe( &self->validator_rewards, ctx );
6282 0 : fd_bincode_double_decode_unsafe( &self->validator_rate, ctx );
6283 0 : fd_bincode_double_decode_unsafe( &self->foundation_rate, ctx );
6284 0 : fd_bincode_double_decode_unsafe( &self->prev_epoch_duration_in_years, ctx );
6285 0 : fd_bincode_uint64_decode_unsafe( &self->capitalization, ctx );
6286 0 : fd_point_value_decode_inner( &self->point_value, alloc_mem, ctx );
6287 0 : }
6288 0 : void * fd_partitioned_rewards_calculation_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6289 0 : fd_partitioned_rewards_calculation_t * self = (fd_partitioned_rewards_calculation_t *)mem;
6290 0 : fd_partitioned_rewards_calculation_new( self );
6291 0 : void * alloc_region = (uchar *)mem + sizeof(fd_partitioned_rewards_calculation_t);
6292 0 : void * * alloc_mem = &alloc_region;
6293 0 : fd_partitioned_rewards_calculation_decode_inner( mem, alloc_mem, ctx );
6294 0 : return self;
6295 0 : }
6296 0 : void fd_partitioned_rewards_calculation_new(fd_partitioned_rewards_calculation_t * self) {
6297 0 : fd_memset( self, 0, sizeof(fd_partitioned_rewards_calculation_t) );
6298 0 : fd_stake_reward_calculation_partitioned_new( &self->stake_rewards_by_partition );
6299 0 : fd_point_value_new( &self->point_value );
6300 0 : }
6301 0 : void fd_partitioned_rewards_calculation_walk( void * w, fd_partitioned_rewards_calculation_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
6302 0 : (void) varint;
6303 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_partitioned_rewards_calculation", level++, 0 );
6304 0 : if( self->vote_reward_map_root ) {
6305 0 : for( fd_vote_reward_t_mapnode_t * n = fd_vote_reward_t_map_minimum(self->vote_reward_map_pool, self->vote_reward_map_root ); n; n = fd_vote_reward_t_map_successor( self->vote_reward_map_pool, n ) ) {
6306 0 : fd_vote_reward_walk(w, &n->elem, fun, "vote_reward_map", level, 0 );
6307 0 : }
6308 0 : }
6309 0 : fd_stake_reward_calculation_partitioned_walk( w, &self->stake_rewards_by_partition, fun, "stake_rewards_by_partition", level, 0 );
6310 0 : fun( w, &self->old_vote_balance_and_staked, "old_vote_balance_and_staked", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
6311 0 : fun( w, &self->validator_rewards, "validator_rewards", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
6312 0 : fun( w, &self->validator_rate, "validator_rate", FD_FLAMENCO_TYPE_DOUBLE, "double", level, 0 );
6313 0 : fun( w, &self->foundation_rate, "foundation_rate", FD_FLAMENCO_TYPE_DOUBLE, "double", level, 0 );
6314 0 : fun( w, &self->prev_epoch_duration_in_years, "prev_epoch_duration_in_years", FD_FLAMENCO_TYPE_DOUBLE, "double", level, 0 );
6315 0 : fun( w, &self->capitalization, "capitalization", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
6316 0 : fd_point_value_walk( w, &self->point_value, fun, "point_value", level, 0 );
6317 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_partitioned_rewards_calculation", level--, 0 );
6318 0 : }
6319 0 : ulong fd_partitioned_rewards_calculation_size( fd_partitioned_rewards_calculation_t const * self ) {
6320 0 : ulong size = 0;
6321 0 : if( self->vote_reward_map_root ) {
6322 0 : size += sizeof(ulong);
6323 0 : ulong max = fd_vote_reward_t_map_max( self->vote_reward_map_pool );
6324 0 : size += fd_vote_reward_t_map_footprint( max );
6325 0 : for( fd_vote_reward_t_mapnode_t * n = fd_vote_reward_t_map_minimum( self->vote_reward_map_pool, self->vote_reward_map_root ); n; n = fd_vote_reward_t_map_successor( self->vote_reward_map_pool, n ) ) {
6326 0 : size += fd_vote_reward_size( &n->elem ) - sizeof(fd_vote_reward_t);
6327 0 : }
6328 0 : } else {
6329 0 : size += sizeof(ulong);
6330 0 : }
6331 0 : size += fd_stake_reward_calculation_partitioned_size( &self->stake_rewards_by_partition );
6332 0 : size += sizeof(ulong);
6333 0 : size += sizeof(ulong);
6334 0 : size += sizeof(double);
6335 0 : size += sizeof(double);
6336 0 : size += sizeof(double);
6337 0 : size += sizeof(ulong);
6338 0 : size += fd_point_value_size( &self->point_value );
6339 0 : return size;
6340 0 : }
6341 :
6342 0 : int fd_start_block_height_and_rewards_encode( fd_start_block_height_and_rewards_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6343 0 : int err;
6344 0 : err = fd_bincode_uint64_encode( self->distribution_starting_block_height, ctx );
6345 0 : if( FD_UNLIKELY( err ) ) return err;
6346 0 : err = fd_partitioned_stake_rewards_encode( &self->partitioned_stake_rewards, ctx );
6347 0 : if( FD_UNLIKELY( err ) ) return err;
6348 0 : return FD_BINCODE_SUCCESS;
6349 0 : }
6350 0 : int fd_start_block_height_and_rewards_encode_global( fd_start_block_height_and_rewards_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6351 0 : int err;
6352 0 : err = fd_bincode_uint64_encode( self->distribution_starting_block_height, ctx );
6353 0 : if( FD_UNLIKELY( err ) ) return err;
6354 0 : err = fd_partitioned_stake_rewards_encode_global( &self->partitioned_stake_rewards, ctx );
6355 0 : if( FD_UNLIKELY( err ) ) return err;
6356 0 : return FD_BINCODE_SUCCESS;
6357 0 : }
6358 0 : static int fd_start_block_height_and_rewards_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6359 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6360 0 : int err = 0;
6361 0 : err = fd_bincode_uint64_decode_footprint( ctx );
6362 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6363 0 : err = fd_partitioned_stake_rewards_decode_footprint_inner( ctx, total_sz );
6364 0 : if( FD_UNLIKELY( err ) ) return err;
6365 0 : return 0;
6366 0 : }
6367 0 : int fd_start_block_height_and_rewards_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6368 0 : *total_sz += sizeof(fd_start_block_height_and_rewards_t);
6369 0 : void const * start_data = ctx->data;
6370 0 : int err = fd_start_block_height_and_rewards_decode_footprint_inner( ctx, total_sz );
6371 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6372 0 : ctx->data = start_data;
6373 0 : return err;
6374 0 : }
6375 0 : static void fd_start_block_height_and_rewards_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6376 0 : fd_start_block_height_and_rewards_t * self = (fd_start_block_height_and_rewards_t *)struct_mem;
6377 0 : fd_bincode_uint64_decode_unsafe( &self->distribution_starting_block_height, ctx );
6378 0 : fd_partitioned_stake_rewards_decode_inner( &self->partitioned_stake_rewards, alloc_mem, ctx );
6379 0 : }
6380 0 : void * fd_start_block_height_and_rewards_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6381 0 : fd_start_block_height_and_rewards_t * self = (fd_start_block_height_and_rewards_t *)mem;
6382 0 : fd_start_block_height_and_rewards_new( self );
6383 0 : void * alloc_region = (uchar *)mem + sizeof(fd_start_block_height_and_rewards_t);
6384 0 : void * * alloc_mem = &alloc_region;
6385 0 : fd_start_block_height_and_rewards_decode_inner( mem, alloc_mem, ctx );
6386 0 : return self;
6387 0 : }
6388 0 : static void fd_start_block_height_and_rewards_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6389 0 : fd_start_block_height_and_rewards_global_t * self = (fd_start_block_height_and_rewards_global_t *)struct_mem;
6390 0 : fd_bincode_uint64_decode_unsafe( &self->distribution_starting_block_height, ctx );
6391 0 : fd_partitioned_stake_rewards_decode_inner_global( &self->partitioned_stake_rewards, alloc_mem, ctx );
6392 0 : }
6393 0 : void * fd_start_block_height_and_rewards_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6394 0 : fd_start_block_height_and_rewards_global_t * self = (fd_start_block_height_and_rewards_global_t *)mem;
6395 0 : fd_start_block_height_and_rewards_new( (fd_start_block_height_and_rewards_t *)self );
6396 0 : void * alloc_region = (uchar *)mem + sizeof(fd_start_block_height_and_rewards_global_t);
6397 0 : void * * alloc_mem = &alloc_region;
6398 0 : fd_start_block_height_and_rewards_decode_inner_global( mem, alloc_mem, ctx );
6399 0 : return self;
6400 0 : }
6401 0 : void fd_start_block_height_and_rewards_new(fd_start_block_height_and_rewards_t * self) {
6402 0 : fd_memset( self, 0, sizeof(fd_start_block_height_and_rewards_t) );
6403 0 : fd_partitioned_stake_rewards_new( &self->partitioned_stake_rewards );
6404 0 : }
6405 0 : void fd_start_block_height_and_rewards_walk( void * w, fd_start_block_height_and_rewards_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
6406 0 : (void) varint;
6407 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_start_block_height_and_rewards", level++, 0 );
6408 0 : fun( w, &self->distribution_starting_block_height, "distribution_starting_block_height", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
6409 0 : fd_partitioned_stake_rewards_walk( w, &self->partitioned_stake_rewards, fun, "partitioned_stake_rewards", level, 0 );
6410 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_start_block_height_and_rewards", level--, 0 );
6411 0 : }
6412 0 : ulong fd_start_block_height_and_rewards_size( fd_start_block_height_and_rewards_t const * self ) {
6413 0 : ulong size = 0;
6414 0 : size += sizeof(ulong);
6415 0 : size += fd_partitioned_stake_rewards_size( &self->partitioned_stake_rewards );
6416 0 : return size;
6417 0 : }
6418 :
6419 0 : ulong fd_start_block_height_and_rewards_size_global( fd_start_block_height_and_rewards_global_t const * self ) {
6420 0 : ulong size = 0;
6421 0 : size += sizeof(ulong);
6422 0 : size += fd_partitioned_stake_rewards_size_global( &self->partitioned_stake_rewards );
6423 0 : return size;
6424 0 : }
6425 :
6426 0 : int fd_fd_epoch_reward_status_inner_encode( fd_fd_epoch_reward_status_inner_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6427 0 : int err;
6428 0 : err = fd_start_block_height_and_rewards_encode( &self->Active, ctx );
6429 0 : if( FD_UNLIKELY( err ) ) return err;
6430 0 : return FD_BINCODE_SUCCESS;
6431 0 : }
6432 0 : static int fd_fd_epoch_reward_status_inner_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6433 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6434 0 : int err = 0;
6435 0 : err = fd_start_block_height_and_rewards_decode_footprint_inner( ctx, total_sz );
6436 0 : if( FD_UNLIKELY( err ) ) return err;
6437 0 : return 0;
6438 0 : }
6439 0 : int fd_fd_epoch_reward_status_inner_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6440 0 : *total_sz += sizeof(fd_fd_epoch_reward_status_inner_t);
6441 0 : void const * start_data = ctx->data;
6442 0 : int err = fd_fd_epoch_reward_status_inner_decode_footprint_inner( ctx, total_sz );
6443 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6444 0 : ctx->data = start_data;
6445 0 : return err;
6446 0 : }
6447 0 : static void fd_fd_epoch_reward_status_inner_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6448 0 : fd_fd_epoch_reward_status_inner_t * self = (fd_fd_epoch_reward_status_inner_t *)struct_mem;
6449 0 : fd_start_block_height_and_rewards_decode_inner( &self->Active, alloc_mem, ctx );
6450 0 : }
6451 0 : void * fd_fd_epoch_reward_status_inner_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6452 0 : fd_fd_epoch_reward_status_inner_t * self = (fd_fd_epoch_reward_status_inner_t *)mem;
6453 0 : fd_fd_epoch_reward_status_inner_new( self );
6454 0 : void * alloc_region = (uchar *)mem + sizeof(fd_fd_epoch_reward_status_inner_t);
6455 0 : void * * alloc_mem = &alloc_region;
6456 0 : fd_fd_epoch_reward_status_inner_decode_inner( mem, alloc_mem, ctx );
6457 0 : return self;
6458 0 : }
6459 0 : void fd_fd_epoch_reward_status_inner_new(fd_fd_epoch_reward_status_inner_t * self) {
6460 0 : fd_memset( self, 0, sizeof(fd_fd_epoch_reward_status_inner_t) );
6461 0 : fd_start_block_height_and_rewards_new( &self->Active );
6462 0 : }
6463 0 : void fd_fd_epoch_reward_status_inner_walk( void * w, fd_fd_epoch_reward_status_inner_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
6464 0 : (void) varint;
6465 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_fd_epoch_reward_status_inner", level++, 0 );
6466 0 : fd_start_block_height_and_rewards_walk( w, &self->Active, fun, "Active", level, 0 );
6467 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_fd_epoch_reward_status_inner", level--, 0 );
6468 0 : }
6469 0 : ulong fd_fd_epoch_reward_status_inner_size( fd_fd_epoch_reward_status_inner_t const * self ) {
6470 0 : ulong size = 0;
6471 0 : size += fd_start_block_height_and_rewards_size( &self->Active );
6472 0 : return size;
6473 0 : }
6474 :
6475 0 : FD_FN_PURE uchar fd_epoch_reward_status_is_Active(fd_epoch_reward_status_t const * self) {
6476 0 : return self->discriminant == 0;
6477 0 : }
6478 0 : FD_FN_PURE uchar fd_epoch_reward_status_is_Inactive(fd_epoch_reward_status_t const * self) {
6479 0 : return self->discriminant == 1;
6480 0 : }
6481 : void fd_epoch_reward_status_inner_new( fd_epoch_reward_status_inner_t * self, uint discriminant );
6482 0 : int fd_epoch_reward_status_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6483 0 : int err;
6484 0 : switch (discriminant) {
6485 0 : case 0: {
6486 0 : err = fd_start_block_height_and_rewards_decode_footprint_inner( ctx, total_sz );
6487 0 : if( FD_UNLIKELY( err ) ) return err;
6488 0 : return FD_BINCODE_SUCCESS;
6489 0 : }
6490 0 : case 1: {
6491 0 : return FD_BINCODE_SUCCESS;
6492 0 : }
6493 0 : default: return FD_BINCODE_ERR_ENCODING;
6494 0 : }
6495 0 : }
6496 0 : static int fd_epoch_reward_status_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6497 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6498 0 : uint discriminant = 0;
6499 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
6500 0 : if( FD_UNLIKELY( err ) ) return err;
6501 0 : return fd_epoch_reward_status_inner_decode_footprint( discriminant, ctx, total_sz );
6502 0 : }
6503 0 : int fd_epoch_reward_status_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6504 0 : *total_sz += sizeof(fd_epoch_reward_status_t);
6505 0 : void const * start_data = ctx->data;
6506 0 : int err = fd_epoch_reward_status_decode_footprint_inner( ctx, total_sz );
6507 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6508 0 : ctx->data = start_data;
6509 0 : return err;
6510 0 : }
6511 0 : static void fd_epoch_reward_status_inner_decode_inner( fd_epoch_reward_status_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
6512 0 : switch (discriminant) {
6513 0 : case 0: {
6514 0 : fd_start_block_height_and_rewards_decode_inner( &self->Active, alloc_mem, ctx );
6515 0 : break;
6516 0 : }
6517 0 : case 1: {
6518 0 : break;
6519 0 : }
6520 0 : }
6521 0 : }
6522 0 : static void fd_epoch_reward_status_inner_decode_inner_global( fd_epoch_reward_status_inner_global_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
6523 0 : switch (discriminant) {
6524 0 : case 0: {
6525 0 : fd_start_block_height_and_rewards_decode_inner_global( &self->Active, alloc_mem, ctx );
6526 0 : break;
6527 0 : }
6528 0 : case 1: {
6529 0 : break;
6530 0 : }
6531 0 : }
6532 0 : }
6533 0 : static void fd_epoch_reward_status_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6534 0 : fd_epoch_reward_status_t * self = (fd_epoch_reward_status_t *)struct_mem;
6535 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
6536 0 : fd_epoch_reward_status_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
6537 0 : }
6538 0 : void * fd_epoch_reward_status_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6539 0 : fd_epoch_reward_status_t * self = (fd_epoch_reward_status_t *)mem;
6540 0 : fd_epoch_reward_status_new( self );
6541 0 : void * alloc_region = (uchar *)mem + sizeof(fd_epoch_reward_status_t);
6542 0 : void * * alloc_mem = &alloc_region;
6543 0 : fd_epoch_reward_status_decode_inner( mem, alloc_mem, ctx );
6544 0 : return self;
6545 0 : }
6546 0 : static int fd_epoch_reward_status_inner_encode_global( fd_epoch_reward_status_inner_global_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
6547 0 : int err;
6548 0 : switch (discriminant) {
6549 0 : case 0: {
6550 0 : err = fd_start_block_height_and_rewards_encode_global( &self->Active, ctx );
6551 0 : if( FD_UNLIKELY( err ) ) return err;
6552 0 : break;
6553 0 : }
6554 0 : }
6555 0 : return FD_BINCODE_SUCCESS;
6556 0 : }
6557 0 : int fd_epoch_reward_status_encode_global( fd_epoch_reward_status_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6558 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
6559 0 : if( FD_UNLIKELY( err ) ) return err;
6560 0 : return fd_epoch_reward_status_inner_encode_global( &self->inner, self->discriminant, ctx );
6561 0 : }
6562 :
6563 0 : static void fd_epoch_reward_status_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6564 0 : fd_epoch_reward_status_global_t * self = (fd_epoch_reward_status_global_t *)struct_mem;
6565 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
6566 0 : fd_epoch_reward_status_inner_decode_inner_global( &self->inner, alloc_mem, self->discriminant, ctx );
6567 0 : }
6568 0 : void * fd_epoch_reward_status_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6569 0 : fd_epoch_reward_status_t * self = (fd_epoch_reward_status_t *)mem;
6570 0 : fd_epoch_reward_status_new( self );
6571 0 : void * alloc_region = (uchar *)mem + sizeof(fd_epoch_reward_status_t);
6572 0 : void * * alloc_mem = &alloc_region;
6573 0 : fd_epoch_reward_status_decode_inner_global( mem, alloc_mem, ctx );
6574 0 : return self;
6575 0 : }
6576 0 : void fd_epoch_reward_status_inner_new( fd_epoch_reward_status_inner_t * self, uint discriminant ) {
6577 0 : switch( discriminant ) {
6578 0 : case 0: {
6579 0 : fd_start_block_height_and_rewards_new( &self->Active );
6580 0 : break;
6581 0 : }
6582 0 : case 1: {
6583 0 : break;
6584 0 : }
6585 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
6586 0 : }
6587 0 : }
6588 0 : void fd_epoch_reward_status_new_disc( fd_epoch_reward_status_t * self, uint discriminant ) {
6589 0 : self->discriminant = discriminant;
6590 0 : fd_epoch_reward_status_inner_new( &self->inner, self->discriminant );
6591 0 : }
6592 0 : void fd_epoch_reward_status_new( fd_epoch_reward_status_t * self ) {
6593 0 : fd_memset( self, 0, sizeof(fd_epoch_reward_status_t) );
6594 0 : fd_epoch_reward_status_new_disc( self, UINT_MAX );
6595 0 : }
6596 :
6597 0 : void fd_epoch_reward_status_walk( void * w, fd_epoch_reward_status_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
6598 0 : (void) varint;
6599 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_epoch_reward_status", level++, 0);
6600 0 : switch( self->discriminant ) {
6601 0 : case 0: {
6602 0 : fun( w, self, "Active", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
6603 0 : fd_start_block_height_and_rewards_walk( w, &self->inner.Active, fun, "Active", level, 0 );
6604 0 : break;
6605 0 : }
6606 0 : case 1: {
6607 0 : fun( w, self, "Inactive", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
6608 0 : break;
6609 0 : }
6610 0 : }
6611 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_epoch_reward_status", level--, 0 );
6612 0 : }
6613 0 : ulong fd_epoch_reward_status_size( fd_epoch_reward_status_t const * self ) {
6614 0 : ulong size = 0;
6615 0 : size += sizeof(uint);
6616 0 : switch (self->discriminant) {
6617 0 : case 0: {
6618 0 : size += fd_start_block_height_and_rewards_size( &self->inner.Active );
6619 0 : break;
6620 0 : }
6621 0 : }
6622 0 : return size;
6623 0 : }
6624 :
6625 0 : ulong fd_epoch_reward_status_size_global( fd_epoch_reward_status_global_t const * self ) {
6626 0 : ulong size = 0;
6627 0 : size += sizeof(uint);
6628 0 : switch (self->discriminant) {
6629 0 : case 0: {
6630 0 : size += fd_start_block_height_and_rewards_size_global( &self->inner.Active );
6631 0 : break;
6632 0 : }
6633 0 : }
6634 0 : return size;
6635 0 : }
6636 :
6637 0 : int fd_epoch_reward_status_inner_encode( fd_epoch_reward_status_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
6638 0 : int err;
6639 0 : switch (discriminant) {
6640 0 : case 0: {
6641 0 : err = fd_start_block_height_and_rewards_encode( &self->Active, ctx );
6642 0 : if( FD_UNLIKELY( err ) ) return err;
6643 0 : break;
6644 0 : }
6645 0 : }
6646 0 : return FD_BINCODE_SUCCESS;
6647 0 : }
6648 0 : int fd_epoch_reward_status_encode( fd_epoch_reward_status_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6649 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
6650 0 : if( FD_UNLIKELY( err ) ) return err;
6651 0 : return fd_epoch_reward_status_inner_encode( &self->inner, self->discriminant, ctx );
6652 0 : }
6653 :
6654 0 : int fd_prev_epoch_inflation_rewards_encode( fd_prev_epoch_inflation_rewards_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6655 0 : int err;
6656 0 : err = fd_bincode_uint64_encode( self->validator_rewards, ctx );
6657 0 : if( FD_UNLIKELY( err ) ) return err;
6658 0 : err = fd_bincode_double_encode( self->prev_epoch_duration_in_years, ctx );
6659 0 : if( FD_UNLIKELY( err ) ) return err;
6660 0 : err = fd_bincode_double_encode( self->validator_rate, ctx );
6661 0 : if( FD_UNLIKELY( err ) ) return err;
6662 0 : err = fd_bincode_double_encode( self->foundation_rate, ctx );
6663 0 : if( FD_UNLIKELY( err ) ) return err;
6664 0 : return FD_BINCODE_SUCCESS;
6665 0 : }
6666 0 : static inline int fd_prev_epoch_inflation_rewards_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6667 0 : if( (ulong)ctx->data + 32UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6668 0 : ctx->data = (void *)( (ulong)ctx->data + 32UL );
6669 0 : return 0;
6670 0 : }
6671 0 : static void fd_prev_epoch_inflation_rewards_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6672 0 : fd_prev_epoch_inflation_rewards_t * self = (fd_prev_epoch_inflation_rewards_t *)struct_mem;
6673 0 : fd_bincode_uint64_decode_unsafe( &self->validator_rewards, ctx );
6674 0 : fd_bincode_double_decode_unsafe( &self->prev_epoch_duration_in_years, ctx );
6675 0 : fd_bincode_double_decode_unsafe( &self->validator_rate, ctx );
6676 0 : fd_bincode_double_decode_unsafe( &self->foundation_rate, ctx );
6677 0 : }
6678 0 : void * fd_prev_epoch_inflation_rewards_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6679 0 : fd_prev_epoch_inflation_rewards_t * self = (fd_prev_epoch_inflation_rewards_t *)mem;
6680 0 : fd_prev_epoch_inflation_rewards_new( self );
6681 0 : void * alloc_region = (uchar *)mem + sizeof(fd_prev_epoch_inflation_rewards_t);
6682 0 : void * * alloc_mem = &alloc_region;
6683 0 : fd_prev_epoch_inflation_rewards_decode_inner( mem, alloc_mem, ctx );
6684 0 : return self;
6685 0 : }
6686 0 : void fd_prev_epoch_inflation_rewards_walk( void * w, fd_prev_epoch_inflation_rewards_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
6687 0 : (void) varint;
6688 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_prev_epoch_inflation_rewards", level++, 0 );
6689 0 : fun( w, &self->validator_rewards, "validator_rewards", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
6690 0 : fun( w, &self->prev_epoch_duration_in_years, "prev_epoch_duration_in_years", FD_FLAMENCO_TYPE_DOUBLE, "double", level, 0 );
6691 0 : fun( w, &self->validator_rate, "validator_rate", FD_FLAMENCO_TYPE_DOUBLE, "double", level, 0 );
6692 0 : fun( w, &self->foundation_rate, "foundation_rate", FD_FLAMENCO_TYPE_DOUBLE, "double", level, 0 );
6693 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_prev_epoch_inflation_rewards", level--, 0 );
6694 0 : }
6695 0 : int fd_vote_encode( fd_vote_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6696 0 : int err;
6697 0 : if( self->slots ) {
6698 0 : ulong slots_len = deq_ulong_cnt( self->slots );
6699 0 : err = fd_bincode_uint64_encode( slots_len, ctx );
6700 0 : if( FD_UNLIKELY( err ) ) return err;
6701 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 ) ) {
6702 0 : ulong const * ele = deq_ulong_iter_ele_const( self->slots, iter );
6703 0 : err = fd_bincode_uint64_encode( ele[0], ctx );
6704 0 : }
6705 0 : } else {
6706 0 : ulong slots_len = 0;
6707 0 : err = fd_bincode_uint64_encode( slots_len, ctx );
6708 0 : if( FD_UNLIKELY( err ) ) return err;
6709 0 : }
6710 0 : err = fd_hash_encode( &self->hash, ctx );
6711 0 : if( FD_UNLIKELY( err ) ) return err;
6712 0 : err = fd_bincode_bool_encode( self->has_timestamp, ctx );
6713 0 : if( FD_UNLIKELY( err ) ) return err;
6714 0 : if( self->has_timestamp ) {
6715 0 : err = fd_bincode_int64_encode( self->timestamp, ctx );
6716 0 : if( FD_UNLIKELY( err ) ) return err;
6717 0 : }
6718 0 : return FD_BINCODE_SUCCESS;
6719 0 : }
6720 0 : static int fd_vote_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6721 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6722 0 : int err = 0;
6723 0 : ulong slots_len;
6724 0 : err = fd_bincode_uint64_decode( &slots_len, ctx );
6725 0 : if( FD_UNLIKELY( err ) ) return err;
6726 0 : ulong slots_max = slots_len == 0 ? 1 : slots_len;
6727 0 : *total_sz += deq_ulong_align() + deq_ulong_footprint( slots_max ) ;
6728 0 : ulong slots_sz;
6729 0 : if( FD_UNLIKELY( __builtin_umull_overflow( slots_len, 8, &slots_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
6730 0 : err = fd_bincode_bytes_decode_footprint( slots_sz, ctx );
6731 0 : if( FD_UNLIKELY( err ) ) return err;
6732 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
6733 0 : if( FD_UNLIKELY( err ) ) return err;
6734 0 : {
6735 0 : uchar o;
6736 0 : err = fd_bincode_bool_decode( &o, ctx );
6737 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6738 0 : if( o ) {
6739 0 : err = fd_bincode_int64_decode_footprint( ctx );
6740 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6741 0 : }
6742 0 : }
6743 0 : return 0;
6744 0 : }
6745 0 : int fd_vote_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6746 0 : *total_sz += sizeof(fd_vote_t);
6747 0 : void const * start_data = ctx->data;
6748 0 : int err = fd_vote_decode_footprint_inner( ctx, total_sz );
6749 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6750 0 : ctx->data = start_data;
6751 0 : return err;
6752 0 : }
6753 0 : static void fd_vote_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6754 0 : fd_vote_t * self = (fd_vote_t *)struct_mem;
6755 0 : ulong slots_len;
6756 0 : fd_bincode_uint64_decode_unsafe( &slots_len, ctx );
6757 0 : self->slots = deq_ulong_join_new( alloc_mem, slots_len );
6758 0 : for( ulong i=0; i < slots_len; i++ ) {
6759 0 : ulong * elem = deq_ulong_push_tail_nocopy( self->slots );
6760 0 : fd_bincode_uint64_decode_unsafe( elem, ctx );
6761 0 : }
6762 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
6763 0 : {
6764 0 : uchar o;
6765 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
6766 0 : self->has_timestamp = !!o;
6767 0 : if( o ) {
6768 0 : fd_bincode_int64_decode_unsafe( &self->timestamp, ctx );
6769 0 : }
6770 0 : }
6771 0 : }
6772 0 : void * fd_vote_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6773 0 : fd_vote_t * self = (fd_vote_t *)mem;
6774 0 : fd_vote_new( self );
6775 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_t);
6776 0 : void * * alloc_mem = &alloc_region;
6777 0 : fd_vote_decode_inner( mem, alloc_mem, ctx );
6778 0 : return self;
6779 0 : }
6780 0 : void fd_vote_new(fd_vote_t * self) {
6781 0 : fd_memset( self, 0, sizeof(fd_vote_t) );
6782 0 : fd_hash_new( &self->hash );
6783 0 : }
6784 0 : void fd_vote_walk( void * w, fd_vote_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
6785 0 : (void) varint;
6786 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote", level++, 0 );
6787 :
6788 : /* Walk deque */
6789 0 : fun( w, self->slots, "slots", FD_FLAMENCO_TYPE_ARR, "slots", level++, 0 );
6790 0 : if( self->slots ) {
6791 0 : for( deq_ulong_iter_t iter = deq_ulong_iter_init( self->slots );
6792 0 : !deq_ulong_iter_done( self->slots, iter );
6793 0 : iter = deq_ulong_iter_next( self->slots, iter ) ) {
6794 0 : ulong * ele = deq_ulong_iter_ele( self->slots, iter );
6795 0 : fun(w, ele, "ele", FD_FLAMENCO_TYPE_ULONG, "long", level, 0 );
6796 0 : }
6797 0 : }
6798 0 : fun( w, self->slots, "slots", FD_FLAMENCO_TYPE_ARR_END, "slots", level--, 0 );
6799 : /* Done walking deque */
6800 :
6801 0 : fd_hash_walk( w, &self->hash, fun, "hash", level, 0 );
6802 0 : if( !self->has_timestamp ) {
6803 0 : fun( w, NULL, "timestamp", FD_FLAMENCO_TYPE_NULL, "long", level, 0 );
6804 0 : } else {
6805 0 : fun( w, &self->timestamp, "timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level, 0 );
6806 0 : }
6807 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote", level--, 0 );
6808 0 : }
6809 0 : ulong fd_vote_size( fd_vote_t const * self ) {
6810 0 : ulong size = 0;
6811 0 : if( self->slots ) {
6812 0 : size += sizeof(ulong);
6813 0 : ulong slots_len = deq_ulong_cnt(self->slots);
6814 0 : size += slots_len * sizeof(ulong);
6815 0 : } else {
6816 0 : size += sizeof(ulong);
6817 0 : }
6818 0 : size += fd_hash_size( &self->hash );
6819 0 : size += sizeof(char);
6820 0 : if( self->has_timestamp ) {
6821 0 : size += sizeof(long);
6822 0 : }
6823 0 : return size;
6824 0 : }
6825 :
6826 0 : int fd_vote_init_encode( fd_vote_init_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6827 0 : int err;
6828 0 : err = fd_pubkey_encode( &self->node_pubkey, ctx );
6829 0 : if( FD_UNLIKELY( err ) ) return err;
6830 0 : err = fd_pubkey_encode( &self->authorized_voter, ctx );
6831 0 : if( FD_UNLIKELY( err ) ) return err;
6832 0 : err = fd_pubkey_encode( &self->authorized_withdrawer, ctx );
6833 0 : if( FD_UNLIKELY( err ) ) return err;
6834 0 : err = fd_bincode_uint8_encode( (uchar)(self->commission), ctx );
6835 0 : if( FD_UNLIKELY( err ) ) return err;
6836 0 : return FD_BINCODE_SUCCESS;
6837 0 : }
6838 0 : static inline int fd_vote_init_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6839 0 : if( (ulong)ctx->data + 97UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6840 0 : ctx->data = (void *)( (ulong)ctx->data + 97UL );
6841 0 : return 0;
6842 0 : }
6843 0 : static void fd_vote_init_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6844 0 : fd_vote_init_t * self = (fd_vote_init_t *)struct_mem;
6845 0 : fd_pubkey_decode_inner( &self->node_pubkey, alloc_mem, ctx );
6846 0 : fd_pubkey_decode_inner( &self->authorized_voter, alloc_mem, ctx );
6847 0 : fd_pubkey_decode_inner( &self->authorized_withdrawer, alloc_mem, ctx );
6848 0 : fd_bincode_uint8_decode_unsafe( &self->commission, ctx );
6849 0 : }
6850 0 : void * fd_vote_init_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6851 0 : fd_vote_init_t * self = (fd_vote_init_t *)mem;
6852 0 : fd_vote_init_new( self );
6853 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_init_t);
6854 0 : void * * alloc_mem = &alloc_region;
6855 0 : fd_vote_init_decode_inner( mem, alloc_mem, ctx );
6856 0 : return self;
6857 0 : }
6858 0 : void fd_vote_init_walk( void * w, fd_vote_init_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
6859 0 : (void) varint;
6860 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_init", level++, 0 );
6861 0 : fd_pubkey_walk( w, &self->node_pubkey, fun, "node_pubkey", level, 0 );
6862 0 : fd_pubkey_walk( w, &self->authorized_voter, fun, "authorized_voter", level, 0 );
6863 0 : fd_pubkey_walk( w, &self->authorized_withdrawer, fun, "authorized_withdrawer", level, 0 );
6864 0 : fun( w, &self->commission, "commission", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
6865 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_init", level--, 0 );
6866 0 : }
6867 0 : FD_FN_PURE uchar fd_vote_authorize_is_voter(fd_vote_authorize_t const * self) {
6868 0 : return self->discriminant == 0;
6869 0 : }
6870 0 : FD_FN_PURE uchar fd_vote_authorize_is_withdrawer(fd_vote_authorize_t const * self) {
6871 0 : return self->discriminant == 1;
6872 0 : }
6873 0 : int fd_vote_authorize_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6874 0 : int err;
6875 0 : switch (discriminant) {
6876 0 : case 0: {
6877 0 : return FD_BINCODE_SUCCESS;
6878 0 : }
6879 0 : case 1: {
6880 0 : return FD_BINCODE_SUCCESS;
6881 0 : }
6882 0 : default: return FD_BINCODE_ERR_ENCODING;
6883 0 : }
6884 0 : }
6885 0 : static int fd_vote_authorize_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6886 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6887 0 : uint discriminant = 0;
6888 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
6889 0 : if( FD_UNLIKELY( err ) ) return err;
6890 0 : return fd_vote_authorize_inner_decode_footprint( discriminant, ctx, total_sz );
6891 0 : }
6892 0 : int fd_vote_authorize_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6893 0 : *total_sz += sizeof(fd_vote_authorize_t);
6894 0 : void const * start_data = ctx->data;
6895 0 : int err = fd_vote_authorize_decode_footprint_inner( ctx, total_sz );
6896 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6897 0 : ctx->data = start_data;
6898 0 : return err;
6899 0 : }
6900 0 : static void fd_vote_authorize_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6901 0 : fd_vote_authorize_t * self = (fd_vote_authorize_t *)struct_mem;
6902 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
6903 0 : }
6904 0 : void * fd_vote_authorize_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6905 0 : fd_vote_authorize_t * self = (fd_vote_authorize_t *)mem;
6906 0 : fd_vote_authorize_new( self );
6907 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_authorize_t);
6908 0 : void * * alloc_mem = &alloc_region;
6909 0 : fd_vote_authorize_decode_inner( mem, alloc_mem, ctx );
6910 0 : return self;
6911 0 : }
6912 :
6913 0 : void fd_vote_authorize_walk( void * w, fd_vote_authorize_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
6914 0 : (void) varint;
6915 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_vote_authorize", level++, 0);
6916 0 : switch( self->discriminant ) {
6917 0 : case 0: {
6918 0 : fun( w, self, "voter", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
6919 0 : break;
6920 0 : }
6921 0 : case 1: {
6922 0 : fun( w, self, "withdrawer", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
6923 0 : break;
6924 0 : }
6925 0 : }
6926 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_vote_authorize", level--, 0 );
6927 0 : }
6928 0 : ulong fd_vote_authorize_size( fd_vote_authorize_t const * self ) {
6929 0 : ulong size = 0;
6930 0 : size += sizeof(uint);
6931 0 : switch (self->discriminant) {
6932 0 : }
6933 0 : return size;
6934 0 : }
6935 :
6936 0 : int fd_vote_authorize_encode( fd_vote_authorize_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6937 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
6938 0 : if( FD_UNLIKELY( err ) ) return err;
6939 0 : return err;
6940 0 : }
6941 :
6942 0 : int fd_vote_authorize_pubkey_encode( fd_vote_authorize_pubkey_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6943 0 : int err;
6944 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
6945 0 : if( FD_UNLIKELY( err ) ) return err;
6946 0 : err = fd_vote_authorize_encode( &self->vote_authorize, ctx );
6947 0 : if( FD_UNLIKELY( err ) ) return err;
6948 0 : return FD_BINCODE_SUCCESS;
6949 0 : }
6950 0 : static int fd_vote_authorize_pubkey_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_pubkey_decode_footprint_inner( ctx, total_sz );
6954 0 : if( FD_UNLIKELY( err ) ) return err;
6955 0 : err = fd_vote_authorize_decode_footprint_inner( ctx, total_sz );
6956 0 : if( FD_UNLIKELY( err ) ) return err;
6957 0 : return 0;
6958 0 : }
6959 0 : int fd_vote_authorize_pubkey_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6960 0 : *total_sz += sizeof(fd_vote_authorize_pubkey_t);
6961 0 : void const * start_data = ctx->data;
6962 0 : int err = fd_vote_authorize_pubkey_decode_footprint_inner( ctx, total_sz );
6963 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6964 0 : ctx->data = start_data;
6965 0 : return err;
6966 0 : }
6967 0 : static void fd_vote_authorize_pubkey_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6968 0 : fd_vote_authorize_pubkey_t * self = (fd_vote_authorize_pubkey_t *)struct_mem;
6969 0 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
6970 0 : fd_vote_authorize_decode_inner( &self->vote_authorize, alloc_mem, ctx );
6971 0 : }
6972 0 : void * fd_vote_authorize_pubkey_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6973 0 : fd_vote_authorize_pubkey_t * self = (fd_vote_authorize_pubkey_t *)mem;
6974 0 : fd_vote_authorize_pubkey_new( self );
6975 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_authorize_pubkey_t);
6976 0 : void * * alloc_mem = &alloc_region;
6977 0 : fd_vote_authorize_pubkey_decode_inner( mem, alloc_mem, ctx );
6978 0 : return self;
6979 0 : }
6980 0 : void fd_vote_authorize_pubkey_new(fd_vote_authorize_pubkey_t * self) {
6981 0 : fd_memset( self, 0, sizeof(fd_vote_authorize_pubkey_t) );
6982 0 : fd_pubkey_new( &self->pubkey );
6983 0 : fd_vote_authorize_new( &self->vote_authorize );
6984 0 : }
6985 0 : void fd_vote_authorize_pubkey_walk( void * w, fd_vote_authorize_pubkey_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
6986 0 : (void) varint;
6987 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_authorize_pubkey", level++, 0 );
6988 0 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level, 0 );
6989 0 : fd_vote_authorize_walk( w, &self->vote_authorize, fun, "vote_authorize", level, 0 );
6990 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_authorize_pubkey", level--, 0 );
6991 0 : }
6992 0 : int fd_vote_switch_encode( fd_vote_switch_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6993 0 : int err;
6994 0 : err = fd_vote_encode( &self->vote, ctx );
6995 0 : if( FD_UNLIKELY( err ) ) return err;
6996 0 : err = fd_hash_encode( &self->hash, ctx );
6997 0 : if( FD_UNLIKELY( err ) ) return err;
6998 0 : return FD_BINCODE_SUCCESS;
6999 0 : }
7000 0 : static int fd_vote_switch_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7001 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7002 0 : int err = 0;
7003 0 : err = fd_vote_decode_footprint_inner( ctx, total_sz );
7004 0 : if( FD_UNLIKELY( err ) ) return err;
7005 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
7006 0 : if( FD_UNLIKELY( err ) ) return err;
7007 0 : return 0;
7008 0 : }
7009 0 : int fd_vote_switch_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7010 0 : *total_sz += sizeof(fd_vote_switch_t);
7011 0 : void const * start_data = ctx->data;
7012 0 : int err = fd_vote_switch_decode_footprint_inner( ctx, total_sz );
7013 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7014 0 : ctx->data = start_data;
7015 0 : return err;
7016 0 : }
7017 0 : static void fd_vote_switch_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7018 0 : fd_vote_switch_t * self = (fd_vote_switch_t *)struct_mem;
7019 0 : fd_vote_decode_inner( &self->vote, alloc_mem, ctx );
7020 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
7021 0 : }
7022 0 : void * fd_vote_switch_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7023 0 : fd_vote_switch_t * self = (fd_vote_switch_t *)mem;
7024 0 : fd_vote_switch_new( self );
7025 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_switch_t);
7026 0 : void * * alloc_mem = &alloc_region;
7027 0 : fd_vote_switch_decode_inner( mem, alloc_mem, ctx );
7028 0 : return self;
7029 0 : }
7030 0 : void fd_vote_switch_new(fd_vote_switch_t * self) {
7031 0 : fd_memset( self, 0, sizeof(fd_vote_switch_t) );
7032 0 : fd_vote_new( &self->vote );
7033 0 : fd_hash_new( &self->hash );
7034 0 : }
7035 0 : void fd_vote_switch_walk( void * w, fd_vote_switch_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
7036 0 : (void) varint;
7037 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_switch", level++, 0 );
7038 0 : fd_vote_walk( w, &self->vote, fun, "vote", level, 0 );
7039 0 : fd_hash_walk( w, &self->hash, fun, "hash", level, 0 );
7040 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_switch", level--, 0 );
7041 0 : }
7042 0 : ulong fd_vote_switch_size( fd_vote_switch_t const * self ) {
7043 0 : ulong size = 0;
7044 0 : size += fd_vote_size( &self->vote );
7045 0 : size += fd_hash_size( &self->hash );
7046 0 : return size;
7047 0 : }
7048 :
7049 0 : int fd_update_vote_state_switch_encode( fd_update_vote_state_switch_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7050 0 : int err;
7051 0 : err = fd_vote_state_update_encode( &self->vote_state_update, ctx );
7052 0 : if( FD_UNLIKELY( err ) ) return err;
7053 0 : err = fd_hash_encode( &self->hash, ctx );
7054 0 : if( FD_UNLIKELY( err ) ) return err;
7055 0 : return FD_BINCODE_SUCCESS;
7056 0 : }
7057 0 : static int fd_update_vote_state_switch_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7058 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7059 0 : int err = 0;
7060 0 : err = fd_vote_state_update_decode_footprint_inner( ctx, total_sz );
7061 0 : if( FD_UNLIKELY( err ) ) return err;
7062 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
7063 0 : if( FD_UNLIKELY( err ) ) return err;
7064 0 : return 0;
7065 0 : }
7066 0 : int fd_update_vote_state_switch_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7067 0 : *total_sz += sizeof(fd_update_vote_state_switch_t);
7068 0 : void const * start_data = ctx->data;
7069 0 : int err = fd_update_vote_state_switch_decode_footprint_inner( ctx, total_sz );
7070 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7071 0 : ctx->data = start_data;
7072 0 : return err;
7073 0 : }
7074 0 : static void fd_update_vote_state_switch_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7075 0 : fd_update_vote_state_switch_t * self = (fd_update_vote_state_switch_t *)struct_mem;
7076 0 : fd_vote_state_update_decode_inner( &self->vote_state_update, alloc_mem, ctx );
7077 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
7078 0 : }
7079 0 : void * fd_update_vote_state_switch_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7080 0 : fd_update_vote_state_switch_t * self = (fd_update_vote_state_switch_t *)mem;
7081 0 : fd_update_vote_state_switch_new( self );
7082 0 : void * alloc_region = (uchar *)mem + sizeof(fd_update_vote_state_switch_t);
7083 0 : void * * alloc_mem = &alloc_region;
7084 0 : fd_update_vote_state_switch_decode_inner( mem, alloc_mem, ctx );
7085 0 : return self;
7086 0 : }
7087 0 : void fd_update_vote_state_switch_new(fd_update_vote_state_switch_t * self) {
7088 0 : fd_memset( self, 0, sizeof(fd_update_vote_state_switch_t) );
7089 0 : fd_vote_state_update_new( &self->vote_state_update );
7090 0 : fd_hash_new( &self->hash );
7091 0 : }
7092 0 : void fd_update_vote_state_switch_walk( void * w, fd_update_vote_state_switch_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
7093 0 : (void) varint;
7094 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_update_vote_state_switch", level++, 0 );
7095 0 : fd_vote_state_update_walk( w, &self->vote_state_update, fun, "vote_state_update", level, 0 );
7096 0 : fd_hash_walk( w, &self->hash, fun, "hash", level, 0 );
7097 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_update_vote_state_switch", level--, 0 );
7098 0 : }
7099 0 : ulong fd_update_vote_state_switch_size( fd_update_vote_state_switch_t const * self ) {
7100 0 : ulong size = 0;
7101 0 : size += fd_vote_state_update_size( &self->vote_state_update );
7102 0 : size += fd_hash_size( &self->hash );
7103 0 : return size;
7104 0 : }
7105 :
7106 0 : int fd_vote_authorize_with_seed_args_encode( fd_vote_authorize_with_seed_args_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7107 0 : int err;
7108 0 : err = fd_vote_authorize_encode( &self->authorization_type, ctx );
7109 0 : if( FD_UNLIKELY( err ) ) return err;
7110 0 : err = fd_pubkey_encode( &self->current_authority_derived_key_owner, ctx );
7111 0 : if( FD_UNLIKELY( err ) ) return err;
7112 0 : err = fd_bincode_uint64_encode( self->current_authority_derived_key_seed_len, ctx );
7113 0 : if( FD_UNLIKELY(err) ) return err;
7114 0 : if( self->current_authority_derived_key_seed_len ) {
7115 0 : err = fd_bincode_bytes_encode( self->current_authority_derived_key_seed, self->current_authority_derived_key_seed_len, ctx );
7116 0 : if( FD_UNLIKELY( err ) ) return err;
7117 0 : }
7118 0 : err = fd_pubkey_encode( &self->new_authority, ctx );
7119 0 : if( FD_UNLIKELY( err ) ) return err;
7120 0 : return FD_BINCODE_SUCCESS;
7121 0 : }
7122 0 : static int fd_vote_authorize_with_seed_args_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7123 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7124 0 : int err = 0;
7125 0 : err = fd_vote_authorize_decode_footprint_inner( ctx, total_sz );
7126 0 : if( FD_UNLIKELY( err ) ) return err;
7127 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
7128 0 : if( FD_UNLIKELY( err ) ) return err;
7129 0 : ulong current_authority_derived_key_seed_len;
7130 0 : err = fd_bincode_uint64_decode( ¤t_authority_derived_key_seed_len, ctx );
7131 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7132 0 : *total_sz += current_authority_derived_key_seed_len;
7133 0 : if( current_authority_derived_key_seed_len ) {
7134 0 : err = fd_bincode_bytes_decode_footprint( current_authority_derived_key_seed_len, ctx );
7135 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7136 0 : err = !fd_utf8_verify( (char const *) ctx->data - current_authority_derived_key_seed_len, current_authority_derived_key_seed_len );
7137 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7138 0 : }
7139 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
7140 0 : if( FD_UNLIKELY( err ) ) return err;
7141 0 : return 0;
7142 0 : }
7143 0 : int fd_vote_authorize_with_seed_args_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7144 0 : *total_sz += sizeof(fd_vote_authorize_with_seed_args_t);
7145 0 : void const * start_data = ctx->data;
7146 0 : int err = fd_vote_authorize_with_seed_args_decode_footprint_inner( ctx, total_sz );
7147 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7148 0 : ctx->data = start_data;
7149 0 : return err;
7150 0 : }
7151 0 : static void fd_vote_authorize_with_seed_args_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7152 0 : fd_vote_authorize_with_seed_args_t * self = (fd_vote_authorize_with_seed_args_t *)struct_mem;
7153 0 : fd_vote_authorize_decode_inner( &self->authorization_type, alloc_mem, ctx );
7154 0 : fd_pubkey_decode_inner( &self->current_authority_derived_key_owner, alloc_mem, ctx );
7155 0 : fd_bincode_uint64_decode_unsafe( &self->current_authority_derived_key_seed_len, ctx );
7156 0 : if( self->current_authority_derived_key_seed_len ) {
7157 0 : self->current_authority_derived_key_seed = *alloc_mem;
7158 0 : fd_bincode_bytes_decode_unsafe( self->current_authority_derived_key_seed, self->current_authority_derived_key_seed_len, ctx );
7159 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->current_authority_derived_key_seed_len;
7160 0 : } else
7161 0 : self->current_authority_derived_key_seed = NULL;
7162 0 : fd_pubkey_decode_inner( &self->new_authority, alloc_mem, ctx );
7163 0 : }
7164 0 : void * fd_vote_authorize_with_seed_args_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7165 0 : fd_vote_authorize_with_seed_args_t * self = (fd_vote_authorize_with_seed_args_t *)mem;
7166 0 : fd_vote_authorize_with_seed_args_new( self );
7167 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_authorize_with_seed_args_t);
7168 0 : void * * alloc_mem = &alloc_region;
7169 0 : fd_vote_authorize_with_seed_args_decode_inner( mem, alloc_mem, ctx );
7170 0 : return self;
7171 0 : }
7172 0 : void fd_vote_authorize_with_seed_args_new(fd_vote_authorize_with_seed_args_t * self) {
7173 0 : fd_memset( self, 0, sizeof(fd_vote_authorize_with_seed_args_t) );
7174 0 : fd_vote_authorize_new( &self->authorization_type );
7175 0 : fd_pubkey_new( &self->current_authority_derived_key_owner );
7176 0 : fd_pubkey_new( &self->new_authority );
7177 0 : }
7178 0 : void fd_vote_authorize_with_seed_args_walk( void * w, fd_vote_authorize_with_seed_args_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
7179 0 : (void) varint;
7180 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_authorize_with_seed_args", level++, 0 );
7181 0 : fd_vote_authorize_walk( w, &self->authorization_type, fun, "authorization_type", level, 0 );
7182 0 : fd_pubkey_walk( w, &self->current_authority_derived_key_owner, fun, "current_authority_derived_key_owner", level, 0 );
7183 0 : if( self->current_authority_derived_key_seed_len ) {
7184 0 : fun( w, NULL, "current_authority_derived_key_seed", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
7185 0 : for( ulong i=0; i < self->current_authority_derived_key_seed_len; i++ )
7186 0 : fun( w, self->current_authority_derived_key_seed + i, "current_authority_derived_key_seed", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
7187 0 : fun( w, NULL, "current_authority_derived_key_seed", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
7188 0 : }
7189 0 : fd_pubkey_walk( w, &self->new_authority, fun, "new_authority", level, 0 );
7190 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_authorize_with_seed_args", level--, 0 );
7191 0 : }
7192 0 : ulong fd_vote_authorize_with_seed_args_size( fd_vote_authorize_with_seed_args_t const * self ) {
7193 0 : ulong size = 0;
7194 0 : size += fd_vote_authorize_size( &self->authorization_type );
7195 0 : size += fd_pubkey_size( &self->current_authority_derived_key_owner );
7196 0 : do {
7197 0 : size += sizeof(ulong);
7198 0 : size += self->current_authority_derived_key_seed_len;
7199 0 : } while(0);
7200 0 : size += fd_pubkey_size( &self->new_authority );
7201 0 : return size;
7202 0 : }
7203 :
7204 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 ) {
7205 0 : int err;
7206 0 : err = fd_vote_authorize_encode( &self->authorization_type, ctx );
7207 0 : if( FD_UNLIKELY( err ) ) return err;
7208 0 : err = fd_pubkey_encode( &self->current_authority_derived_key_owner, ctx );
7209 0 : if( FD_UNLIKELY( err ) ) return err;
7210 0 : err = fd_bincode_uint64_encode( self->current_authority_derived_key_seed_len, ctx );
7211 0 : if( FD_UNLIKELY(err) ) return err;
7212 0 : if( self->current_authority_derived_key_seed_len ) {
7213 0 : err = fd_bincode_bytes_encode( self->current_authority_derived_key_seed, self->current_authority_derived_key_seed_len, ctx );
7214 0 : if( FD_UNLIKELY( err ) ) return err;
7215 0 : }
7216 0 : return FD_BINCODE_SUCCESS;
7217 0 : }
7218 0 : static int fd_vote_authorize_checked_with_seed_args_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7219 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7220 0 : int err = 0;
7221 0 : err = fd_vote_authorize_decode_footprint_inner( ctx, total_sz );
7222 0 : if( FD_UNLIKELY( err ) ) return err;
7223 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
7224 0 : if( FD_UNLIKELY( err ) ) return err;
7225 0 : ulong current_authority_derived_key_seed_len;
7226 0 : err = fd_bincode_uint64_decode( ¤t_authority_derived_key_seed_len, ctx );
7227 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7228 0 : *total_sz += current_authority_derived_key_seed_len;
7229 0 : if( current_authority_derived_key_seed_len ) {
7230 0 : err = fd_bincode_bytes_decode_footprint( current_authority_derived_key_seed_len, ctx );
7231 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7232 0 : err = !fd_utf8_verify( (char const *) ctx->data - current_authority_derived_key_seed_len, current_authority_derived_key_seed_len );
7233 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7234 0 : }
7235 0 : return 0;
7236 0 : }
7237 0 : int fd_vote_authorize_checked_with_seed_args_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7238 0 : *total_sz += sizeof(fd_vote_authorize_checked_with_seed_args_t);
7239 0 : void const * start_data = ctx->data;
7240 0 : int err = fd_vote_authorize_checked_with_seed_args_decode_footprint_inner( ctx, total_sz );
7241 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7242 0 : ctx->data = start_data;
7243 0 : return err;
7244 0 : }
7245 0 : static void fd_vote_authorize_checked_with_seed_args_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7246 0 : fd_vote_authorize_checked_with_seed_args_t * self = (fd_vote_authorize_checked_with_seed_args_t *)struct_mem;
7247 0 : fd_vote_authorize_decode_inner( &self->authorization_type, alloc_mem, ctx );
7248 0 : fd_pubkey_decode_inner( &self->current_authority_derived_key_owner, alloc_mem, ctx );
7249 0 : fd_bincode_uint64_decode_unsafe( &self->current_authority_derived_key_seed_len, ctx );
7250 0 : if( self->current_authority_derived_key_seed_len ) {
7251 0 : self->current_authority_derived_key_seed = *alloc_mem;
7252 0 : fd_bincode_bytes_decode_unsafe( self->current_authority_derived_key_seed, self->current_authority_derived_key_seed_len, ctx );
7253 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->current_authority_derived_key_seed_len;
7254 0 : } else
7255 0 : self->current_authority_derived_key_seed = NULL;
7256 0 : }
7257 0 : void * fd_vote_authorize_checked_with_seed_args_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7258 0 : fd_vote_authorize_checked_with_seed_args_t * self = (fd_vote_authorize_checked_with_seed_args_t *)mem;
7259 0 : fd_vote_authorize_checked_with_seed_args_new( self );
7260 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_authorize_checked_with_seed_args_t);
7261 0 : void * * alloc_mem = &alloc_region;
7262 0 : fd_vote_authorize_checked_with_seed_args_decode_inner( mem, alloc_mem, ctx );
7263 0 : return self;
7264 0 : }
7265 0 : void fd_vote_authorize_checked_with_seed_args_new(fd_vote_authorize_checked_with_seed_args_t * self) {
7266 0 : fd_memset( self, 0, sizeof(fd_vote_authorize_checked_with_seed_args_t) );
7267 0 : fd_vote_authorize_new( &self->authorization_type );
7268 0 : fd_pubkey_new( &self->current_authority_derived_key_owner );
7269 0 : }
7270 0 : void fd_vote_authorize_checked_with_seed_args_walk( void * w, fd_vote_authorize_checked_with_seed_args_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
7271 0 : (void) varint;
7272 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_authorize_checked_with_seed_args", level++, 0 );
7273 0 : fd_vote_authorize_walk( w, &self->authorization_type, fun, "authorization_type", level, 0 );
7274 0 : fd_pubkey_walk( w, &self->current_authority_derived_key_owner, fun, "current_authority_derived_key_owner", level, 0 );
7275 0 : if( self->current_authority_derived_key_seed_len ) {
7276 0 : fun( w, NULL, "current_authority_derived_key_seed", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
7277 0 : for( ulong i=0; i < self->current_authority_derived_key_seed_len; i++ )
7278 0 : fun( w, self->current_authority_derived_key_seed + i, "current_authority_derived_key_seed", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
7279 0 : fun( w, NULL, "current_authority_derived_key_seed", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
7280 0 : }
7281 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_authorize_checked_with_seed_args", level--, 0 );
7282 0 : }
7283 0 : ulong fd_vote_authorize_checked_with_seed_args_size( fd_vote_authorize_checked_with_seed_args_t const * self ) {
7284 0 : ulong size = 0;
7285 0 : size += fd_vote_authorize_size( &self->authorization_type );
7286 0 : size += fd_pubkey_size( &self->current_authority_derived_key_owner );
7287 0 : do {
7288 0 : size += sizeof(ulong);
7289 0 : size += self->current_authority_derived_key_seed_len;
7290 0 : } while(0);
7291 0 : return size;
7292 0 : }
7293 :
7294 0 : FD_FN_PURE uchar fd_vote_instruction_is_initialize_account(fd_vote_instruction_t const * self) {
7295 0 : return self->discriminant == 0;
7296 0 : }
7297 0 : FD_FN_PURE uchar fd_vote_instruction_is_authorize(fd_vote_instruction_t const * self) {
7298 0 : return self->discriminant == 1;
7299 0 : }
7300 0 : FD_FN_PURE uchar fd_vote_instruction_is_vote(fd_vote_instruction_t const * self) {
7301 0 : return self->discriminant == 2;
7302 0 : }
7303 0 : FD_FN_PURE uchar fd_vote_instruction_is_withdraw(fd_vote_instruction_t const * self) {
7304 0 : return self->discriminant == 3;
7305 0 : }
7306 0 : FD_FN_PURE uchar fd_vote_instruction_is_update_validator_identity(fd_vote_instruction_t const * self) {
7307 0 : return self->discriminant == 4;
7308 0 : }
7309 0 : FD_FN_PURE uchar fd_vote_instruction_is_update_commission(fd_vote_instruction_t const * self) {
7310 0 : return self->discriminant == 5;
7311 0 : }
7312 0 : FD_FN_PURE uchar fd_vote_instruction_is_vote_switch(fd_vote_instruction_t const * self) {
7313 0 : return self->discriminant == 6;
7314 0 : }
7315 0 : FD_FN_PURE uchar fd_vote_instruction_is_authorize_checked(fd_vote_instruction_t const * self) {
7316 0 : return self->discriminant == 7;
7317 0 : }
7318 0 : FD_FN_PURE uchar fd_vote_instruction_is_update_vote_state(fd_vote_instruction_t const * self) {
7319 0 : return self->discriminant == 8;
7320 0 : }
7321 0 : FD_FN_PURE uchar fd_vote_instruction_is_update_vote_state_switch(fd_vote_instruction_t const * self) {
7322 0 : return self->discriminant == 9;
7323 0 : }
7324 0 : FD_FN_PURE uchar fd_vote_instruction_is_authorize_with_seed(fd_vote_instruction_t const * self) {
7325 0 : return self->discriminant == 10;
7326 0 : }
7327 0 : FD_FN_PURE uchar fd_vote_instruction_is_authorize_checked_with_seed(fd_vote_instruction_t const * self) {
7328 0 : return self->discriminant == 11;
7329 0 : }
7330 0 : FD_FN_PURE uchar fd_vote_instruction_is_compact_update_vote_state(fd_vote_instruction_t const * self) {
7331 0 : return self->discriminant == 12;
7332 0 : }
7333 0 : FD_FN_PURE uchar fd_vote_instruction_is_compact_update_vote_state_switch(fd_vote_instruction_t const * self) {
7334 0 : return self->discriminant == 13;
7335 0 : }
7336 0 : FD_FN_PURE uchar fd_vote_instruction_is_tower_sync(fd_vote_instruction_t const * self) {
7337 0 : return self->discriminant == 14;
7338 0 : }
7339 0 : FD_FN_PURE uchar fd_vote_instruction_is_tower_sync_switch(fd_vote_instruction_t const * self) {
7340 0 : return self->discriminant == 15;
7341 0 : }
7342 : void fd_vote_instruction_inner_new( fd_vote_instruction_inner_t * self, uint discriminant );
7343 0 : int fd_vote_instruction_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7344 0 : int err;
7345 0 : switch (discriminant) {
7346 0 : case 0: {
7347 0 : err = fd_vote_init_decode_footprint_inner( ctx, total_sz );
7348 0 : if( FD_UNLIKELY( err ) ) return err;
7349 0 : return FD_BINCODE_SUCCESS;
7350 0 : }
7351 0 : case 1: {
7352 0 : err = fd_vote_authorize_pubkey_decode_footprint_inner( ctx, total_sz );
7353 0 : if( FD_UNLIKELY( err ) ) return err;
7354 0 : return FD_BINCODE_SUCCESS;
7355 0 : }
7356 0 : case 2: {
7357 0 : err = fd_vote_decode_footprint_inner( ctx, total_sz );
7358 0 : if( FD_UNLIKELY( err ) ) return err;
7359 0 : return FD_BINCODE_SUCCESS;
7360 0 : }
7361 0 : case 3: {
7362 0 : err = fd_bincode_uint64_decode_footprint( ctx );
7363 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7364 0 : return FD_BINCODE_SUCCESS;
7365 0 : }
7366 0 : case 4: {
7367 0 : return FD_BINCODE_SUCCESS;
7368 0 : }
7369 0 : case 5: {
7370 0 : err = fd_bincode_uint8_decode_footprint( ctx );
7371 0 : if( FD_UNLIKELY( err ) ) return err;
7372 0 : return FD_BINCODE_SUCCESS;
7373 0 : }
7374 0 : case 6: {
7375 0 : err = fd_vote_switch_decode_footprint_inner( ctx, total_sz );
7376 0 : if( FD_UNLIKELY( err ) ) return err;
7377 0 : return FD_BINCODE_SUCCESS;
7378 0 : }
7379 0 : case 7: {
7380 0 : err = fd_vote_authorize_decode_footprint_inner( ctx, total_sz );
7381 0 : if( FD_UNLIKELY( err ) ) return err;
7382 0 : return FD_BINCODE_SUCCESS;
7383 0 : }
7384 0 : case 8: {
7385 0 : err = fd_vote_state_update_decode_footprint_inner( ctx, total_sz );
7386 0 : if( FD_UNLIKELY( err ) ) return err;
7387 0 : return FD_BINCODE_SUCCESS;
7388 0 : }
7389 0 : case 9: {
7390 0 : err = fd_update_vote_state_switch_decode_footprint_inner( ctx, total_sz );
7391 0 : if( FD_UNLIKELY( err ) ) return err;
7392 0 : return FD_BINCODE_SUCCESS;
7393 0 : }
7394 0 : case 10: {
7395 0 : err = fd_vote_authorize_with_seed_args_decode_footprint_inner( ctx, total_sz );
7396 0 : if( FD_UNLIKELY( err ) ) return err;
7397 0 : return FD_BINCODE_SUCCESS;
7398 0 : }
7399 0 : case 11: {
7400 0 : err = fd_vote_authorize_checked_with_seed_args_decode_footprint_inner( ctx, total_sz );
7401 0 : if( FD_UNLIKELY( err ) ) return err;
7402 0 : return FD_BINCODE_SUCCESS;
7403 0 : }
7404 0 : case 12: {
7405 0 : err = fd_compact_vote_state_update_decode_footprint_inner( ctx, total_sz );
7406 0 : if( FD_UNLIKELY( err ) ) return err;
7407 0 : return FD_BINCODE_SUCCESS;
7408 0 : }
7409 0 : case 13: {
7410 0 : err = fd_compact_vote_state_update_switch_decode_footprint_inner( ctx, total_sz );
7411 0 : if( FD_UNLIKELY( err ) ) return err;
7412 0 : return FD_BINCODE_SUCCESS;
7413 0 : }
7414 0 : case 14: {
7415 0 : err = fd_tower_sync_decode_footprint_inner( ctx, total_sz );
7416 0 : if( FD_UNLIKELY( err ) ) return err;
7417 0 : return FD_BINCODE_SUCCESS;
7418 0 : }
7419 0 : case 15: {
7420 0 : err = fd_tower_sync_switch_decode_footprint_inner( ctx, total_sz );
7421 0 : if( FD_UNLIKELY( err ) ) return err;
7422 0 : return FD_BINCODE_SUCCESS;
7423 0 : }
7424 0 : default: return FD_BINCODE_ERR_ENCODING;
7425 0 : }
7426 0 : }
7427 0 : static int fd_vote_instruction_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7428 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7429 0 : uint discriminant = 0;
7430 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
7431 0 : if( FD_UNLIKELY( err ) ) return err;
7432 0 : return fd_vote_instruction_inner_decode_footprint( discriminant, ctx, total_sz );
7433 0 : }
7434 0 : int fd_vote_instruction_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7435 0 : *total_sz += sizeof(fd_vote_instruction_t);
7436 0 : void const * start_data = ctx->data;
7437 0 : int err = fd_vote_instruction_decode_footprint_inner( ctx, total_sz );
7438 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7439 0 : ctx->data = start_data;
7440 0 : return err;
7441 0 : }
7442 0 : static void fd_vote_instruction_inner_decode_inner( fd_vote_instruction_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
7443 0 : switch (discriminant) {
7444 0 : case 0: {
7445 0 : fd_vote_init_decode_inner( &self->initialize_account, alloc_mem, ctx );
7446 0 : break;
7447 0 : }
7448 0 : case 1: {
7449 0 : fd_vote_authorize_pubkey_decode_inner( &self->authorize, alloc_mem, ctx );
7450 0 : break;
7451 0 : }
7452 0 : case 2: {
7453 0 : fd_vote_decode_inner( &self->vote, alloc_mem, ctx );
7454 0 : break;
7455 0 : }
7456 0 : case 3: {
7457 0 : fd_bincode_uint64_decode_unsafe( &self->withdraw, ctx );
7458 0 : break;
7459 0 : }
7460 0 : case 4: {
7461 0 : break;
7462 0 : }
7463 0 : case 5: {
7464 0 : fd_bincode_uint8_decode_unsafe( &self->update_commission, ctx );
7465 0 : break;
7466 0 : }
7467 0 : case 6: {
7468 0 : fd_vote_switch_decode_inner( &self->vote_switch, alloc_mem, ctx );
7469 0 : break;
7470 0 : }
7471 0 : case 7: {
7472 0 : fd_vote_authorize_decode_inner( &self->authorize_checked, alloc_mem, ctx );
7473 0 : break;
7474 0 : }
7475 0 : case 8: {
7476 0 : fd_vote_state_update_decode_inner( &self->update_vote_state, alloc_mem, ctx );
7477 0 : break;
7478 0 : }
7479 0 : case 9: {
7480 0 : fd_update_vote_state_switch_decode_inner( &self->update_vote_state_switch, alloc_mem, ctx );
7481 0 : break;
7482 0 : }
7483 0 : case 10: {
7484 0 : fd_vote_authorize_with_seed_args_decode_inner( &self->authorize_with_seed, alloc_mem, ctx );
7485 0 : break;
7486 0 : }
7487 0 : case 11: {
7488 0 : fd_vote_authorize_checked_with_seed_args_decode_inner( &self->authorize_checked_with_seed, alloc_mem, ctx );
7489 0 : break;
7490 0 : }
7491 0 : case 12: {
7492 0 : fd_compact_vote_state_update_decode_inner( &self->compact_update_vote_state, alloc_mem, ctx );
7493 0 : break;
7494 0 : }
7495 0 : case 13: {
7496 0 : fd_compact_vote_state_update_switch_decode_inner( &self->compact_update_vote_state_switch, alloc_mem, ctx );
7497 0 : break;
7498 0 : }
7499 0 : case 14: {
7500 0 : fd_tower_sync_decode_inner( &self->tower_sync, alloc_mem, ctx );
7501 0 : break;
7502 0 : }
7503 0 : case 15: {
7504 0 : fd_tower_sync_switch_decode_inner( &self->tower_sync_switch, alloc_mem, ctx );
7505 0 : break;
7506 0 : }
7507 0 : }
7508 0 : }
7509 0 : static void fd_vote_instruction_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7510 0 : fd_vote_instruction_t * self = (fd_vote_instruction_t *)struct_mem;
7511 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
7512 0 : fd_vote_instruction_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
7513 0 : }
7514 0 : void * fd_vote_instruction_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7515 0 : fd_vote_instruction_t * self = (fd_vote_instruction_t *)mem;
7516 0 : fd_vote_instruction_new( self );
7517 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_instruction_t);
7518 0 : void * * alloc_mem = &alloc_region;
7519 0 : fd_vote_instruction_decode_inner( mem, alloc_mem, ctx );
7520 0 : return self;
7521 0 : }
7522 0 : void fd_vote_instruction_inner_new( fd_vote_instruction_inner_t * self, uint discriminant ) {
7523 0 : switch( discriminant ) {
7524 0 : case 0: {
7525 0 : fd_vote_init_new( &self->initialize_account );
7526 0 : break;
7527 0 : }
7528 0 : case 1: {
7529 0 : fd_vote_authorize_pubkey_new( &self->authorize );
7530 0 : break;
7531 0 : }
7532 0 : case 2: {
7533 0 : fd_vote_new( &self->vote );
7534 0 : break;
7535 0 : }
7536 0 : case 3: {
7537 0 : break;
7538 0 : }
7539 0 : case 4: {
7540 0 : break;
7541 0 : }
7542 0 : case 5: {
7543 0 : break;
7544 0 : }
7545 0 : case 6: {
7546 0 : fd_vote_switch_new( &self->vote_switch );
7547 0 : break;
7548 0 : }
7549 0 : case 7: {
7550 0 : fd_vote_authorize_new( &self->authorize_checked );
7551 0 : break;
7552 0 : }
7553 0 : case 8: {
7554 0 : fd_vote_state_update_new( &self->update_vote_state );
7555 0 : break;
7556 0 : }
7557 0 : case 9: {
7558 0 : fd_update_vote_state_switch_new( &self->update_vote_state_switch );
7559 0 : break;
7560 0 : }
7561 0 : case 10: {
7562 0 : fd_vote_authorize_with_seed_args_new( &self->authorize_with_seed );
7563 0 : break;
7564 0 : }
7565 0 : case 11: {
7566 0 : fd_vote_authorize_checked_with_seed_args_new( &self->authorize_checked_with_seed );
7567 0 : break;
7568 0 : }
7569 0 : case 12: {
7570 0 : fd_compact_vote_state_update_new( &self->compact_update_vote_state );
7571 0 : break;
7572 0 : }
7573 0 : case 13: {
7574 0 : fd_compact_vote_state_update_switch_new( &self->compact_update_vote_state_switch );
7575 0 : break;
7576 0 : }
7577 0 : case 14: {
7578 0 : fd_tower_sync_new( &self->tower_sync );
7579 0 : break;
7580 0 : }
7581 0 : case 15: {
7582 0 : fd_tower_sync_switch_new( &self->tower_sync_switch );
7583 0 : break;
7584 0 : }
7585 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
7586 0 : }
7587 0 : }
7588 0 : void fd_vote_instruction_new_disc( fd_vote_instruction_t * self, uint discriminant ) {
7589 0 : self->discriminant = discriminant;
7590 0 : fd_vote_instruction_inner_new( &self->inner, self->discriminant );
7591 0 : }
7592 0 : void fd_vote_instruction_new( fd_vote_instruction_t * self ) {
7593 0 : fd_memset( self, 0, sizeof(fd_vote_instruction_t) );
7594 0 : fd_vote_instruction_new_disc( self, UINT_MAX );
7595 0 : }
7596 :
7597 0 : void fd_vote_instruction_walk( void * w, fd_vote_instruction_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
7598 0 : (void) varint;
7599 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_vote_instruction", level++, 0);
7600 0 : switch( self->discriminant ) {
7601 0 : case 0: {
7602 0 : fun( w, self, "initialize_account", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
7603 0 : fd_vote_init_walk( w, &self->inner.initialize_account, fun, "initialize_account", level, 0 );
7604 0 : break;
7605 0 : }
7606 0 : case 1: {
7607 0 : fun( w, self, "authorize", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
7608 0 : fd_vote_authorize_pubkey_walk( w, &self->inner.authorize, fun, "authorize", level, 0 );
7609 0 : break;
7610 0 : }
7611 0 : case 2: {
7612 0 : fun( w, self, "vote", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
7613 0 : fd_vote_walk( w, &self->inner.vote, fun, "vote", level, 0 );
7614 0 : break;
7615 0 : }
7616 0 : case 3: {
7617 0 : fun( w, self, "withdraw", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
7618 0 : fun( w, &self->inner.withdraw, "withdraw", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
7619 0 : break;
7620 0 : }
7621 0 : case 4: {
7622 0 : fun( w, self, "update_validator_identity", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
7623 0 : break;
7624 0 : }
7625 0 : case 5: {
7626 0 : fun( w, self, "update_commission", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
7627 0 : fun( w, &self->inner.update_commission, "update_commission", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
7628 0 : break;
7629 0 : }
7630 0 : case 6: {
7631 0 : fun( w, self, "vote_switch", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
7632 0 : fd_vote_switch_walk( w, &self->inner.vote_switch, fun, "vote_switch", level, 0 );
7633 0 : break;
7634 0 : }
7635 0 : case 7: {
7636 0 : fun( w, self, "authorize_checked", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
7637 0 : fd_vote_authorize_walk( w, &self->inner.authorize_checked, fun, "authorize_checked", level, 0 );
7638 0 : break;
7639 0 : }
7640 0 : case 8: {
7641 0 : fun( w, self, "update_vote_state", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
7642 0 : fd_vote_state_update_walk( w, &self->inner.update_vote_state, fun, "update_vote_state", level, 0 );
7643 0 : break;
7644 0 : }
7645 0 : case 9: {
7646 0 : fun( w, self, "update_vote_state_switch", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
7647 0 : fd_update_vote_state_switch_walk( w, &self->inner.update_vote_state_switch, fun, "update_vote_state_switch", level, 0 );
7648 0 : break;
7649 0 : }
7650 0 : case 10: {
7651 0 : fun( w, self, "authorize_with_seed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
7652 0 : fd_vote_authorize_with_seed_args_walk( w, &self->inner.authorize_with_seed, fun, "authorize_with_seed", level, 0 );
7653 0 : break;
7654 0 : }
7655 0 : case 11: {
7656 0 : fun( w, self, "authorize_checked_with_seed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
7657 0 : fd_vote_authorize_checked_with_seed_args_walk( w, &self->inner.authorize_checked_with_seed, fun, "authorize_checked_with_seed", level, 0 );
7658 0 : break;
7659 0 : }
7660 0 : case 12: {
7661 0 : fun( w, self, "compact_update_vote_state", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
7662 0 : fd_compact_vote_state_update_walk( w, &self->inner.compact_update_vote_state, fun, "compact_update_vote_state", level, 0 );
7663 0 : break;
7664 0 : }
7665 0 : case 13: {
7666 0 : fun( w, self, "compact_update_vote_state_switch", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
7667 0 : fd_compact_vote_state_update_switch_walk( w, &self->inner.compact_update_vote_state_switch, fun, "compact_update_vote_state_switch", level, 0 );
7668 0 : break;
7669 0 : }
7670 0 : case 14: {
7671 0 : fun( w, self, "tower_sync", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
7672 0 : fd_tower_sync_walk( w, &self->inner.tower_sync, fun, "tower_sync", level, 0 );
7673 0 : break;
7674 0 : }
7675 0 : case 15: {
7676 0 : fun( w, self, "tower_sync_switch", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
7677 0 : fd_tower_sync_switch_walk( w, &self->inner.tower_sync_switch, fun, "tower_sync_switch", level, 0 );
7678 0 : break;
7679 0 : }
7680 0 : }
7681 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_vote_instruction", level--, 0 );
7682 0 : }
7683 0 : ulong fd_vote_instruction_size( fd_vote_instruction_t const * self ) {
7684 0 : ulong size = 0;
7685 0 : size += sizeof(uint);
7686 0 : switch (self->discriminant) {
7687 0 : case 0: {
7688 0 : size += fd_vote_init_size( &self->inner.initialize_account );
7689 0 : break;
7690 0 : }
7691 0 : case 1: {
7692 0 : size += fd_vote_authorize_pubkey_size( &self->inner.authorize );
7693 0 : break;
7694 0 : }
7695 0 : case 2: {
7696 0 : size += fd_vote_size( &self->inner.vote );
7697 0 : break;
7698 0 : }
7699 0 : case 3: {
7700 0 : size += sizeof(ulong);
7701 0 : break;
7702 0 : }
7703 0 : case 5: {
7704 0 : size += sizeof(char);
7705 0 : break;
7706 0 : }
7707 0 : case 6: {
7708 0 : size += fd_vote_switch_size( &self->inner.vote_switch );
7709 0 : break;
7710 0 : }
7711 0 : case 7: {
7712 0 : size += fd_vote_authorize_size( &self->inner.authorize_checked );
7713 0 : break;
7714 0 : }
7715 0 : case 8: {
7716 0 : size += fd_vote_state_update_size( &self->inner.update_vote_state );
7717 0 : break;
7718 0 : }
7719 0 : case 9: {
7720 0 : size += fd_update_vote_state_switch_size( &self->inner.update_vote_state_switch );
7721 0 : break;
7722 0 : }
7723 0 : case 10: {
7724 0 : size += fd_vote_authorize_with_seed_args_size( &self->inner.authorize_with_seed );
7725 0 : break;
7726 0 : }
7727 0 : case 11: {
7728 0 : size += fd_vote_authorize_checked_with_seed_args_size( &self->inner.authorize_checked_with_seed );
7729 0 : break;
7730 0 : }
7731 0 : case 12: {
7732 0 : size += fd_compact_vote_state_update_size( &self->inner.compact_update_vote_state );
7733 0 : break;
7734 0 : }
7735 0 : case 13: {
7736 0 : size += fd_compact_vote_state_update_switch_size( &self->inner.compact_update_vote_state_switch );
7737 0 : break;
7738 0 : }
7739 0 : case 14: {
7740 0 : size += fd_tower_sync_size( &self->inner.tower_sync );
7741 0 : break;
7742 0 : }
7743 0 : case 15: {
7744 0 : size += fd_tower_sync_switch_size( &self->inner.tower_sync_switch );
7745 0 : break;
7746 0 : }
7747 0 : }
7748 0 : return size;
7749 0 : }
7750 :
7751 0 : int fd_vote_instruction_inner_encode( fd_vote_instruction_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
7752 0 : int err;
7753 0 : switch (discriminant) {
7754 0 : case 0: {
7755 0 : err = fd_vote_init_encode( &self->initialize_account, ctx );
7756 0 : if( FD_UNLIKELY( err ) ) return err;
7757 0 : break;
7758 0 : }
7759 0 : case 1: {
7760 0 : err = fd_vote_authorize_pubkey_encode( &self->authorize, ctx );
7761 0 : if( FD_UNLIKELY( err ) ) return err;
7762 0 : break;
7763 0 : }
7764 0 : case 2: {
7765 0 : err = fd_vote_encode( &self->vote, ctx );
7766 0 : if( FD_UNLIKELY( err ) ) return err;
7767 0 : break;
7768 0 : }
7769 0 : case 3: {
7770 0 : err = fd_bincode_uint64_encode( self->withdraw, ctx );
7771 0 : if( FD_UNLIKELY( err ) ) return err;
7772 0 : break;
7773 0 : }
7774 0 : case 5: {
7775 0 : err = fd_bincode_uint8_encode( (uchar)(self->update_commission), ctx );
7776 0 : if( FD_UNLIKELY( err ) ) return err;
7777 0 : break;
7778 0 : }
7779 0 : case 6: {
7780 0 : err = fd_vote_switch_encode( &self->vote_switch, ctx );
7781 0 : if( FD_UNLIKELY( err ) ) return err;
7782 0 : break;
7783 0 : }
7784 0 : case 7: {
7785 0 : err = fd_vote_authorize_encode( &self->authorize_checked, ctx );
7786 0 : if( FD_UNLIKELY( err ) ) return err;
7787 0 : break;
7788 0 : }
7789 0 : case 8: {
7790 0 : err = fd_vote_state_update_encode( &self->update_vote_state, ctx );
7791 0 : if( FD_UNLIKELY( err ) ) return err;
7792 0 : break;
7793 0 : }
7794 0 : case 9: {
7795 0 : err = fd_update_vote_state_switch_encode( &self->update_vote_state_switch, ctx );
7796 0 : if( FD_UNLIKELY( err ) ) return err;
7797 0 : break;
7798 0 : }
7799 0 : case 10: {
7800 0 : err = fd_vote_authorize_with_seed_args_encode( &self->authorize_with_seed, ctx );
7801 0 : if( FD_UNLIKELY( err ) ) return err;
7802 0 : break;
7803 0 : }
7804 0 : case 11: {
7805 0 : err = fd_vote_authorize_checked_with_seed_args_encode( &self->authorize_checked_with_seed, ctx );
7806 0 : if( FD_UNLIKELY( err ) ) return err;
7807 0 : break;
7808 0 : }
7809 0 : case 12: {
7810 0 : err = fd_compact_vote_state_update_encode( &self->compact_update_vote_state, ctx );
7811 0 : if( FD_UNLIKELY( err ) ) return err;
7812 0 : break;
7813 0 : }
7814 0 : case 13: {
7815 0 : err = fd_compact_vote_state_update_switch_encode( &self->compact_update_vote_state_switch, ctx );
7816 0 : if( FD_UNLIKELY( err ) ) return err;
7817 0 : break;
7818 0 : }
7819 0 : case 14: {
7820 0 : err = fd_tower_sync_encode( &self->tower_sync, ctx );
7821 0 : if( FD_UNLIKELY( err ) ) return err;
7822 0 : break;
7823 0 : }
7824 0 : case 15: {
7825 0 : err = fd_tower_sync_switch_encode( &self->tower_sync_switch, ctx );
7826 0 : if( FD_UNLIKELY( err ) ) return err;
7827 0 : break;
7828 0 : }
7829 0 : }
7830 0 : return FD_BINCODE_SUCCESS;
7831 0 : }
7832 0 : int fd_vote_instruction_encode( fd_vote_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7833 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
7834 0 : if( FD_UNLIKELY( err ) ) return err;
7835 0 : return fd_vote_instruction_inner_encode( &self->inner, self->discriminant, ctx );
7836 0 : }
7837 :
7838 0 : int fd_system_program_instruction_create_account_encode( fd_system_program_instruction_create_account_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7839 0 : int err;
7840 0 : err = fd_bincode_uint64_encode( self->lamports, ctx );
7841 0 : if( FD_UNLIKELY( err ) ) return err;
7842 0 : err = fd_bincode_uint64_encode( self->space, ctx );
7843 0 : if( FD_UNLIKELY( err ) ) return err;
7844 0 : err = fd_pubkey_encode( &self->owner, ctx );
7845 0 : if( FD_UNLIKELY( err ) ) return err;
7846 0 : return FD_BINCODE_SUCCESS;
7847 0 : }
7848 0 : static inline int fd_system_program_instruction_create_account_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7849 0 : if( (ulong)ctx->data + 48UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7850 0 : ctx->data = (void *)( (ulong)ctx->data + 48UL );
7851 0 : return 0;
7852 0 : }
7853 0 : static void fd_system_program_instruction_create_account_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7854 0 : fd_system_program_instruction_create_account_t * self = (fd_system_program_instruction_create_account_t *)struct_mem;
7855 0 : fd_bincode_uint64_decode_unsafe( &self->lamports, ctx );
7856 0 : fd_bincode_uint64_decode_unsafe( &self->space, ctx );
7857 0 : fd_pubkey_decode_inner( &self->owner, alloc_mem, ctx );
7858 0 : }
7859 0 : void * fd_system_program_instruction_create_account_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7860 0 : fd_system_program_instruction_create_account_t * self = (fd_system_program_instruction_create_account_t *)mem;
7861 0 : fd_system_program_instruction_create_account_new( self );
7862 0 : void * alloc_region = (uchar *)mem + sizeof(fd_system_program_instruction_create_account_t);
7863 0 : void * * alloc_mem = &alloc_region;
7864 0 : fd_system_program_instruction_create_account_decode_inner( mem, alloc_mem, ctx );
7865 0 : return self;
7866 0 : }
7867 0 : void fd_system_program_instruction_create_account_walk( void * w, fd_system_program_instruction_create_account_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
7868 0 : (void) varint;
7869 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_system_program_instruction_create_account", level++, 0 );
7870 0 : fun( w, &self->lamports, "lamports", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
7871 0 : fun( w, &self->space, "space", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
7872 0 : fd_pubkey_walk( w, &self->owner, fun, "owner", level, 0 );
7873 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_system_program_instruction_create_account", level--, 0 );
7874 0 : }
7875 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 ) {
7876 0 : int err;
7877 0 : err = fd_pubkey_encode( &self->base, ctx );
7878 0 : if( FD_UNLIKELY( err ) ) return err;
7879 0 : err = fd_bincode_uint64_encode( self->seed_len, ctx );
7880 0 : if( FD_UNLIKELY(err) ) return err;
7881 0 : if( self->seed_len ) {
7882 0 : err = fd_bincode_bytes_encode( self->seed, self->seed_len, ctx );
7883 0 : if( FD_UNLIKELY( err ) ) return err;
7884 0 : }
7885 0 : err = fd_bincode_uint64_encode( self->lamports, ctx );
7886 0 : if( FD_UNLIKELY( err ) ) return err;
7887 0 : err = fd_bincode_uint64_encode( self->space, ctx );
7888 0 : if( FD_UNLIKELY( err ) ) return err;
7889 0 : err = fd_pubkey_encode( &self->owner, ctx );
7890 0 : if( FD_UNLIKELY( err ) ) return err;
7891 0 : return FD_BINCODE_SUCCESS;
7892 0 : }
7893 0 : static int fd_system_program_instruction_create_account_with_seed_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7894 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7895 0 : int err = 0;
7896 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
7897 0 : if( FD_UNLIKELY( err ) ) return err;
7898 0 : ulong seed_len;
7899 0 : err = fd_bincode_uint64_decode( &seed_len, ctx );
7900 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7901 0 : *total_sz += seed_len;
7902 0 : if( seed_len ) {
7903 0 : err = fd_bincode_bytes_decode_footprint( seed_len, ctx );
7904 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7905 0 : err = !fd_utf8_verify( (char const *) ctx->data - seed_len, seed_len );
7906 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7907 0 : }
7908 0 : err = fd_bincode_uint64_decode_footprint( ctx );
7909 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7910 0 : err = fd_bincode_uint64_decode_footprint( ctx );
7911 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7912 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
7913 0 : if( FD_UNLIKELY( err ) ) return err;
7914 0 : return 0;
7915 0 : }
7916 0 : int fd_system_program_instruction_create_account_with_seed_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7917 0 : *total_sz += sizeof(fd_system_program_instruction_create_account_with_seed_t);
7918 0 : void const * start_data = ctx->data;
7919 0 : int err = fd_system_program_instruction_create_account_with_seed_decode_footprint_inner( ctx, total_sz );
7920 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7921 0 : ctx->data = start_data;
7922 0 : return err;
7923 0 : }
7924 0 : static void fd_system_program_instruction_create_account_with_seed_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7925 0 : fd_system_program_instruction_create_account_with_seed_t * self = (fd_system_program_instruction_create_account_with_seed_t *)struct_mem;
7926 0 : fd_pubkey_decode_inner( &self->base, alloc_mem, ctx );
7927 0 : fd_bincode_uint64_decode_unsafe( &self->seed_len, ctx );
7928 0 : if( self->seed_len ) {
7929 0 : self->seed = *alloc_mem;
7930 0 : fd_bincode_bytes_decode_unsafe( self->seed, self->seed_len, ctx );
7931 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->seed_len;
7932 0 : } else
7933 0 : self->seed = NULL;
7934 0 : fd_bincode_uint64_decode_unsafe( &self->lamports, ctx );
7935 0 : fd_bincode_uint64_decode_unsafe( &self->space, ctx );
7936 0 : fd_pubkey_decode_inner( &self->owner, alloc_mem, ctx );
7937 0 : }
7938 0 : void * fd_system_program_instruction_create_account_with_seed_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7939 0 : fd_system_program_instruction_create_account_with_seed_t * self = (fd_system_program_instruction_create_account_with_seed_t *)mem;
7940 0 : fd_system_program_instruction_create_account_with_seed_new( self );
7941 0 : void * alloc_region = (uchar *)mem + sizeof(fd_system_program_instruction_create_account_with_seed_t);
7942 0 : void * * alloc_mem = &alloc_region;
7943 0 : fd_system_program_instruction_create_account_with_seed_decode_inner( mem, alloc_mem, ctx );
7944 0 : return self;
7945 0 : }
7946 0 : void fd_system_program_instruction_create_account_with_seed_new(fd_system_program_instruction_create_account_with_seed_t * self) {
7947 0 : fd_memset( self, 0, sizeof(fd_system_program_instruction_create_account_with_seed_t) );
7948 0 : fd_pubkey_new( &self->base );
7949 0 : fd_pubkey_new( &self->owner );
7950 0 : }
7951 0 : void fd_system_program_instruction_create_account_with_seed_walk( void * w, fd_system_program_instruction_create_account_with_seed_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
7952 0 : (void) varint;
7953 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_system_program_instruction_create_account_with_seed", level++, 0 );
7954 0 : fd_pubkey_walk( w, &self->base, fun, "base", level, 0 );
7955 0 : if( self->seed_len ) {
7956 0 : fun( w, NULL, "seed", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
7957 0 : for( ulong i=0; i < self->seed_len; i++ )
7958 0 : fun( w, self->seed + i, "seed", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
7959 0 : fun( w, NULL, "seed", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
7960 0 : }
7961 0 : fun( w, &self->lamports, "lamports", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
7962 0 : fun( w, &self->space, "space", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
7963 0 : fd_pubkey_walk( w, &self->owner, fun, "owner", level, 0 );
7964 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_system_program_instruction_create_account_with_seed", level--, 0 );
7965 0 : }
7966 0 : ulong fd_system_program_instruction_create_account_with_seed_size( fd_system_program_instruction_create_account_with_seed_t const * self ) {
7967 0 : ulong size = 0;
7968 0 : size += fd_pubkey_size( &self->base );
7969 0 : do {
7970 0 : size += sizeof(ulong);
7971 0 : size += self->seed_len;
7972 0 : } while(0);
7973 0 : size += sizeof(ulong);
7974 0 : size += sizeof(ulong);
7975 0 : size += fd_pubkey_size( &self->owner );
7976 0 : return size;
7977 0 : }
7978 :
7979 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 ) {
7980 0 : int err;
7981 0 : err = fd_pubkey_encode( &self->base, ctx );
7982 0 : if( FD_UNLIKELY( err ) ) return err;
7983 0 : err = fd_bincode_uint64_encode( self->seed_len, ctx );
7984 0 : if( FD_UNLIKELY(err) ) return err;
7985 0 : if( self->seed_len ) {
7986 0 : err = fd_bincode_bytes_encode( self->seed, self->seed_len, ctx );
7987 0 : if( FD_UNLIKELY( err ) ) return err;
7988 0 : }
7989 0 : err = fd_bincode_uint64_encode( self->space, ctx );
7990 0 : if( FD_UNLIKELY( err ) ) return err;
7991 0 : err = fd_pubkey_encode( &self->owner, ctx );
7992 0 : if( FD_UNLIKELY( err ) ) return err;
7993 0 : return FD_BINCODE_SUCCESS;
7994 0 : }
7995 0 : static int fd_system_program_instruction_allocate_with_seed_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7996 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7997 0 : int err = 0;
7998 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
7999 0 : if( FD_UNLIKELY( err ) ) return err;
8000 0 : ulong seed_len;
8001 0 : err = fd_bincode_uint64_decode( &seed_len, ctx );
8002 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8003 0 : *total_sz += seed_len;
8004 0 : if( seed_len ) {
8005 0 : err = fd_bincode_bytes_decode_footprint( seed_len, ctx );
8006 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8007 0 : err = !fd_utf8_verify( (char const *) ctx->data - seed_len, seed_len );
8008 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8009 0 : }
8010 0 : err = fd_bincode_uint64_decode_footprint( ctx );
8011 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8012 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
8013 0 : if( FD_UNLIKELY( err ) ) return err;
8014 0 : return 0;
8015 0 : }
8016 0 : int fd_system_program_instruction_allocate_with_seed_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8017 0 : *total_sz += sizeof(fd_system_program_instruction_allocate_with_seed_t);
8018 0 : void const * start_data = ctx->data;
8019 0 : int err = fd_system_program_instruction_allocate_with_seed_decode_footprint_inner( ctx, total_sz );
8020 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8021 0 : ctx->data = start_data;
8022 0 : return err;
8023 0 : }
8024 0 : static void fd_system_program_instruction_allocate_with_seed_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8025 0 : fd_system_program_instruction_allocate_with_seed_t * self = (fd_system_program_instruction_allocate_with_seed_t *)struct_mem;
8026 0 : fd_pubkey_decode_inner( &self->base, alloc_mem, ctx );
8027 0 : fd_bincode_uint64_decode_unsafe( &self->seed_len, ctx );
8028 0 : if( self->seed_len ) {
8029 0 : self->seed = *alloc_mem;
8030 0 : fd_bincode_bytes_decode_unsafe( self->seed, self->seed_len, ctx );
8031 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->seed_len;
8032 0 : } else
8033 0 : self->seed = NULL;
8034 0 : fd_bincode_uint64_decode_unsafe( &self->space, ctx );
8035 0 : fd_pubkey_decode_inner( &self->owner, alloc_mem, ctx );
8036 0 : }
8037 0 : void * fd_system_program_instruction_allocate_with_seed_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8038 0 : fd_system_program_instruction_allocate_with_seed_t * self = (fd_system_program_instruction_allocate_with_seed_t *)mem;
8039 0 : fd_system_program_instruction_allocate_with_seed_new( self );
8040 0 : void * alloc_region = (uchar *)mem + sizeof(fd_system_program_instruction_allocate_with_seed_t);
8041 0 : void * * alloc_mem = &alloc_region;
8042 0 : fd_system_program_instruction_allocate_with_seed_decode_inner( mem, alloc_mem, ctx );
8043 0 : return self;
8044 0 : }
8045 0 : void fd_system_program_instruction_allocate_with_seed_new(fd_system_program_instruction_allocate_with_seed_t * self) {
8046 0 : fd_memset( self, 0, sizeof(fd_system_program_instruction_allocate_with_seed_t) );
8047 0 : fd_pubkey_new( &self->base );
8048 0 : fd_pubkey_new( &self->owner );
8049 0 : }
8050 0 : void fd_system_program_instruction_allocate_with_seed_walk( void * w, fd_system_program_instruction_allocate_with_seed_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
8051 0 : (void) varint;
8052 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_system_program_instruction_allocate_with_seed", level++, 0 );
8053 0 : fd_pubkey_walk( w, &self->base, fun, "base", level, 0 );
8054 0 : if( self->seed_len ) {
8055 0 : fun( w, NULL, "seed", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
8056 0 : for( ulong i=0; i < self->seed_len; i++ )
8057 0 : fun( w, self->seed + i, "seed", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
8058 0 : fun( w, NULL, "seed", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
8059 0 : }
8060 0 : fun( w, &self->space, "space", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
8061 0 : fd_pubkey_walk( w, &self->owner, fun, "owner", level, 0 );
8062 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_system_program_instruction_allocate_with_seed", level--, 0 );
8063 0 : }
8064 0 : ulong fd_system_program_instruction_allocate_with_seed_size( fd_system_program_instruction_allocate_with_seed_t const * self ) {
8065 0 : ulong size = 0;
8066 0 : size += fd_pubkey_size( &self->base );
8067 0 : do {
8068 0 : size += sizeof(ulong);
8069 0 : size += self->seed_len;
8070 0 : } while(0);
8071 0 : size += sizeof(ulong);
8072 0 : size += fd_pubkey_size( &self->owner );
8073 0 : return size;
8074 0 : }
8075 :
8076 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 ) {
8077 0 : int err;
8078 0 : err = fd_pubkey_encode( &self->base, ctx );
8079 0 : if( FD_UNLIKELY( err ) ) return err;
8080 0 : err = fd_bincode_uint64_encode( self->seed_len, ctx );
8081 0 : if( FD_UNLIKELY(err) ) return err;
8082 0 : if( self->seed_len ) {
8083 0 : err = fd_bincode_bytes_encode( self->seed, self->seed_len, ctx );
8084 0 : if( FD_UNLIKELY( err ) ) return err;
8085 0 : }
8086 0 : err = fd_pubkey_encode( &self->owner, ctx );
8087 0 : if( FD_UNLIKELY( err ) ) return err;
8088 0 : return FD_BINCODE_SUCCESS;
8089 0 : }
8090 0 : static int fd_system_program_instruction_assign_with_seed_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8091 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8092 0 : int err = 0;
8093 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
8094 0 : if( FD_UNLIKELY( err ) ) return err;
8095 0 : ulong seed_len;
8096 0 : err = fd_bincode_uint64_decode( &seed_len, ctx );
8097 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8098 0 : *total_sz += seed_len;
8099 0 : if( seed_len ) {
8100 0 : err = fd_bincode_bytes_decode_footprint( seed_len, ctx );
8101 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8102 0 : err = !fd_utf8_verify( (char const *) ctx->data - seed_len, seed_len );
8103 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8104 0 : }
8105 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
8106 0 : if( FD_UNLIKELY( err ) ) return err;
8107 0 : return 0;
8108 0 : }
8109 0 : int fd_system_program_instruction_assign_with_seed_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8110 0 : *total_sz += sizeof(fd_system_program_instruction_assign_with_seed_t);
8111 0 : void const * start_data = ctx->data;
8112 0 : int err = fd_system_program_instruction_assign_with_seed_decode_footprint_inner( ctx, total_sz );
8113 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8114 0 : ctx->data = start_data;
8115 0 : return err;
8116 0 : }
8117 0 : static void fd_system_program_instruction_assign_with_seed_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8118 0 : fd_system_program_instruction_assign_with_seed_t * self = (fd_system_program_instruction_assign_with_seed_t *)struct_mem;
8119 0 : fd_pubkey_decode_inner( &self->base, alloc_mem, ctx );
8120 0 : fd_bincode_uint64_decode_unsafe( &self->seed_len, ctx );
8121 0 : if( self->seed_len ) {
8122 0 : self->seed = *alloc_mem;
8123 0 : fd_bincode_bytes_decode_unsafe( self->seed, self->seed_len, ctx );
8124 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->seed_len;
8125 0 : } else
8126 0 : self->seed = NULL;
8127 0 : fd_pubkey_decode_inner( &self->owner, alloc_mem, ctx );
8128 0 : }
8129 0 : void * fd_system_program_instruction_assign_with_seed_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8130 0 : fd_system_program_instruction_assign_with_seed_t * self = (fd_system_program_instruction_assign_with_seed_t *)mem;
8131 0 : fd_system_program_instruction_assign_with_seed_new( self );
8132 0 : void * alloc_region = (uchar *)mem + sizeof(fd_system_program_instruction_assign_with_seed_t);
8133 0 : void * * alloc_mem = &alloc_region;
8134 0 : fd_system_program_instruction_assign_with_seed_decode_inner( mem, alloc_mem, ctx );
8135 0 : return self;
8136 0 : }
8137 0 : void fd_system_program_instruction_assign_with_seed_new(fd_system_program_instruction_assign_with_seed_t * self) {
8138 0 : fd_memset( self, 0, sizeof(fd_system_program_instruction_assign_with_seed_t) );
8139 0 : fd_pubkey_new( &self->base );
8140 0 : fd_pubkey_new( &self->owner );
8141 0 : }
8142 0 : void fd_system_program_instruction_assign_with_seed_walk( void * w, fd_system_program_instruction_assign_with_seed_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
8143 0 : (void) varint;
8144 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_system_program_instruction_assign_with_seed", level++, 0 );
8145 0 : fd_pubkey_walk( w, &self->base, fun, "base", level, 0 );
8146 0 : if( self->seed_len ) {
8147 0 : fun( w, NULL, "seed", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
8148 0 : for( ulong i=0; i < self->seed_len; i++ )
8149 0 : fun( w, self->seed + i, "seed", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
8150 0 : fun( w, NULL, "seed", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
8151 0 : }
8152 0 : fd_pubkey_walk( w, &self->owner, fun, "owner", level, 0 );
8153 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_system_program_instruction_assign_with_seed", level--, 0 );
8154 0 : }
8155 0 : ulong fd_system_program_instruction_assign_with_seed_size( fd_system_program_instruction_assign_with_seed_t const * self ) {
8156 0 : ulong size = 0;
8157 0 : size += fd_pubkey_size( &self->base );
8158 0 : do {
8159 0 : size += sizeof(ulong);
8160 0 : size += self->seed_len;
8161 0 : } while(0);
8162 0 : size += fd_pubkey_size( &self->owner );
8163 0 : return size;
8164 0 : }
8165 :
8166 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 ) {
8167 0 : int err;
8168 0 : err = fd_bincode_uint64_encode( self->lamports, ctx );
8169 0 : if( FD_UNLIKELY( err ) ) return err;
8170 0 : err = fd_bincode_uint64_encode( self->from_seed_len, ctx );
8171 0 : if( FD_UNLIKELY(err) ) return err;
8172 0 : if( self->from_seed_len ) {
8173 0 : err = fd_bincode_bytes_encode( self->from_seed, self->from_seed_len, ctx );
8174 0 : if( FD_UNLIKELY( err ) ) return err;
8175 0 : }
8176 0 : err = fd_pubkey_encode( &self->from_owner, ctx );
8177 0 : if( FD_UNLIKELY( err ) ) return err;
8178 0 : return FD_BINCODE_SUCCESS;
8179 0 : }
8180 0 : static int fd_system_program_instruction_transfer_with_seed_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8181 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8182 0 : int err = 0;
8183 0 : err = fd_bincode_uint64_decode_footprint( ctx );
8184 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8185 0 : ulong from_seed_len;
8186 0 : err = fd_bincode_uint64_decode( &from_seed_len, ctx );
8187 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8188 0 : *total_sz += from_seed_len;
8189 0 : if( from_seed_len ) {
8190 0 : err = fd_bincode_bytes_decode_footprint( from_seed_len, ctx );
8191 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8192 0 : err = !fd_utf8_verify( (char const *) ctx->data - from_seed_len, from_seed_len );
8193 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8194 0 : }
8195 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
8196 0 : if( FD_UNLIKELY( err ) ) return err;
8197 0 : return 0;
8198 0 : }
8199 0 : int fd_system_program_instruction_transfer_with_seed_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8200 0 : *total_sz += sizeof(fd_system_program_instruction_transfer_with_seed_t);
8201 0 : void const * start_data = ctx->data;
8202 0 : int err = fd_system_program_instruction_transfer_with_seed_decode_footprint_inner( ctx, total_sz );
8203 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8204 0 : ctx->data = start_data;
8205 0 : return err;
8206 0 : }
8207 0 : static void fd_system_program_instruction_transfer_with_seed_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8208 0 : fd_system_program_instruction_transfer_with_seed_t * self = (fd_system_program_instruction_transfer_with_seed_t *)struct_mem;
8209 0 : fd_bincode_uint64_decode_unsafe( &self->lamports, ctx );
8210 0 : fd_bincode_uint64_decode_unsafe( &self->from_seed_len, ctx );
8211 0 : if( self->from_seed_len ) {
8212 0 : self->from_seed = *alloc_mem;
8213 0 : fd_bincode_bytes_decode_unsafe( self->from_seed, self->from_seed_len, ctx );
8214 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->from_seed_len;
8215 0 : } else
8216 0 : self->from_seed = NULL;
8217 0 : fd_pubkey_decode_inner( &self->from_owner, alloc_mem, ctx );
8218 0 : }
8219 0 : void * fd_system_program_instruction_transfer_with_seed_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8220 0 : fd_system_program_instruction_transfer_with_seed_t * self = (fd_system_program_instruction_transfer_with_seed_t *)mem;
8221 0 : fd_system_program_instruction_transfer_with_seed_new( self );
8222 0 : void * alloc_region = (uchar *)mem + sizeof(fd_system_program_instruction_transfer_with_seed_t);
8223 0 : void * * alloc_mem = &alloc_region;
8224 0 : fd_system_program_instruction_transfer_with_seed_decode_inner( mem, alloc_mem, ctx );
8225 0 : return self;
8226 0 : }
8227 0 : void fd_system_program_instruction_transfer_with_seed_new(fd_system_program_instruction_transfer_with_seed_t * self) {
8228 0 : fd_memset( self, 0, sizeof(fd_system_program_instruction_transfer_with_seed_t) );
8229 0 : fd_pubkey_new( &self->from_owner );
8230 0 : }
8231 0 : void fd_system_program_instruction_transfer_with_seed_walk( void * w, fd_system_program_instruction_transfer_with_seed_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
8232 0 : (void) varint;
8233 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_system_program_instruction_transfer_with_seed", level++, 0 );
8234 0 : fun( w, &self->lamports, "lamports", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
8235 0 : if( self->from_seed_len ) {
8236 0 : fun( w, NULL, "from_seed", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
8237 0 : for( ulong i=0; i < self->from_seed_len; i++ )
8238 0 : fun( w, self->from_seed + i, "from_seed", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
8239 0 : fun( w, NULL, "from_seed", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
8240 0 : }
8241 0 : fd_pubkey_walk( w, &self->from_owner, fun, "from_owner", level, 0 );
8242 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_system_program_instruction_transfer_with_seed", level--, 0 );
8243 0 : }
8244 0 : ulong fd_system_program_instruction_transfer_with_seed_size( fd_system_program_instruction_transfer_with_seed_t const * self ) {
8245 0 : ulong size = 0;
8246 0 : size += sizeof(ulong);
8247 0 : do {
8248 0 : size += sizeof(ulong);
8249 0 : size += self->from_seed_len;
8250 0 : } while(0);
8251 0 : size += fd_pubkey_size( &self->from_owner );
8252 0 : return size;
8253 0 : }
8254 :
8255 0 : FD_FN_PURE uchar fd_system_program_instruction_is_create_account(fd_system_program_instruction_t const * self) {
8256 0 : return self->discriminant == 0;
8257 0 : }
8258 0 : FD_FN_PURE uchar fd_system_program_instruction_is_assign(fd_system_program_instruction_t const * self) {
8259 0 : return self->discriminant == 1;
8260 0 : }
8261 0 : FD_FN_PURE uchar fd_system_program_instruction_is_transfer(fd_system_program_instruction_t const * self) {
8262 0 : return self->discriminant == 2;
8263 0 : }
8264 0 : FD_FN_PURE uchar fd_system_program_instruction_is_create_account_with_seed(fd_system_program_instruction_t const * self) {
8265 0 : return self->discriminant == 3;
8266 0 : }
8267 0 : FD_FN_PURE uchar fd_system_program_instruction_is_advance_nonce_account(fd_system_program_instruction_t const * self) {
8268 0 : return self->discriminant == 4;
8269 0 : }
8270 0 : FD_FN_PURE uchar fd_system_program_instruction_is_withdraw_nonce_account(fd_system_program_instruction_t const * self) {
8271 0 : return self->discriminant == 5;
8272 0 : }
8273 0 : FD_FN_PURE uchar fd_system_program_instruction_is_initialize_nonce_account(fd_system_program_instruction_t const * self) {
8274 0 : return self->discriminant == 6;
8275 0 : }
8276 0 : FD_FN_PURE uchar fd_system_program_instruction_is_authorize_nonce_account(fd_system_program_instruction_t const * self) {
8277 0 : return self->discriminant == 7;
8278 0 : }
8279 0 : FD_FN_PURE uchar fd_system_program_instruction_is_allocate(fd_system_program_instruction_t const * self) {
8280 0 : return self->discriminant == 8;
8281 0 : }
8282 0 : FD_FN_PURE uchar fd_system_program_instruction_is_allocate_with_seed(fd_system_program_instruction_t const * self) {
8283 0 : return self->discriminant == 9;
8284 0 : }
8285 0 : FD_FN_PURE uchar fd_system_program_instruction_is_assign_with_seed(fd_system_program_instruction_t const * self) {
8286 0 : return self->discriminant == 10;
8287 0 : }
8288 0 : FD_FN_PURE uchar fd_system_program_instruction_is_transfer_with_seed(fd_system_program_instruction_t const * self) {
8289 0 : return self->discriminant == 11;
8290 0 : }
8291 0 : FD_FN_PURE uchar fd_system_program_instruction_is_upgrade_nonce_account(fd_system_program_instruction_t const * self) {
8292 0 : return self->discriminant == 12;
8293 0 : }
8294 : void fd_system_program_instruction_inner_new( fd_system_program_instruction_inner_t * self, uint discriminant );
8295 0 : int fd_system_program_instruction_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8296 0 : int err;
8297 0 : switch (discriminant) {
8298 0 : case 0: {
8299 0 : err = fd_system_program_instruction_create_account_decode_footprint_inner( ctx, total_sz );
8300 0 : if( FD_UNLIKELY( err ) ) return err;
8301 0 : return FD_BINCODE_SUCCESS;
8302 0 : }
8303 0 : case 1: {
8304 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
8305 0 : if( FD_UNLIKELY( err ) ) return err;
8306 0 : return FD_BINCODE_SUCCESS;
8307 0 : }
8308 0 : case 2: {
8309 0 : err = fd_bincode_uint64_decode_footprint( ctx );
8310 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8311 0 : return FD_BINCODE_SUCCESS;
8312 0 : }
8313 0 : case 3: {
8314 0 : err = fd_system_program_instruction_create_account_with_seed_decode_footprint_inner( ctx, total_sz );
8315 0 : if( FD_UNLIKELY( err ) ) return err;
8316 0 : return FD_BINCODE_SUCCESS;
8317 0 : }
8318 0 : case 4: {
8319 0 : return FD_BINCODE_SUCCESS;
8320 0 : }
8321 0 : case 5: {
8322 0 : err = fd_bincode_uint64_decode_footprint( ctx );
8323 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8324 0 : return FD_BINCODE_SUCCESS;
8325 0 : }
8326 0 : case 6: {
8327 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
8328 0 : if( FD_UNLIKELY( err ) ) return err;
8329 0 : return FD_BINCODE_SUCCESS;
8330 0 : }
8331 0 : case 7: {
8332 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
8333 0 : if( FD_UNLIKELY( err ) ) return err;
8334 0 : return FD_BINCODE_SUCCESS;
8335 0 : }
8336 0 : case 8: {
8337 0 : err = fd_bincode_uint64_decode_footprint( ctx );
8338 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8339 0 : return FD_BINCODE_SUCCESS;
8340 0 : }
8341 0 : case 9: {
8342 0 : err = fd_system_program_instruction_allocate_with_seed_decode_footprint_inner( ctx, total_sz );
8343 0 : if( FD_UNLIKELY( err ) ) return err;
8344 0 : return FD_BINCODE_SUCCESS;
8345 0 : }
8346 0 : case 10: {
8347 0 : err = fd_system_program_instruction_assign_with_seed_decode_footprint_inner( ctx, total_sz );
8348 0 : if( FD_UNLIKELY( err ) ) return err;
8349 0 : return FD_BINCODE_SUCCESS;
8350 0 : }
8351 0 : case 11: {
8352 0 : err = fd_system_program_instruction_transfer_with_seed_decode_footprint_inner( ctx, total_sz );
8353 0 : if( FD_UNLIKELY( err ) ) return err;
8354 0 : return FD_BINCODE_SUCCESS;
8355 0 : }
8356 0 : case 12: {
8357 0 : return FD_BINCODE_SUCCESS;
8358 0 : }
8359 0 : default: return FD_BINCODE_ERR_ENCODING;
8360 0 : }
8361 0 : }
8362 0 : static int fd_system_program_instruction_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8363 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8364 0 : uint discriminant = 0;
8365 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
8366 0 : if( FD_UNLIKELY( err ) ) return err;
8367 0 : return fd_system_program_instruction_inner_decode_footprint( discriminant, ctx, total_sz );
8368 0 : }
8369 0 : int fd_system_program_instruction_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8370 0 : *total_sz += sizeof(fd_system_program_instruction_t);
8371 0 : void const * start_data = ctx->data;
8372 0 : int err = fd_system_program_instruction_decode_footprint_inner( ctx, total_sz );
8373 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8374 0 : ctx->data = start_data;
8375 0 : return err;
8376 0 : }
8377 0 : static void fd_system_program_instruction_inner_decode_inner( fd_system_program_instruction_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
8378 0 : switch (discriminant) {
8379 0 : case 0: {
8380 0 : fd_system_program_instruction_create_account_decode_inner( &self->create_account, alloc_mem, ctx );
8381 0 : break;
8382 0 : }
8383 0 : case 1: {
8384 0 : fd_pubkey_decode_inner( &self->assign, alloc_mem, ctx );
8385 0 : break;
8386 0 : }
8387 0 : case 2: {
8388 0 : fd_bincode_uint64_decode_unsafe( &self->transfer, ctx );
8389 0 : break;
8390 0 : }
8391 0 : case 3: {
8392 0 : fd_system_program_instruction_create_account_with_seed_decode_inner( &self->create_account_with_seed, alloc_mem, ctx );
8393 0 : break;
8394 0 : }
8395 0 : case 4: {
8396 0 : break;
8397 0 : }
8398 0 : case 5: {
8399 0 : fd_bincode_uint64_decode_unsafe( &self->withdraw_nonce_account, ctx );
8400 0 : break;
8401 0 : }
8402 0 : case 6: {
8403 0 : fd_pubkey_decode_inner( &self->initialize_nonce_account, alloc_mem, ctx );
8404 0 : break;
8405 0 : }
8406 0 : case 7: {
8407 0 : fd_pubkey_decode_inner( &self->authorize_nonce_account, alloc_mem, ctx );
8408 0 : break;
8409 0 : }
8410 0 : case 8: {
8411 0 : fd_bincode_uint64_decode_unsafe( &self->allocate, ctx );
8412 0 : break;
8413 0 : }
8414 0 : case 9: {
8415 0 : fd_system_program_instruction_allocate_with_seed_decode_inner( &self->allocate_with_seed, alloc_mem, ctx );
8416 0 : break;
8417 0 : }
8418 0 : case 10: {
8419 0 : fd_system_program_instruction_assign_with_seed_decode_inner( &self->assign_with_seed, alloc_mem, ctx );
8420 0 : break;
8421 0 : }
8422 0 : case 11: {
8423 0 : fd_system_program_instruction_transfer_with_seed_decode_inner( &self->transfer_with_seed, alloc_mem, ctx );
8424 0 : break;
8425 0 : }
8426 0 : case 12: {
8427 0 : break;
8428 0 : }
8429 0 : }
8430 0 : }
8431 0 : static void fd_system_program_instruction_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8432 0 : fd_system_program_instruction_t * self = (fd_system_program_instruction_t *)struct_mem;
8433 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
8434 0 : fd_system_program_instruction_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
8435 0 : }
8436 0 : void * fd_system_program_instruction_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8437 0 : fd_system_program_instruction_t * self = (fd_system_program_instruction_t *)mem;
8438 0 : fd_system_program_instruction_new( self );
8439 0 : void * alloc_region = (uchar *)mem + sizeof(fd_system_program_instruction_t);
8440 0 : void * * alloc_mem = &alloc_region;
8441 0 : fd_system_program_instruction_decode_inner( mem, alloc_mem, ctx );
8442 0 : return self;
8443 0 : }
8444 0 : void fd_system_program_instruction_inner_new( fd_system_program_instruction_inner_t * self, uint discriminant ) {
8445 0 : switch( discriminant ) {
8446 0 : case 0: {
8447 0 : fd_system_program_instruction_create_account_new( &self->create_account );
8448 0 : break;
8449 0 : }
8450 0 : case 1: {
8451 0 : fd_pubkey_new( &self->assign );
8452 0 : break;
8453 0 : }
8454 0 : case 2: {
8455 0 : break;
8456 0 : }
8457 0 : case 3: {
8458 0 : fd_system_program_instruction_create_account_with_seed_new( &self->create_account_with_seed );
8459 0 : break;
8460 0 : }
8461 0 : case 4: {
8462 0 : break;
8463 0 : }
8464 0 : case 5: {
8465 0 : break;
8466 0 : }
8467 0 : case 6: {
8468 0 : fd_pubkey_new( &self->initialize_nonce_account );
8469 0 : break;
8470 0 : }
8471 0 : case 7: {
8472 0 : fd_pubkey_new( &self->authorize_nonce_account );
8473 0 : break;
8474 0 : }
8475 0 : case 8: {
8476 0 : break;
8477 0 : }
8478 0 : case 9: {
8479 0 : fd_system_program_instruction_allocate_with_seed_new( &self->allocate_with_seed );
8480 0 : break;
8481 0 : }
8482 0 : case 10: {
8483 0 : fd_system_program_instruction_assign_with_seed_new( &self->assign_with_seed );
8484 0 : break;
8485 0 : }
8486 0 : case 11: {
8487 0 : fd_system_program_instruction_transfer_with_seed_new( &self->transfer_with_seed );
8488 0 : break;
8489 0 : }
8490 0 : case 12: {
8491 0 : break;
8492 0 : }
8493 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
8494 0 : }
8495 0 : }
8496 0 : void fd_system_program_instruction_new_disc( fd_system_program_instruction_t * self, uint discriminant ) {
8497 0 : self->discriminant = discriminant;
8498 0 : fd_system_program_instruction_inner_new( &self->inner, self->discriminant );
8499 0 : }
8500 0 : void fd_system_program_instruction_new( fd_system_program_instruction_t * self ) {
8501 0 : fd_memset( self, 0, sizeof(fd_system_program_instruction_t) );
8502 0 : fd_system_program_instruction_new_disc( self, UINT_MAX );
8503 0 : }
8504 :
8505 0 : void fd_system_program_instruction_walk( void * w, fd_system_program_instruction_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
8506 0 : (void) varint;
8507 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_system_program_instruction", level++, 0);
8508 0 : switch( self->discriminant ) {
8509 0 : case 0: {
8510 0 : fun( w, self, "create_account", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8511 0 : fd_system_program_instruction_create_account_walk( w, &self->inner.create_account, fun, "create_account", level, 0 );
8512 0 : break;
8513 0 : }
8514 0 : case 1: {
8515 0 : fun( w, self, "assign", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8516 0 : fd_pubkey_walk( w, &self->inner.assign, fun, "assign", level, 0 );
8517 0 : break;
8518 0 : }
8519 0 : case 2: {
8520 0 : fun( w, self, "transfer", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8521 0 : fun( w, &self->inner.transfer, "transfer", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
8522 0 : break;
8523 0 : }
8524 0 : case 3: {
8525 0 : fun( w, self, "create_account_with_seed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8526 0 : fd_system_program_instruction_create_account_with_seed_walk( w, &self->inner.create_account_with_seed, fun, "create_account_with_seed", level, 0 );
8527 0 : break;
8528 0 : }
8529 0 : case 4: {
8530 0 : fun( w, self, "advance_nonce_account", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8531 0 : break;
8532 0 : }
8533 0 : case 5: {
8534 0 : fun( w, self, "withdraw_nonce_account", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8535 0 : fun( w, &self->inner.withdraw_nonce_account, "withdraw_nonce_account", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
8536 0 : break;
8537 0 : }
8538 0 : case 6: {
8539 0 : fun( w, self, "initialize_nonce_account", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8540 0 : fd_pubkey_walk( w, &self->inner.initialize_nonce_account, fun, "initialize_nonce_account", level, 0 );
8541 0 : break;
8542 0 : }
8543 0 : case 7: {
8544 0 : fun( w, self, "authorize_nonce_account", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8545 0 : fd_pubkey_walk( w, &self->inner.authorize_nonce_account, fun, "authorize_nonce_account", level, 0 );
8546 0 : break;
8547 0 : }
8548 0 : case 8: {
8549 0 : fun( w, self, "allocate", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8550 0 : fun( w, &self->inner.allocate, "allocate", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
8551 0 : break;
8552 0 : }
8553 0 : case 9: {
8554 0 : fun( w, self, "allocate_with_seed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8555 0 : fd_system_program_instruction_allocate_with_seed_walk( w, &self->inner.allocate_with_seed, fun, "allocate_with_seed", level, 0 );
8556 0 : break;
8557 0 : }
8558 0 : case 10: {
8559 0 : fun( w, self, "assign_with_seed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8560 0 : fd_system_program_instruction_assign_with_seed_walk( w, &self->inner.assign_with_seed, fun, "assign_with_seed", level, 0 );
8561 0 : break;
8562 0 : }
8563 0 : case 11: {
8564 0 : fun( w, self, "transfer_with_seed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8565 0 : fd_system_program_instruction_transfer_with_seed_walk( w, &self->inner.transfer_with_seed, fun, "transfer_with_seed", level, 0 );
8566 0 : break;
8567 0 : }
8568 0 : case 12: {
8569 0 : fun( w, self, "upgrade_nonce_account", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8570 0 : break;
8571 0 : }
8572 0 : }
8573 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_system_program_instruction", level--, 0 );
8574 0 : }
8575 0 : ulong fd_system_program_instruction_size( fd_system_program_instruction_t const * self ) {
8576 0 : ulong size = 0;
8577 0 : size += sizeof(uint);
8578 0 : switch (self->discriminant) {
8579 0 : case 0: {
8580 0 : size += fd_system_program_instruction_create_account_size( &self->inner.create_account );
8581 0 : break;
8582 0 : }
8583 0 : case 1: {
8584 0 : size += fd_pubkey_size( &self->inner.assign );
8585 0 : break;
8586 0 : }
8587 0 : case 2: {
8588 0 : size += sizeof(ulong);
8589 0 : break;
8590 0 : }
8591 0 : case 3: {
8592 0 : size += fd_system_program_instruction_create_account_with_seed_size( &self->inner.create_account_with_seed );
8593 0 : break;
8594 0 : }
8595 0 : case 5: {
8596 0 : size += sizeof(ulong);
8597 0 : break;
8598 0 : }
8599 0 : case 6: {
8600 0 : size += fd_pubkey_size( &self->inner.initialize_nonce_account );
8601 0 : break;
8602 0 : }
8603 0 : case 7: {
8604 0 : size += fd_pubkey_size( &self->inner.authorize_nonce_account );
8605 0 : break;
8606 0 : }
8607 0 : case 8: {
8608 0 : size += sizeof(ulong);
8609 0 : break;
8610 0 : }
8611 0 : case 9: {
8612 0 : size += fd_system_program_instruction_allocate_with_seed_size( &self->inner.allocate_with_seed );
8613 0 : break;
8614 0 : }
8615 0 : case 10: {
8616 0 : size += fd_system_program_instruction_assign_with_seed_size( &self->inner.assign_with_seed );
8617 0 : break;
8618 0 : }
8619 0 : case 11: {
8620 0 : size += fd_system_program_instruction_transfer_with_seed_size( &self->inner.transfer_with_seed );
8621 0 : break;
8622 0 : }
8623 0 : }
8624 0 : return size;
8625 0 : }
8626 :
8627 0 : int fd_system_program_instruction_inner_encode( fd_system_program_instruction_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
8628 0 : int err;
8629 0 : switch (discriminant) {
8630 0 : case 0: {
8631 0 : err = fd_system_program_instruction_create_account_encode( &self->create_account, ctx );
8632 0 : if( FD_UNLIKELY( err ) ) return err;
8633 0 : break;
8634 0 : }
8635 0 : case 1: {
8636 0 : err = fd_pubkey_encode( &self->assign, ctx );
8637 0 : if( FD_UNLIKELY( err ) ) return err;
8638 0 : break;
8639 0 : }
8640 0 : case 2: {
8641 0 : err = fd_bincode_uint64_encode( self->transfer, ctx );
8642 0 : if( FD_UNLIKELY( err ) ) return err;
8643 0 : break;
8644 0 : }
8645 0 : case 3: {
8646 0 : err = fd_system_program_instruction_create_account_with_seed_encode( &self->create_account_with_seed, ctx );
8647 0 : if( FD_UNLIKELY( err ) ) return err;
8648 0 : break;
8649 0 : }
8650 0 : case 5: {
8651 0 : err = fd_bincode_uint64_encode( self->withdraw_nonce_account, ctx );
8652 0 : if( FD_UNLIKELY( err ) ) return err;
8653 0 : break;
8654 0 : }
8655 0 : case 6: {
8656 0 : err = fd_pubkey_encode( &self->initialize_nonce_account, ctx );
8657 0 : if( FD_UNLIKELY( err ) ) return err;
8658 0 : break;
8659 0 : }
8660 0 : case 7: {
8661 0 : err = fd_pubkey_encode( &self->authorize_nonce_account, ctx );
8662 0 : if( FD_UNLIKELY( err ) ) return err;
8663 0 : break;
8664 0 : }
8665 0 : case 8: {
8666 0 : err = fd_bincode_uint64_encode( self->allocate, ctx );
8667 0 : if( FD_UNLIKELY( err ) ) return err;
8668 0 : break;
8669 0 : }
8670 0 : case 9: {
8671 0 : err = fd_system_program_instruction_allocate_with_seed_encode( &self->allocate_with_seed, ctx );
8672 0 : if( FD_UNLIKELY( err ) ) return err;
8673 0 : break;
8674 0 : }
8675 0 : case 10: {
8676 0 : err = fd_system_program_instruction_assign_with_seed_encode( &self->assign_with_seed, ctx );
8677 0 : if( FD_UNLIKELY( err ) ) return err;
8678 0 : break;
8679 0 : }
8680 0 : case 11: {
8681 0 : err = fd_system_program_instruction_transfer_with_seed_encode( &self->transfer_with_seed, ctx );
8682 0 : if( FD_UNLIKELY( err ) ) return err;
8683 0 : break;
8684 0 : }
8685 0 : }
8686 0 : return FD_BINCODE_SUCCESS;
8687 0 : }
8688 0 : int fd_system_program_instruction_encode( fd_system_program_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8689 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
8690 0 : if( FD_UNLIKELY( err ) ) return err;
8691 0 : return fd_system_program_instruction_inner_encode( &self->inner, self->discriminant, ctx );
8692 0 : }
8693 :
8694 0 : FD_FN_PURE uchar fd_system_error_is_account_already_in_use(fd_system_error_t const * self) {
8695 0 : return self->discriminant == 0;
8696 0 : }
8697 0 : FD_FN_PURE uchar fd_system_error_is_result_with_negative_lamports(fd_system_error_t const * self) {
8698 0 : return self->discriminant == 1;
8699 0 : }
8700 0 : FD_FN_PURE uchar fd_system_error_is_invalid_program_id(fd_system_error_t const * self) {
8701 0 : return self->discriminant == 2;
8702 0 : }
8703 0 : FD_FN_PURE uchar fd_system_error_is_invalid_account_data_length(fd_system_error_t const * self) {
8704 0 : return self->discriminant == 3;
8705 0 : }
8706 0 : FD_FN_PURE uchar fd_system_error_is_max_seed_length_exceeded(fd_system_error_t const * self) {
8707 0 : return self->discriminant == 4;
8708 0 : }
8709 0 : FD_FN_PURE uchar fd_system_error_is_address_with_seed_mismatch(fd_system_error_t const * self) {
8710 0 : return self->discriminant == 5;
8711 0 : }
8712 0 : FD_FN_PURE uchar fd_system_error_is_nonce_no_recent_blockhashes(fd_system_error_t const * self) {
8713 0 : return self->discriminant == 6;
8714 0 : }
8715 0 : FD_FN_PURE uchar fd_system_error_is_nonce_blockhash_not_expired(fd_system_error_t const * self) {
8716 0 : return self->discriminant == 7;
8717 0 : }
8718 0 : FD_FN_PURE uchar fd_system_error_is_nonce_unexpected_blockhash_value(fd_system_error_t const * self) {
8719 0 : return self->discriminant == 8;
8720 0 : }
8721 0 : int fd_system_error_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8722 0 : int err;
8723 0 : switch (discriminant) {
8724 0 : case 0: {
8725 0 : return FD_BINCODE_SUCCESS;
8726 0 : }
8727 0 : case 1: {
8728 0 : return FD_BINCODE_SUCCESS;
8729 0 : }
8730 0 : case 2: {
8731 0 : return FD_BINCODE_SUCCESS;
8732 0 : }
8733 0 : case 3: {
8734 0 : return FD_BINCODE_SUCCESS;
8735 0 : }
8736 0 : case 4: {
8737 0 : return FD_BINCODE_SUCCESS;
8738 0 : }
8739 0 : case 5: {
8740 0 : return FD_BINCODE_SUCCESS;
8741 0 : }
8742 0 : case 6: {
8743 0 : return FD_BINCODE_SUCCESS;
8744 0 : }
8745 0 : case 7: {
8746 0 : return FD_BINCODE_SUCCESS;
8747 0 : }
8748 0 : case 8: {
8749 0 : return FD_BINCODE_SUCCESS;
8750 0 : }
8751 0 : default: return FD_BINCODE_ERR_ENCODING;
8752 0 : }
8753 0 : }
8754 0 : static int fd_system_error_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8755 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8756 0 : uint discriminant = 0;
8757 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
8758 0 : if( FD_UNLIKELY( err ) ) return err;
8759 0 : return fd_system_error_inner_decode_footprint( discriminant, ctx, total_sz );
8760 0 : }
8761 0 : int fd_system_error_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8762 0 : *total_sz += sizeof(fd_system_error_t);
8763 0 : void const * start_data = ctx->data;
8764 0 : int err = fd_system_error_decode_footprint_inner( ctx, total_sz );
8765 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8766 0 : ctx->data = start_data;
8767 0 : return err;
8768 0 : }
8769 0 : static void fd_system_error_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8770 0 : fd_system_error_t * self = (fd_system_error_t *)struct_mem;
8771 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
8772 0 : }
8773 0 : void * fd_system_error_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8774 0 : fd_system_error_t * self = (fd_system_error_t *)mem;
8775 0 : fd_system_error_new( self );
8776 0 : void * alloc_region = (uchar *)mem + sizeof(fd_system_error_t);
8777 0 : void * * alloc_mem = &alloc_region;
8778 0 : fd_system_error_decode_inner( mem, alloc_mem, ctx );
8779 0 : return self;
8780 0 : }
8781 :
8782 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, uint varint ) {
8783 0 : (void) varint;
8784 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_system_error", level++, 0);
8785 0 : switch( self->discriminant ) {
8786 0 : case 0: {
8787 0 : fun( w, self, "account_already_in_use", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8788 0 : break;
8789 0 : }
8790 0 : case 1: {
8791 0 : fun( w, self, "result_with_negative_lamports", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8792 0 : break;
8793 0 : }
8794 0 : case 2: {
8795 0 : fun( w, self, "invalid_program_id", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8796 0 : break;
8797 0 : }
8798 0 : case 3: {
8799 0 : fun( w, self, "invalid_account_data_length", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8800 0 : break;
8801 0 : }
8802 0 : case 4: {
8803 0 : fun( w, self, "max_seed_length_exceeded", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8804 0 : break;
8805 0 : }
8806 0 : case 5: {
8807 0 : fun( w, self, "address_with_seed_mismatch", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8808 0 : break;
8809 0 : }
8810 0 : case 6: {
8811 0 : fun( w, self, "nonce_no_recent_blockhashes", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8812 0 : break;
8813 0 : }
8814 0 : case 7: {
8815 0 : fun( w, self, "nonce_blockhash_not_expired", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8816 0 : break;
8817 0 : }
8818 0 : case 8: {
8819 0 : fun( w, self, "nonce_unexpected_blockhash_value", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8820 0 : break;
8821 0 : }
8822 0 : }
8823 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_system_error", level--, 0 );
8824 0 : }
8825 0 : ulong fd_system_error_size( fd_system_error_t const * self ) {
8826 0 : ulong size = 0;
8827 0 : size += sizeof(uint);
8828 0 : switch (self->discriminant) {
8829 0 : }
8830 0 : return size;
8831 0 : }
8832 :
8833 0 : int fd_system_error_encode( fd_system_error_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8834 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
8835 0 : if( FD_UNLIKELY( err ) ) return err;
8836 0 : return err;
8837 0 : }
8838 :
8839 12 : int fd_stake_authorized_encode( fd_stake_authorized_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8840 12 : int err;
8841 12 : err = fd_pubkey_encode( &self->staker, ctx );
8842 12 : if( FD_UNLIKELY( err ) ) return err;
8843 12 : err = fd_pubkey_encode( &self->withdrawer, ctx );
8844 12 : if( FD_UNLIKELY( err ) ) return err;
8845 12 : return FD_BINCODE_SUCCESS;
8846 12 : }
8847 0 : static inline int fd_stake_authorized_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8848 0 : if( (ulong)ctx->data + 64UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8849 0 : ctx->data = (void *)( (ulong)ctx->data + 64UL );
8850 0 : return 0;
8851 0 : }
8852 0 : static void fd_stake_authorized_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8853 0 : fd_stake_authorized_t * self = (fd_stake_authorized_t *)struct_mem;
8854 0 : fd_pubkey_decode_inner( &self->staker, alloc_mem, ctx );
8855 0 : fd_pubkey_decode_inner( &self->withdrawer, alloc_mem, ctx );
8856 0 : }
8857 0 : void * fd_stake_authorized_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8858 0 : fd_stake_authorized_t * self = (fd_stake_authorized_t *)mem;
8859 0 : fd_stake_authorized_new( self );
8860 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_authorized_t);
8861 0 : void * * alloc_mem = &alloc_region;
8862 0 : fd_stake_authorized_decode_inner( mem, alloc_mem, ctx );
8863 0 : return self;
8864 0 : }
8865 0 : void fd_stake_authorized_walk( void * w, fd_stake_authorized_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
8866 0 : (void) varint;
8867 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_authorized", level++, 0 );
8868 0 : fd_pubkey_walk( w, &self->staker, fun, "staker", level, 0 );
8869 0 : fd_pubkey_walk( w, &self->withdrawer, fun, "withdrawer", level, 0 );
8870 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_authorized", level--, 0 );
8871 0 : }
8872 12 : int fd_stake_lockup_encode( fd_stake_lockup_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8873 12 : int err;
8874 12 : err = fd_bincode_uint64_encode( (ulong)self->unix_timestamp, ctx );
8875 12 : if( FD_UNLIKELY( err ) ) return err;
8876 12 : err = fd_bincode_uint64_encode( self->epoch, ctx );
8877 12 : if( FD_UNLIKELY( err ) ) return err;
8878 12 : err = fd_pubkey_encode( &self->custodian, ctx );
8879 12 : if( FD_UNLIKELY( err ) ) return err;
8880 12 : return FD_BINCODE_SUCCESS;
8881 12 : }
8882 0 : static inline int fd_stake_lockup_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8883 0 : if( (ulong)ctx->data + 48UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8884 0 : ctx->data = (void *)( (ulong)ctx->data + 48UL );
8885 0 : return 0;
8886 0 : }
8887 0 : static void fd_stake_lockup_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8888 0 : fd_stake_lockup_t * self = (fd_stake_lockup_t *)struct_mem;
8889 0 : fd_bincode_uint64_decode_unsafe( (ulong *) &self->unix_timestamp, ctx );
8890 0 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
8891 0 : fd_pubkey_decode_inner( &self->custodian, alloc_mem, ctx );
8892 0 : }
8893 0 : void * fd_stake_lockup_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8894 0 : fd_stake_lockup_t * self = (fd_stake_lockup_t *)mem;
8895 0 : fd_stake_lockup_new( self );
8896 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_lockup_t);
8897 0 : void * * alloc_mem = &alloc_region;
8898 0 : fd_stake_lockup_decode_inner( mem, alloc_mem, ctx );
8899 0 : return self;
8900 0 : }
8901 0 : void fd_stake_lockup_walk( void * w, fd_stake_lockup_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
8902 0 : (void) varint;
8903 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_lockup", level++, 0 );
8904 0 : fun( w, &self->unix_timestamp, "unix_timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level, 0 );
8905 0 : fun( w, &self->epoch, "epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
8906 0 : fd_pubkey_walk( w, &self->custodian, fun, "custodian", level, 0 );
8907 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_lockup", level--, 0 );
8908 0 : }
8909 0 : int fd_stake_instruction_initialize_encode( fd_stake_instruction_initialize_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8910 0 : int err;
8911 0 : err = fd_stake_authorized_encode( &self->authorized, ctx );
8912 0 : if( FD_UNLIKELY( err ) ) return err;
8913 0 : err = fd_stake_lockup_encode( &self->lockup, ctx );
8914 0 : if( FD_UNLIKELY( err ) ) return err;
8915 0 : return FD_BINCODE_SUCCESS;
8916 0 : }
8917 0 : static inline int fd_stake_instruction_initialize_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8918 0 : if( (ulong)ctx->data + 112UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8919 0 : ctx->data = (void *)( (ulong)ctx->data + 112UL );
8920 0 : return 0;
8921 0 : }
8922 0 : static void fd_stake_instruction_initialize_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8923 0 : fd_stake_instruction_initialize_t * self = (fd_stake_instruction_initialize_t *)struct_mem;
8924 0 : fd_stake_authorized_decode_inner( &self->authorized, alloc_mem, ctx );
8925 0 : fd_stake_lockup_decode_inner( &self->lockup, alloc_mem, ctx );
8926 0 : }
8927 0 : void * fd_stake_instruction_initialize_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8928 0 : fd_stake_instruction_initialize_t * self = (fd_stake_instruction_initialize_t *)mem;
8929 0 : fd_stake_instruction_initialize_new( self );
8930 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_instruction_initialize_t);
8931 0 : void * * alloc_mem = &alloc_region;
8932 0 : fd_stake_instruction_initialize_decode_inner( mem, alloc_mem, ctx );
8933 0 : return self;
8934 0 : }
8935 0 : void fd_stake_instruction_initialize_walk( void * w, fd_stake_instruction_initialize_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
8936 0 : (void) varint;
8937 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_instruction_initialize", level++, 0 );
8938 0 : fd_stake_authorized_walk( w, &self->authorized, fun, "authorized", level, 0 );
8939 0 : fd_stake_lockup_walk( w, &self->lockup, fun, "lockup", level, 0 );
8940 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_instruction_initialize", level--, 0 );
8941 0 : }
8942 0 : int fd_stake_lockup_custodian_args_encode( fd_stake_lockup_custodian_args_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8943 0 : int err;
8944 0 : err = fd_stake_lockup_encode( &self->lockup, ctx );
8945 0 : if( FD_UNLIKELY( err ) ) return err;
8946 0 : err = fd_sol_sysvar_clock_encode( &self->clock, ctx );
8947 0 : if( FD_UNLIKELY( err ) ) return err;
8948 0 : if( self->custodian != NULL ) {
8949 0 : err = fd_bincode_bool_encode( 1, ctx );
8950 0 : if( FD_UNLIKELY( err ) ) return err;
8951 0 : err = fd_pubkey_encode( self->custodian, ctx );
8952 0 : if( FD_UNLIKELY( err ) ) return err;
8953 0 : } else {
8954 0 : err = fd_bincode_bool_encode( 0, ctx );
8955 0 : if( FD_UNLIKELY( err ) ) return err;
8956 0 : }
8957 0 : return FD_BINCODE_SUCCESS;
8958 0 : }
8959 0 : static int fd_stake_lockup_custodian_args_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8960 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8961 0 : int err = 0;
8962 0 : err = fd_stake_lockup_decode_footprint_inner( ctx, total_sz );
8963 0 : if( FD_UNLIKELY( err ) ) return err;
8964 0 : err = fd_sol_sysvar_clock_decode_footprint_inner( ctx, total_sz );
8965 0 : if( FD_UNLIKELY( err ) ) return err;
8966 0 : {
8967 0 : uchar o;
8968 0 : err = fd_bincode_bool_decode( &o, ctx );
8969 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8970 0 : if( o ) {
8971 0 : *total_sz += FD_PUBKEY_ALIGN + sizeof(fd_pubkey_t);
8972 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
8973 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8974 0 : }
8975 0 : }
8976 0 : return 0;
8977 0 : }
8978 0 : int fd_stake_lockup_custodian_args_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8979 0 : *total_sz += sizeof(fd_stake_lockup_custodian_args_t);
8980 0 : void const * start_data = ctx->data;
8981 0 : int err = fd_stake_lockup_custodian_args_decode_footprint_inner( ctx, total_sz );
8982 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8983 0 : ctx->data = start_data;
8984 0 : return err;
8985 0 : }
8986 0 : static void fd_stake_lockup_custodian_args_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8987 0 : fd_stake_lockup_custodian_args_t * self = (fd_stake_lockup_custodian_args_t *)struct_mem;
8988 0 : fd_stake_lockup_decode_inner( &self->lockup, alloc_mem, ctx );
8989 0 : fd_sol_sysvar_clock_decode_inner( &self->clock, alloc_mem, ctx );
8990 0 : {
8991 0 : uchar o;
8992 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
8993 0 : if( o ) {
8994 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, FD_PUBKEY_ALIGN );
8995 0 : self->custodian = *alloc_mem;
8996 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(fd_pubkey_t);
8997 0 : fd_pubkey_new( self->custodian );
8998 0 : fd_pubkey_decode_inner( self->custodian, alloc_mem, ctx );
8999 0 : } else {
9000 0 : self->custodian = NULL;
9001 0 : }
9002 0 : }
9003 0 : }
9004 0 : void * fd_stake_lockup_custodian_args_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9005 0 : fd_stake_lockup_custodian_args_t * self = (fd_stake_lockup_custodian_args_t *)mem;
9006 0 : fd_stake_lockup_custodian_args_new( self );
9007 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_lockup_custodian_args_t);
9008 0 : void * * alloc_mem = &alloc_region;
9009 0 : fd_stake_lockup_custodian_args_decode_inner( mem, alloc_mem, ctx );
9010 0 : return self;
9011 0 : }
9012 0 : void fd_stake_lockup_custodian_args_new(fd_stake_lockup_custodian_args_t * self) {
9013 0 : fd_memset( self, 0, sizeof(fd_stake_lockup_custodian_args_t) );
9014 0 : fd_stake_lockup_new( &self->lockup );
9015 0 : fd_sol_sysvar_clock_new( &self->clock );
9016 0 : }
9017 0 : void fd_stake_lockup_custodian_args_walk( void * w, fd_stake_lockup_custodian_args_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
9018 0 : (void) varint;
9019 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_lockup_custodian_args", level++, 0 );
9020 0 : fd_stake_lockup_walk( w, &self->lockup, fun, "lockup", level, 0 );
9021 0 : fd_sol_sysvar_clock_walk( w, &self->clock, fun, "clock", level, 0 );
9022 0 : if( !self->custodian ) {
9023 0 : fun( w, NULL, "custodian", FD_FLAMENCO_TYPE_NULL, "pubkey", level, 0 );
9024 0 : } else {
9025 0 : fd_pubkey_walk( w, self->custodian, fun, "custodian", level, 0 );
9026 0 : }
9027 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_lockup_custodian_args", level--, 0 );
9028 0 : }
9029 0 : ulong fd_stake_lockup_custodian_args_size( fd_stake_lockup_custodian_args_t const * self ) {
9030 0 : ulong size = 0;
9031 0 : size += fd_stake_lockup_size( &self->lockup );
9032 0 : size += fd_sol_sysvar_clock_size( &self->clock );
9033 0 : size += sizeof(char);
9034 0 : if( NULL != self->custodian ) {
9035 0 : size += fd_pubkey_size( self->custodian );
9036 0 : }
9037 0 : return size;
9038 0 : }
9039 :
9040 0 : FD_FN_PURE uchar fd_stake_authorize_is_staker(fd_stake_authorize_t const * self) {
9041 0 : return self->discriminant == 0;
9042 0 : }
9043 0 : FD_FN_PURE uchar fd_stake_authorize_is_withdrawer(fd_stake_authorize_t const * self) {
9044 0 : return self->discriminant == 1;
9045 0 : }
9046 0 : int fd_stake_authorize_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9047 0 : int err;
9048 0 : switch (discriminant) {
9049 0 : case 0: {
9050 0 : return FD_BINCODE_SUCCESS;
9051 0 : }
9052 0 : case 1: {
9053 0 : return FD_BINCODE_SUCCESS;
9054 0 : }
9055 0 : default: return FD_BINCODE_ERR_ENCODING;
9056 0 : }
9057 0 : }
9058 0 : static int fd_stake_authorize_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9059 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9060 0 : uint discriminant = 0;
9061 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
9062 0 : if( FD_UNLIKELY( err ) ) return err;
9063 0 : return fd_stake_authorize_inner_decode_footprint( discriminant, ctx, total_sz );
9064 0 : }
9065 0 : int fd_stake_authorize_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9066 0 : *total_sz += sizeof(fd_stake_authorize_t);
9067 0 : void const * start_data = ctx->data;
9068 0 : int err = fd_stake_authorize_decode_footprint_inner( ctx, total_sz );
9069 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9070 0 : ctx->data = start_data;
9071 0 : return err;
9072 0 : }
9073 0 : static void fd_stake_authorize_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9074 0 : fd_stake_authorize_t * self = (fd_stake_authorize_t *)struct_mem;
9075 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
9076 0 : }
9077 0 : void * fd_stake_authorize_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9078 0 : fd_stake_authorize_t * self = (fd_stake_authorize_t *)mem;
9079 0 : fd_stake_authorize_new( self );
9080 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_authorize_t);
9081 0 : void * * alloc_mem = &alloc_region;
9082 0 : fd_stake_authorize_decode_inner( mem, alloc_mem, ctx );
9083 0 : return self;
9084 0 : }
9085 :
9086 0 : void fd_stake_authorize_walk( void * w, fd_stake_authorize_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
9087 0 : (void) varint;
9088 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_stake_authorize", level++, 0);
9089 0 : switch( self->discriminant ) {
9090 0 : case 0: {
9091 0 : fun( w, self, "staker", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
9092 0 : break;
9093 0 : }
9094 0 : case 1: {
9095 0 : fun( w, self, "withdrawer", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
9096 0 : break;
9097 0 : }
9098 0 : }
9099 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_stake_authorize", level--, 0 );
9100 0 : }
9101 0 : ulong fd_stake_authorize_size( fd_stake_authorize_t const * self ) {
9102 0 : ulong size = 0;
9103 0 : size += sizeof(uint);
9104 0 : switch (self->discriminant) {
9105 0 : }
9106 0 : return size;
9107 0 : }
9108 :
9109 0 : int fd_stake_authorize_encode( fd_stake_authorize_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9110 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
9111 0 : if( FD_UNLIKELY( err ) ) return err;
9112 0 : return err;
9113 0 : }
9114 :
9115 0 : int fd_stake_instruction_authorize_encode( fd_stake_instruction_authorize_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9116 0 : int err;
9117 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
9118 0 : if( FD_UNLIKELY( err ) ) return err;
9119 0 : err = fd_stake_authorize_encode( &self->stake_authorize, ctx );
9120 0 : if( FD_UNLIKELY( err ) ) return err;
9121 0 : return FD_BINCODE_SUCCESS;
9122 0 : }
9123 0 : static int fd_stake_instruction_authorize_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9124 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9125 0 : int err = 0;
9126 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
9127 0 : if( FD_UNLIKELY( err ) ) return err;
9128 0 : err = fd_stake_authorize_decode_footprint_inner( ctx, total_sz );
9129 0 : if( FD_UNLIKELY( err ) ) return err;
9130 0 : return 0;
9131 0 : }
9132 0 : int fd_stake_instruction_authorize_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9133 0 : *total_sz += sizeof(fd_stake_instruction_authorize_t);
9134 0 : void const * start_data = ctx->data;
9135 0 : int err = fd_stake_instruction_authorize_decode_footprint_inner( ctx, total_sz );
9136 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9137 0 : ctx->data = start_data;
9138 0 : return err;
9139 0 : }
9140 0 : static void fd_stake_instruction_authorize_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9141 0 : fd_stake_instruction_authorize_t * self = (fd_stake_instruction_authorize_t *)struct_mem;
9142 0 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
9143 0 : fd_stake_authorize_decode_inner( &self->stake_authorize, alloc_mem, ctx );
9144 0 : }
9145 0 : void * fd_stake_instruction_authorize_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9146 0 : fd_stake_instruction_authorize_t * self = (fd_stake_instruction_authorize_t *)mem;
9147 0 : fd_stake_instruction_authorize_new( self );
9148 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_instruction_authorize_t);
9149 0 : void * * alloc_mem = &alloc_region;
9150 0 : fd_stake_instruction_authorize_decode_inner( mem, alloc_mem, ctx );
9151 0 : return self;
9152 0 : }
9153 0 : void fd_stake_instruction_authorize_new(fd_stake_instruction_authorize_t * self) {
9154 0 : fd_memset( self, 0, sizeof(fd_stake_instruction_authorize_t) );
9155 0 : fd_pubkey_new( &self->pubkey );
9156 0 : fd_stake_authorize_new( &self->stake_authorize );
9157 0 : }
9158 0 : void fd_stake_instruction_authorize_walk( void * w, fd_stake_instruction_authorize_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
9159 0 : (void) varint;
9160 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_instruction_authorize", level++, 0 );
9161 0 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level, 0 );
9162 0 : fd_stake_authorize_walk( w, &self->stake_authorize, fun, "stake_authorize", level, 0 );
9163 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_instruction_authorize", level--, 0 );
9164 0 : }
9165 0 : int fd_authorize_with_seed_args_encode( fd_authorize_with_seed_args_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9166 0 : int err;
9167 0 : err = fd_pubkey_encode( &self->new_authorized_pubkey, ctx );
9168 0 : if( FD_UNLIKELY( err ) ) return err;
9169 0 : err = fd_stake_authorize_encode( &self->stake_authorize, ctx );
9170 0 : if( FD_UNLIKELY( err ) ) return err;
9171 0 : err = fd_bincode_uint64_encode( self->authority_seed_len, ctx );
9172 0 : if( FD_UNLIKELY(err) ) return err;
9173 0 : if( self->authority_seed_len ) {
9174 0 : err = fd_bincode_bytes_encode( self->authority_seed, self->authority_seed_len, ctx );
9175 0 : if( FD_UNLIKELY( err ) ) return err;
9176 0 : }
9177 0 : err = fd_pubkey_encode( &self->authority_owner, ctx );
9178 0 : if( FD_UNLIKELY( err ) ) return err;
9179 0 : return FD_BINCODE_SUCCESS;
9180 0 : }
9181 0 : static int fd_authorize_with_seed_args_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9182 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9183 0 : int err = 0;
9184 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
9185 0 : if( FD_UNLIKELY( err ) ) return err;
9186 0 : err = fd_stake_authorize_decode_footprint_inner( ctx, total_sz );
9187 0 : if( FD_UNLIKELY( err ) ) return err;
9188 0 : ulong authority_seed_len;
9189 0 : err = fd_bincode_uint64_decode( &authority_seed_len, ctx );
9190 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9191 0 : *total_sz += authority_seed_len;
9192 0 : if( authority_seed_len ) {
9193 0 : err = fd_bincode_bytes_decode_footprint( authority_seed_len, ctx );
9194 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9195 0 : err = !fd_utf8_verify( (char const *) ctx->data - authority_seed_len, authority_seed_len );
9196 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9197 0 : }
9198 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
9199 0 : if( FD_UNLIKELY( err ) ) return err;
9200 0 : return 0;
9201 0 : }
9202 0 : int fd_authorize_with_seed_args_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9203 0 : *total_sz += sizeof(fd_authorize_with_seed_args_t);
9204 0 : void const * start_data = ctx->data;
9205 0 : int err = fd_authorize_with_seed_args_decode_footprint_inner( ctx, total_sz );
9206 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9207 0 : ctx->data = start_data;
9208 0 : return err;
9209 0 : }
9210 0 : static void fd_authorize_with_seed_args_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9211 0 : fd_authorize_with_seed_args_t * self = (fd_authorize_with_seed_args_t *)struct_mem;
9212 0 : fd_pubkey_decode_inner( &self->new_authorized_pubkey, alloc_mem, ctx );
9213 0 : fd_stake_authorize_decode_inner( &self->stake_authorize, alloc_mem, ctx );
9214 0 : fd_bincode_uint64_decode_unsafe( &self->authority_seed_len, ctx );
9215 0 : if( self->authority_seed_len ) {
9216 0 : self->authority_seed = *alloc_mem;
9217 0 : fd_bincode_bytes_decode_unsafe( self->authority_seed, self->authority_seed_len, ctx );
9218 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->authority_seed_len;
9219 0 : } else
9220 0 : self->authority_seed = NULL;
9221 0 : fd_pubkey_decode_inner( &self->authority_owner, alloc_mem, ctx );
9222 0 : }
9223 0 : void * fd_authorize_with_seed_args_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9224 0 : fd_authorize_with_seed_args_t * self = (fd_authorize_with_seed_args_t *)mem;
9225 0 : fd_authorize_with_seed_args_new( self );
9226 0 : void * alloc_region = (uchar *)mem + sizeof(fd_authorize_with_seed_args_t);
9227 0 : void * * alloc_mem = &alloc_region;
9228 0 : fd_authorize_with_seed_args_decode_inner( mem, alloc_mem, ctx );
9229 0 : return self;
9230 0 : }
9231 0 : void fd_authorize_with_seed_args_new(fd_authorize_with_seed_args_t * self) {
9232 0 : fd_memset( self, 0, sizeof(fd_authorize_with_seed_args_t) );
9233 0 : fd_pubkey_new( &self->new_authorized_pubkey );
9234 0 : fd_stake_authorize_new( &self->stake_authorize );
9235 0 : fd_pubkey_new( &self->authority_owner );
9236 0 : }
9237 0 : void fd_authorize_with_seed_args_walk( void * w, fd_authorize_with_seed_args_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
9238 0 : (void) varint;
9239 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_authorize_with_seed_args", level++, 0 );
9240 0 : fd_pubkey_walk( w, &self->new_authorized_pubkey, fun, "new_authorized_pubkey", level, 0 );
9241 0 : fd_stake_authorize_walk( w, &self->stake_authorize, fun, "stake_authorize", level, 0 );
9242 0 : if( self->authority_seed_len ) {
9243 0 : fun( w, NULL, "authority_seed", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
9244 0 : for( ulong i=0; i < self->authority_seed_len; i++ )
9245 0 : fun( w, self->authority_seed + i, "authority_seed", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
9246 0 : fun( w, NULL, "authority_seed", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
9247 0 : }
9248 0 : fd_pubkey_walk( w, &self->authority_owner, fun, "authority_owner", level, 0 );
9249 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_authorize_with_seed_args", level--, 0 );
9250 0 : }
9251 0 : ulong fd_authorize_with_seed_args_size( fd_authorize_with_seed_args_t const * self ) {
9252 0 : ulong size = 0;
9253 0 : size += fd_pubkey_size( &self->new_authorized_pubkey );
9254 0 : size += fd_stake_authorize_size( &self->stake_authorize );
9255 0 : do {
9256 0 : size += sizeof(ulong);
9257 0 : size += self->authority_seed_len;
9258 0 : } while(0);
9259 0 : size += fd_pubkey_size( &self->authority_owner );
9260 0 : return size;
9261 0 : }
9262 :
9263 0 : int fd_authorize_checked_with_seed_args_encode( fd_authorize_checked_with_seed_args_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9264 0 : int err;
9265 0 : err = fd_stake_authorize_encode( &self->stake_authorize, ctx );
9266 0 : if( FD_UNLIKELY( err ) ) return err;
9267 0 : err = fd_bincode_uint64_encode( self->authority_seed_len, ctx );
9268 0 : if( FD_UNLIKELY(err) ) return err;
9269 0 : if( self->authority_seed_len ) {
9270 0 : err = fd_bincode_bytes_encode( self->authority_seed, self->authority_seed_len, ctx );
9271 0 : if( FD_UNLIKELY( err ) ) return err;
9272 0 : }
9273 0 : err = fd_pubkey_encode( &self->authority_owner, ctx );
9274 0 : if( FD_UNLIKELY( err ) ) return err;
9275 0 : return FD_BINCODE_SUCCESS;
9276 0 : }
9277 0 : static int fd_authorize_checked_with_seed_args_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9278 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9279 0 : int err = 0;
9280 0 : err = fd_stake_authorize_decode_footprint_inner( ctx, total_sz );
9281 0 : if( FD_UNLIKELY( err ) ) return err;
9282 0 : ulong authority_seed_len;
9283 0 : err = fd_bincode_uint64_decode( &authority_seed_len, ctx );
9284 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9285 0 : *total_sz += authority_seed_len;
9286 0 : if( authority_seed_len ) {
9287 0 : err = fd_bincode_bytes_decode_footprint( authority_seed_len, ctx );
9288 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9289 0 : err = !fd_utf8_verify( (char const *) ctx->data - authority_seed_len, authority_seed_len );
9290 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9291 0 : }
9292 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
9293 0 : if( FD_UNLIKELY( err ) ) return err;
9294 0 : return 0;
9295 0 : }
9296 0 : int fd_authorize_checked_with_seed_args_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9297 0 : *total_sz += sizeof(fd_authorize_checked_with_seed_args_t);
9298 0 : void const * start_data = ctx->data;
9299 0 : int err = fd_authorize_checked_with_seed_args_decode_footprint_inner( ctx, total_sz );
9300 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9301 0 : ctx->data = start_data;
9302 0 : return err;
9303 0 : }
9304 0 : static void fd_authorize_checked_with_seed_args_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9305 0 : fd_authorize_checked_with_seed_args_t * self = (fd_authorize_checked_with_seed_args_t *)struct_mem;
9306 0 : fd_stake_authorize_decode_inner( &self->stake_authorize, alloc_mem, ctx );
9307 0 : fd_bincode_uint64_decode_unsafe( &self->authority_seed_len, ctx );
9308 0 : if( self->authority_seed_len ) {
9309 0 : self->authority_seed = *alloc_mem;
9310 0 : fd_bincode_bytes_decode_unsafe( self->authority_seed, self->authority_seed_len, ctx );
9311 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->authority_seed_len;
9312 0 : } else
9313 0 : self->authority_seed = NULL;
9314 0 : fd_pubkey_decode_inner( &self->authority_owner, alloc_mem, ctx );
9315 0 : }
9316 0 : void * fd_authorize_checked_with_seed_args_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9317 0 : fd_authorize_checked_with_seed_args_t * self = (fd_authorize_checked_with_seed_args_t *)mem;
9318 0 : fd_authorize_checked_with_seed_args_new( self );
9319 0 : void * alloc_region = (uchar *)mem + sizeof(fd_authorize_checked_with_seed_args_t);
9320 0 : void * * alloc_mem = &alloc_region;
9321 0 : fd_authorize_checked_with_seed_args_decode_inner( mem, alloc_mem, ctx );
9322 0 : return self;
9323 0 : }
9324 0 : void fd_authorize_checked_with_seed_args_new(fd_authorize_checked_with_seed_args_t * self) {
9325 0 : fd_memset( self, 0, sizeof(fd_authorize_checked_with_seed_args_t) );
9326 0 : fd_stake_authorize_new( &self->stake_authorize );
9327 0 : fd_pubkey_new( &self->authority_owner );
9328 0 : }
9329 0 : void fd_authorize_checked_with_seed_args_walk( void * w, fd_authorize_checked_with_seed_args_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
9330 0 : (void) varint;
9331 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_authorize_checked_with_seed_args", level++, 0 );
9332 0 : fd_stake_authorize_walk( w, &self->stake_authorize, fun, "stake_authorize", level, 0 );
9333 0 : if( self->authority_seed_len ) {
9334 0 : fun( w, NULL, "authority_seed", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
9335 0 : for( ulong i=0; i < self->authority_seed_len; i++ )
9336 0 : fun( w, self->authority_seed + i, "authority_seed", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
9337 0 : fun( w, NULL, "authority_seed", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
9338 0 : }
9339 0 : fd_pubkey_walk( w, &self->authority_owner, fun, "authority_owner", level, 0 );
9340 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_authorize_checked_with_seed_args", level--, 0 );
9341 0 : }
9342 0 : ulong fd_authorize_checked_with_seed_args_size( fd_authorize_checked_with_seed_args_t const * self ) {
9343 0 : ulong size = 0;
9344 0 : size += fd_stake_authorize_size( &self->stake_authorize );
9345 0 : do {
9346 0 : size += sizeof(ulong);
9347 0 : size += self->authority_seed_len;
9348 0 : } while(0);
9349 0 : size += fd_pubkey_size( &self->authority_owner );
9350 0 : return size;
9351 0 : }
9352 :
9353 0 : int fd_lockup_checked_args_encode( fd_lockup_checked_args_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9354 0 : int err;
9355 0 : if( self->unix_timestamp != NULL ) {
9356 0 : err = fd_bincode_bool_encode( 1, ctx );
9357 0 : if( FD_UNLIKELY( err ) ) return err;
9358 0 : err = fd_bincode_int64_encode( self->unix_timestamp[0], ctx );
9359 0 : if( FD_UNLIKELY( err ) ) return err;
9360 0 : } else {
9361 0 : err = fd_bincode_bool_encode( 0, ctx );
9362 0 : if( FD_UNLIKELY( err ) ) return err;
9363 0 : }
9364 0 : if( self->epoch != NULL ) {
9365 0 : err = fd_bincode_bool_encode( 1, ctx );
9366 0 : if( FD_UNLIKELY( err ) ) return err;
9367 0 : err = fd_bincode_uint64_encode( self->epoch[0], ctx );
9368 0 : if( FD_UNLIKELY( err ) ) return err;
9369 0 : } else {
9370 0 : err = fd_bincode_bool_encode( 0, ctx );
9371 0 : if( FD_UNLIKELY( err ) ) return err;
9372 0 : }
9373 0 : return FD_BINCODE_SUCCESS;
9374 0 : }
9375 0 : static int fd_lockup_checked_args_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9376 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9377 0 : int err = 0;
9378 0 : {
9379 0 : uchar o;
9380 0 : err = fd_bincode_bool_decode( &o, ctx );
9381 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9382 0 : if( o ) {
9383 0 : *total_sz += 8UL + sizeof(long);
9384 0 : err = fd_bincode_int64_decode_footprint( ctx );
9385 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9386 0 : }
9387 0 : }
9388 0 : {
9389 0 : uchar o;
9390 0 : err = fd_bincode_bool_decode( &o, ctx );
9391 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9392 0 : if( o ) {
9393 0 : *total_sz += 8UL + sizeof(ulong);
9394 0 : err = fd_bincode_uint64_decode_footprint( ctx );
9395 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9396 0 : }
9397 0 : }
9398 0 : return 0;
9399 0 : }
9400 0 : int fd_lockup_checked_args_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9401 0 : *total_sz += sizeof(fd_lockup_checked_args_t);
9402 0 : void const * start_data = ctx->data;
9403 0 : int err = fd_lockup_checked_args_decode_footprint_inner( ctx, total_sz );
9404 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9405 0 : ctx->data = start_data;
9406 0 : return err;
9407 0 : }
9408 0 : static void fd_lockup_checked_args_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9409 0 : fd_lockup_checked_args_t * self = (fd_lockup_checked_args_t *)struct_mem;
9410 0 : {
9411 0 : uchar o;
9412 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
9413 0 : if( o ) {
9414 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, 8UL );
9415 0 : self->unix_timestamp = *alloc_mem;
9416 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(long);
9417 0 : fd_bincode_int64_decode_unsafe( self->unix_timestamp, ctx );
9418 0 : } else {
9419 0 : self->unix_timestamp = NULL;
9420 0 : }
9421 0 : }
9422 0 : {
9423 0 : uchar o;
9424 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
9425 0 : if( o ) {
9426 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, 8UL );
9427 0 : self->epoch = *alloc_mem;
9428 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(ulong);
9429 0 : fd_bincode_uint64_decode_unsafe( self->epoch, ctx );
9430 0 : } else {
9431 0 : self->epoch = NULL;
9432 0 : }
9433 0 : }
9434 0 : }
9435 0 : void * fd_lockup_checked_args_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9436 0 : fd_lockup_checked_args_t * self = (fd_lockup_checked_args_t *)mem;
9437 0 : fd_lockup_checked_args_new( self );
9438 0 : void * alloc_region = (uchar *)mem + sizeof(fd_lockup_checked_args_t);
9439 0 : void * * alloc_mem = &alloc_region;
9440 0 : fd_lockup_checked_args_decode_inner( mem, alloc_mem, ctx );
9441 0 : return self;
9442 0 : }
9443 0 : void fd_lockup_checked_args_new(fd_lockup_checked_args_t * self) {
9444 0 : fd_memset( self, 0, sizeof(fd_lockup_checked_args_t) );
9445 0 : }
9446 0 : void fd_lockup_checked_args_walk( void * w, fd_lockup_checked_args_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
9447 0 : (void) varint;
9448 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_lockup_checked_args", level++, 0 );
9449 0 : if( !self->unix_timestamp ) {
9450 0 : fun( w, NULL, "unix_timestamp", FD_FLAMENCO_TYPE_NULL, "long", level, 0 );
9451 0 : } else {
9452 0 : fun( w, self->unix_timestamp, "unix_timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level, 0 );
9453 0 : }
9454 0 : if( !self->epoch ) {
9455 0 : fun( w, NULL, "epoch", FD_FLAMENCO_TYPE_NULL, "ulong", level, 0 );
9456 0 : } else {
9457 0 : fun( w, self->epoch, "epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
9458 0 : }
9459 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_lockup_checked_args", level--, 0 );
9460 0 : }
9461 0 : ulong fd_lockup_checked_args_size( fd_lockup_checked_args_t const * self ) {
9462 0 : ulong size = 0;
9463 0 : size += sizeof(char);
9464 0 : if( NULL != self->unix_timestamp ) {
9465 0 : size += sizeof(long);
9466 0 : }
9467 0 : size += sizeof(char);
9468 0 : if( NULL != self->epoch ) {
9469 0 : size += sizeof(ulong);
9470 0 : }
9471 0 : return size;
9472 0 : }
9473 :
9474 0 : int fd_lockup_args_encode( fd_lockup_args_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9475 0 : int err;
9476 0 : if( self->unix_timestamp != NULL ) {
9477 0 : err = fd_bincode_bool_encode( 1, ctx );
9478 0 : if( FD_UNLIKELY( err ) ) return err;
9479 0 : err = fd_bincode_int64_encode( self->unix_timestamp[0], ctx );
9480 0 : if( FD_UNLIKELY( err ) ) return err;
9481 0 : } else {
9482 0 : err = fd_bincode_bool_encode( 0, ctx );
9483 0 : if( FD_UNLIKELY( err ) ) return err;
9484 0 : }
9485 0 : if( self->epoch != NULL ) {
9486 0 : err = fd_bincode_bool_encode( 1, ctx );
9487 0 : if( FD_UNLIKELY( err ) ) return err;
9488 0 : err = fd_bincode_uint64_encode( self->epoch[0], ctx );
9489 0 : if( FD_UNLIKELY( err ) ) return err;
9490 0 : } else {
9491 0 : err = fd_bincode_bool_encode( 0, ctx );
9492 0 : if( FD_UNLIKELY( err ) ) return err;
9493 0 : }
9494 0 : if( self->custodian != NULL ) {
9495 0 : err = fd_bincode_bool_encode( 1, ctx );
9496 0 : if( FD_UNLIKELY( err ) ) return err;
9497 0 : err = fd_pubkey_encode( self->custodian, ctx );
9498 0 : if( FD_UNLIKELY( err ) ) return err;
9499 0 : } else {
9500 0 : err = fd_bincode_bool_encode( 0, ctx );
9501 0 : if( FD_UNLIKELY( err ) ) return err;
9502 0 : }
9503 0 : return FD_BINCODE_SUCCESS;
9504 0 : }
9505 0 : static int fd_lockup_args_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9506 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9507 0 : int err = 0;
9508 0 : {
9509 0 : uchar o;
9510 0 : err = fd_bincode_bool_decode( &o, ctx );
9511 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9512 0 : if( o ) {
9513 0 : *total_sz += 8UL + sizeof(long);
9514 0 : err = fd_bincode_int64_decode_footprint( ctx );
9515 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9516 0 : }
9517 0 : }
9518 0 : {
9519 0 : uchar o;
9520 0 : err = fd_bincode_bool_decode( &o, ctx );
9521 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9522 0 : if( o ) {
9523 0 : *total_sz += 8UL + sizeof(ulong);
9524 0 : err = fd_bincode_uint64_decode_footprint( ctx );
9525 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9526 0 : }
9527 0 : }
9528 0 : {
9529 0 : uchar o;
9530 0 : err = fd_bincode_bool_decode( &o, ctx );
9531 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9532 0 : if( o ) {
9533 0 : *total_sz += FD_PUBKEY_ALIGN + sizeof(fd_pubkey_t);
9534 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
9535 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9536 0 : }
9537 0 : }
9538 0 : return 0;
9539 0 : }
9540 0 : int fd_lockup_args_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9541 0 : *total_sz += sizeof(fd_lockup_args_t);
9542 0 : void const * start_data = ctx->data;
9543 0 : int err = fd_lockup_args_decode_footprint_inner( ctx, total_sz );
9544 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9545 0 : ctx->data = start_data;
9546 0 : return err;
9547 0 : }
9548 0 : static void fd_lockup_args_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9549 0 : fd_lockup_args_t * self = (fd_lockup_args_t *)struct_mem;
9550 0 : {
9551 0 : uchar o;
9552 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
9553 0 : if( o ) {
9554 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, 8UL );
9555 0 : self->unix_timestamp = *alloc_mem;
9556 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(long);
9557 0 : fd_bincode_int64_decode_unsafe( self->unix_timestamp, ctx );
9558 0 : } else {
9559 0 : self->unix_timestamp = NULL;
9560 0 : }
9561 0 : }
9562 0 : {
9563 0 : uchar o;
9564 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
9565 0 : if( o ) {
9566 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, 8UL );
9567 0 : self->epoch = *alloc_mem;
9568 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(ulong);
9569 0 : fd_bincode_uint64_decode_unsafe( self->epoch, ctx );
9570 0 : } else {
9571 0 : self->epoch = NULL;
9572 0 : }
9573 0 : }
9574 0 : {
9575 0 : uchar o;
9576 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
9577 0 : if( o ) {
9578 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, FD_PUBKEY_ALIGN );
9579 0 : self->custodian = *alloc_mem;
9580 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(fd_pubkey_t);
9581 0 : fd_pubkey_new( self->custodian );
9582 0 : fd_pubkey_decode_inner( self->custodian, alloc_mem, ctx );
9583 0 : } else {
9584 0 : self->custodian = NULL;
9585 0 : }
9586 0 : }
9587 0 : }
9588 0 : void * fd_lockup_args_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9589 0 : fd_lockup_args_t * self = (fd_lockup_args_t *)mem;
9590 0 : fd_lockup_args_new( self );
9591 0 : void * alloc_region = (uchar *)mem + sizeof(fd_lockup_args_t);
9592 0 : void * * alloc_mem = &alloc_region;
9593 0 : fd_lockup_args_decode_inner( mem, alloc_mem, ctx );
9594 0 : return self;
9595 0 : }
9596 0 : void fd_lockup_args_new(fd_lockup_args_t * self) {
9597 0 : fd_memset( self, 0, sizeof(fd_lockup_args_t) );
9598 0 : }
9599 0 : void fd_lockup_args_walk( void * w, fd_lockup_args_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
9600 0 : (void) varint;
9601 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_lockup_args", level++, 0 );
9602 0 : if( !self->unix_timestamp ) {
9603 0 : fun( w, NULL, "unix_timestamp", FD_FLAMENCO_TYPE_NULL, "long", level, 0 );
9604 0 : } else {
9605 0 : fun( w, self->unix_timestamp, "unix_timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level, 0 );
9606 0 : }
9607 0 : if( !self->epoch ) {
9608 0 : fun( w, NULL, "epoch", FD_FLAMENCO_TYPE_NULL, "ulong", level, 0 );
9609 0 : } else {
9610 0 : fun( w, self->epoch, "epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
9611 0 : }
9612 0 : if( !self->custodian ) {
9613 0 : fun( w, NULL, "custodian", FD_FLAMENCO_TYPE_NULL, "pubkey", level, 0 );
9614 0 : } else {
9615 0 : fd_pubkey_walk( w, self->custodian, fun, "custodian", level, 0 );
9616 0 : }
9617 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_lockup_args", level--, 0 );
9618 0 : }
9619 0 : ulong fd_lockup_args_size( fd_lockup_args_t const * self ) {
9620 0 : ulong size = 0;
9621 0 : size += sizeof(char);
9622 0 : if( NULL != self->unix_timestamp ) {
9623 0 : size += sizeof(long);
9624 0 : }
9625 0 : size += sizeof(char);
9626 0 : if( NULL != self->epoch ) {
9627 0 : size += sizeof(ulong);
9628 0 : }
9629 0 : size += sizeof(char);
9630 0 : if( NULL != self->custodian ) {
9631 0 : size += fd_pubkey_size( self->custodian );
9632 0 : }
9633 0 : return size;
9634 0 : }
9635 :
9636 0 : FD_FN_PURE uchar fd_stake_instruction_is_initialize(fd_stake_instruction_t const * self) {
9637 0 : return self->discriminant == 0;
9638 0 : }
9639 0 : FD_FN_PURE uchar fd_stake_instruction_is_authorize(fd_stake_instruction_t const * self) {
9640 0 : return self->discriminant == 1;
9641 0 : }
9642 0 : FD_FN_PURE uchar fd_stake_instruction_is_delegate_stake(fd_stake_instruction_t const * self) {
9643 0 : return self->discriminant == 2;
9644 0 : }
9645 0 : FD_FN_PURE uchar fd_stake_instruction_is_split(fd_stake_instruction_t const * self) {
9646 0 : return self->discriminant == 3;
9647 0 : }
9648 0 : FD_FN_PURE uchar fd_stake_instruction_is_withdraw(fd_stake_instruction_t const * self) {
9649 0 : return self->discriminant == 4;
9650 0 : }
9651 0 : FD_FN_PURE uchar fd_stake_instruction_is_deactivate(fd_stake_instruction_t const * self) {
9652 0 : return self->discriminant == 5;
9653 0 : }
9654 0 : FD_FN_PURE uchar fd_stake_instruction_is_set_lockup(fd_stake_instruction_t const * self) {
9655 0 : return self->discriminant == 6;
9656 0 : }
9657 0 : FD_FN_PURE uchar fd_stake_instruction_is_merge(fd_stake_instruction_t const * self) {
9658 0 : return self->discriminant == 7;
9659 0 : }
9660 0 : FD_FN_PURE uchar fd_stake_instruction_is_authorize_with_seed(fd_stake_instruction_t const * self) {
9661 0 : return self->discriminant == 8;
9662 0 : }
9663 0 : FD_FN_PURE uchar fd_stake_instruction_is_initialize_checked(fd_stake_instruction_t const * self) {
9664 0 : return self->discriminant == 9;
9665 0 : }
9666 0 : FD_FN_PURE uchar fd_stake_instruction_is_authorize_checked(fd_stake_instruction_t const * self) {
9667 0 : return self->discriminant == 10;
9668 0 : }
9669 0 : FD_FN_PURE uchar fd_stake_instruction_is_authorize_checked_with_seed(fd_stake_instruction_t const * self) {
9670 0 : return self->discriminant == 11;
9671 0 : }
9672 0 : FD_FN_PURE uchar fd_stake_instruction_is_set_lockup_checked(fd_stake_instruction_t const * self) {
9673 0 : return self->discriminant == 12;
9674 0 : }
9675 0 : FD_FN_PURE uchar fd_stake_instruction_is_get_minimum_delegation(fd_stake_instruction_t const * self) {
9676 0 : return self->discriminant == 13;
9677 0 : }
9678 0 : FD_FN_PURE uchar fd_stake_instruction_is_deactivate_delinquent(fd_stake_instruction_t const * self) {
9679 0 : return self->discriminant == 14;
9680 0 : }
9681 0 : FD_FN_PURE uchar fd_stake_instruction_is_redelegate(fd_stake_instruction_t const * self) {
9682 0 : return self->discriminant == 15;
9683 0 : }
9684 0 : FD_FN_PURE uchar fd_stake_instruction_is_move_stake(fd_stake_instruction_t const * self) {
9685 0 : return self->discriminant == 16;
9686 0 : }
9687 0 : FD_FN_PURE uchar fd_stake_instruction_is_move_lamports(fd_stake_instruction_t const * self) {
9688 0 : return self->discriminant == 17;
9689 0 : }
9690 : void fd_stake_instruction_inner_new( fd_stake_instruction_inner_t * self, uint discriminant );
9691 0 : int fd_stake_instruction_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9692 0 : int err;
9693 0 : switch (discriminant) {
9694 0 : case 0: {
9695 0 : err = fd_stake_instruction_initialize_decode_footprint_inner( ctx, total_sz );
9696 0 : if( FD_UNLIKELY( err ) ) return err;
9697 0 : return FD_BINCODE_SUCCESS;
9698 0 : }
9699 0 : case 1: {
9700 0 : err = fd_stake_instruction_authorize_decode_footprint_inner( ctx, total_sz );
9701 0 : if( FD_UNLIKELY( err ) ) return err;
9702 0 : return FD_BINCODE_SUCCESS;
9703 0 : }
9704 0 : case 2: {
9705 0 : return FD_BINCODE_SUCCESS;
9706 0 : }
9707 0 : case 3: {
9708 0 : err = fd_bincode_uint64_decode_footprint( ctx );
9709 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9710 0 : return FD_BINCODE_SUCCESS;
9711 0 : }
9712 0 : case 4: {
9713 0 : err = fd_bincode_uint64_decode_footprint( ctx );
9714 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9715 0 : return FD_BINCODE_SUCCESS;
9716 0 : }
9717 0 : case 5: {
9718 0 : return FD_BINCODE_SUCCESS;
9719 0 : }
9720 0 : case 6: {
9721 0 : err = fd_lockup_args_decode_footprint_inner( ctx, total_sz );
9722 0 : if( FD_UNLIKELY( err ) ) return err;
9723 0 : return FD_BINCODE_SUCCESS;
9724 0 : }
9725 0 : case 7: {
9726 0 : return FD_BINCODE_SUCCESS;
9727 0 : }
9728 0 : case 8: {
9729 0 : err = fd_authorize_with_seed_args_decode_footprint_inner( ctx, total_sz );
9730 0 : if( FD_UNLIKELY( err ) ) return err;
9731 0 : return FD_BINCODE_SUCCESS;
9732 0 : }
9733 0 : case 9: {
9734 0 : return FD_BINCODE_SUCCESS;
9735 0 : }
9736 0 : case 10: {
9737 0 : err = fd_stake_authorize_decode_footprint_inner( ctx, total_sz );
9738 0 : if( FD_UNLIKELY( err ) ) return err;
9739 0 : return FD_BINCODE_SUCCESS;
9740 0 : }
9741 0 : case 11: {
9742 0 : err = fd_authorize_checked_with_seed_args_decode_footprint_inner( ctx, total_sz );
9743 0 : if( FD_UNLIKELY( err ) ) return err;
9744 0 : return FD_BINCODE_SUCCESS;
9745 0 : }
9746 0 : case 12: {
9747 0 : err = fd_lockup_checked_args_decode_footprint_inner( ctx, total_sz );
9748 0 : if( FD_UNLIKELY( err ) ) return err;
9749 0 : return FD_BINCODE_SUCCESS;
9750 0 : }
9751 0 : case 13: {
9752 0 : return FD_BINCODE_SUCCESS;
9753 0 : }
9754 0 : case 14: {
9755 0 : return FD_BINCODE_SUCCESS;
9756 0 : }
9757 0 : case 15: {
9758 0 : return FD_BINCODE_SUCCESS;
9759 0 : }
9760 0 : case 16: {
9761 0 : err = fd_bincode_uint64_decode_footprint( ctx );
9762 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9763 0 : return FD_BINCODE_SUCCESS;
9764 0 : }
9765 0 : case 17: {
9766 0 : err = fd_bincode_uint64_decode_footprint( ctx );
9767 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9768 0 : return FD_BINCODE_SUCCESS;
9769 0 : }
9770 0 : default: return FD_BINCODE_ERR_ENCODING;
9771 0 : }
9772 0 : }
9773 0 : static int fd_stake_instruction_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9774 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9775 0 : uint discriminant = 0;
9776 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
9777 0 : if( FD_UNLIKELY( err ) ) return err;
9778 0 : return fd_stake_instruction_inner_decode_footprint( discriminant, ctx, total_sz );
9779 0 : }
9780 0 : int fd_stake_instruction_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9781 0 : *total_sz += sizeof(fd_stake_instruction_t);
9782 0 : void const * start_data = ctx->data;
9783 0 : int err = fd_stake_instruction_decode_footprint_inner( ctx, total_sz );
9784 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9785 0 : ctx->data = start_data;
9786 0 : return err;
9787 0 : }
9788 0 : static void fd_stake_instruction_inner_decode_inner( fd_stake_instruction_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
9789 0 : switch (discriminant) {
9790 0 : case 0: {
9791 0 : fd_stake_instruction_initialize_decode_inner( &self->initialize, alloc_mem, ctx );
9792 0 : break;
9793 0 : }
9794 0 : case 1: {
9795 0 : fd_stake_instruction_authorize_decode_inner( &self->authorize, alloc_mem, ctx );
9796 0 : break;
9797 0 : }
9798 0 : case 2: {
9799 0 : break;
9800 0 : }
9801 0 : case 3: {
9802 0 : fd_bincode_uint64_decode_unsafe( &self->split, ctx );
9803 0 : break;
9804 0 : }
9805 0 : case 4: {
9806 0 : fd_bincode_uint64_decode_unsafe( &self->withdraw, ctx );
9807 0 : break;
9808 0 : }
9809 0 : case 5: {
9810 0 : break;
9811 0 : }
9812 0 : case 6: {
9813 0 : fd_lockup_args_decode_inner( &self->set_lockup, alloc_mem, ctx );
9814 0 : break;
9815 0 : }
9816 0 : case 7: {
9817 0 : break;
9818 0 : }
9819 0 : case 8: {
9820 0 : fd_authorize_with_seed_args_decode_inner( &self->authorize_with_seed, alloc_mem, ctx );
9821 0 : break;
9822 0 : }
9823 0 : case 9: {
9824 0 : break;
9825 0 : }
9826 0 : case 10: {
9827 0 : fd_stake_authorize_decode_inner( &self->authorize_checked, alloc_mem, ctx );
9828 0 : break;
9829 0 : }
9830 0 : case 11: {
9831 0 : fd_authorize_checked_with_seed_args_decode_inner( &self->authorize_checked_with_seed, alloc_mem, ctx );
9832 0 : break;
9833 0 : }
9834 0 : case 12: {
9835 0 : fd_lockup_checked_args_decode_inner( &self->set_lockup_checked, alloc_mem, ctx );
9836 0 : break;
9837 0 : }
9838 0 : case 13: {
9839 0 : break;
9840 0 : }
9841 0 : case 14: {
9842 0 : break;
9843 0 : }
9844 0 : case 15: {
9845 0 : break;
9846 0 : }
9847 0 : case 16: {
9848 0 : fd_bincode_uint64_decode_unsafe( &self->move_stake, ctx );
9849 0 : break;
9850 0 : }
9851 0 : case 17: {
9852 0 : fd_bincode_uint64_decode_unsafe( &self->move_lamports, ctx );
9853 0 : break;
9854 0 : }
9855 0 : }
9856 0 : }
9857 0 : static void fd_stake_instruction_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9858 0 : fd_stake_instruction_t * self = (fd_stake_instruction_t *)struct_mem;
9859 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
9860 0 : fd_stake_instruction_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
9861 0 : }
9862 0 : void * fd_stake_instruction_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9863 0 : fd_stake_instruction_t * self = (fd_stake_instruction_t *)mem;
9864 0 : fd_stake_instruction_new( self );
9865 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_instruction_t);
9866 0 : void * * alloc_mem = &alloc_region;
9867 0 : fd_stake_instruction_decode_inner( mem, alloc_mem, ctx );
9868 0 : return self;
9869 0 : }
9870 0 : void fd_stake_instruction_inner_new( fd_stake_instruction_inner_t * self, uint discriminant ) {
9871 0 : switch( discriminant ) {
9872 0 : case 0: {
9873 0 : fd_stake_instruction_initialize_new( &self->initialize );
9874 0 : break;
9875 0 : }
9876 0 : case 1: {
9877 0 : fd_stake_instruction_authorize_new( &self->authorize );
9878 0 : break;
9879 0 : }
9880 0 : case 2: {
9881 0 : break;
9882 0 : }
9883 0 : case 3: {
9884 0 : break;
9885 0 : }
9886 0 : case 4: {
9887 0 : break;
9888 0 : }
9889 0 : case 5: {
9890 0 : break;
9891 0 : }
9892 0 : case 6: {
9893 0 : fd_lockup_args_new( &self->set_lockup );
9894 0 : break;
9895 0 : }
9896 0 : case 7: {
9897 0 : break;
9898 0 : }
9899 0 : case 8: {
9900 0 : fd_authorize_with_seed_args_new( &self->authorize_with_seed );
9901 0 : break;
9902 0 : }
9903 0 : case 9: {
9904 0 : break;
9905 0 : }
9906 0 : case 10: {
9907 0 : fd_stake_authorize_new( &self->authorize_checked );
9908 0 : break;
9909 0 : }
9910 0 : case 11: {
9911 0 : fd_authorize_checked_with_seed_args_new( &self->authorize_checked_with_seed );
9912 0 : break;
9913 0 : }
9914 0 : case 12: {
9915 0 : fd_lockup_checked_args_new( &self->set_lockup_checked );
9916 0 : break;
9917 0 : }
9918 0 : case 13: {
9919 0 : break;
9920 0 : }
9921 0 : case 14: {
9922 0 : break;
9923 0 : }
9924 0 : case 15: {
9925 0 : break;
9926 0 : }
9927 0 : case 16: {
9928 0 : break;
9929 0 : }
9930 0 : case 17: {
9931 0 : break;
9932 0 : }
9933 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
9934 0 : }
9935 0 : }
9936 0 : void fd_stake_instruction_new_disc( fd_stake_instruction_t * self, uint discriminant ) {
9937 0 : self->discriminant = discriminant;
9938 0 : fd_stake_instruction_inner_new( &self->inner, self->discriminant );
9939 0 : }
9940 0 : void fd_stake_instruction_new( fd_stake_instruction_t * self ) {
9941 0 : fd_memset( self, 0, sizeof(fd_stake_instruction_t) );
9942 0 : fd_stake_instruction_new_disc( self, UINT_MAX );
9943 0 : }
9944 :
9945 0 : void fd_stake_instruction_walk( void * w, fd_stake_instruction_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
9946 0 : (void) varint;
9947 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_stake_instruction", level++, 0);
9948 0 : switch( self->discriminant ) {
9949 0 : case 0: {
9950 0 : fun( w, self, "initialize", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
9951 0 : fd_stake_instruction_initialize_walk( w, &self->inner.initialize, fun, "initialize", level, 0 );
9952 0 : break;
9953 0 : }
9954 0 : case 1: {
9955 0 : fun( w, self, "authorize", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
9956 0 : fd_stake_instruction_authorize_walk( w, &self->inner.authorize, fun, "authorize", level, 0 );
9957 0 : break;
9958 0 : }
9959 0 : case 2: {
9960 0 : fun( w, self, "delegate_stake", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
9961 0 : break;
9962 0 : }
9963 0 : case 3: {
9964 0 : fun( w, self, "split", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
9965 0 : fun( w, &self->inner.split, "split", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
9966 0 : break;
9967 0 : }
9968 0 : case 4: {
9969 0 : fun( w, self, "withdraw", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
9970 0 : fun( w, &self->inner.withdraw, "withdraw", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
9971 0 : break;
9972 0 : }
9973 0 : case 5: {
9974 0 : fun( w, self, "deactivate", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
9975 0 : break;
9976 0 : }
9977 0 : case 6: {
9978 0 : fun( w, self, "set_lockup", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
9979 0 : fd_lockup_args_walk( w, &self->inner.set_lockup, fun, "set_lockup", level, 0 );
9980 0 : break;
9981 0 : }
9982 0 : case 7: {
9983 0 : fun( w, self, "merge", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
9984 0 : break;
9985 0 : }
9986 0 : case 8: {
9987 0 : fun( w, self, "authorize_with_seed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
9988 0 : fd_authorize_with_seed_args_walk( w, &self->inner.authorize_with_seed, fun, "authorize_with_seed", level, 0 );
9989 0 : break;
9990 0 : }
9991 0 : case 9: {
9992 0 : fun( w, self, "initialize_checked", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
9993 0 : break;
9994 0 : }
9995 0 : case 10: {
9996 0 : fun( w, self, "authorize_checked", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
9997 0 : fd_stake_authorize_walk( w, &self->inner.authorize_checked, fun, "authorize_checked", level, 0 );
9998 0 : break;
9999 0 : }
10000 0 : case 11: {
10001 0 : fun( w, self, "authorize_checked_with_seed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
10002 0 : fd_authorize_checked_with_seed_args_walk( w, &self->inner.authorize_checked_with_seed, fun, "authorize_checked_with_seed", level, 0 );
10003 0 : break;
10004 0 : }
10005 0 : case 12: {
10006 0 : fun( w, self, "set_lockup_checked", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
10007 0 : fd_lockup_checked_args_walk( w, &self->inner.set_lockup_checked, fun, "set_lockup_checked", level, 0 );
10008 0 : break;
10009 0 : }
10010 0 : case 13: {
10011 0 : fun( w, self, "get_minimum_delegation", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
10012 0 : break;
10013 0 : }
10014 0 : case 14: {
10015 0 : fun( w, self, "deactivate_delinquent", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
10016 0 : break;
10017 0 : }
10018 0 : case 15: {
10019 0 : fun( w, self, "redelegate", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
10020 0 : break;
10021 0 : }
10022 0 : case 16: {
10023 0 : fun( w, self, "move_stake", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
10024 0 : fun( w, &self->inner.move_stake, "move_stake", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
10025 0 : break;
10026 0 : }
10027 0 : case 17: {
10028 0 : fun( w, self, "move_lamports", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
10029 0 : fun( w, &self->inner.move_lamports, "move_lamports", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
10030 0 : break;
10031 0 : }
10032 0 : }
10033 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_stake_instruction", level--, 0 );
10034 0 : }
10035 0 : ulong fd_stake_instruction_size( fd_stake_instruction_t const * self ) {
10036 0 : ulong size = 0;
10037 0 : size += sizeof(uint);
10038 0 : switch (self->discriminant) {
10039 0 : case 0: {
10040 0 : size += fd_stake_instruction_initialize_size( &self->inner.initialize );
10041 0 : break;
10042 0 : }
10043 0 : case 1: {
10044 0 : size += fd_stake_instruction_authorize_size( &self->inner.authorize );
10045 0 : break;
10046 0 : }
10047 0 : case 3: {
10048 0 : size += sizeof(ulong);
10049 0 : break;
10050 0 : }
10051 0 : case 4: {
10052 0 : size += sizeof(ulong);
10053 0 : break;
10054 0 : }
10055 0 : case 6: {
10056 0 : size += fd_lockup_args_size( &self->inner.set_lockup );
10057 0 : break;
10058 0 : }
10059 0 : case 8: {
10060 0 : size += fd_authorize_with_seed_args_size( &self->inner.authorize_with_seed );
10061 0 : break;
10062 0 : }
10063 0 : case 10: {
10064 0 : size += fd_stake_authorize_size( &self->inner.authorize_checked );
10065 0 : break;
10066 0 : }
10067 0 : case 11: {
10068 0 : size += fd_authorize_checked_with_seed_args_size( &self->inner.authorize_checked_with_seed );
10069 0 : break;
10070 0 : }
10071 0 : case 12: {
10072 0 : size += fd_lockup_checked_args_size( &self->inner.set_lockup_checked );
10073 0 : break;
10074 0 : }
10075 0 : case 16: {
10076 0 : size += sizeof(ulong);
10077 0 : break;
10078 0 : }
10079 0 : case 17: {
10080 0 : size += sizeof(ulong);
10081 0 : break;
10082 0 : }
10083 0 : }
10084 0 : return size;
10085 0 : }
10086 :
10087 0 : int fd_stake_instruction_inner_encode( fd_stake_instruction_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
10088 0 : int err;
10089 0 : switch (discriminant) {
10090 0 : case 0: {
10091 0 : err = fd_stake_instruction_initialize_encode( &self->initialize, ctx );
10092 0 : if( FD_UNLIKELY( err ) ) return err;
10093 0 : break;
10094 0 : }
10095 0 : case 1: {
10096 0 : err = fd_stake_instruction_authorize_encode( &self->authorize, ctx );
10097 0 : if( FD_UNLIKELY( err ) ) return err;
10098 0 : break;
10099 0 : }
10100 0 : case 3: {
10101 0 : err = fd_bincode_uint64_encode( self->split, ctx );
10102 0 : if( FD_UNLIKELY( err ) ) return err;
10103 0 : break;
10104 0 : }
10105 0 : case 4: {
10106 0 : err = fd_bincode_uint64_encode( self->withdraw, ctx );
10107 0 : if( FD_UNLIKELY( err ) ) return err;
10108 0 : break;
10109 0 : }
10110 0 : case 6: {
10111 0 : err = fd_lockup_args_encode( &self->set_lockup, ctx );
10112 0 : if( FD_UNLIKELY( err ) ) return err;
10113 0 : break;
10114 0 : }
10115 0 : case 8: {
10116 0 : err = fd_authorize_with_seed_args_encode( &self->authorize_with_seed, ctx );
10117 0 : if( FD_UNLIKELY( err ) ) return err;
10118 0 : break;
10119 0 : }
10120 0 : case 10: {
10121 0 : err = fd_stake_authorize_encode( &self->authorize_checked, ctx );
10122 0 : if( FD_UNLIKELY( err ) ) return err;
10123 0 : break;
10124 0 : }
10125 0 : case 11: {
10126 0 : err = fd_authorize_checked_with_seed_args_encode( &self->authorize_checked_with_seed, ctx );
10127 0 : if( FD_UNLIKELY( err ) ) return err;
10128 0 : break;
10129 0 : }
10130 0 : case 12: {
10131 0 : err = fd_lockup_checked_args_encode( &self->set_lockup_checked, ctx );
10132 0 : if( FD_UNLIKELY( err ) ) return err;
10133 0 : break;
10134 0 : }
10135 0 : case 16: {
10136 0 : err = fd_bincode_uint64_encode( self->move_stake, ctx );
10137 0 : if( FD_UNLIKELY( err ) ) return err;
10138 0 : break;
10139 0 : }
10140 0 : case 17: {
10141 0 : err = fd_bincode_uint64_encode( self->move_lamports, ctx );
10142 0 : if( FD_UNLIKELY( err ) ) return err;
10143 0 : break;
10144 0 : }
10145 0 : }
10146 0 : return FD_BINCODE_SUCCESS;
10147 0 : }
10148 0 : int fd_stake_instruction_encode( fd_stake_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
10149 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
10150 0 : if( FD_UNLIKELY( err ) ) return err;
10151 0 : return fd_stake_instruction_inner_encode( &self->inner, self->discriminant, ctx );
10152 0 : }
10153 :
10154 12 : int fd_stake_meta_encode( fd_stake_meta_t const * self, fd_bincode_encode_ctx_t * ctx ) {
10155 12 : int err;
10156 12 : err = fd_bincode_uint64_encode( self->rent_exempt_reserve, ctx );
10157 12 : if( FD_UNLIKELY( err ) ) return err;
10158 12 : err = fd_stake_authorized_encode( &self->authorized, ctx );
10159 12 : if( FD_UNLIKELY( err ) ) return err;
10160 12 : err = fd_stake_lockup_encode( &self->lockup, ctx );
10161 12 : if( FD_UNLIKELY( err ) ) return err;
10162 12 : return FD_BINCODE_SUCCESS;
10163 12 : }
10164 0 : static inline int fd_stake_meta_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10165 0 : if( (ulong)ctx->data + 120UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10166 0 : ctx->data = (void *)( (ulong)ctx->data + 120UL );
10167 0 : return 0;
10168 0 : }
10169 0 : static void fd_stake_meta_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
10170 0 : fd_stake_meta_t * self = (fd_stake_meta_t *)struct_mem;
10171 0 : fd_bincode_uint64_decode_unsafe( &self->rent_exempt_reserve, ctx );
10172 0 : fd_stake_authorized_decode_inner( &self->authorized, alloc_mem, ctx );
10173 0 : fd_stake_lockup_decode_inner( &self->lockup, alloc_mem, ctx );
10174 0 : }
10175 0 : void * fd_stake_meta_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
10176 0 : fd_stake_meta_t * self = (fd_stake_meta_t *)mem;
10177 0 : fd_stake_meta_new( self );
10178 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_meta_t);
10179 0 : void * * alloc_mem = &alloc_region;
10180 0 : fd_stake_meta_decode_inner( mem, alloc_mem, ctx );
10181 0 : return self;
10182 0 : }
10183 0 : void fd_stake_meta_walk( void * w, fd_stake_meta_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
10184 0 : (void) varint;
10185 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_meta", level++, 0 );
10186 0 : fun( w, &self->rent_exempt_reserve, "rent_exempt_reserve", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
10187 0 : fd_stake_authorized_walk( w, &self->authorized, fun, "authorized", level, 0 );
10188 0 : fd_stake_lockup_walk( w, &self->lockup, fun, "lockup", level, 0 );
10189 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_meta", level--, 0 );
10190 0 : }
10191 12 : int fd_stake_flags_encode( fd_stake_flags_t const * self, fd_bincode_encode_ctx_t * ctx ) {
10192 12 : int err;
10193 12 : err = fd_bincode_uint8_encode( (uchar)(self->bits), ctx );
10194 12 : if( FD_UNLIKELY( err ) ) return err;
10195 12 : return FD_BINCODE_SUCCESS;
10196 12 : }
10197 0 : static inline int fd_stake_flags_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10198 0 : if( (ulong)ctx->data + 1UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10199 0 : ctx->data = (void *)( (ulong)ctx->data + 1UL );
10200 0 : return 0;
10201 0 : }
10202 0 : static void fd_stake_flags_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
10203 0 : fd_stake_flags_t * self = (fd_stake_flags_t *)struct_mem;
10204 0 : fd_bincode_uint8_decode_unsafe( &self->bits, ctx );
10205 0 : }
10206 0 : void * fd_stake_flags_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
10207 0 : fd_stake_flags_t * self = (fd_stake_flags_t *)mem;
10208 0 : fd_stake_flags_new( self );
10209 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_flags_t);
10210 0 : void * * alloc_mem = &alloc_region;
10211 0 : fd_stake_flags_decode_inner( mem, alloc_mem, ctx );
10212 0 : return self;
10213 0 : }
10214 0 : void fd_stake_flags_walk( void * w, fd_stake_flags_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
10215 0 : (void) varint;
10216 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_flags", level++, 0 );
10217 0 : fun( w, &self->bits, "bits", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
10218 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_flags", level--, 0 );
10219 0 : }
10220 0 : int fd_stake_state_v2_initialized_encode( fd_stake_state_v2_initialized_t const * self, fd_bincode_encode_ctx_t * ctx ) {
10221 0 : int err;
10222 0 : err = fd_stake_meta_encode( &self->meta, ctx );
10223 0 : if( FD_UNLIKELY( err ) ) return err;
10224 0 : return FD_BINCODE_SUCCESS;
10225 0 : }
10226 0 : static inline int fd_stake_state_v2_initialized_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10227 0 : if( (ulong)ctx->data + 120UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10228 0 : ctx->data = (void *)( (ulong)ctx->data + 120UL );
10229 0 : return 0;
10230 0 : }
10231 0 : static void fd_stake_state_v2_initialized_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
10232 0 : fd_stake_state_v2_initialized_t * self = (fd_stake_state_v2_initialized_t *)struct_mem;
10233 0 : fd_stake_meta_decode_inner( &self->meta, alloc_mem, ctx );
10234 0 : }
10235 0 : void * fd_stake_state_v2_initialized_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
10236 0 : fd_stake_state_v2_initialized_t * self = (fd_stake_state_v2_initialized_t *)mem;
10237 0 : fd_stake_state_v2_initialized_new( self );
10238 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_state_v2_initialized_t);
10239 0 : void * * alloc_mem = &alloc_region;
10240 0 : fd_stake_state_v2_initialized_decode_inner( mem, alloc_mem, ctx );
10241 0 : return self;
10242 0 : }
10243 0 : void fd_stake_state_v2_initialized_walk( void * w, fd_stake_state_v2_initialized_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
10244 0 : (void) varint;
10245 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_state_v2_initialized", level++, 0 );
10246 0 : fd_stake_meta_walk( w, &self->meta, fun, "meta", level, 0 );
10247 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_state_v2_initialized", level--, 0 );
10248 0 : }
10249 12 : int fd_stake_state_v2_stake_encode( fd_stake_state_v2_stake_t const * self, fd_bincode_encode_ctx_t * ctx ) {
10250 12 : int err;
10251 12 : err = fd_stake_meta_encode( &self->meta, ctx );
10252 12 : if( FD_UNLIKELY( err ) ) return err;
10253 12 : err = fd_stake_encode( &self->stake, ctx );
10254 12 : if( FD_UNLIKELY( err ) ) return err;
10255 12 : err = fd_stake_flags_encode( &self->stake_flags, ctx );
10256 12 : if( FD_UNLIKELY( err ) ) return err;
10257 12 : return FD_BINCODE_SUCCESS;
10258 12 : }
10259 0 : static inline int fd_stake_state_v2_stake_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10260 0 : if( (ulong)ctx->data + 193UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10261 0 : ctx->data = (void *)( (ulong)ctx->data + 193UL );
10262 0 : return 0;
10263 0 : }
10264 0 : static void fd_stake_state_v2_stake_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
10265 0 : fd_stake_state_v2_stake_t * self = (fd_stake_state_v2_stake_t *)struct_mem;
10266 0 : fd_stake_meta_decode_inner( &self->meta, alloc_mem, ctx );
10267 0 : fd_stake_decode_inner( &self->stake, alloc_mem, ctx );
10268 0 : fd_stake_flags_decode_inner( &self->stake_flags, alloc_mem, ctx );
10269 0 : }
10270 0 : void * fd_stake_state_v2_stake_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
10271 0 : fd_stake_state_v2_stake_t * self = (fd_stake_state_v2_stake_t *)mem;
10272 0 : fd_stake_state_v2_stake_new( self );
10273 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_state_v2_stake_t);
10274 0 : void * * alloc_mem = &alloc_region;
10275 0 : fd_stake_state_v2_stake_decode_inner( mem, alloc_mem, ctx );
10276 0 : return self;
10277 0 : }
10278 0 : void fd_stake_state_v2_stake_walk( void * w, fd_stake_state_v2_stake_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
10279 0 : (void) varint;
10280 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_state_v2_stake", level++, 0 );
10281 0 : fd_stake_meta_walk( w, &self->meta, fun, "meta", level, 0 );
10282 0 : fd_stake_walk( w, &self->stake, fun, "stake", level, 0 );
10283 0 : fd_stake_flags_walk( w, &self->stake_flags, fun, "stake_flags", level, 0 );
10284 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_state_v2_stake", level--, 0 );
10285 0 : }
10286 0 : FD_FN_PURE uchar fd_stake_state_v2_is_uninitialized(fd_stake_state_v2_t const * self) {
10287 0 : return self->discriminant == 0;
10288 0 : }
10289 0 : FD_FN_PURE uchar fd_stake_state_v2_is_initialized(fd_stake_state_v2_t const * self) {
10290 0 : return self->discriminant == 1;
10291 0 : }
10292 0 : FD_FN_PURE uchar fd_stake_state_v2_is_stake(fd_stake_state_v2_t const * self) {
10293 0 : return self->discriminant == 2;
10294 0 : }
10295 0 : FD_FN_PURE uchar fd_stake_state_v2_is_rewards_pool(fd_stake_state_v2_t const * self) {
10296 0 : return self->discriminant == 3;
10297 0 : }
10298 : void fd_stake_state_v2_inner_new( fd_stake_state_v2_inner_t * self, uint discriminant );
10299 0 : int fd_stake_state_v2_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10300 0 : int err;
10301 0 : switch (discriminant) {
10302 0 : case 0: {
10303 0 : return FD_BINCODE_SUCCESS;
10304 0 : }
10305 0 : case 1: {
10306 0 : err = fd_stake_state_v2_initialized_decode_footprint_inner( ctx, total_sz );
10307 0 : if( FD_UNLIKELY( err ) ) return err;
10308 0 : return FD_BINCODE_SUCCESS;
10309 0 : }
10310 0 : case 2: {
10311 0 : err = fd_stake_state_v2_stake_decode_footprint_inner( ctx, total_sz );
10312 0 : if( FD_UNLIKELY( err ) ) return err;
10313 0 : return FD_BINCODE_SUCCESS;
10314 0 : }
10315 0 : case 3: {
10316 0 : return FD_BINCODE_SUCCESS;
10317 0 : }
10318 0 : default: return FD_BINCODE_ERR_ENCODING;
10319 0 : }
10320 0 : }
10321 0 : static int fd_stake_state_v2_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10322 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10323 0 : uint discriminant = 0;
10324 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
10325 0 : if( FD_UNLIKELY( err ) ) return err;
10326 0 : return fd_stake_state_v2_inner_decode_footprint( discriminant, ctx, total_sz );
10327 0 : }
10328 0 : int fd_stake_state_v2_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10329 0 : *total_sz += sizeof(fd_stake_state_v2_t);
10330 0 : void const * start_data = ctx->data;
10331 0 : int err = fd_stake_state_v2_decode_footprint_inner( ctx, total_sz );
10332 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10333 0 : ctx->data = start_data;
10334 0 : return err;
10335 0 : }
10336 0 : static void fd_stake_state_v2_inner_decode_inner( fd_stake_state_v2_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
10337 0 : switch (discriminant) {
10338 0 : case 0: {
10339 0 : break;
10340 0 : }
10341 0 : case 1: {
10342 0 : fd_stake_state_v2_initialized_decode_inner( &self->initialized, alloc_mem, ctx );
10343 0 : break;
10344 0 : }
10345 0 : case 2: {
10346 0 : fd_stake_state_v2_stake_decode_inner( &self->stake, alloc_mem, ctx );
10347 0 : break;
10348 0 : }
10349 0 : case 3: {
10350 0 : break;
10351 0 : }
10352 0 : }
10353 0 : }
10354 0 : static void fd_stake_state_v2_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
10355 0 : fd_stake_state_v2_t * self = (fd_stake_state_v2_t *)struct_mem;
10356 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
10357 0 : fd_stake_state_v2_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
10358 0 : }
10359 0 : void * fd_stake_state_v2_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
10360 0 : fd_stake_state_v2_t * self = (fd_stake_state_v2_t *)mem;
10361 0 : fd_stake_state_v2_new( self );
10362 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_state_v2_t);
10363 0 : void * * alloc_mem = &alloc_region;
10364 0 : fd_stake_state_v2_decode_inner( mem, alloc_mem, ctx );
10365 0 : return self;
10366 0 : }
10367 12 : void fd_stake_state_v2_inner_new( fd_stake_state_v2_inner_t * self, uint discriminant ) {
10368 12 : switch( discriminant ) {
10369 0 : case 0: {
10370 0 : break;
10371 0 : }
10372 0 : case 1: {
10373 0 : fd_stake_state_v2_initialized_new( &self->initialized );
10374 0 : break;
10375 0 : }
10376 12 : case 2: {
10377 12 : fd_stake_state_v2_stake_new( &self->stake );
10378 12 : break;
10379 0 : }
10380 0 : case 3: {
10381 0 : break;
10382 0 : }
10383 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
10384 12 : }
10385 12 : }
10386 12 : void fd_stake_state_v2_new_disc( fd_stake_state_v2_t * self, uint discriminant ) {
10387 12 : self->discriminant = discriminant;
10388 12 : fd_stake_state_v2_inner_new( &self->inner, self->discriminant );
10389 12 : }
10390 0 : void fd_stake_state_v2_new( fd_stake_state_v2_t * self ) {
10391 0 : fd_memset( self, 0, sizeof(fd_stake_state_v2_t) );
10392 0 : fd_stake_state_v2_new_disc( self, UINT_MAX );
10393 0 : }
10394 :
10395 0 : void fd_stake_state_v2_walk( void * w, fd_stake_state_v2_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
10396 0 : (void) varint;
10397 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_stake_state_v2", level++, 0);
10398 0 : switch( self->discriminant ) {
10399 0 : case 0: {
10400 0 : fun( w, self, "uninitialized", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
10401 0 : break;
10402 0 : }
10403 0 : case 1: {
10404 0 : fun( w, self, "initialized", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
10405 0 : fd_stake_state_v2_initialized_walk( w, &self->inner.initialized, fun, "initialized", level, 0 );
10406 0 : break;
10407 0 : }
10408 0 : case 2: {
10409 0 : fun( w, self, "stake", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
10410 0 : fd_stake_state_v2_stake_walk( w, &self->inner.stake, fun, "stake", level, 0 );
10411 0 : break;
10412 0 : }
10413 0 : case 3: {
10414 0 : fun( w, self, "rewards_pool", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
10415 0 : break;
10416 0 : }
10417 0 : }
10418 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_stake_state_v2", level--, 0 );
10419 0 : }
10420 0 : ulong fd_stake_state_v2_size( fd_stake_state_v2_t const * self ) {
10421 0 : ulong size = 0;
10422 0 : size += sizeof(uint);
10423 0 : switch (self->discriminant) {
10424 0 : case 1: {
10425 0 : size += fd_stake_state_v2_initialized_size( &self->inner.initialized );
10426 0 : break;
10427 0 : }
10428 0 : case 2: {
10429 0 : size += fd_stake_state_v2_stake_size( &self->inner.stake );
10430 0 : break;
10431 0 : }
10432 0 : }
10433 0 : return size;
10434 0 : }
10435 :
10436 12 : int fd_stake_state_v2_inner_encode( fd_stake_state_v2_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
10437 12 : int err;
10438 12 : switch (discriminant) {
10439 0 : case 1: {
10440 0 : err = fd_stake_state_v2_initialized_encode( &self->initialized, ctx );
10441 0 : if( FD_UNLIKELY( err ) ) return err;
10442 0 : break;
10443 0 : }
10444 12 : case 2: {
10445 12 : err = fd_stake_state_v2_stake_encode( &self->stake, ctx );
10446 12 : if( FD_UNLIKELY( err ) ) return err;
10447 12 : break;
10448 12 : }
10449 12 : }
10450 12 : return FD_BINCODE_SUCCESS;
10451 12 : }
10452 12 : int fd_stake_state_v2_encode( fd_stake_state_v2_t const * self, fd_bincode_encode_ctx_t * ctx ) {
10453 12 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
10454 12 : if( FD_UNLIKELY( err ) ) return err;
10455 12 : return fd_stake_state_v2_inner_encode( &self->inner, self->discriminant, ctx );
10456 12 : }
10457 :
10458 0 : int fd_nonce_data_encode( fd_nonce_data_t const * self, fd_bincode_encode_ctx_t * ctx ) {
10459 0 : int err;
10460 0 : err = fd_pubkey_encode( &self->authority, ctx );
10461 0 : if( FD_UNLIKELY( err ) ) return err;
10462 0 : err = fd_hash_encode( &self->durable_nonce, ctx );
10463 0 : if( FD_UNLIKELY( err ) ) return err;
10464 0 : err = fd_fee_calculator_encode( &self->fee_calculator, ctx );
10465 0 : if( FD_UNLIKELY( err ) ) return err;
10466 0 : return FD_BINCODE_SUCCESS;
10467 0 : }
10468 0 : static inline int fd_nonce_data_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10469 0 : if( (ulong)ctx->data + 72UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10470 0 : ctx->data = (void *)( (ulong)ctx->data + 72UL );
10471 0 : return 0;
10472 0 : }
10473 0 : static void fd_nonce_data_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
10474 0 : fd_nonce_data_t * self = (fd_nonce_data_t *)struct_mem;
10475 0 : fd_pubkey_decode_inner( &self->authority, alloc_mem, ctx );
10476 0 : fd_hash_decode_inner( &self->durable_nonce, alloc_mem, ctx );
10477 0 : fd_fee_calculator_decode_inner( &self->fee_calculator, alloc_mem, ctx );
10478 0 : }
10479 0 : void * fd_nonce_data_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
10480 0 : fd_nonce_data_t * self = (fd_nonce_data_t *)mem;
10481 0 : fd_nonce_data_new( self );
10482 0 : void * alloc_region = (uchar *)mem + sizeof(fd_nonce_data_t);
10483 0 : void * * alloc_mem = &alloc_region;
10484 0 : fd_nonce_data_decode_inner( mem, alloc_mem, ctx );
10485 0 : return self;
10486 0 : }
10487 0 : void fd_nonce_data_walk( void * w, fd_nonce_data_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
10488 0 : (void) varint;
10489 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_nonce_data", level++, 0 );
10490 0 : fd_pubkey_walk( w, &self->authority, fun, "authority", level, 0 );
10491 0 : fd_hash_walk( w, &self->durable_nonce, fun, "durable_nonce", level, 0 );
10492 0 : fd_fee_calculator_walk( w, &self->fee_calculator, fun, "fee_calculator", level, 0 );
10493 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_nonce_data", level--, 0 );
10494 0 : }
10495 0 : FD_FN_PURE uchar fd_nonce_state_is_uninitialized(fd_nonce_state_t const * self) {
10496 0 : return self->discriminant == 0;
10497 0 : }
10498 0 : FD_FN_PURE uchar fd_nonce_state_is_initialized(fd_nonce_state_t const * self) {
10499 0 : return self->discriminant == 1;
10500 0 : }
10501 : void fd_nonce_state_inner_new( fd_nonce_state_inner_t * self, uint discriminant );
10502 0 : int fd_nonce_state_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10503 0 : int err;
10504 0 : switch (discriminant) {
10505 0 : case 0: {
10506 0 : return FD_BINCODE_SUCCESS;
10507 0 : }
10508 0 : case 1: {
10509 0 : err = fd_nonce_data_decode_footprint_inner( ctx, total_sz );
10510 0 : if( FD_UNLIKELY( err ) ) return err;
10511 0 : return FD_BINCODE_SUCCESS;
10512 0 : }
10513 0 : default: return FD_BINCODE_ERR_ENCODING;
10514 0 : }
10515 0 : }
10516 0 : static int fd_nonce_state_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10517 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10518 0 : uint discriminant = 0;
10519 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
10520 0 : if( FD_UNLIKELY( err ) ) return err;
10521 0 : return fd_nonce_state_inner_decode_footprint( discriminant, ctx, total_sz );
10522 0 : }
10523 0 : int fd_nonce_state_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10524 0 : *total_sz += sizeof(fd_nonce_state_t);
10525 0 : void const * start_data = ctx->data;
10526 0 : int err = fd_nonce_state_decode_footprint_inner( ctx, total_sz );
10527 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10528 0 : ctx->data = start_data;
10529 0 : return err;
10530 0 : }
10531 0 : static void fd_nonce_state_inner_decode_inner( fd_nonce_state_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
10532 0 : switch (discriminant) {
10533 0 : case 0: {
10534 0 : break;
10535 0 : }
10536 0 : case 1: {
10537 0 : fd_nonce_data_decode_inner( &self->initialized, alloc_mem, ctx );
10538 0 : break;
10539 0 : }
10540 0 : }
10541 0 : }
10542 0 : static void fd_nonce_state_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
10543 0 : fd_nonce_state_t * self = (fd_nonce_state_t *)struct_mem;
10544 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
10545 0 : fd_nonce_state_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
10546 0 : }
10547 0 : void * fd_nonce_state_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
10548 0 : fd_nonce_state_t * self = (fd_nonce_state_t *)mem;
10549 0 : fd_nonce_state_new( self );
10550 0 : void * alloc_region = (uchar *)mem + sizeof(fd_nonce_state_t);
10551 0 : void * * alloc_mem = &alloc_region;
10552 0 : fd_nonce_state_decode_inner( mem, alloc_mem, ctx );
10553 0 : return self;
10554 0 : }
10555 0 : void fd_nonce_state_inner_new( fd_nonce_state_inner_t * self, uint discriminant ) {
10556 0 : switch( discriminant ) {
10557 0 : case 0: {
10558 0 : break;
10559 0 : }
10560 0 : case 1: {
10561 0 : fd_nonce_data_new( &self->initialized );
10562 0 : break;
10563 0 : }
10564 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
10565 0 : }
10566 0 : }
10567 0 : void fd_nonce_state_new_disc( fd_nonce_state_t * self, uint discriminant ) {
10568 0 : self->discriminant = discriminant;
10569 0 : fd_nonce_state_inner_new( &self->inner, self->discriminant );
10570 0 : }
10571 0 : void fd_nonce_state_new( fd_nonce_state_t * self ) {
10572 0 : fd_memset( self, 0, sizeof(fd_nonce_state_t) );
10573 0 : fd_nonce_state_new_disc( self, UINT_MAX );
10574 0 : }
10575 :
10576 0 : void fd_nonce_state_walk( void * w, fd_nonce_state_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
10577 0 : (void) varint;
10578 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_nonce_state", level++, 0);
10579 0 : switch( self->discriminant ) {
10580 0 : case 0: {
10581 0 : fun( w, self, "uninitialized", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
10582 0 : break;
10583 0 : }
10584 0 : case 1: {
10585 0 : fun( w, self, "initialized", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
10586 0 : fd_nonce_data_walk( w, &self->inner.initialized, fun, "initialized", level, 0 );
10587 0 : break;
10588 0 : }
10589 0 : }
10590 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_nonce_state", level--, 0 );
10591 0 : }
10592 0 : ulong fd_nonce_state_size( fd_nonce_state_t const * self ) {
10593 0 : ulong size = 0;
10594 0 : size += sizeof(uint);
10595 0 : switch (self->discriminant) {
10596 0 : case 1: {
10597 0 : size += fd_nonce_data_size( &self->inner.initialized );
10598 0 : break;
10599 0 : }
10600 0 : }
10601 0 : return size;
10602 0 : }
10603 :
10604 0 : int fd_nonce_state_inner_encode( fd_nonce_state_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
10605 0 : int err;
10606 0 : switch (discriminant) {
10607 0 : case 1: {
10608 0 : err = fd_nonce_data_encode( &self->initialized, ctx );
10609 0 : if( FD_UNLIKELY( err ) ) return err;
10610 0 : break;
10611 0 : }
10612 0 : }
10613 0 : return FD_BINCODE_SUCCESS;
10614 0 : }
10615 0 : int fd_nonce_state_encode( fd_nonce_state_t const * self, fd_bincode_encode_ctx_t * ctx ) {
10616 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
10617 0 : if( FD_UNLIKELY( err ) ) return err;
10618 0 : return fd_nonce_state_inner_encode( &self->inner, self->discriminant, ctx );
10619 0 : }
10620 :
10621 0 : FD_FN_PURE uchar fd_nonce_state_versions_is_legacy(fd_nonce_state_versions_t const * self) {
10622 0 : return self->discriminant == 0;
10623 0 : }
10624 0 : FD_FN_PURE uchar fd_nonce_state_versions_is_current(fd_nonce_state_versions_t const * self) {
10625 0 : return self->discriminant == 1;
10626 0 : }
10627 : void fd_nonce_state_versions_inner_new( fd_nonce_state_versions_inner_t * self, uint discriminant );
10628 0 : int fd_nonce_state_versions_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10629 0 : int err;
10630 0 : switch (discriminant) {
10631 0 : case 0: {
10632 0 : err = fd_nonce_state_decode_footprint_inner( ctx, total_sz );
10633 0 : if( FD_UNLIKELY( err ) ) return err;
10634 0 : return FD_BINCODE_SUCCESS;
10635 0 : }
10636 0 : case 1: {
10637 0 : err = fd_nonce_state_decode_footprint_inner( ctx, total_sz );
10638 0 : if( FD_UNLIKELY( err ) ) return err;
10639 0 : return FD_BINCODE_SUCCESS;
10640 0 : }
10641 0 : default: return FD_BINCODE_ERR_ENCODING;
10642 0 : }
10643 0 : }
10644 0 : static int fd_nonce_state_versions_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10645 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10646 0 : uint discriminant = 0;
10647 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
10648 0 : if( FD_UNLIKELY( err ) ) return err;
10649 0 : return fd_nonce_state_versions_inner_decode_footprint( discriminant, ctx, total_sz );
10650 0 : }
10651 0 : int fd_nonce_state_versions_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10652 0 : *total_sz += sizeof(fd_nonce_state_versions_t);
10653 0 : void const * start_data = ctx->data;
10654 0 : int err = fd_nonce_state_versions_decode_footprint_inner( ctx, total_sz );
10655 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10656 0 : ctx->data = start_data;
10657 0 : return err;
10658 0 : }
10659 0 : static void fd_nonce_state_versions_inner_decode_inner( fd_nonce_state_versions_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
10660 0 : switch (discriminant) {
10661 0 : case 0: {
10662 0 : fd_nonce_state_decode_inner( &self->legacy, alloc_mem, ctx );
10663 0 : break;
10664 0 : }
10665 0 : case 1: {
10666 0 : fd_nonce_state_decode_inner( &self->current, alloc_mem, ctx );
10667 0 : break;
10668 0 : }
10669 0 : }
10670 0 : }
10671 0 : static void fd_nonce_state_versions_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
10672 0 : fd_nonce_state_versions_t * self = (fd_nonce_state_versions_t *)struct_mem;
10673 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
10674 0 : fd_nonce_state_versions_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
10675 0 : }
10676 0 : void * fd_nonce_state_versions_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
10677 0 : fd_nonce_state_versions_t * self = (fd_nonce_state_versions_t *)mem;
10678 0 : fd_nonce_state_versions_new( self );
10679 0 : void * alloc_region = (uchar *)mem + sizeof(fd_nonce_state_versions_t);
10680 0 : void * * alloc_mem = &alloc_region;
10681 0 : fd_nonce_state_versions_decode_inner( mem, alloc_mem, ctx );
10682 0 : return self;
10683 0 : }
10684 0 : void fd_nonce_state_versions_inner_new( fd_nonce_state_versions_inner_t * self, uint discriminant ) {
10685 0 : switch( discriminant ) {
10686 0 : case 0: {
10687 0 : fd_nonce_state_new( &self->legacy );
10688 0 : break;
10689 0 : }
10690 0 : case 1: {
10691 0 : fd_nonce_state_new( &self->current );
10692 0 : break;
10693 0 : }
10694 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
10695 0 : }
10696 0 : }
10697 0 : void fd_nonce_state_versions_new_disc( fd_nonce_state_versions_t * self, uint discriminant ) {
10698 0 : self->discriminant = discriminant;
10699 0 : fd_nonce_state_versions_inner_new( &self->inner, self->discriminant );
10700 0 : }
10701 0 : void fd_nonce_state_versions_new( fd_nonce_state_versions_t * self ) {
10702 0 : fd_memset( self, 0, sizeof(fd_nonce_state_versions_t) );
10703 0 : fd_nonce_state_versions_new_disc( self, UINT_MAX );
10704 0 : }
10705 :
10706 0 : void fd_nonce_state_versions_walk( void * w, fd_nonce_state_versions_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
10707 0 : (void) varint;
10708 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_nonce_state_versions", level++, 0);
10709 0 : switch( self->discriminant ) {
10710 0 : case 0: {
10711 0 : fun( w, self, "legacy", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
10712 0 : fd_nonce_state_walk( w, &self->inner.legacy, fun, "legacy", level, 0 );
10713 0 : break;
10714 0 : }
10715 0 : case 1: {
10716 0 : fun( w, self, "current", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
10717 0 : fd_nonce_state_walk( w, &self->inner.current, fun, "current", level, 0 );
10718 0 : break;
10719 0 : }
10720 0 : }
10721 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_nonce_state_versions", level--, 0 );
10722 0 : }
10723 0 : ulong fd_nonce_state_versions_size( fd_nonce_state_versions_t const * self ) {
10724 0 : ulong size = 0;
10725 0 : size += sizeof(uint);
10726 0 : switch (self->discriminant) {
10727 0 : case 0: {
10728 0 : size += fd_nonce_state_size( &self->inner.legacy );
10729 0 : break;
10730 0 : }
10731 0 : case 1: {
10732 0 : size += fd_nonce_state_size( &self->inner.current );
10733 0 : break;
10734 0 : }
10735 0 : }
10736 0 : return size;
10737 0 : }
10738 :
10739 0 : int fd_nonce_state_versions_inner_encode( fd_nonce_state_versions_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
10740 0 : int err;
10741 0 : switch (discriminant) {
10742 0 : case 0: {
10743 0 : err = fd_nonce_state_encode( &self->legacy, ctx );
10744 0 : if( FD_UNLIKELY( err ) ) return err;
10745 0 : break;
10746 0 : }
10747 0 : case 1: {
10748 0 : err = fd_nonce_state_encode( &self->current, ctx );
10749 0 : if( FD_UNLIKELY( err ) ) return err;
10750 0 : break;
10751 0 : }
10752 0 : }
10753 0 : return FD_BINCODE_SUCCESS;
10754 0 : }
10755 0 : int fd_nonce_state_versions_encode( fd_nonce_state_versions_t const * self, fd_bincode_encode_ctx_t * ctx ) {
10756 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
10757 0 : if( FD_UNLIKELY( err ) ) return err;
10758 0 : return fd_nonce_state_versions_inner_encode( &self->inner, self->discriminant, ctx );
10759 0 : }
10760 :
10761 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 ) {
10762 0 : int err;
10763 0 : err = fd_bincode_uint32_encode( self->units, ctx );
10764 0 : if( FD_UNLIKELY( err ) ) return err;
10765 0 : err = fd_bincode_uint32_encode( self->additional_fee, ctx );
10766 0 : if( FD_UNLIKELY( err ) ) return err;
10767 0 : return FD_BINCODE_SUCCESS;
10768 0 : }
10769 0 : static inline int fd_compute_budget_program_instruction_request_units_deprecated_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10770 0 : if( (ulong)ctx->data + 8UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10771 0 : ctx->data = (void *)( (ulong)ctx->data + 8UL );
10772 0 : return 0;
10773 0 : }
10774 0 : static void fd_compute_budget_program_instruction_request_units_deprecated_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
10775 0 : fd_compute_budget_program_instruction_request_units_deprecated_t * self = (fd_compute_budget_program_instruction_request_units_deprecated_t *)struct_mem;
10776 0 : fd_bincode_uint32_decode_unsafe( &self->units, ctx );
10777 0 : fd_bincode_uint32_decode_unsafe( &self->additional_fee, ctx );
10778 0 : }
10779 0 : void * fd_compute_budget_program_instruction_request_units_deprecated_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
10780 0 : fd_compute_budget_program_instruction_request_units_deprecated_t * self = (fd_compute_budget_program_instruction_request_units_deprecated_t *)mem;
10781 0 : fd_compute_budget_program_instruction_request_units_deprecated_new( self );
10782 0 : void * alloc_region = (uchar *)mem + sizeof(fd_compute_budget_program_instruction_request_units_deprecated_t);
10783 0 : void * * alloc_mem = &alloc_region;
10784 0 : fd_compute_budget_program_instruction_request_units_deprecated_decode_inner( mem, alloc_mem, ctx );
10785 0 : return self;
10786 0 : }
10787 0 : void fd_compute_budget_program_instruction_request_units_deprecated_walk( void * w, fd_compute_budget_program_instruction_request_units_deprecated_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
10788 0 : (void) varint;
10789 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_compute_budget_program_instruction_request_units_deprecated", level++, 0 );
10790 0 : fun( w, &self->units, "units", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
10791 0 : fun( w, &self->additional_fee, "additional_fee", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
10792 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_compute_budget_program_instruction_request_units_deprecated", level--, 0 );
10793 0 : }
10794 0 : FD_FN_PURE uchar fd_compute_budget_program_instruction_is_request_units_deprecated(fd_compute_budget_program_instruction_t const * self) {
10795 0 : return self->discriminant == 0;
10796 0 : }
10797 0 : FD_FN_PURE uchar fd_compute_budget_program_instruction_is_request_heap_frame(fd_compute_budget_program_instruction_t const * self) {
10798 0 : return self->discriminant == 1;
10799 0 : }
10800 0 : FD_FN_PURE uchar fd_compute_budget_program_instruction_is_set_compute_unit_limit(fd_compute_budget_program_instruction_t const * self) {
10801 0 : return self->discriminant == 2;
10802 0 : }
10803 0 : FD_FN_PURE uchar fd_compute_budget_program_instruction_is_set_compute_unit_price(fd_compute_budget_program_instruction_t const * self) {
10804 0 : return self->discriminant == 3;
10805 0 : }
10806 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) {
10807 0 : return self->discriminant == 4;
10808 0 : }
10809 : void fd_compute_budget_program_instruction_inner_new( fd_compute_budget_program_instruction_inner_t * self, uint discriminant );
10810 0 : int fd_compute_budget_program_instruction_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10811 0 : int err;
10812 0 : switch (discriminant) {
10813 0 : case 0: {
10814 0 : err = fd_compute_budget_program_instruction_request_units_deprecated_decode_footprint_inner( ctx, total_sz );
10815 0 : if( FD_UNLIKELY( err ) ) return err;
10816 0 : return FD_BINCODE_SUCCESS;
10817 0 : }
10818 0 : case 1: {
10819 0 : err = fd_bincode_uint32_decode_footprint( ctx );
10820 0 : if( FD_UNLIKELY( err ) ) return err;
10821 0 : return FD_BINCODE_SUCCESS;
10822 0 : }
10823 0 : case 2: {
10824 0 : err = fd_bincode_uint32_decode_footprint( ctx );
10825 0 : if( FD_UNLIKELY( err ) ) return err;
10826 0 : return FD_BINCODE_SUCCESS;
10827 0 : }
10828 0 : case 3: {
10829 0 : err = fd_bincode_uint64_decode_footprint( ctx );
10830 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10831 0 : return FD_BINCODE_SUCCESS;
10832 0 : }
10833 0 : case 4: {
10834 0 : err = fd_bincode_uint32_decode_footprint( ctx );
10835 0 : if( FD_UNLIKELY( err ) ) return err;
10836 0 : return FD_BINCODE_SUCCESS;
10837 0 : }
10838 0 : default: return FD_BINCODE_ERR_ENCODING;
10839 0 : }
10840 0 : }
10841 0 : static int fd_compute_budget_program_instruction_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10842 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10843 0 : ushort discriminant = 0;
10844 0 : int err = fd_bincode_compact_u16_decode( &discriminant, ctx );
10845 0 : if( FD_UNLIKELY( err ) ) return err;
10846 0 : return fd_compute_budget_program_instruction_inner_decode_footprint( discriminant, ctx, total_sz );
10847 0 : }
10848 0 : int fd_compute_budget_program_instruction_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10849 0 : *total_sz += sizeof(fd_compute_budget_program_instruction_t);
10850 0 : void const * start_data = ctx->data;
10851 0 : int err = fd_compute_budget_program_instruction_decode_footprint_inner( ctx, total_sz );
10852 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10853 0 : ctx->data = start_data;
10854 0 : return err;
10855 0 : }
10856 0 : static void fd_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 ) {
10857 0 : switch (discriminant) {
10858 0 : case 0: {
10859 0 : fd_compute_budget_program_instruction_request_units_deprecated_decode_inner( &self->request_units_deprecated, alloc_mem, ctx );
10860 0 : break;
10861 0 : }
10862 0 : case 1: {
10863 0 : fd_bincode_uint32_decode_unsafe( &self->request_heap_frame, ctx );
10864 0 : break;
10865 0 : }
10866 0 : case 2: {
10867 0 : fd_bincode_uint32_decode_unsafe( &self->set_compute_unit_limit, ctx );
10868 0 : break;
10869 0 : }
10870 0 : case 3: {
10871 0 : fd_bincode_uint64_decode_unsafe( &self->set_compute_unit_price, ctx );
10872 0 : break;
10873 0 : }
10874 0 : case 4: {
10875 0 : fd_bincode_uint32_decode_unsafe( &self->set_loaded_accounts_data_size_limit, ctx );
10876 0 : break;
10877 0 : }
10878 0 : }
10879 0 : }
10880 0 : static void fd_compute_budget_program_instruction_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
10881 0 : fd_compute_budget_program_instruction_t * self = (fd_compute_budget_program_instruction_t *)struct_mem;
10882 0 : ushort tmp = 0;
10883 0 : fd_bincode_compact_u16_decode_unsafe( &tmp, ctx );
10884 0 : self->discriminant = tmp;
10885 0 : fd_compute_budget_program_instruction_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
10886 0 : }
10887 0 : void * fd_compute_budget_program_instruction_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
10888 0 : fd_compute_budget_program_instruction_t * self = (fd_compute_budget_program_instruction_t *)mem;
10889 0 : fd_compute_budget_program_instruction_new( self );
10890 0 : void * alloc_region = (uchar *)mem + sizeof(fd_compute_budget_program_instruction_t);
10891 0 : void * * alloc_mem = &alloc_region;
10892 0 : fd_compute_budget_program_instruction_decode_inner( mem, alloc_mem, ctx );
10893 0 : return self;
10894 0 : }
10895 0 : void fd_compute_budget_program_instruction_inner_new( fd_compute_budget_program_instruction_inner_t * self, uint discriminant ) {
10896 0 : switch( discriminant ) {
10897 0 : case 0: {
10898 0 : fd_compute_budget_program_instruction_request_units_deprecated_new( &self->request_units_deprecated );
10899 0 : break;
10900 0 : }
10901 0 : case 1: {
10902 0 : break;
10903 0 : }
10904 0 : case 2: {
10905 0 : break;
10906 0 : }
10907 0 : case 3: {
10908 0 : break;
10909 0 : }
10910 0 : case 4: {
10911 0 : break;
10912 0 : }
10913 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
10914 0 : }
10915 0 : }
10916 0 : void fd_compute_budget_program_instruction_new_disc( fd_compute_budget_program_instruction_t * self, uint discriminant ) {
10917 0 : self->discriminant = discriminant;
10918 0 : fd_compute_budget_program_instruction_inner_new( &self->inner, self->discriminant );
10919 0 : }
10920 0 : void fd_compute_budget_program_instruction_new( fd_compute_budget_program_instruction_t * self ) {
10921 0 : fd_memset( self, 0, sizeof(fd_compute_budget_program_instruction_t) );
10922 0 : fd_compute_budget_program_instruction_new_disc( self, UINT_MAX );
10923 0 : }
10924 :
10925 0 : void fd_compute_budget_program_instruction_walk( void * w, fd_compute_budget_program_instruction_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
10926 0 : (void) varint;
10927 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_compute_budget_program_instruction", level++, 0);
10928 0 : switch( self->discriminant ) {
10929 0 : case 0: {
10930 0 : fun( w, self, "request_units_deprecated", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
10931 0 : fd_compute_budget_program_instruction_request_units_deprecated_walk( w, &self->inner.request_units_deprecated, fun, "request_units_deprecated", level, 0 );
10932 0 : break;
10933 0 : }
10934 0 : case 1: {
10935 0 : fun( w, self, "request_heap_frame", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
10936 0 : fun( w, &self->inner.request_heap_frame, "request_heap_frame", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
10937 0 : break;
10938 0 : }
10939 0 : case 2: {
10940 0 : fun( w, self, "set_compute_unit_limit", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
10941 0 : fun( w, &self->inner.set_compute_unit_limit, "set_compute_unit_limit", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
10942 0 : break;
10943 0 : }
10944 0 : case 3: {
10945 0 : fun( w, self, "set_compute_unit_price", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
10946 0 : fun( w, &self->inner.set_compute_unit_price, "set_compute_unit_price", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
10947 0 : break;
10948 0 : }
10949 0 : case 4: {
10950 0 : fun( w, self, "set_loaded_accounts_data_size_limit", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
10951 0 : fun( w, &self->inner.set_loaded_accounts_data_size_limit, "set_loaded_accounts_data_size_limit", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
10952 0 : break;
10953 0 : }
10954 0 : }
10955 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_compute_budget_program_instruction", level--, 0 );
10956 0 : }
10957 0 : ulong fd_compute_budget_program_instruction_size( fd_compute_budget_program_instruction_t const * self ) {
10958 0 : ulong size = 0;
10959 0 : size += sizeof(uint);
10960 0 : switch (self->discriminant) {
10961 0 : case 0: {
10962 0 : size += fd_compute_budget_program_instruction_request_units_deprecated_size( &self->inner.request_units_deprecated );
10963 0 : break;
10964 0 : }
10965 0 : case 1: {
10966 0 : size += sizeof(uint);
10967 0 : break;
10968 0 : }
10969 0 : case 2: {
10970 0 : size += sizeof(uint);
10971 0 : break;
10972 0 : }
10973 0 : case 3: {
10974 0 : size += sizeof(ulong);
10975 0 : break;
10976 0 : }
10977 0 : case 4: {
10978 0 : size += sizeof(uint);
10979 0 : break;
10980 0 : }
10981 0 : }
10982 0 : return size;
10983 0 : }
10984 :
10985 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 ) {
10986 0 : int err;
10987 0 : switch (discriminant) {
10988 0 : case 0: {
10989 0 : err = fd_compute_budget_program_instruction_request_units_deprecated_encode( &self->request_units_deprecated, ctx );
10990 0 : if( FD_UNLIKELY( err ) ) return err;
10991 0 : break;
10992 0 : }
10993 0 : case 1: {
10994 0 : err = fd_bincode_uint32_encode( self->request_heap_frame, ctx );
10995 0 : if( FD_UNLIKELY( err ) ) return err;
10996 0 : break;
10997 0 : }
10998 0 : case 2: {
10999 0 : err = fd_bincode_uint32_encode( self->set_compute_unit_limit, ctx );
11000 0 : if( FD_UNLIKELY( err ) ) return err;
11001 0 : break;
11002 0 : }
11003 0 : case 3: {
11004 0 : err = fd_bincode_uint64_encode( self->set_compute_unit_price, ctx );
11005 0 : if( FD_UNLIKELY( err ) ) return err;
11006 0 : break;
11007 0 : }
11008 0 : case 4: {
11009 0 : err = fd_bincode_uint32_encode( self->set_loaded_accounts_data_size_limit, ctx );
11010 0 : if( FD_UNLIKELY( err ) ) return err;
11011 0 : break;
11012 0 : }
11013 0 : }
11014 0 : return FD_BINCODE_SUCCESS;
11015 0 : }
11016 0 : int fd_compute_budget_program_instruction_encode( fd_compute_budget_program_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
11017 0 : ushort discriminant = (ushort) self->discriminant;
11018 0 : int err = fd_bincode_compact_u16_encode( &discriminant, ctx );
11019 0 : if( FD_UNLIKELY( err ) ) return err;
11020 0 : return fd_compute_budget_program_instruction_inner_encode( &self->inner, self->discriminant, ctx );
11021 0 : }
11022 :
11023 0 : int fd_config_keys_encode( fd_config_keys_t const * self, fd_bincode_encode_ctx_t * ctx ) {
11024 0 : int err;
11025 0 : err = fd_bincode_compact_u16_encode( &self->keys_len, ctx );
11026 0 : if( FD_UNLIKELY(err) ) return err;
11027 0 : if( self->keys_len ) {
11028 0 : for( ulong i=0; i < self->keys_len; i++ ) {
11029 0 : err = fd_config_keys_pair_encode( self->keys + i, ctx );
11030 0 : if( FD_UNLIKELY( err ) ) return err;
11031 0 : }
11032 0 : }
11033 0 : return FD_BINCODE_SUCCESS;
11034 0 : }
11035 0 : static int fd_config_keys_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11036 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11037 0 : int err = 0;
11038 0 : ushort keys_len;
11039 0 : err = fd_bincode_compact_u16_decode( &keys_len, ctx );
11040 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11041 0 : if( keys_len ) {
11042 0 : *total_sz += FD_CONFIG_KEYS_PAIR_ALIGN + sizeof(fd_config_keys_pair_t)*keys_len;
11043 0 : for( ulong i=0; i < keys_len; i++ ) {
11044 0 : err = fd_config_keys_pair_decode_footprint_inner( ctx, total_sz );
11045 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11046 0 : }
11047 0 : }
11048 0 : return 0;
11049 0 : }
11050 0 : int fd_config_keys_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11051 0 : *total_sz += sizeof(fd_config_keys_t);
11052 0 : void const * start_data = ctx->data;
11053 0 : int err = fd_config_keys_decode_footprint_inner( ctx, total_sz );
11054 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11055 0 : ctx->data = start_data;
11056 0 : return err;
11057 0 : }
11058 0 : static void fd_config_keys_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
11059 0 : fd_config_keys_t * self = (fd_config_keys_t *)struct_mem;
11060 0 : fd_bincode_compact_u16_decode_unsafe( &self->keys_len, ctx );
11061 0 : if( self->keys_len ) {
11062 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_CONFIG_KEYS_PAIR_ALIGN );
11063 0 : self->keys = *alloc_mem;
11064 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_config_keys_pair_t)*self->keys_len;
11065 0 : for( ulong i=0; i < self->keys_len; i++ ) {
11066 0 : fd_config_keys_pair_new( self->keys + i );
11067 0 : fd_config_keys_pair_decode_inner( self->keys + i, alloc_mem, ctx );
11068 0 : }
11069 0 : } else
11070 0 : self->keys = NULL;
11071 0 : }
11072 0 : void * fd_config_keys_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
11073 0 : fd_config_keys_t * self = (fd_config_keys_t *)mem;
11074 0 : fd_config_keys_new( self );
11075 0 : void * alloc_region = (uchar *)mem + sizeof(fd_config_keys_t);
11076 0 : void * * alloc_mem = &alloc_region;
11077 0 : fd_config_keys_decode_inner( mem, alloc_mem, ctx );
11078 0 : return self;
11079 0 : }
11080 0 : void fd_config_keys_new(fd_config_keys_t * self) {
11081 0 : fd_memset( self, 0, sizeof(fd_config_keys_t) );
11082 0 : }
11083 0 : void fd_config_keys_walk( void * w, fd_config_keys_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
11084 0 : (void) varint;
11085 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_config_keys", level++, 0 );
11086 0 : fun( w, &self->keys_len, "keys_len", FD_FLAMENCO_TYPE_USHORT, "ushort", level, 1 );
11087 0 : if( self->keys_len ) {
11088 0 : fun( w, NULL, "keys", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
11089 0 : for( ulong i=0; i < self->keys_len; i++ )
11090 0 : fd_config_keys_pair_walk(w, self->keys + i, fun, "config_keys_pair", level, 0 );
11091 0 : fun( w, NULL, "keys", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
11092 0 : }
11093 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_config_keys", level--, 0 );
11094 0 : }
11095 0 : ulong fd_config_keys_size( fd_config_keys_t const * self ) {
11096 0 : ulong size = 0;
11097 0 : do {
11098 0 : ushort tmp = (ushort)self->keys_len;
11099 0 : size += fd_bincode_compact_u16_size( &tmp );
11100 0 : for( ulong i=0; i < self->keys_len; i++ )
11101 0 : size += fd_config_keys_pair_size( self->keys + i );
11102 0 : } while(0);
11103 0 : return size;
11104 0 : }
11105 :
11106 0 : int fd_bpf_loader_program_instruction_write_encode( fd_bpf_loader_program_instruction_write_t const * self, fd_bincode_encode_ctx_t * ctx ) {
11107 0 : int err;
11108 0 : err = fd_bincode_uint32_encode( self->offset, ctx );
11109 0 : if( FD_UNLIKELY( err ) ) return err;
11110 0 : err = fd_bincode_uint64_encode( self->bytes_len, ctx );
11111 0 : if( FD_UNLIKELY(err) ) return err;
11112 0 : if( self->bytes_len ) {
11113 0 : err = fd_bincode_bytes_encode( self->bytes, self->bytes_len, ctx );
11114 0 : if( FD_UNLIKELY( err ) ) return err;
11115 0 : }
11116 0 : return FD_BINCODE_SUCCESS;
11117 0 : }
11118 0 : static int fd_bpf_loader_program_instruction_write_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11119 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11120 0 : int err = 0;
11121 0 : err = fd_bincode_uint32_decode_footprint( ctx );
11122 0 : if( FD_UNLIKELY( err ) ) return err;
11123 0 : ulong bytes_len;
11124 0 : err = fd_bincode_uint64_decode( &bytes_len, ctx );
11125 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11126 0 : if( bytes_len ) {
11127 0 : *total_sz += 8UL + bytes_len;
11128 0 : err = fd_bincode_bytes_decode_footprint( bytes_len, ctx );
11129 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11130 0 : }
11131 0 : return 0;
11132 0 : }
11133 0 : int fd_bpf_loader_program_instruction_write_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11134 0 : *total_sz += sizeof(fd_bpf_loader_program_instruction_write_t);
11135 0 : void const * start_data = ctx->data;
11136 0 : int err = fd_bpf_loader_program_instruction_write_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 : static void fd_bpf_loader_program_instruction_write_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
11142 0 : fd_bpf_loader_program_instruction_write_t * self = (fd_bpf_loader_program_instruction_write_t *)struct_mem;
11143 0 : fd_bincode_uint32_decode_unsafe( &self->offset, ctx );
11144 0 : fd_bincode_uint64_decode_unsafe( &self->bytes_len, ctx );
11145 0 : if( self->bytes_len ) {
11146 0 : self->bytes = *alloc_mem;
11147 0 : fd_bincode_bytes_decode_unsafe( self->bytes, self->bytes_len, ctx );
11148 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->bytes_len;
11149 0 : } else
11150 0 : self->bytes = NULL;
11151 0 : }
11152 0 : void * fd_bpf_loader_program_instruction_write_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
11153 0 : fd_bpf_loader_program_instruction_write_t * self = (fd_bpf_loader_program_instruction_write_t *)mem;
11154 0 : fd_bpf_loader_program_instruction_write_new( self );
11155 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_loader_program_instruction_write_t);
11156 0 : void * * alloc_mem = &alloc_region;
11157 0 : fd_bpf_loader_program_instruction_write_decode_inner( mem, alloc_mem, ctx );
11158 0 : return self;
11159 0 : }
11160 0 : void fd_bpf_loader_program_instruction_write_new(fd_bpf_loader_program_instruction_write_t * self) {
11161 0 : fd_memset( self, 0, sizeof(fd_bpf_loader_program_instruction_write_t) );
11162 0 : }
11163 0 : void fd_bpf_loader_program_instruction_write_walk( void * w, fd_bpf_loader_program_instruction_write_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
11164 0 : (void) varint;
11165 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_bpf_loader_program_instruction_write", level++, 0 );
11166 0 : fun( w, &self->offset, "offset", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
11167 0 : if( self->bytes_len ) {
11168 0 : fun( w, NULL, "bytes", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
11169 0 : for( ulong i=0; i < self->bytes_len; i++ )
11170 0 : fun( w, self->bytes + i, "bytes", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
11171 0 : fun( w, NULL, "bytes", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
11172 0 : }
11173 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_bpf_loader_program_instruction_write", level--, 0 );
11174 0 : }
11175 0 : ulong fd_bpf_loader_program_instruction_write_size( fd_bpf_loader_program_instruction_write_t const * self ) {
11176 0 : ulong size = 0;
11177 0 : size += sizeof(uint);
11178 0 : do {
11179 0 : size += sizeof(ulong);
11180 0 : size += self->bytes_len;
11181 0 : } while(0);
11182 0 : return size;
11183 0 : }
11184 :
11185 0 : FD_FN_PURE uchar fd_bpf_loader_program_instruction_is_write(fd_bpf_loader_program_instruction_t const * self) {
11186 0 : return self->discriminant == 0;
11187 0 : }
11188 0 : FD_FN_PURE uchar fd_bpf_loader_program_instruction_is_finalize(fd_bpf_loader_program_instruction_t const * self) {
11189 0 : return self->discriminant == 1;
11190 0 : }
11191 : void fd_bpf_loader_program_instruction_inner_new( fd_bpf_loader_program_instruction_inner_t * self, uint discriminant );
11192 0 : int fd_bpf_loader_program_instruction_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11193 0 : int err;
11194 0 : switch (discriminant) {
11195 0 : case 0: {
11196 0 : err = fd_bpf_loader_program_instruction_write_decode_footprint_inner( ctx, total_sz );
11197 0 : if( FD_UNLIKELY( err ) ) return err;
11198 0 : return FD_BINCODE_SUCCESS;
11199 0 : }
11200 0 : case 1: {
11201 0 : return FD_BINCODE_SUCCESS;
11202 0 : }
11203 0 : default: return FD_BINCODE_ERR_ENCODING;
11204 0 : }
11205 0 : }
11206 0 : static int fd_bpf_loader_program_instruction_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11207 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11208 0 : uint discriminant = 0;
11209 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
11210 0 : if( FD_UNLIKELY( err ) ) return err;
11211 0 : return fd_bpf_loader_program_instruction_inner_decode_footprint( discriminant, ctx, total_sz );
11212 0 : }
11213 0 : int fd_bpf_loader_program_instruction_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11214 0 : *total_sz += sizeof(fd_bpf_loader_program_instruction_t);
11215 0 : void const * start_data = ctx->data;
11216 0 : int err = fd_bpf_loader_program_instruction_decode_footprint_inner( ctx, total_sz );
11217 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11218 0 : ctx->data = start_data;
11219 0 : return err;
11220 0 : }
11221 0 : static void fd_bpf_loader_program_instruction_inner_decode_inner( fd_bpf_loader_program_instruction_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
11222 0 : switch (discriminant) {
11223 0 : case 0: {
11224 0 : fd_bpf_loader_program_instruction_write_decode_inner( &self->write, alloc_mem, ctx );
11225 0 : break;
11226 0 : }
11227 0 : case 1: {
11228 0 : break;
11229 0 : }
11230 0 : }
11231 0 : }
11232 0 : static void fd_bpf_loader_program_instruction_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
11233 0 : fd_bpf_loader_program_instruction_t * self = (fd_bpf_loader_program_instruction_t *)struct_mem;
11234 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
11235 0 : fd_bpf_loader_program_instruction_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
11236 0 : }
11237 0 : void * fd_bpf_loader_program_instruction_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
11238 0 : fd_bpf_loader_program_instruction_t * self = (fd_bpf_loader_program_instruction_t *)mem;
11239 0 : fd_bpf_loader_program_instruction_new( self );
11240 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_loader_program_instruction_t);
11241 0 : void * * alloc_mem = &alloc_region;
11242 0 : fd_bpf_loader_program_instruction_decode_inner( mem, alloc_mem, ctx );
11243 0 : return self;
11244 0 : }
11245 0 : void fd_bpf_loader_program_instruction_inner_new( fd_bpf_loader_program_instruction_inner_t * self, uint discriminant ) {
11246 0 : switch( discriminant ) {
11247 0 : case 0: {
11248 0 : fd_bpf_loader_program_instruction_write_new( &self->write );
11249 0 : break;
11250 0 : }
11251 0 : case 1: {
11252 0 : break;
11253 0 : }
11254 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
11255 0 : }
11256 0 : }
11257 0 : void fd_bpf_loader_program_instruction_new_disc( fd_bpf_loader_program_instruction_t * self, uint discriminant ) {
11258 0 : self->discriminant = discriminant;
11259 0 : fd_bpf_loader_program_instruction_inner_new( &self->inner, self->discriminant );
11260 0 : }
11261 0 : void fd_bpf_loader_program_instruction_new( fd_bpf_loader_program_instruction_t * self ) {
11262 0 : fd_memset( self, 0, sizeof(fd_bpf_loader_program_instruction_t) );
11263 0 : fd_bpf_loader_program_instruction_new_disc( self, UINT_MAX );
11264 0 : }
11265 :
11266 0 : void fd_bpf_loader_program_instruction_walk( void * w, fd_bpf_loader_program_instruction_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
11267 0 : (void) varint;
11268 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_bpf_loader_program_instruction", level++, 0);
11269 0 : switch( self->discriminant ) {
11270 0 : case 0: {
11271 0 : fun( w, self, "write", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
11272 0 : fd_bpf_loader_program_instruction_write_walk( w, &self->inner.write, fun, "write", level, 0 );
11273 0 : break;
11274 0 : }
11275 0 : case 1: {
11276 0 : fun( w, self, "finalize", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
11277 0 : break;
11278 0 : }
11279 0 : }
11280 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_bpf_loader_program_instruction", level--, 0 );
11281 0 : }
11282 0 : ulong fd_bpf_loader_program_instruction_size( fd_bpf_loader_program_instruction_t const * self ) {
11283 0 : ulong size = 0;
11284 0 : size += sizeof(uint);
11285 0 : switch (self->discriminant) {
11286 0 : case 0: {
11287 0 : size += fd_bpf_loader_program_instruction_write_size( &self->inner.write );
11288 0 : break;
11289 0 : }
11290 0 : }
11291 0 : return size;
11292 0 : }
11293 :
11294 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 ) {
11295 0 : int err;
11296 0 : switch (discriminant) {
11297 0 : case 0: {
11298 0 : err = fd_bpf_loader_program_instruction_write_encode( &self->write, ctx );
11299 0 : if( FD_UNLIKELY( err ) ) return err;
11300 0 : break;
11301 0 : }
11302 0 : }
11303 0 : return FD_BINCODE_SUCCESS;
11304 0 : }
11305 0 : int fd_bpf_loader_program_instruction_encode( fd_bpf_loader_program_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
11306 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
11307 0 : if( FD_UNLIKELY( err ) ) return err;
11308 0 : return fd_bpf_loader_program_instruction_inner_encode( &self->inner, self->discriminant, ctx );
11309 0 : }
11310 :
11311 0 : int fd_loader_v4_program_instruction_write_encode( fd_loader_v4_program_instruction_write_t const * self, fd_bincode_encode_ctx_t * ctx ) {
11312 0 : int err;
11313 0 : err = fd_bincode_uint32_encode( self->offset, ctx );
11314 0 : if( FD_UNLIKELY( err ) ) return err;
11315 0 : err = fd_bincode_uint64_encode( self->bytes_len, ctx );
11316 0 : if( FD_UNLIKELY(err) ) return err;
11317 0 : if( self->bytes_len ) {
11318 0 : err = fd_bincode_bytes_encode( self->bytes, self->bytes_len, ctx );
11319 0 : if( FD_UNLIKELY( err ) ) return err;
11320 0 : }
11321 0 : return FD_BINCODE_SUCCESS;
11322 0 : }
11323 0 : static int fd_loader_v4_program_instruction_write_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11324 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11325 0 : int err = 0;
11326 0 : err = fd_bincode_uint32_decode_footprint( ctx );
11327 0 : if( FD_UNLIKELY( err ) ) return err;
11328 0 : ulong bytes_len;
11329 0 : err = fd_bincode_uint64_decode( &bytes_len, ctx );
11330 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11331 0 : if( bytes_len ) {
11332 0 : *total_sz += 8UL + bytes_len;
11333 0 : err = fd_bincode_bytes_decode_footprint( bytes_len, ctx );
11334 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11335 0 : }
11336 0 : return 0;
11337 0 : }
11338 0 : int fd_loader_v4_program_instruction_write_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11339 0 : *total_sz += sizeof(fd_loader_v4_program_instruction_write_t);
11340 0 : void const * start_data = ctx->data;
11341 0 : int err = fd_loader_v4_program_instruction_write_decode_footprint_inner( ctx, total_sz );
11342 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11343 0 : ctx->data = start_data;
11344 0 : return err;
11345 0 : }
11346 0 : static void fd_loader_v4_program_instruction_write_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
11347 0 : fd_loader_v4_program_instruction_write_t * self = (fd_loader_v4_program_instruction_write_t *)struct_mem;
11348 0 : fd_bincode_uint32_decode_unsafe( &self->offset, ctx );
11349 0 : fd_bincode_uint64_decode_unsafe( &self->bytes_len, ctx );
11350 0 : if( self->bytes_len ) {
11351 0 : self->bytes = *alloc_mem;
11352 0 : fd_bincode_bytes_decode_unsafe( self->bytes, self->bytes_len, ctx );
11353 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->bytes_len;
11354 0 : } else
11355 0 : self->bytes = NULL;
11356 0 : }
11357 0 : void * fd_loader_v4_program_instruction_write_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
11358 0 : fd_loader_v4_program_instruction_write_t * self = (fd_loader_v4_program_instruction_write_t *)mem;
11359 0 : fd_loader_v4_program_instruction_write_new( self );
11360 0 : void * alloc_region = (uchar *)mem + sizeof(fd_loader_v4_program_instruction_write_t);
11361 0 : void * * alloc_mem = &alloc_region;
11362 0 : fd_loader_v4_program_instruction_write_decode_inner( mem, alloc_mem, ctx );
11363 0 : return self;
11364 0 : }
11365 0 : void fd_loader_v4_program_instruction_write_new(fd_loader_v4_program_instruction_write_t * self) {
11366 0 : fd_memset( self, 0, sizeof(fd_loader_v4_program_instruction_write_t) );
11367 0 : }
11368 0 : void fd_loader_v4_program_instruction_write_walk( void * w, fd_loader_v4_program_instruction_write_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
11369 0 : (void) varint;
11370 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_loader_v4_program_instruction_write", level++, 0 );
11371 0 : fun( w, &self->offset, "offset", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
11372 0 : if( self->bytes_len ) {
11373 0 : fun( w, NULL, "bytes", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
11374 0 : for( ulong i=0; i < self->bytes_len; i++ )
11375 0 : fun( w, self->bytes + i, "bytes", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
11376 0 : fun( w, NULL, "bytes", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
11377 0 : }
11378 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_loader_v4_program_instruction_write", level--, 0 );
11379 0 : }
11380 0 : ulong fd_loader_v4_program_instruction_write_size( fd_loader_v4_program_instruction_write_t const * self ) {
11381 0 : ulong size = 0;
11382 0 : size += sizeof(uint);
11383 0 : do {
11384 0 : size += sizeof(ulong);
11385 0 : size += self->bytes_len;
11386 0 : } while(0);
11387 0 : return size;
11388 0 : }
11389 :
11390 0 : int fd_loader_v4_program_instruction_copy_encode( fd_loader_v4_program_instruction_copy_t const * self, fd_bincode_encode_ctx_t * ctx ) {
11391 0 : int err;
11392 0 : err = fd_bincode_uint32_encode( self->destination_offset, ctx );
11393 0 : if( FD_UNLIKELY( err ) ) return err;
11394 0 : err = fd_bincode_uint32_encode( self->source_offset, ctx );
11395 0 : if( FD_UNLIKELY( err ) ) return err;
11396 0 : err = fd_bincode_uint32_encode( self->length, ctx );
11397 0 : if( FD_UNLIKELY( err ) ) return err;
11398 0 : return FD_BINCODE_SUCCESS;
11399 0 : }
11400 0 : static inline int fd_loader_v4_program_instruction_copy_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11401 0 : if( (ulong)ctx->data + 12UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11402 0 : ctx->data = (void *)( (ulong)ctx->data + 12UL );
11403 0 : return 0;
11404 0 : }
11405 0 : static void fd_loader_v4_program_instruction_copy_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
11406 0 : fd_loader_v4_program_instruction_copy_t * self = (fd_loader_v4_program_instruction_copy_t *)struct_mem;
11407 0 : fd_bincode_uint32_decode_unsafe( &self->destination_offset, ctx );
11408 0 : fd_bincode_uint32_decode_unsafe( &self->source_offset, ctx );
11409 0 : fd_bincode_uint32_decode_unsafe( &self->length, ctx );
11410 0 : }
11411 0 : void * fd_loader_v4_program_instruction_copy_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
11412 0 : fd_loader_v4_program_instruction_copy_t * self = (fd_loader_v4_program_instruction_copy_t *)mem;
11413 0 : fd_loader_v4_program_instruction_copy_new( self );
11414 0 : void * alloc_region = (uchar *)mem + sizeof(fd_loader_v4_program_instruction_copy_t);
11415 0 : void * * alloc_mem = &alloc_region;
11416 0 : fd_loader_v4_program_instruction_copy_decode_inner( mem, alloc_mem, ctx );
11417 0 : return self;
11418 0 : }
11419 0 : void fd_loader_v4_program_instruction_copy_walk( void * w, fd_loader_v4_program_instruction_copy_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
11420 0 : (void) varint;
11421 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_loader_v4_program_instruction_copy", level++, 0 );
11422 0 : fun( w, &self->destination_offset, "destination_offset", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
11423 0 : fun( w, &self->source_offset, "source_offset", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
11424 0 : fun( w, &self->length, "length", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
11425 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_loader_v4_program_instruction_copy", level--, 0 );
11426 0 : }
11427 0 : int fd_loader_v4_program_instruction_set_program_length_encode( fd_loader_v4_program_instruction_set_program_length_t const * self, fd_bincode_encode_ctx_t * ctx ) {
11428 0 : int err;
11429 0 : err = fd_bincode_uint32_encode( self->new_size, ctx );
11430 0 : if( FD_UNLIKELY( err ) ) return err;
11431 0 : return FD_BINCODE_SUCCESS;
11432 0 : }
11433 0 : static inline int fd_loader_v4_program_instruction_set_program_length_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11434 0 : if( (ulong)ctx->data + 4UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11435 0 : ctx->data = (void *)( (ulong)ctx->data + 4UL );
11436 0 : return 0;
11437 0 : }
11438 0 : static void fd_loader_v4_program_instruction_set_program_length_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
11439 0 : fd_loader_v4_program_instruction_set_program_length_t * self = (fd_loader_v4_program_instruction_set_program_length_t *)struct_mem;
11440 0 : fd_bincode_uint32_decode_unsafe( &self->new_size, ctx );
11441 0 : }
11442 0 : void * fd_loader_v4_program_instruction_set_program_length_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
11443 0 : fd_loader_v4_program_instruction_set_program_length_t * self = (fd_loader_v4_program_instruction_set_program_length_t *)mem;
11444 0 : fd_loader_v4_program_instruction_set_program_length_new( self );
11445 0 : void * alloc_region = (uchar *)mem + sizeof(fd_loader_v4_program_instruction_set_program_length_t);
11446 0 : void * * alloc_mem = &alloc_region;
11447 0 : fd_loader_v4_program_instruction_set_program_length_decode_inner( mem, alloc_mem, ctx );
11448 0 : return self;
11449 0 : }
11450 0 : void fd_loader_v4_program_instruction_set_program_length_walk( void * w, fd_loader_v4_program_instruction_set_program_length_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
11451 0 : (void) varint;
11452 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_loader_v4_program_instruction_set_program_length", level++, 0 );
11453 0 : fun( w, &self->new_size, "new_size", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
11454 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_loader_v4_program_instruction_set_program_length", level--, 0 );
11455 0 : }
11456 0 : FD_FN_PURE uchar fd_loader_v4_program_instruction_is_write(fd_loader_v4_program_instruction_t const * self) {
11457 0 : return self->discriminant == 0;
11458 0 : }
11459 0 : FD_FN_PURE uchar fd_loader_v4_program_instruction_is_copy(fd_loader_v4_program_instruction_t const * self) {
11460 0 : return self->discriminant == 1;
11461 0 : }
11462 0 : FD_FN_PURE uchar fd_loader_v4_program_instruction_is_set_program_length(fd_loader_v4_program_instruction_t const * self) {
11463 0 : return self->discriminant == 2;
11464 0 : }
11465 0 : FD_FN_PURE uchar fd_loader_v4_program_instruction_is_deploy(fd_loader_v4_program_instruction_t const * self) {
11466 0 : return self->discriminant == 3;
11467 0 : }
11468 0 : FD_FN_PURE uchar fd_loader_v4_program_instruction_is_retract(fd_loader_v4_program_instruction_t const * self) {
11469 0 : return self->discriminant == 4;
11470 0 : }
11471 0 : FD_FN_PURE uchar fd_loader_v4_program_instruction_is_transfer_authority(fd_loader_v4_program_instruction_t const * self) {
11472 0 : return self->discriminant == 5;
11473 0 : }
11474 0 : FD_FN_PURE uchar fd_loader_v4_program_instruction_is_finalize(fd_loader_v4_program_instruction_t const * self) {
11475 0 : return self->discriminant == 6;
11476 0 : }
11477 : void fd_loader_v4_program_instruction_inner_new( fd_loader_v4_program_instruction_inner_t * self, uint discriminant );
11478 0 : int fd_loader_v4_program_instruction_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11479 0 : int err;
11480 0 : switch (discriminant) {
11481 0 : case 0: {
11482 0 : err = fd_loader_v4_program_instruction_write_decode_footprint_inner( ctx, total_sz );
11483 0 : if( FD_UNLIKELY( err ) ) return err;
11484 0 : return FD_BINCODE_SUCCESS;
11485 0 : }
11486 0 : case 1: {
11487 0 : err = fd_loader_v4_program_instruction_copy_decode_footprint_inner( ctx, total_sz );
11488 0 : if( FD_UNLIKELY( err ) ) return err;
11489 0 : return FD_BINCODE_SUCCESS;
11490 0 : }
11491 0 : case 2: {
11492 0 : err = fd_loader_v4_program_instruction_set_program_length_decode_footprint_inner( ctx, total_sz );
11493 0 : if( FD_UNLIKELY( err ) ) return err;
11494 0 : return FD_BINCODE_SUCCESS;
11495 0 : }
11496 0 : case 3: {
11497 0 : return FD_BINCODE_SUCCESS;
11498 0 : }
11499 0 : case 4: {
11500 0 : return FD_BINCODE_SUCCESS;
11501 0 : }
11502 0 : case 5: {
11503 0 : return FD_BINCODE_SUCCESS;
11504 0 : }
11505 0 : case 6: {
11506 0 : return FD_BINCODE_SUCCESS;
11507 0 : }
11508 0 : default: return FD_BINCODE_ERR_ENCODING;
11509 0 : }
11510 0 : }
11511 0 : static int fd_loader_v4_program_instruction_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11512 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11513 0 : uint discriminant = 0;
11514 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
11515 0 : if( FD_UNLIKELY( err ) ) return err;
11516 0 : return fd_loader_v4_program_instruction_inner_decode_footprint( discriminant, ctx, total_sz );
11517 0 : }
11518 0 : int fd_loader_v4_program_instruction_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11519 0 : *total_sz += sizeof(fd_loader_v4_program_instruction_t);
11520 0 : void const * start_data = ctx->data;
11521 0 : int err = fd_loader_v4_program_instruction_decode_footprint_inner( ctx, total_sz );
11522 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11523 0 : ctx->data = start_data;
11524 0 : return err;
11525 0 : }
11526 0 : static void fd_loader_v4_program_instruction_inner_decode_inner( fd_loader_v4_program_instruction_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
11527 0 : switch (discriminant) {
11528 0 : case 0: {
11529 0 : fd_loader_v4_program_instruction_write_decode_inner( &self->write, alloc_mem, ctx );
11530 0 : break;
11531 0 : }
11532 0 : case 1: {
11533 0 : fd_loader_v4_program_instruction_copy_decode_inner( &self->copy, alloc_mem, ctx );
11534 0 : break;
11535 0 : }
11536 0 : case 2: {
11537 0 : fd_loader_v4_program_instruction_set_program_length_decode_inner( &self->set_program_length, alloc_mem, ctx );
11538 0 : break;
11539 0 : }
11540 0 : case 3: {
11541 0 : break;
11542 0 : }
11543 0 : case 4: {
11544 0 : break;
11545 0 : }
11546 0 : case 5: {
11547 0 : break;
11548 0 : }
11549 0 : case 6: {
11550 0 : break;
11551 0 : }
11552 0 : }
11553 0 : }
11554 0 : static void fd_loader_v4_program_instruction_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
11555 0 : fd_loader_v4_program_instruction_t * self = (fd_loader_v4_program_instruction_t *)struct_mem;
11556 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
11557 0 : fd_loader_v4_program_instruction_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
11558 0 : }
11559 0 : void * fd_loader_v4_program_instruction_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
11560 0 : fd_loader_v4_program_instruction_t * self = (fd_loader_v4_program_instruction_t *)mem;
11561 0 : fd_loader_v4_program_instruction_new( self );
11562 0 : void * alloc_region = (uchar *)mem + sizeof(fd_loader_v4_program_instruction_t);
11563 0 : void * * alloc_mem = &alloc_region;
11564 0 : fd_loader_v4_program_instruction_decode_inner( mem, alloc_mem, ctx );
11565 0 : return self;
11566 0 : }
11567 0 : void fd_loader_v4_program_instruction_inner_new( fd_loader_v4_program_instruction_inner_t * self, uint discriminant ) {
11568 0 : switch( discriminant ) {
11569 0 : case 0: {
11570 0 : fd_loader_v4_program_instruction_write_new( &self->write );
11571 0 : break;
11572 0 : }
11573 0 : case 1: {
11574 0 : fd_loader_v4_program_instruction_copy_new( &self->copy );
11575 0 : break;
11576 0 : }
11577 0 : case 2: {
11578 0 : fd_loader_v4_program_instruction_set_program_length_new( &self->set_program_length );
11579 0 : break;
11580 0 : }
11581 0 : case 3: {
11582 0 : break;
11583 0 : }
11584 0 : case 4: {
11585 0 : break;
11586 0 : }
11587 0 : case 5: {
11588 0 : break;
11589 0 : }
11590 0 : case 6: {
11591 0 : break;
11592 0 : }
11593 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
11594 0 : }
11595 0 : }
11596 0 : void fd_loader_v4_program_instruction_new_disc( fd_loader_v4_program_instruction_t * self, uint discriminant ) {
11597 0 : self->discriminant = discriminant;
11598 0 : fd_loader_v4_program_instruction_inner_new( &self->inner, self->discriminant );
11599 0 : }
11600 0 : void fd_loader_v4_program_instruction_new( fd_loader_v4_program_instruction_t * self ) {
11601 0 : fd_memset( self, 0, sizeof(fd_loader_v4_program_instruction_t) );
11602 0 : fd_loader_v4_program_instruction_new_disc( self, UINT_MAX );
11603 0 : }
11604 :
11605 0 : void fd_loader_v4_program_instruction_walk( void * w, fd_loader_v4_program_instruction_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
11606 0 : (void) varint;
11607 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_loader_v4_program_instruction", level++, 0);
11608 0 : switch( self->discriminant ) {
11609 0 : case 0: {
11610 0 : fun( w, self, "write", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
11611 0 : fd_loader_v4_program_instruction_write_walk( w, &self->inner.write, fun, "write", level, 0 );
11612 0 : break;
11613 0 : }
11614 0 : case 1: {
11615 0 : fun( w, self, "copy", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
11616 0 : fd_loader_v4_program_instruction_copy_walk( w, &self->inner.copy, fun, "copy", level, 0 );
11617 0 : break;
11618 0 : }
11619 0 : case 2: {
11620 0 : fun( w, self, "set_program_length", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
11621 0 : fd_loader_v4_program_instruction_set_program_length_walk( w, &self->inner.set_program_length, fun, "set_program_length", level, 0 );
11622 0 : break;
11623 0 : }
11624 0 : case 3: {
11625 0 : fun( w, self, "deploy", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
11626 0 : break;
11627 0 : }
11628 0 : case 4: {
11629 0 : fun( w, self, "retract", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
11630 0 : break;
11631 0 : }
11632 0 : case 5: {
11633 0 : fun( w, self, "transfer_authority", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
11634 0 : break;
11635 0 : }
11636 0 : case 6: {
11637 0 : fun( w, self, "finalize", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
11638 0 : break;
11639 0 : }
11640 0 : }
11641 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_loader_v4_program_instruction", level--, 0 );
11642 0 : }
11643 0 : ulong fd_loader_v4_program_instruction_size( fd_loader_v4_program_instruction_t const * self ) {
11644 0 : ulong size = 0;
11645 0 : size += sizeof(uint);
11646 0 : switch (self->discriminant) {
11647 0 : case 0: {
11648 0 : size += fd_loader_v4_program_instruction_write_size( &self->inner.write );
11649 0 : break;
11650 0 : }
11651 0 : case 1: {
11652 0 : size += fd_loader_v4_program_instruction_copy_size( &self->inner.copy );
11653 0 : break;
11654 0 : }
11655 0 : case 2: {
11656 0 : size += fd_loader_v4_program_instruction_set_program_length_size( &self->inner.set_program_length );
11657 0 : break;
11658 0 : }
11659 0 : }
11660 0 : return size;
11661 0 : }
11662 :
11663 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 ) {
11664 0 : int err;
11665 0 : switch (discriminant) {
11666 0 : case 0: {
11667 0 : err = fd_loader_v4_program_instruction_write_encode( &self->write, ctx );
11668 0 : if( FD_UNLIKELY( err ) ) return err;
11669 0 : break;
11670 0 : }
11671 0 : case 1: {
11672 0 : err = fd_loader_v4_program_instruction_copy_encode( &self->copy, ctx );
11673 0 : if( FD_UNLIKELY( err ) ) return err;
11674 0 : break;
11675 0 : }
11676 0 : case 2: {
11677 0 : err = fd_loader_v4_program_instruction_set_program_length_encode( &self->set_program_length, ctx );
11678 0 : if( FD_UNLIKELY( err ) ) return err;
11679 0 : break;
11680 0 : }
11681 0 : }
11682 0 : return FD_BINCODE_SUCCESS;
11683 0 : }
11684 0 : int fd_loader_v4_program_instruction_encode( fd_loader_v4_program_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
11685 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
11686 0 : if( FD_UNLIKELY( err ) ) return err;
11687 0 : return fd_loader_v4_program_instruction_inner_encode( &self->inner, self->discriminant, ctx );
11688 0 : }
11689 :
11690 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 ) {
11691 0 : int err;
11692 0 : err = fd_bincode_uint32_encode( self->offset, ctx );
11693 0 : if( FD_UNLIKELY( err ) ) return err;
11694 0 : err = fd_bincode_uint64_encode( self->bytes_len, ctx );
11695 0 : if( FD_UNLIKELY(err) ) return err;
11696 0 : if( self->bytes_len ) {
11697 0 : err = fd_bincode_bytes_encode( self->bytes, self->bytes_len, ctx );
11698 0 : if( FD_UNLIKELY( err ) ) return err;
11699 0 : }
11700 0 : return FD_BINCODE_SUCCESS;
11701 0 : }
11702 0 : static int fd_bpf_upgradeable_loader_program_instruction_write_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11703 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11704 0 : int err = 0;
11705 0 : err = fd_bincode_uint32_decode_footprint( ctx );
11706 0 : if( FD_UNLIKELY( err ) ) return err;
11707 0 : ulong bytes_len;
11708 0 : err = fd_bincode_uint64_decode( &bytes_len, ctx );
11709 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11710 0 : if( bytes_len ) {
11711 0 : *total_sz += 8UL + bytes_len;
11712 0 : err = fd_bincode_bytes_decode_footprint( bytes_len, ctx );
11713 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11714 0 : }
11715 0 : return 0;
11716 0 : }
11717 0 : int fd_bpf_upgradeable_loader_program_instruction_write_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11718 0 : *total_sz += sizeof(fd_bpf_upgradeable_loader_program_instruction_write_t);
11719 0 : void const * start_data = ctx->data;
11720 0 : int err = fd_bpf_upgradeable_loader_program_instruction_write_decode_footprint_inner( ctx, total_sz );
11721 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11722 0 : ctx->data = start_data;
11723 0 : return err;
11724 0 : }
11725 0 : static void fd_bpf_upgradeable_loader_program_instruction_write_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
11726 0 : fd_bpf_upgradeable_loader_program_instruction_write_t * self = (fd_bpf_upgradeable_loader_program_instruction_write_t *)struct_mem;
11727 0 : fd_bincode_uint32_decode_unsafe( &self->offset, ctx );
11728 0 : fd_bincode_uint64_decode_unsafe( &self->bytes_len, ctx );
11729 0 : if( self->bytes_len ) {
11730 0 : self->bytes = *alloc_mem;
11731 0 : fd_bincode_bytes_decode_unsafe( self->bytes, self->bytes_len, ctx );
11732 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->bytes_len;
11733 0 : } else
11734 0 : self->bytes = NULL;
11735 0 : }
11736 0 : void * fd_bpf_upgradeable_loader_program_instruction_write_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
11737 0 : fd_bpf_upgradeable_loader_program_instruction_write_t * self = (fd_bpf_upgradeable_loader_program_instruction_write_t *)mem;
11738 0 : fd_bpf_upgradeable_loader_program_instruction_write_new( self );
11739 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_program_instruction_write_t);
11740 0 : void * * alloc_mem = &alloc_region;
11741 0 : fd_bpf_upgradeable_loader_program_instruction_write_decode_inner( mem, alloc_mem, ctx );
11742 0 : return self;
11743 0 : }
11744 0 : void fd_bpf_upgradeable_loader_program_instruction_write_new(fd_bpf_upgradeable_loader_program_instruction_write_t * self) {
11745 0 : fd_memset( self, 0, sizeof(fd_bpf_upgradeable_loader_program_instruction_write_t) );
11746 0 : }
11747 0 : void fd_bpf_upgradeable_loader_program_instruction_write_walk( void * w, fd_bpf_upgradeable_loader_program_instruction_write_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
11748 0 : (void) varint;
11749 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_bpf_upgradeable_loader_program_instruction_write", level++, 0 );
11750 0 : fun( w, &self->offset, "offset", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
11751 0 : if( self->bytes_len ) {
11752 0 : fun( w, NULL, "bytes", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
11753 0 : for( ulong i=0; i < self->bytes_len; i++ )
11754 0 : fun( w, self->bytes + i, "bytes", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
11755 0 : fun( w, NULL, "bytes", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
11756 0 : }
11757 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_bpf_upgradeable_loader_program_instruction_write", level--, 0 );
11758 0 : }
11759 0 : ulong fd_bpf_upgradeable_loader_program_instruction_write_size( fd_bpf_upgradeable_loader_program_instruction_write_t const * self ) {
11760 0 : ulong size = 0;
11761 0 : size += sizeof(uint);
11762 0 : do {
11763 0 : size += sizeof(ulong);
11764 0 : size += self->bytes_len;
11765 0 : } while(0);
11766 0 : return size;
11767 0 : }
11768 :
11769 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 ) {
11770 0 : int err;
11771 0 : err = fd_bincode_uint64_encode( self->max_data_len, ctx );
11772 0 : if( FD_UNLIKELY( err ) ) return err;
11773 0 : return FD_BINCODE_SUCCESS;
11774 0 : }
11775 0 : static inline int fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11776 0 : if( (ulong)ctx->data + 8UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11777 0 : ctx->data = (void *)( (ulong)ctx->data + 8UL );
11778 0 : return 0;
11779 0 : }
11780 0 : static void fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
11781 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;
11782 0 : fd_bincode_uint64_decode_unsafe( &self->max_data_len, ctx );
11783 0 : }
11784 0 : void * fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
11785 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;
11786 0 : fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_new( self );
11787 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_t);
11788 0 : void * * alloc_mem = &alloc_region;
11789 0 : fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_decode_inner( mem, alloc_mem, ctx );
11790 0 : return self;
11791 0 : }
11792 0 : void fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_walk( void * w, fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
11793 0 : (void) varint;
11794 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len", level++, 0 );
11795 0 : fun( w, &self->max_data_len, "max_data_len", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
11796 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len", level--, 0 );
11797 0 : }
11798 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 ) {
11799 0 : int err;
11800 0 : err = fd_bincode_uint32_encode( self->additional_bytes, ctx );
11801 0 : if( FD_UNLIKELY( err ) ) return err;
11802 0 : return FD_BINCODE_SUCCESS;
11803 0 : }
11804 0 : static inline int fd_bpf_upgradeable_loader_program_instruction_extend_program_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11805 0 : if( (ulong)ctx->data + 4UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11806 0 : ctx->data = (void *)( (ulong)ctx->data + 4UL );
11807 0 : return 0;
11808 0 : }
11809 0 : static void fd_bpf_upgradeable_loader_program_instruction_extend_program_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
11810 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_t * self = (fd_bpf_upgradeable_loader_program_instruction_extend_program_t *)struct_mem;
11811 0 : fd_bincode_uint32_decode_unsafe( &self->additional_bytes, ctx );
11812 0 : }
11813 0 : void * fd_bpf_upgradeable_loader_program_instruction_extend_program_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
11814 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_t * self = (fd_bpf_upgradeable_loader_program_instruction_extend_program_t *)mem;
11815 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_new( self );
11816 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_program_instruction_extend_program_t);
11817 0 : void * * alloc_mem = &alloc_region;
11818 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_decode_inner( mem, alloc_mem, ctx );
11819 0 : return self;
11820 0 : }
11821 0 : void fd_bpf_upgradeable_loader_program_instruction_extend_program_walk( void * w, fd_bpf_upgradeable_loader_program_instruction_extend_program_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
11822 0 : (void) varint;
11823 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_bpf_upgradeable_loader_program_instruction_extend_program", level++, 0 );
11824 0 : fun( w, &self->additional_bytes, "additional_bytes", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
11825 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_bpf_upgradeable_loader_program_instruction_extend_program", level--, 0 );
11826 0 : }
11827 0 : int fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_encode( fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_t const * self, fd_bincode_encode_ctx_t * ctx ) {
11828 0 : int err;
11829 0 : err = fd_bincode_uint32_encode( self->additional_bytes, ctx );
11830 0 : if( FD_UNLIKELY( err ) ) return err;
11831 0 : return FD_BINCODE_SUCCESS;
11832 0 : }
11833 0 : static inline int fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11834 0 : if( (ulong)ctx->data + 4UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11835 0 : ctx->data = (void *)( (ulong)ctx->data + 4UL );
11836 0 : return 0;
11837 0 : }
11838 0 : static void fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
11839 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_t * self = (fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_t *)struct_mem;
11840 0 : fd_bincode_uint32_decode_unsafe( &self->additional_bytes, ctx );
11841 0 : }
11842 0 : void * fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
11843 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_t * self = (fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_t *)mem;
11844 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_new( self );
11845 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_t);
11846 0 : void * * alloc_mem = &alloc_region;
11847 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_decode_inner( mem, alloc_mem, ctx );
11848 0 : return self;
11849 0 : }
11850 0 : void fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_walk( void * w, fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
11851 0 : (void) varint;
11852 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_bpf_upgradeable_loader_program_instruction_extend_program_checked", level++, 0 );
11853 0 : fun( w, &self->additional_bytes, "additional_bytes", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
11854 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_bpf_upgradeable_loader_program_instruction_extend_program_checked", level--, 0 );
11855 0 : }
11856 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_initialize_buffer(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
11857 0 : return self->discriminant == 0;
11858 0 : }
11859 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_write(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
11860 0 : return self->discriminant == 1;
11861 0 : }
11862 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) {
11863 0 : return self->discriminant == 2;
11864 0 : }
11865 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_upgrade(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
11866 0 : return self->discriminant == 3;
11867 0 : }
11868 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_set_authority(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
11869 0 : return self->discriminant == 4;
11870 0 : }
11871 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_close(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
11872 0 : return self->discriminant == 5;
11873 0 : }
11874 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_extend_program(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
11875 0 : return self->discriminant == 6;
11876 0 : }
11877 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_set_authority_checked(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
11878 0 : return self->discriminant == 7;
11879 0 : }
11880 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_migrate(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
11881 0 : return self->discriminant == 8;
11882 0 : }
11883 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_extend_program_checked(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
11884 0 : return self->discriminant == 9;
11885 0 : }
11886 : void fd_bpf_upgradeable_loader_program_instruction_inner_new( fd_bpf_upgradeable_loader_program_instruction_inner_t * self, uint discriminant );
11887 0 : int fd_bpf_upgradeable_loader_program_instruction_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11888 0 : int err;
11889 0 : switch (discriminant) {
11890 0 : case 0: {
11891 0 : return FD_BINCODE_SUCCESS;
11892 0 : }
11893 0 : case 1: {
11894 0 : err = fd_bpf_upgradeable_loader_program_instruction_write_decode_footprint_inner( ctx, total_sz );
11895 0 : if( FD_UNLIKELY( err ) ) return err;
11896 0 : return FD_BINCODE_SUCCESS;
11897 0 : }
11898 0 : case 2: {
11899 0 : err = fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_decode_footprint_inner( ctx, total_sz );
11900 0 : if( FD_UNLIKELY( err ) ) return err;
11901 0 : return FD_BINCODE_SUCCESS;
11902 0 : }
11903 0 : case 3: {
11904 0 : return FD_BINCODE_SUCCESS;
11905 0 : }
11906 0 : case 4: {
11907 0 : return FD_BINCODE_SUCCESS;
11908 0 : }
11909 0 : case 5: {
11910 0 : return FD_BINCODE_SUCCESS;
11911 0 : }
11912 0 : case 6: {
11913 0 : err = fd_bpf_upgradeable_loader_program_instruction_extend_program_decode_footprint_inner( ctx, total_sz );
11914 0 : if( FD_UNLIKELY( err ) ) return err;
11915 0 : return FD_BINCODE_SUCCESS;
11916 0 : }
11917 0 : case 7: {
11918 0 : return FD_BINCODE_SUCCESS;
11919 0 : }
11920 0 : case 8: {
11921 0 : return FD_BINCODE_SUCCESS;
11922 0 : }
11923 0 : case 9: {
11924 0 : err = fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_decode_footprint_inner( ctx, total_sz );
11925 0 : if( FD_UNLIKELY( err ) ) return err;
11926 0 : return FD_BINCODE_SUCCESS;
11927 0 : }
11928 0 : default: return FD_BINCODE_ERR_ENCODING;
11929 0 : }
11930 0 : }
11931 0 : static int fd_bpf_upgradeable_loader_program_instruction_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11932 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11933 0 : uint discriminant = 0;
11934 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
11935 0 : if( FD_UNLIKELY( err ) ) return err;
11936 0 : return fd_bpf_upgradeable_loader_program_instruction_inner_decode_footprint( discriminant, ctx, total_sz );
11937 0 : }
11938 0 : int fd_bpf_upgradeable_loader_program_instruction_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11939 0 : *total_sz += sizeof(fd_bpf_upgradeable_loader_program_instruction_t);
11940 0 : void const * start_data = ctx->data;
11941 0 : int err = fd_bpf_upgradeable_loader_program_instruction_decode_footprint_inner( ctx, total_sz );
11942 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11943 0 : ctx->data = start_data;
11944 0 : return err;
11945 0 : }
11946 0 : static void fd_bpf_upgradeable_loader_program_instruction_inner_decode_inner( fd_bpf_upgradeable_loader_program_instruction_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
11947 0 : switch (discriminant) {
11948 0 : case 0: {
11949 0 : break;
11950 0 : }
11951 0 : case 1: {
11952 0 : fd_bpf_upgradeable_loader_program_instruction_write_decode_inner( &self->write, alloc_mem, ctx );
11953 0 : break;
11954 0 : }
11955 0 : case 2: {
11956 0 : fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_decode_inner( &self->deploy_with_max_data_len, alloc_mem, ctx );
11957 0 : break;
11958 0 : }
11959 0 : case 3: {
11960 0 : break;
11961 0 : }
11962 0 : case 4: {
11963 0 : break;
11964 0 : }
11965 0 : case 5: {
11966 0 : break;
11967 0 : }
11968 0 : case 6: {
11969 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_decode_inner( &self->extend_program, alloc_mem, ctx );
11970 0 : break;
11971 0 : }
11972 0 : case 7: {
11973 0 : break;
11974 0 : }
11975 0 : case 8: {
11976 0 : break;
11977 0 : }
11978 0 : case 9: {
11979 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_decode_inner( &self->extend_program_checked, alloc_mem, ctx );
11980 0 : break;
11981 0 : }
11982 0 : }
11983 0 : }
11984 0 : static void fd_bpf_upgradeable_loader_program_instruction_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
11985 0 : fd_bpf_upgradeable_loader_program_instruction_t * self = (fd_bpf_upgradeable_loader_program_instruction_t *)struct_mem;
11986 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
11987 0 : fd_bpf_upgradeable_loader_program_instruction_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
11988 0 : }
11989 0 : void * fd_bpf_upgradeable_loader_program_instruction_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
11990 0 : fd_bpf_upgradeable_loader_program_instruction_t * self = (fd_bpf_upgradeable_loader_program_instruction_t *)mem;
11991 0 : fd_bpf_upgradeable_loader_program_instruction_new( self );
11992 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_program_instruction_t);
11993 0 : void * * alloc_mem = &alloc_region;
11994 0 : fd_bpf_upgradeable_loader_program_instruction_decode_inner( mem, alloc_mem, ctx );
11995 0 : return self;
11996 0 : }
11997 0 : void fd_bpf_upgradeable_loader_program_instruction_inner_new( fd_bpf_upgradeable_loader_program_instruction_inner_t * self, uint discriminant ) {
11998 0 : switch( discriminant ) {
11999 0 : case 0: {
12000 0 : break;
12001 0 : }
12002 0 : case 1: {
12003 0 : fd_bpf_upgradeable_loader_program_instruction_write_new( &self->write );
12004 0 : break;
12005 0 : }
12006 0 : case 2: {
12007 0 : fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_new( &self->deploy_with_max_data_len );
12008 0 : break;
12009 0 : }
12010 0 : case 3: {
12011 0 : break;
12012 0 : }
12013 0 : case 4: {
12014 0 : break;
12015 0 : }
12016 0 : case 5: {
12017 0 : break;
12018 0 : }
12019 0 : case 6: {
12020 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_new( &self->extend_program );
12021 0 : break;
12022 0 : }
12023 0 : case 7: {
12024 0 : break;
12025 0 : }
12026 0 : case 8: {
12027 0 : break;
12028 0 : }
12029 0 : case 9: {
12030 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_new( &self->extend_program_checked );
12031 0 : break;
12032 0 : }
12033 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
12034 0 : }
12035 0 : }
12036 0 : void fd_bpf_upgradeable_loader_program_instruction_new_disc( fd_bpf_upgradeable_loader_program_instruction_t * self, uint discriminant ) {
12037 0 : self->discriminant = discriminant;
12038 0 : fd_bpf_upgradeable_loader_program_instruction_inner_new( &self->inner, self->discriminant );
12039 0 : }
12040 0 : void fd_bpf_upgradeable_loader_program_instruction_new( fd_bpf_upgradeable_loader_program_instruction_t * self ) {
12041 0 : fd_memset( self, 0, sizeof(fd_bpf_upgradeable_loader_program_instruction_t) );
12042 0 : fd_bpf_upgradeable_loader_program_instruction_new_disc( self, UINT_MAX );
12043 0 : }
12044 :
12045 0 : void fd_bpf_upgradeable_loader_program_instruction_walk( void * w, fd_bpf_upgradeable_loader_program_instruction_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
12046 0 : (void) varint;
12047 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_bpf_upgradeable_loader_program_instruction", level++, 0);
12048 0 : switch( self->discriminant ) {
12049 0 : case 0: {
12050 0 : fun( w, self, "initialize_buffer", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
12051 0 : break;
12052 0 : }
12053 0 : case 1: {
12054 0 : fun( w, self, "write", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
12055 0 : fd_bpf_upgradeable_loader_program_instruction_write_walk( w, &self->inner.write, fun, "write", level, 0 );
12056 0 : break;
12057 0 : }
12058 0 : case 2: {
12059 0 : fun( w, self, "deploy_with_max_data_len", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
12060 0 : fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_walk( w, &self->inner.deploy_with_max_data_len, fun, "deploy_with_max_data_len", level, 0 );
12061 0 : break;
12062 0 : }
12063 0 : case 3: {
12064 0 : fun( w, self, "upgrade", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
12065 0 : break;
12066 0 : }
12067 0 : case 4: {
12068 0 : fun( w, self, "set_authority", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
12069 0 : break;
12070 0 : }
12071 0 : case 5: {
12072 0 : fun( w, self, "close", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
12073 0 : break;
12074 0 : }
12075 0 : case 6: {
12076 0 : fun( w, self, "extend_program", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
12077 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_walk( w, &self->inner.extend_program, fun, "extend_program", level, 0 );
12078 0 : break;
12079 0 : }
12080 0 : case 7: {
12081 0 : fun( w, self, "set_authority_checked", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
12082 0 : break;
12083 0 : }
12084 0 : case 8: {
12085 0 : fun( w, self, "migrate", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
12086 0 : break;
12087 0 : }
12088 0 : case 9: {
12089 0 : fun( w, self, "extend_program_checked", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
12090 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_walk( w, &self->inner.extend_program_checked, fun, "extend_program_checked", level, 0 );
12091 0 : break;
12092 0 : }
12093 0 : }
12094 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_bpf_upgradeable_loader_program_instruction", level--, 0 );
12095 0 : }
12096 0 : ulong fd_bpf_upgradeable_loader_program_instruction_size( fd_bpf_upgradeable_loader_program_instruction_t const * self ) {
12097 0 : ulong size = 0;
12098 0 : size += sizeof(uint);
12099 0 : switch (self->discriminant) {
12100 0 : case 1: {
12101 0 : size += fd_bpf_upgradeable_loader_program_instruction_write_size( &self->inner.write );
12102 0 : break;
12103 0 : }
12104 0 : case 2: {
12105 0 : size += fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_size( &self->inner.deploy_with_max_data_len );
12106 0 : break;
12107 0 : }
12108 0 : case 6: {
12109 0 : size += fd_bpf_upgradeable_loader_program_instruction_extend_program_size( &self->inner.extend_program );
12110 0 : break;
12111 0 : }
12112 0 : case 9: {
12113 0 : size += fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_size( &self->inner.extend_program_checked );
12114 0 : break;
12115 0 : }
12116 0 : }
12117 0 : return size;
12118 0 : }
12119 :
12120 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 ) {
12121 0 : int err;
12122 0 : switch (discriminant) {
12123 0 : case 1: {
12124 0 : err = fd_bpf_upgradeable_loader_program_instruction_write_encode( &self->write, ctx );
12125 0 : if( FD_UNLIKELY( err ) ) return err;
12126 0 : break;
12127 0 : }
12128 0 : case 2: {
12129 0 : err = fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_encode( &self->deploy_with_max_data_len, ctx );
12130 0 : if( FD_UNLIKELY( err ) ) return err;
12131 0 : break;
12132 0 : }
12133 0 : case 6: {
12134 0 : err = fd_bpf_upgradeable_loader_program_instruction_extend_program_encode( &self->extend_program, ctx );
12135 0 : if( FD_UNLIKELY( err ) ) return err;
12136 0 : break;
12137 0 : }
12138 0 : case 9: {
12139 0 : err = fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_encode( &self->extend_program_checked, ctx );
12140 0 : if( FD_UNLIKELY( err ) ) return err;
12141 0 : break;
12142 0 : }
12143 0 : }
12144 0 : return FD_BINCODE_SUCCESS;
12145 0 : }
12146 0 : int fd_bpf_upgradeable_loader_program_instruction_encode( fd_bpf_upgradeable_loader_program_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
12147 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
12148 0 : if( FD_UNLIKELY( err ) ) return err;
12149 0 : return fd_bpf_upgradeable_loader_program_instruction_inner_encode( &self->inner, self->discriminant, ctx );
12150 0 : }
12151 :
12152 0 : int fd_bpf_upgradeable_loader_state_buffer_encode( fd_bpf_upgradeable_loader_state_buffer_t const * self, fd_bincode_encode_ctx_t * ctx ) {
12153 0 : int err;
12154 0 : err = fd_bincode_bool_encode( self->has_authority_address, ctx );
12155 0 : if( FD_UNLIKELY( err ) ) return err;
12156 0 : if( self->has_authority_address ) {
12157 0 : err = fd_pubkey_encode( &self->authority_address, ctx );
12158 0 : if( FD_UNLIKELY( err ) ) return err;
12159 0 : }
12160 0 : return FD_BINCODE_SUCCESS;
12161 0 : }
12162 0 : static int fd_bpf_upgradeable_loader_state_buffer_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12163 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12164 0 : int err = 0;
12165 0 : {
12166 0 : uchar o;
12167 0 : err = fd_bincode_bool_decode( &o, ctx );
12168 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12169 0 : if( o ) {
12170 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
12171 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12172 0 : }
12173 0 : }
12174 0 : return 0;
12175 0 : }
12176 0 : int fd_bpf_upgradeable_loader_state_buffer_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12177 0 : *total_sz += sizeof(fd_bpf_upgradeable_loader_state_buffer_t);
12178 0 : void const * start_data = ctx->data;
12179 0 : int err = fd_bpf_upgradeable_loader_state_buffer_decode_footprint_inner( ctx, total_sz );
12180 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12181 0 : ctx->data = start_data;
12182 0 : return err;
12183 0 : }
12184 0 : static void fd_bpf_upgradeable_loader_state_buffer_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
12185 0 : fd_bpf_upgradeable_loader_state_buffer_t * self = (fd_bpf_upgradeable_loader_state_buffer_t *)struct_mem;
12186 0 : {
12187 0 : uchar o;
12188 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
12189 0 : self->has_authority_address = !!o;
12190 0 : if( o ) {
12191 0 : fd_pubkey_new( &self->authority_address );
12192 0 : fd_pubkey_decode_inner( &self->authority_address, alloc_mem, ctx );
12193 0 : }
12194 0 : }
12195 0 : }
12196 0 : void * fd_bpf_upgradeable_loader_state_buffer_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
12197 0 : fd_bpf_upgradeable_loader_state_buffer_t * self = (fd_bpf_upgradeable_loader_state_buffer_t *)mem;
12198 0 : fd_bpf_upgradeable_loader_state_buffer_new( self );
12199 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_state_buffer_t);
12200 0 : void * * alloc_mem = &alloc_region;
12201 0 : fd_bpf_upgradeable_loader_state_buffer_decode_inner( mem, alloc_mem, ctx );
12202 0 : return self;
12203 0 : }
12204 0 : void fd_bpf_upgradeable_loader_state_buffer_new(fd_bpf_upgradeable_loader_state_buffer_t * self) {
12205 0 : fd_memset( self, 0, sizeof(fd_bpf_upgradeable_loader_state_buffer_t) );
12206 0 : }
12207 0 : void fd_bpf_upgradeable_loader_state_buffer_walk( void * w, fd_bpf_upgradeable_loader_state_buffer_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
12208 0 : (void) varint;
12209 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_bpf_upgradeable_loader_state_buffer", level++, 0 );
12210 0 : if( !self->has_authority_address ) {
12211 0 : fun( w, NULL, "authority_address", FD_FLAMENCO_TYPE_NULL, "pubkey", level, 0 );
12212 0 : } else {
12213 0 : fd_pubkey_walk( w, &self->authority_address, fun, "authority_address", level, 0 );
12214 0 : }
12215 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_bpf_upgradeable_loader_state_buffer", level--, 0 );
12216 0 : }
12217 0 : ulong fd_bpf_upgradeable_loader_state_buffer_size( fd_bpf_upgradeable_loader_state_buffer_t const * self ) {
12218 0 : ulong size = 0;
12219 0 : size += sizeof(char);
12220 0 : if( self->has_authority_address ) {
12221 0 : size += fd_pubkey_size( &self->authority_address );
12222 0 : }
12223 0 : return size;
12224 0 : }
12225 :
12226 0 : int fd_bpf_upgradeable_loader_state_program_encode( fd_bpf_upgradeable_loader_state_program_t const * self, fd_bincode_encode_ctx_t * ctx ) {
12227 0 : int err;
12228 0 : err = fd_pubkey_encode( &self->programdata_address, ctx );
12229 0 : if( FD_UNLIKELY( err ) ) return err;
12230 0 : return FD_BINCODE_SUCCESS;
12231 0 : }
12232 0 : static inline int fd_bpf_upgradeable_loader_state_program_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12233 0 : if( (ulong)ctx->data + 32UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12234 0 : ctx->data = (void *)( (ulong)ctx->data + 32UL );
12235 0 : return 0;
12236 0 : }
12237 0 : static void fd_bpf_upgradeable_loader_state_program_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
12238 0 : fd_bpf_upgradeable_loader_state_program_t * self = (fd_bpf_upgradeable_loader_state_program_t *)struct_mem;
12239 0 : fd_pubkey_decode_inner( &self->programdata_address, alloc_mem, ctx );
12240 0 : }
12241 0 : void * fd_bpf_upgradeable_loader_state_program_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
12242 0 : fd_bpf_upgradeable_loader_state_program_t * self = (fd_bpf_upgradeable_loader_state_program_t *)mem;
12243 0 : fd_bpf_upgradeable_loader_state_program_new( self );
12244 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_state_program_t);
12245 0 : void * * alloc_mem = &alloc_region;
12246 0 : fd_bpf_upgradeable_loader_state_program_decode_inner( mem, alloc_mem, ctx );
12247 0 : return self;
12248 0 : }
12249 0 : void fd_bpf_upgradeable_loader_state_program_walk( void * w, fd_bpf_upgradeable_loader_state_program_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
12250 0 : (void) varint;
12251 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_bpf_upgradeable_loader_state_program", level++, 0 );
12252 0 : fd_pubkey_walk( w, &self->programdata_address, fun, "programdata_address", level, 0 );
12253 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_bpf_upgradeable_loader_state_program", level--, 0 );
12254 0 : }
12255 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 ) {
12256 0 : int err;
12257 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
12258 0 : if( FD_UNLIKELY( err ) ) return err;
12259 0 : err = fd_bincode_bool_encode( self->has_upgrade_authority_address, ctx );
12260 0 : if( FD_UNLIKELY( err ) ) return err;
12261 0 : if( self->has_upgrade_authority_address ) {
12262 0 : err = fd_pubkey_encode( &self->upgrade_authority_address, ctx );
12263 0 : if( FD_UNLIKELY( err ) ) return err;
12264 0 : }
12265 0 : return FD_BINCODE_SUCCESS;
12266 0 : }
12267 0 : static int fd_bpf_upgradeable_loader_state_program_data_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12268 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12269 0 : int err = 0;
12270 0 : err = fd_bincode_uint64_decode_footprint( ctx );
12271 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12272 0 : {
12273 0 : uchar o;
12274 0 : err = fd_bincode_bool_decode( &o, ctx );
12275 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12276 0 : if( o ) {
12277 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
12278 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12279 0 : }
12280 0 : }
12281 0 : return 0;
12282 0 : }
12283 0 : int fd_bpf_upgradeable_loader_state_program_data_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12284 0 : *total_sz += sizeof(fd_bpf_upgradeable_loader_state_program_data_t);
12285 0 : void const * start_data = ctx->data;
12286 0 : int err = fd_bpf_upgradeable_loader_state_program_data_decode_footprint_inner( ctx, total_sz );
12287 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12288 0 : ctx->data = start_data;
12289 0 : return err;
12290 0 : }
12291 0 : static void fd_bpf_upgradeable_loader_state_program_data_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
12292 0 : fd_bpf_upgradeable_loader_state_program_data_t * self = (fd_bpf_upgradeable_loader_state_program_data_t *)struct_mem;
12293 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
12294 0 : {
12295 0 : uchar o;
12296 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
12297 0 : self->has_upgrade_authority_address = !!o;
12298 0 : if( o ) {
12299 0 : fd_pubkey_new( &self->upgrade_authority_address );
12300 0 : fd_pubkey_decode_inner( &self->upgrade_authority_address, alloc_mem, ctx );
12301 0 : }
12302 0 : }
12303 0 : }
12304 0 : void * fd_bpf_upgradeable_loader_state_program_data_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
12305 0 : fd_bpf_upgradeable_loader_state_program_data_t * self = (fd_bpf_upgradeable_loader_state_program_data_t *)mem;
12306 0 : fd_bpf_upgradeable_loader_state_program_data_new( self );
12307 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_state_program_data_t);
12308 0 : void * * alloc_mem = &alloc_region;
12309 0 : fd_bpf_upgradeable_loader_state_program_data_decode_inner( mem, alloc_mem, ctx );
12310 0 : return self;
12311 0 : }
12312 0 : void fd_bpf_upgradeable_loader_state_program_data_new(fd_bpf_upgradeable_loader_state_program_data_t * self) {
12313 0 : fd_memset( self, 0, sizeof(fd_bpf_upgradeable_loader_state_program_data_t) );
12314 0 : }
12315 0 : void fd_bpf_upgradeable_loader_state_program_data_walk( void * w, fd_bpf_upgradeable_loader_state_program_data_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
12316 0 : (void) varint;
12317 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_bpf_upgradeable_loader_state_program_data", level++, 0 );
12318 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
12319 0 : if( !self->has_upgrade_authority_address ) {
12320 0 : fun( w, NULL, "upgrade_authority_address", FD_FLAMENCO_TYPE_NULL, "pubkey", level, 0 );
12321 0 : } else {
12322 0 : fd_pubkey_walk( w, &self->upgrade_authority_address, fun, "upgrade_authority_address", level, 0 );
12323 0 : }
12324 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_bpf_upgradeable_loader_state_program_data", level--, 0 );
12325 0 : }
12326 0 : ulong fd_bpf_upgradeable_loader_state_program_data_size( fd_bpf_upgradeable_loader_state_program_data_t const * self ) {
12327 0 : ulong size = 0;
12328 0 : size += sizeof(ulong);
12329 0 : size += sizeof(char);
12330 0 : if( self->has_upgrade_authority_address ) {
12331 0 : size += fd_pubkey_size( &self->upgrade_authority_address );
12332 0 : }
12333 0 : return size;
12334 0 : }
12335 :
12336 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_state_is_uninitialized(fd_bpf_upgradeable_loader_state_t const * self) {
12337 0 : return self->discriminant == 0;
12338 0 : }
12339 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_state_is_buffer(fd_bpf_upgradeable_loader_state_t const * self) {
12340 0 : return self->discriminant == 1;
12341 0 : }
12342 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_state_is_program(fd_bpf_upgradeable_loader_state_t const * self) {
12343 0 : return self->discriminant == 2;
12344 0 : }
12345 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_state_is_program_data(fd_bpf_upgradeable_loader_state_t const * self) {
12346 0 : return self->discriminant == 3;
12347 0 : }
12348 : void fd_bpf_upgradeable_loader_state_inner_new( fd_bpf_upgradeable_loader_state_inner_t * self, uint discriminant );
12349 0 : int fd_bpf_upgradeable_loader_state_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12350 0 : int err;
12351 0 : switch (discriminant) {
12352 0 : case 0: {
12353 0 : return FD_BINCODE_SUCCESS;
12354 0 : }
12355 0 : case 1: {
12356 0 : err = fd_bpf_upgradeable_loader_state_buffer_decode_footprint_inner( ctx, total_sz );
12357 0 : if( FD_UNLIKELY( err ) ) return err;
12358 0 : return FD_BINCODE_SUCCESS;
12359 0 : }
12360 0 : case 2: {
12361 0 : err = fd_bpf_upgradeable_loader_state_program_decode_footprint_inner( ctx, total_sz );
12362 0 : if( FD_UNLIKELY( err ) ) return err;
12363 0 : return FD_BINCODE_SUCCESS;
12364 0 : }
12365 0 : case 3: {
12366 0 : err = fd_bpf_upgradeable_loader_state_program_data_decode_footprint_inner( ctx, total_sz );
12367 0 : if( FD_UNLIKELY( err ) ) return err;
12368 0 : return FD_BINCODE_SUCCESS;
12369 0 : }
12370 0 : default: return FD_BINCODE_ERR_ENCODING;
12371 0 : }
12372 0 : }
12373 0 : static int fd_bpf_upgradeable_loader_state_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12374 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12375 0 : uint discriminant = 0;
12376 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
12377 0 : if( FD_UNLIKELY( err ) ) return err;
12378 0 : return fd_bpf_upgradeable_loader_state_inner_decode_footprint( discriminant, ctx, total_sz );
12379 0 : }
12380 0 : int fd_bpf_upgradeable_loader_state_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12381 0 : *total_sz += sizeof(fd_bpf_upgradeable_loader_state_t);
12382 0 : void const * start_data = ctx->data;
12383 0 : int err = fd_bpf_upgradeable_loader_state_decode_footprint_inner( ctx, total_sz );
12384 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12385 0 : ctx->data = start_data;
12386 0 : return err;
12387 0 : }
12388 0 : static void fd_bpf_upgradeable_loader_state_inner_decode_inner( fd_bpf_upgradeable_loader_state_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
12389 0 : switch (discriminant) {
12390 0 : case 0: {
12391 0 : break;
12392 0 : }
12393 0 : case 1: {
12394 0 : fd_bpf_upgradeable_loader_state_buffer_decode_inner( &self->buffer, alloc_mem, ctx );
12395 0 : break;
12396 0 : }
12397 0 : case 2: {
12398 0 : fd_bpf_upgradeable_loader_state_program_decode_inner( &self->program, alloc_mem, ctx );
12399 0 : break;
12400 0 : }
12401 0 : case 3: {
12402 0 : fd_bpf_upgradeable_loader_state_program_data_decode_inner( &self->program_data, alloc_mem, ctx );
12403 0 : break;
12404 0 : }
12405 0 : }
12406 0 : }
12407 0 : static void fd_bpf_upgradeable_loader_state_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
12408 0 : fd_bpf_upgradeable_loader_state_t * self = (fd_bpf_upgradeable_loader_state_t *)struct_mem;
12409 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
12410 0 : fd_bpf_upgradeable_loader_state_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
12411 0 : }
12412 0 : void * fd_bpf_upgradeable_loader_state_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
12413 0 : fd_bpf_upgradeable_loader_state_t * self = (fd_bpf_upgradeable_loader_state_t *)mem;
12414 0 : fd_bpf_upgradeable_loader_state_new( self );
12415 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_state_t);
12416 0 : void * * alloc_mem = &alloc_region;
12417 0 : fd_bpf_upgradeable_loader_state_decode_inner( mem, alloc_mem, ctx );
12418 0 : return self;
12419 0 : }
12420 0 : void fd_bpf_upgradeable_loader_state_inner_new( fd_bpf_upgradeable_loader_state_inner_t * self, uint discriminant ) {
12421 0 : switch( discriminant ) {
12422 0 : case 0: {
12423 0 : break;
12424 0 : }
12425 0 : case 1: {
12426 0 : fd_bpf_upgradeable_loader_state_buffer_new( &self->buffer );
12427 0 : break;
12428 0 : }
12429 0 : case 2: {
12430 0 : fd_bpf_upgradeable_loader_state_program_new( &self->program );
12431 0 : break;
12432 0 : }
12433 0 : case 3: {
12434 0 : fd_bpf_upgradeable_loader_state_program_data_new( &self->program_data );
12435 0 : break;
12436 0 : }
12437 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
12438 0 : }
12439 0 : }
12440 0 : void fd_bpf_upgradeable_loader_state_new_disc( fd_bpf_upgradeable_loader_state_t * self, uint discriminant ) {
12441 0 : self->discriminant = discriminant;
12442 0 : fd_bpf_upgradeable_loader_state_inner_new( &self->inner, self->discriminant );
12443 0 : }
12444 0 : void fd_bpf_upgradeable_loader_state_new( fd_bpf_upgradeable_loader_state_t * self ) {
12445 0 : fd_memset( self, 0, sizeof(fd_bpf_upgradeable_loader_state_t) );
12446 0 : fd_bpf_upgradeable_loader_state_new_disc( self, UINT_MAX );
12447 0 : }
12448 :
12449 0 : void fd_bpf_upgradeable_loader_state_walk( void * w, fd_bpf_upgradeable_loader_state_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
12450 0 : (void) varint;
12451 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_bpf_upgradeable_loader_state", level++, 0);
12452 0 : switch( self->discriminant ) {
12453 0 : case 0: {
12454 0 : fun( w, self, "uninitialized", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
12455 0 : break;
12456 0 : }
12457 0 : case 1: {
12458 0 : fun( w, self, "buffer", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
12459 0 : fd_bpf_upgradeable_loader_state_buffer_walk( w, &self->inner.buffer, fun, "buffer", level, 0 );
12460 0 : break;
12461 0 : }
12462 0 : case 2: {
12463 0 : fun( w, self, "program", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
12464 0 : fd_bpf_upgradeable_loader_state_program_walk( w, &self->inner.program, fun, "program", level, 0 );
12465 0 : break;
12466 0 : }
12467 0 : case 3: {
12468 0 : fun( w, self, "program_data", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
12469 0 : fd_bpf_upgradeable_loader_state_program_data_walk( w, &self->inner.program_data, fun, "program_data", level, 0 );
12470 0 : break;
12471 0 : }
12472 0 : }
12473 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_bpf_upgradeable_loader_state", level--, 0 );
12474 0 : }
12475 0 : ulong fd_bpf_upgradeable_loader_state_size( fd_bpf_upgradeable_loader_state_t const * self ) {
12476 0 : ulong size = 0;
12477 0 : size += sizeof(uint);
12478 0 : switch (self->discriminant) {
12479 0 : case 1: {
12480 0 : size += fd_bpf_upgradeable_loader_state_buffer_size( &self->inner.buffer );
12481 0 : break;
12482 0 : }
12483 0 : case 2: {
12484 0 : size += fd_bpf_upgradeable_loader_state_program_size( &self->inner.program );
12485 0 : break;
12486 0 : }
12487 0 : case 3: {
12488 0 : size += fd_bpf_upgradeable_loader_state_program_data_size( &self->inner.program_data );
12489 0 : break;
12490 0 : }
12491 0 : }
12492 0 : return size;
12493 0 : }
12494 :
12495 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 ) {
12496 0 : int err;
12497 0 : switch (discriminant) {
12498 0 : case 1: {
12499 0 : err = fd_bpf_upgradeable_loader_state_buffer_encode( &self->buffer, ctx );
12500 0 : if( FD_UNLIKELY( err ) ) return err;
12501 0 : break;
12502 0 : }
12503 0 : case 2: {
12504 0 : err = fd_bpf_upgradeable_loader_state_program_encode( &self->program, ctx );
12505 0 : if( FD_UNLIKELY( err ) ) return err;
12506 0 : break;
12507 0 : }
12508 0 : case 3: {
12509 0 : err = fd_bpf_upgradeable_loader_state_program_data_encode( &self->program_data, ctx );
12510 0 : if( FD_UNLIKELY( err ) ) return err;
12511 0 : break;
12512 0 : }
12513 0 : }
12514 0 : return FD_BINCODE_SUCCESS;
12515 0 : }
12516 0 : int fd_bpf_upgradeable_loader_state_encode( fd_bpf_upgradeable_loader_state_t const * self, fd_bincode_encode_ctx_t * ctx ) {
12517 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
12518 0 : if( FD_UNLIKELY( err ) ) return err;
12519 0 : return fd_bpf_upgradeable_loader_state_inner_encode( &self->inner, self->discriminant, ctx );
12520 0 : }
12521 :
12522 0 : int fd_loader_v4_state_encode( fd_loader_v4_state_t const * self, fd_bincode_encode_ctx_t * ctx ) {
12523 0 : int err;
12524 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
12525 0 : if( FD_UNLIKELY( err ) ) return err;
12526 0 : err = fd_pubkey_encode( &self->authority_address_or_next_version, ctx );
12527 0 : if( FD_UNLIKELY( err ) ) return err;
12528 0 : err = fd_bincode_uint64_encode( self->status, ctx );
12529 0 : if( FD_UNLIKELY( err ) ) return err;
12530 0 : return FD_BINCODE_SUCCESS;
12531 0 : }
12532 0 : static inline int fd_loader_v4_state_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12533 0 : if( (ulong)ctx->data + 48UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12534 0 : ctx->data = (void *)( (ulong)ctx->data + 48UL );
12535 0 : return 0;
12536 0 : }
12537 0 : static void fd_loader_v4_state_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
12538 0 : fd_loader_v4_state_t * self = (fd_loader_v4_state_t *)struct_mem;
12539 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
12540 0 : fd_pubkey_decode_inner( &self->authority_address_or_next_version, alloc_mem, ctx );
12541 0 : fd_bincode_uint64_decode_unsafe( &self->status, ctx );
12542 0 : }
12543 0 : void * fd_loader_v4_state_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
12544 0 : fd_loader_v4_state_t * self = (fd_loader_v4_state_t *)mem;
12545 0 : fd_loader_v4_state_new( self );
12546 0 : void * alloc_region = (uchar *)mem + sizeof(fd_loader_v4_state_t);
12547 0 : void * * alloc_mem = &alloc_region;
12548 0 : fd_loader_v4_state_decode_inner( mem, alloc_mem, ctx );
12549 0 : return self;
12550 0 : }
12551 0 : void fd_loader_v4_state_walk( void * w, fd_loader_v4_state_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
12552 0 : (void) varint;
12553 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_loader_v4_state", level++, 0 );
12554 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
12555 0 : fd_pubkey_walk( w, &self->authority_address_or_next_version, fun, "authority_address_or_next_version", level, 0 );
12556 0 : fun( w, &self->status, "status", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
12557 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_loader_v4_state", level--, 0 );
12558 0 : }
12559 0 : int fd_frozen_hash_status_encode( fd_frozen_hash_status_t const * self, fd_bincode_encode_ctx_t * ctx ) {
12560 0 : int err;
12561 0 : err = fd_hash_encode( &self->frozen_hash, ctx );
12562 0 : if( FD_UNLIKELY( err ) ) return err;
12563 0 : err = fd_bincode_bool_encode( (uchar)(self->is_duplicate_confirmed), ctx );
12564 0 : if( FD_UNLIKELY( err ) ) return err;
12565 0 : return FD_BINCODE_SUCCESS;
12566 0 : }
12567 0 : static int fd_frozen_hash_status_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12568 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12569 0 : int err = 0;
12570 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
12571 0 : if( FD_UNLIKELY( err ) ) return err;
12572 0 : err = fd_bincode_bool_decode_footprint( ctx );
12573 0 : if( FD_UNLIKELY( err ) ) return err;
12574 0 : return 0;
12575 0 : }
12576 0 : int fd_frozen_hash_status_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12577 0 : *total_sz += sizeof(fd_frozen_hash_status_t);
12578 0 : void const * start_data = ctx->data;
12579 0 : int err = fd_frozen_hash_status_decode_footprint_inner( ctx, total_sz );
12580 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12581 0 : ctx->data = start_data;
12582 0 : return err;
12583 0 : }
12584 0 : static void fd_frozen_hash_status_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
12585 0 : fd_frozen_hash_status_t * self = (fd_frozen_hash_status_t *)struct_mem;
12586 0 : fd_hash_decode_inner( &self->frozen_hash, alloc_mem, ctx );
12587 0 : fd_bincode_bool_decode_unsafe( &self->is_duplicate_confirmed, ctx );
12588 0 : }
12589 0 : void * fd_frozen_hash_status_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
12590 0 : fd_frozen_hash_status_t * self = (fd_frozen_hash_status_t *)mem;
12591 0 : fd_frozen_hash_status_new( self );
12592 0 : void * alloc_region = (uchar *)mem + sizeof(fd_frozen_hash_status_t);
12593 0 : void * * alloc_mem = &alloc_region;
12594 0 : fd_frozen_hash_status_decode_inner( mem, alloc_mem, ctx );
12595 0 : return self;
12596 0 : }
12597 0 : void fd_frozen_hash_status_new(fd_frozen_hash_status_t * self) {
12598 0 : fd_memset( self, 0, sizeof(fd_frozen_hash_status_t) );
12599 0 : fd_hash_new( &self->frozen_hash );
12600 0 : }
12601 0 : void fd_frozen_hash_status_walk( void * w, fd_frozen_hash_status_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
12602 0 : (void) varint;
12603 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_frozen_hash_status", level++, 0 );
12604 0 : fd_hash_walk( w, &self->frozen_hash, fun, "frozen_hash", level, 0 );
12605 0 : fun( w, &self->is_duplicate_confirmed, "is_duplicate_confirmed", FD_FLAMENCO_TYPE_BOOL, "bool", level, 0 );
12606 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_frozen_hash_status", level--, 0 );
12607 0 : }
12608 0 : FD_FN_PURE uchar fd_frozen_hash_versioned_is_current(fd_frozen_hash_versioned_t const * self) {
12609 0 : return self->discriminant == 0;
12610 0 : }
12611 : void fd_frozen_hash_versioned_inner_new( fd_frozen_hash_versioned_inner_t * self, uint discriminant );
12612 0 : int fd_frozen_hash_versioned_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12613 0 : int err;
12614 0 : switch (discriminant) {
12615 0 : case 0: {
12616 0 : err = fd_frozen_hash_status_decode_footprint_inner( ctx, total_sz );
12617 0 : if( FD_UNLIKELY( err ) ) return err;
12618 0 : return FD_BINCODE_SUCCESS;
12619 0 : }
12620 0 : default: return FD_BINCODE_ERR_ENCODING;
12621 0 : }
12622 0 : }
12623 0 : static int fd_frozen_hash_versioned_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12624 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12625 0 : uint discriminant = 0;
12626 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
12627 0 : if( FD_UNLIKELY( err ) ) return err;
12628 0 : return fd_frozen_hash_versioned_inner_decode_footprint( discriminant, ctx, total_sz );
12629 0 : }
12630 0 : int fd_frozen_hash_versioned_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12631 0 : *total_sz += sizeof(fd_frozen_hash_versioned_t);
12632 0 : void const * start_data = ctx->data;
12633 0 : int err = fd_frozen_hash_versioned_decode_footprint_inner( ctx, total_sz );
12634 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12635 0 : ctx->data = start_data;
12636 0 : return err;
12637 0 : }
12638 0 : static void fd_frozen_hash_versioned_inner_decode_inner( fd_frozen_hash_versioned_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
12639 0 : switch (discriminant) {
12640 0 : case 0: {
12641 0 : fd_frozen_hash_status_decode_inner( &self->current, alloc_mem, ctx );
12642 0 : break;
12643 0 : }
12644 0 : }
12645 0 : }
12646 0 : static void fd_frozen_hash_versioned_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
12647 0 : fd_frozen_hash_versioned_t * self = (fd_frozen_hash_versioned_t *)struct_mem;
12648 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
12649 0 : fd_frozen_hash_versioned_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
12650 0 : }
12651 0 : void * fd_frozen_hash_versioned_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
12652 0 : fd_frozen_hash_versioned_t * self = (fd_frozen_hash_versioned_t *)mem;
12653 0 : fd_frozen_hash_versioned_new( self );
12654 0 : void * alloc_region = (uchar *)mem + sizeof(fd_frozen_hash_versioned_t);
12655 0 : void * * alloc_mem = &alloc_region;
12656 0 : fd_frozen_hash_versioned_decode_inner( mem, alloc_mem, ctx );
12657 0 : return self;
12658 0 : }
12659 0 : void fd_frozen_hash_versioned_inner_new( fd_frozen_hash_versioned_inner_t * self, uint discriminant ) {
12660 0 : switch( discriminant ) {
12661 0 : case 0: {
12662 0 : fd_frozen_hash_status_new( &self->current );
12663 0 : break;
12664 0 : }
12665 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
12666 0 : }
12667 0 : }
12668 0 : void fd_frozen_hash_versioned_new_disc( fd_frozen_hash_versioned_t * self, uint discriminant ) {
12669 0 : self->discriminant = discriminant;
12670 0 : fd_frozen_hash_versioned_inner_new( &self->inner, self->discriminant );
12671 0 : }
12672 0 : void fd_frozen_hash_versioned_new( fd_frozen_hash_versioned_t * self ) {
12673 0 : fd_memset( self, 0, sizeof(fd_frozen_hash_versioned_t) );
12674 0 : fd_frozen_hash_versioned_new_disc( self, UINT_MAX );
12675 0 : }
12676 :
12677 0 : void fd_frozen_hash_versioned_walk( void * w, fd_frozen_hash_versioned_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
12678 0 : (void) varint;
12679 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_frozen_hash_versioned", level++, 0);
12680 0 : switch( self->discriminant ) {
12681 0 : case 0: {
12682 0 : fun( w, self, "current", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
12683 0 : fd_frozen_hash_status_walk( w, &self->inner.current, fun, "current", level, 0 );
12684 0 : break;
12685 0 : }
12686 0 : }
12687 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_frozen_hash_versioned", level--, 0 );
12688 0 : }
12689 0 : ulong fd_frozen_hash_versioned_size( fd_frozen_hash_versioned_t const * self ) {
12690 0 : ulong size = 0;
12691 0 : size += sizeof(uint);
12692 0 : switch (self->discriminant) {
12693 0 : case 0: {
12694 0 : size += fd_frozen_hash_status_size( &self->inner.current );
12695 0 : break;
12696 0 : }
12697 0 : }
12698 0 : return size;
12699 0 : }
12700 :
12701 0 : int fd_frozen_hash_versioned_inner_encode( fd_frozen_hash_versioned_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
12702 0 : int err;
12703 0 : switch (discriminant) {
12704 0 : case 0: {
12705 0 : err = fd_frozen_hash_status_encode( &self->current, ctx );
12706 0 : if( FD_UNLIKELY( err ) ) return err;
12707 0 : break;
12708 0 : }
12709 0 : }
12710 0 : return FD_BINCODE_SUCCESS;
12711 0 : }
12712 0 : int fd_frozen_hash_versioned_encode( fd_frozen_hash_versioned_t const * self, fd_bincode_encode_ctx_t * ctx ) {
12713 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
12714 0 : if( FD_UNLIKELY( err ) ) return err;
12715 0 : return fd_frozen_hash_versioned_inner_encode( &self->inner, self->discriminant, ctx );
12716 0 : }
12717 :
12718 0 : int fd_lookup_table_meta_encode( fd_lookup_table_meta_t const * self, fd_bincode_encode_ctx_t * ctx ) {
12719 0 : int err;
12720 0 : err = fd_bincode_uint64_encode( self->deactivation_slot, ctx );
12721 0 : if( FD_UNLIKELY( err ) ) return err;
12722 0 : err = fd_bincode_uint64_encode( self->last_extended_slot, ctx );
12723 0 : if( FD_UNLIKELY( err ) ) return err;
12724 0 : err = fd_bincode_uint8_encode( (uchar)(self->last_extended_slot_start_index), ctx );
12725 0 : if( FD_UNLIKELY( err ) ) return err;
12726 0 : err = fd_bincode_bool_encode( self->has_authority, ctx );
12727 0 : if( FD_UNLIKELY( err ) ) return err;
12728 0 : if( self->has_authority ) {
12729 0 : err = fd_pubkey_encode( &self->authority, ctx );
12730 0 : if( FD_UNLIKELY( err ) ) return err;
12731 0 : }
12732 0 : err = fd_bincode_uint16_encode( self->_padding, ctx );
12733 0 : if( FD_UNLIKELY( err ) ) return err;
12734 0 : return FD_BINCODE_SUCCESS;
12735 0 : }
12736 0 : static int fd_lookup_table_meta_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12737 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12738 0 : int err = 0;
12739 0 : err = fd_bincode_uint64_decode_footprint( ctx );
12740 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12741 0 : err = fd_bincode_uint64_decode_footprint( ctx );
12742 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12743 0 : err = fd_bincode_uint8_decode_footprint( ctx );
12744 0 : if( FD_UNLIKELY( err ) ) return err;
12745 0 : {
12746 0 : uchar o;
12747 0 : err = fd_bincode_bool_decode( &o, ctx );
12748 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12749 0 : if( o ) {
12750 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
12751 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12752 0 : }
12753 0 : }
12754 0 : err = fd_bincode_uint16_decode_footprint( ctx );
12755 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12756 0 : return 0;
12757 0 : }
12758 0 : int fd_lookup_table_meta_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12759 0 : *total_sz += sizeof(fd_lookup_table_meta_t);
12760 0 : void const * start_data = ctx->data;
12761 0 : int err = fd_lookup_table_meta_decode_footprint_inner( ctx, total_sz );
12762 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12763 0 : ctx->data = start_data;
12764 0 : return err;
12765 0 : }
12766 0 : static void fd_lookup_table_meta_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
12767 0 : fd_lookup_table_meta_t * self = (fd_lookup_table_meta_t *)struct_mem;
12768 0 : fd_bincode_uint64_decode_unsafe( &self->deactivation_slot, ctx );
12769 0 : fd_bincode_uint64_decode_unsafe( &self->last_extended_slot, ctx );
12770 0 : fd_bincode_uint8_decode_unsafe( &self->last_extended_slot_start_index, ctx );
12771 0 : {
12772 0 : uchar o;
12773 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
12774 0 : self->has_authority = !!o;
12775 0 : if( o ) {
12776 0 : fd_pubkey_new( &self->authority );
12777 0 : fd_pubkey_decode_inner( &self->authority, alloc_mem, ctx );
12778 0 : }
12779 0 : }
12780 0 : fd_bincode_uint16_decode_unsafe( &self->_padding, ctx );
12781 0 : }
12782 0 : void * fd_lookup_table_meta_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
12783 0 : fd_lookup_table_meta_t * self = (fd_lookup_table_meta_t *)mem;
12784 0 : fd_lookup_table_meta_new( self );
12785 0 : void * alloc_region = (uchar *)mem + sizeof(fd_lookup_table_meta_t);
12786 0 : void * * alloc_mem = &alloc_region;
12787 0 : fd_lookup_table_meta_decode_inner( mem, alloc_mem, ctx );
12788 0 : return self;
12789 0 : }
12790 0 : void fd_lookup_table_meta_new(fd_lookup_table_meta_t * self) {
12791 0 : fd_memset( self, 0, sizeof(fd_lookup_table_meta_t) );
12792 0 : }
12793 0 : void fd_lookup_table_meta_walk( void * w, fd_lookup_table_meta_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
12794 0 : (void) varint;
12795 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_lookup_table_meta", level++, 0 );
12796 0 : fun( w, &self->deactivation_slot, "deactivation_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
12797 0 : fun( w, &self->last_extended_slot, "last_extended_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
12798 0 : fun( w, &self->last_extended_slot_start_index, "last_extended_slot_start_index", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
12799 0 : if( !self->has_authority ) {
12800 0 : fun( w, NULL, "authority", FD_FLAMENCO_TYPE_NULL, "pubkey", level, 0 );
12801 0 : } else {
12802 0 : fd_pubkey_walk( w, &self->authority, fun, "authority", level, 0 );
12803 0 : }
12804 0 : fun( w, &self->_padding, "_padding", FD_FLAMENCO_TYPE_USHORT, "ushort", level, 0 );
12805 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_lookup_table_meta", level--, 0 );
12806 0 : }
12807 0 : ulong fd_lookup_table_meta_size( fd_lookup_table_meta_t const * self ) {
12808 0 : ulong size = 0;
12809 0 : size += sizeof(ulong);
12810 0 : size += sizeof(ulong);
12811 0 : size += sizeof(char);
12812 0 : size += sizeof(char);
12813 0 : if( self->has_authority ) {
12814 0 : size += fd_pubkey_size( &self->authority );
12815 0 : }
12816 0 : size += sizeof(ushort);
12817 0 : return size;
12818 0 : }
12819 :
12820 0 : int fd_address_lookup_table_encode( fd_address_lookup_table_t const * self, fd_bincode_encode_ctx_t * ctx ) {
12821 0 : int err;
12822 0 : err = fd_lookup_table_meta_encode( &self->meta, ctx );
12823 0 : if( FD_UNLIKELY( err ) ) return err;
12824 0 : return FD_BINCODE_SUCCESS;
12825 0 : }
12826 0 : static int fd_address_lookup_table_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12827 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12828 0 : int err = 0;
12829 0 : err = fd_lookup_table_meta_decode_footprint_inner( ctx, total_sz );
12830 0 : if( FD_UNLIKELY( err ) ) return err;
12831 0 : return 0;
12832 0 : }
12833 0 : int fd_address_lookup_table_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12834 0 : *total_sz += sizeof(fd_address_lookup_table_t);
12835 0 : void const * start_data = ctx->data;
12836 0 : int err = fd_address_lookup_table_decode_footprint_inner( ctx, total_sz );
12837 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12838 0 : ctx->data = start_data;
12839 0 : return err;
12840 0 : }
12841 0 : static void fd_address_lookup_table_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
12842 0 : fd_address_lookup_table_t * self = (fd_address_lookup_table_t *)struct_mem;
12843 0 : fd_lookup_table_meta_decode_inner( &self->meta, alloc_mem, ctx );
12844 0 : }
12845 0 : void * fd_address_lookup_table_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
12846 0 : fd_address_lookup_table_t * self = (fd_address_lookup_table_t *)mem;
12847 0 : fd_address_lookup_table_new( self );
12848 0 : void * alloc_region = (uchar *)mem + sizeof(fd_address_lookup_table_t);
12849 0 : void * * alloc_mem = &alloc_region;
12850 0 : fd_address_lookup_table_decode_inner( mem, alloc_mem, ctx );
12851 0 : return self;
12852 0 : }
12853 0 : void fd_address_lookup_table_new(fd_address_lookup_table_t * self) {
12854 0 : fd_memset( self, 0, sizeof(fd_address_lookup_table_t) );
12855 0 : fd_lookup_table_meta_new( &self->meta );
12856 0 : }
12857 0 : void fd_address_lookup_table_walk( void * w, fd_address_lookup_table_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
12858 0 : (void) varint;
12859 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_address_lookup_table", level++, 0 );
12860 0 : fd_lookup_table_meta_walk( w, &self->meta, fun, "meta", level, 0 );
12861 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_address_lookup_table", level--, 0 );
12862 0 : }
12863 0 : ulong fd_address_lookup_table_size( fd_address_lookup_table_t const * self ) {
12864 0 : ulong size = 0;
12865 0 : size += fd_lookup_table_meta_size( &self->meta );
12866 0 : return size;
12867 0 : }
12868 :
12869 0 : FD_FN_PURE uchar fd_address_lookup_table_state_is_uninitialized(fd_address_lookup_table_state_t const * self) {
12870 0 : return self->discriminant == 0;
12871 0 : }
12872 0 : FD_FN_PURE uchar fd_address_lookup_table_state_is_lookup_table(fd_address_lookup_table_state_t const * self) {
12873 0 : return self->discriminant == 1;
12874 0 : }
12875 : void fd_address_lookup_table_state_inner_new( fd_address_lookup_table_state_inner_t * self, uint discriminant );
12876 0 : int fd_address_lookup_table_state_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12877 0 : int err;
12878 0 : switch (discriminant) {
12879 0 : case 0: {
12880 0 : return FD_BINCODE_SUCCESS;
12881 0 : }
12882 0 : case 1: {
12883 0 : err = fd_address_lookup_table_decode_footprint_inner( ctx, total_sz );
12884 0 : if( FD_UNLIKELY( err ) ) return err;
12885 0 : return FD_BINCODE_SUCCESS;
12886 0 : }
12887 0 : default: return FD_BINCODE_ERR_ENCODING;
12888 0 : }
12889 0 : }
12890 0 : static int fd_address_lookup_table_state_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12891 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12892 0 : uint discriminant = 0;
12893 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
12894 0 : if( FD_UNLIKELY( err ) ) return err;
12895 0 : return fd_address_lookup_table_state_inner_decode_footprint( discriminant, ctx, total_sz );
12896 0 : }
12897 0 : int fd_address_lookup_table_state_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12898 0 : *total_sz += sizeof(fd_address_lookup_table_state_t);
12899 0 : void const * start_data = ctx->data;
12900 0 : int err = fd_address_lookup_table_state_decode_footprint_inner( ctx, total_sz );
12901 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12902 0 : ctx->data = start_data;
12903 0 : return err;
12904 0 : }
12905 0 : static void fd_address_lookup_table_state_inner_decode_inner( fd_address_lookup_table_state_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
12906 0 : switch (discriminant) {
12907 0 : case 0: {
12908 0 : break;
12909 0 : }
12910 0 : case 1: {
12911 0 : fd_address_lookup_table_decode_inner( &self->lookup_table, alloc_mem, ctx );
12912 0 : break;
12913 0 : }
12914 0 : }
12915 0 : }
12916 0 : static void fd_address_lookup_table_state_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
12917 0 : fd_address_lookup_table_state_t * self = (fd_address_lookup_table_state_t *)struct_mem;
12918 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
12919 0 : fd_address_lookup_table_state_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
12920 0 : }
12921 0 : void * fd_address_lookup_table_state_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
12922 0 : fd_address_lookup_table_state_t * self = (fd_address_lookup_table_state_t *)mem;
12923 0 : fd_address_lookup_table_state_new( self );
12924 0 : void * alloc_region = (uchar *)mem + sizeof(fd_address_lookup_table_state_t);
12925 0 : void * * alloc_mem = &alloc_region;
12926 0 : fd_address_lookup_table_state_decode_inner( mem, alloc_mem, ctx );
12927 0 : return self;
12928 0 : }
12929 0 : void fd_address_lookup_table_state_inner_new( fd_address_lookup_table_state_inner_t * self, uint discriminant ) {
12930 0 : switch( discriminant ) {
12931 0 : case 0: {
12932 0 : break;
12933 0 : }
12934 0 : case 1: {
12935 0 : fd_address_lookup_table_new( &self->lookup_table );
12936 0 : break;
12937 0 : }
12938 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
12939 0 : }
12940 0 : }
12941 0 : void fd_address_lookup_table_state_new_disc( fd_address_lookup_table_state_t * self, uint discriminant ) {
12942 0 : self->discriminant = discriminant;
12943 0 : fd_address_lookup_table_state_inner_new( &self->inner, self->discriminant );
12944 0 : }
12945 0 : void fd_address_lookup_table_state_new( fd_address_lookup_table_state_t * self ) {
12946 0 : fd_memset( self, 0, sizeof(fd_address_lookup_table_state_t) );
12947 0 : fd_address_lookup_table_state_new_disc( self, UINT_MAX );
12948 0 : }
12949 :
12950 0 : void fd_address_lookup_table_state_walk( void * w, fd_address_lookup_table_state_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
12951 0 : (void) varint;
12952 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_address_lookup_table_state", level++, 0);
12953 0 : switch( self->discriminant ) {
12954 0 : case 0: {
12955 0 : fun( w, self, "uninitialized", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
12956 0 : break;
12957 0 : }
12958 0 : case 1: {
12959 0 : fun( w, self, "lookup_table", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
12960 0 : fd_address_lookup_table_walk( w, &self->inner.lookup_table, fun, "lookup_table", level, 0 );
12961 0 : break;
12962 0 : }
12963 0 : }
12964 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_address_lookup_table_state", level--, 0 );
12965 0 : }
12966 0 : ulong fd_address_lookup_table_state_size( fd_address_lookup_table_state_t const * self ) {
12967 0 : ulong size = 0;
12968 0 : size += sizeof(uint);
12969 0 : switch (self->discriminant) {
12970 0 : case 1: {
12971 0 : size += fd_address_lookup_table_size( &self->inner.lookup_table );
12972 0 : break;
12973 0 : }
12974 0 : }
12975 0 : return size;
12976 0 : }
12977 :
12978 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 ) {
12979 0 : int err;
12980 0 : switch (discriminant) {
12981 0 : case 1: {
12982 0 : err = fd_address_lookup_table_encode( &self->lookup_table, ctx );
12983 0 : if( FD_UNLIKELY( err ) ) return err;
12984 0 : break;
12985 0 : }
12986 0 : }
12987 0 : return FD_BINCODE_SUCCESS;
12988 0 : }
12989 0 : int fd_address_lookup_table_state_encode( fd_address_lookup_table_state_t const * self, fd_bincode_encode_ctx_t * ctx ) {
12990 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
12991 0 : if( FD_UNLIKELY( err ) ) return err;
12992 0 : return fd_address_lookup_table_state_inner_encode( &self->inner, self->discriminant, ctx );
12993 0 : }
12994 :
12995 0 : int fd_gossip_ping_encode( fd_gossip_ping_t const * self, fd_bincode_encode_ctx_t * ctx ) {
12996 0 : int err;
12997 0 : err = fd_pubkey_encode( &self->from, ctx );
12998 0 : if( FD_UNLIKELY( err ) ) return err;
12999 0 : err = fd_hash_encode( &self->token, ctx );
13000 0 : if( FD_UNLIKELY( err ) ) return err;
13001 0 : err = fd_signature_encode( &self->signature, ctx );
13002 0 : if( FD_UNLIKELY( err ) ) return err;
13003 0 : return FD_BINCODE_SUCCESS;
13004 0 : }
13005 3 : static inline int fd_gossip_ping_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13006 3 : if( (ulong)ctx->data + 128UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
13007 3 : ctx->data = (void *)( (ulong)ctx->data + 128UL );
13008 3 : return 0;
13009 3 : }
13010 3 : static void fd_gossip_ping_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
13011 3 : fd_gossip_ping_t * self = (fd_gossip_ping_t *)struct_mem;
13012 3 : fd_pubkey_decode_inner( &self->from, alloc_mem, ctx );
13013 3 : fd_hash_decode_inner( &self->token, alloc_mem, ctx );
13014 3 : fd_signature_decode_inner( &self->signature, alloc_mem, ctx );
13015 3 : }
13016 0 : void * fd_gossip_ping_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
13017 0 : fd_gossip_ping_t * self = (fd_gossip_ping_t *)mem;
13018 0 : fd_gossip_ping_new( self );
13019 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_ping_t);
13020 0 : void * * alloc_mem = &alloc_region;
13021 0 : fd_gossip_ping_decode_inner( mem, alloc_mem, ctx );
13022 0 : return self;
13023 0 : }
13024 3 : void fd_gossip_ping_walk( void * w, fd_gossip_ping_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
13025 3 : (void) varint;
13026 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_ping", level++, 0 );
13027 3 : fd_pubkey_walk( w, &self->from, fun, "from", level, 0 );
13028 3 : fd_hash_walk( w, &self->token, fun, "token", level, 0 );
13029 3 : fd_signature_walk( w, &self->signature, fun, "signature", level, 0 );
13030 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_ping", level--, 0 );
13031 3 : }
13032 0 : FD_FN_PURE uchar fd_gossip_ip_addr_is_ip4(fd_gossip_ip_addr_t const * self) {
13033 0 : return self->discriminant == 0;
13034 0 : }
13035 0 : FD_FN_PURE uchar fd_gossip_ip_addr_is_ip6(fd_gossip_ip_addr_t const * self) {
13036 0 : return self->discriminant == 1;
13037 0 : }
13038 : void fd_gossip_ip_addr_inner_new( fd_gossip_ip_addr_inner_t * self, uint discriminant );
13039 3 : int fd_gossip_ip_addr_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13040 3 : int err;
13041 3 : switch (discriminant) {
13042 3 : case 0: {
13043 3 : err = fd_gossip_ip4_addr_decode_footprint_inner( ctx, total_sz );
13044 3 : if( FD_UNLIKELY( err ) ) return err;
13045 3 : return FD_BINCODE_SUCCESS;
13046 3 : }
13047 0 : case 1: {
13048 0 : err = fd_gossip_ip6_addr_decode_footprint_inner( ctx, total_sz );
13049 0 : if( FD_UNLIKELY( err ) ) return err;
13050 0 : return FD_BINCODE_SUCCESS;
13051 0 : }
13052 0 : default: return FD_BINCODE_ERR_ENCODING;
13053 3 : }
13054 3 : }
13055 3 : static int fd_gossip_ip_addr_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13056 3 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
13057 3 : uint discriminant = 0;
13058 3 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
13059 3 : if( FD_UNLIKELY( err ) ) return err;
13060 3 : return fd_gossip_ip_addr_inner_decode_footprint( discriminant, ctx, total_sz );
13061 3 : }
13062 0 : int fd_gossip_ip_addr_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13063 0 : *total_sz += sizeof(fd_gossip_ip_addr_t);
13064 0 : void const * start_data = ctx->data;
13065 0 : int err = fd_gossip_ip_addr_decode_footprint_inner( ctx, total_sz );
13066 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
13067 0 : ctx->data = start_data;
13068 0 : return err;
13069 0 : }
13070 3 : static 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 ) {
13071 3 : switch (discriminant) {
13072 3 : case 0: {
13073 3 : fd_gossip_ip4_addr_decode_inner( &self->ip4, alloc_mem, ctx );
13074 3 : break;
13075 0 : }
13076 0 : case 1: {
13077 0 : fd_gossip_ip6_addr_decode_inner( &self->ip6, alloc_mem, ctx );
13078 0 : break;
13079 0 : }
13080 3 : }
13081 3 : }
13082 3 : static void fd_gossip_ip_addr_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
13083 3 : fd_gossip_ip_addr_t * self = (fd_gossip_ip_addr_t *)struct_mem;
13084 3 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
13085 3 : fd_gossip_ip_addr_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
13086 3 : }
13087 0 : void * fd_gossip_ip_addr_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
13088 0 : fd_gossip_ip_addr_t * self = (fd_gossip_ip_addr_t *)mem;
13089 0 : fd_gossip_ip_addr_new( self );
13090 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_ip_addr_t);
13091 0 : void * * alloc_mem = &alloc_region;
13092 0 : fd_gossip_ip_addr_decode_inner( mem, alloc_mem, ctx );
13093 0 : return self;
13094 0 : }
13095 3 : void fd_gossip_ip_addr_inner_new( fd_gossip_ip_addr_inner_t * self, uint discriminant ) {
13096 3 : switch( discriminant ) {
13097 0 : case 0: {
13098 0 : fd_gossip_ip4_addr_new( &self->ip4 );
13099 0 : break;
13100 0 : }
13101 0 : case 1: {
13102 0 : fd_gossip_ip6_addr_new( &self->ip6 );
13103 0 : break;
13104 0 : }
13105 3 : default: break; // FD_LOG_ERR(( "unhandled type"));
13106 3 : }
13107 3 : }
13108 3 : void fd_gossip_ip_addr_new_disc( fd_gossip_ip_addr_t * self, uint discriminant ) {
13109 3 : self->discriminant = discriminant;
13110 3 : fd_gossip_ip_addr_inner_new( &self->inner, self->discriminant );
13111 3 : }
13112 3 : void fd_gossip_ip_addr_new( fd_gossip_ip_addr_t * self ) {
13113 3 : fd_memset( self, 0, sizeof(fd_gossip_ip_addr_t) );
13114 3 : fd_gossip_ip_addr_new_disc( self, UINT_MAX );
13115 3 : }
13116 :
13117 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, uint varint ) {
13118 3 : (void) varint;
13119 3 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_gossip_ip_addr", level++, 0);
13120 3 : switch( self->discriminant ) {
13121 3 : case 0: {
13122 3 : fun( w, self, "ip4", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
13123 3 : fd_gossip_ip4_addr_walk( w, &self->inner.ip4, fun, "ip4", level, 0 );
13124 3 : break;
13125 0 : }
13126 0 : case 1: {
13127 0 : fun( w, self, "ip6", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
13128 0 : fd_gossip_ip6_addr_walk( w, &self->inner.ip6, fun, "ip6", level, 0 );
13129 0 : break;
13130 0 : }
13131 3 : }
13132 3 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_gossip_ip_addr", level--, 0 );
13133 3 : }
13134 0 : ulong fd_gossip_ip_addr_size( fd_gossip_ip_addr_t const * self ) {
13135 0 : ulong size = 0;
13136 0 : size += sizeof(uint);
13137 0 : switch (self->discriminant) {
13138 0 : case 0: {
13139 0 : size += fd_gossip_ip4_addr_size( &self->inner.ip4 );
13140 0 : break;
13141 0 : }
13142 0 : case 1: {
13143 0 : size += fd_gossip_ip6_addr_size( &self->inner.ip6 );
13144 0 : break;
13145 0 : }
13146 0 : }
13147 0 : return size;
13148 0 : }
13149 :
13150 0 : int fd_gossip_ip_addr_inner_encode( fd_gossip_ip_addr_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
13151 0 : int err;
13152 0 : switch (discriminant) {
13153 0 : case 0: {
13154 0 : err = fd_gossip_ip4_addr_encode( &self->ip4, ctx );
13155 0 : if( FD_UNLIKELY( err ) ) return err;
13156 0 : break;
13157 0 : }
13158 0 : case 1: {
13159 0 : err = fd_gossip_ip6_addr_encode( &self->ip6, ctx );
13160 0 : if( FD_UNLIKELY( err ) ) return err;
13161 0 : break;
13162 0 : }
13163 0 : }
13164 0 : return FD_BINCODE_SUCCESS;
13165 0 : }
13166 0 : int fd_gossip_ip_addr_encode( fd_gossip_ip_addr_t const * self, fd_bincode_encode_ctx_t * ctx ) {
13167 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
13168 0 : if( FD_UNLIKELY( err ) ) return err;
13169 0 : return fd_gossip_ip_addr_inner_encode( &self->inner, self->discriminant, ctx );
13170 0 : }
13171 :
13172 0 : int fd_gossip_prune_data_encode( fd_gossip_prune_data_t const * self, fd_bincode_encode_ctx_t * ctx ) {
13173 0 : int err;
13174 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
13175 0 : if( FD_UNLIKELY( err ) ) return err;
13176 0 : err = fd_bincode_uint64_encode( self->prunes_len, ctx );
13177 0 : if( FD_UNLIKELY(err) ) return err;
13178 0 : if( self->prunes_len ) {
13179 0 : for( ulong i=0; i < self->prunes_len; i++ ) {
13180 0 : err = fd_pubkey_encode( self->prunes + i, ctx );
13181 0 : if( FD_UNLIKELY( err ) ) return err;
13182 0 : }
13183 0 : }
13184 0 : err = fd_signature_encode( &self->signature, ctx );
13185 0 : if( FD_UNLIKELY( err ) ) return err;
13186 0 : err = fd_pubkey_encode( &self->destination, ctx );
13187 0 : if( FD_UNLIKELY( err ) ) return err;
13188 0 : err = fd_bincode_uint64_encode( self->wallclock, ctx );
13189 0 : if( FD_UNLIKELY( err ) ) return err;
13190 0 : return FD_BINCODE_SUCCESS;
13191 0 : }
13192 0 : static int fd_gossip_prune_data_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13193 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
13194 0 : int err = 0;
13195 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
13196 0 : if( FD_UNLIKELY( err ) ) return err;
13197 0 : ulong prunes_len;
13198 0 : err = fd_bincode_uint64_decode( &prunes_len, ctx );
13199 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13200 0 : if( prunes_len ) {
13201 0 : *total_sz += FD_PUBKEY_ALIGN + sizeof(fd_pubkey_t)*prunes_len;
13202 0 : for( ulong i=0; i < prunes_len; i++ ) {
13203 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
13204 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13205 0 : }
13206 0 : }
13207 0 : err = fd_signature_decode_footprint_inner( ctx, total_sz );
13208 0 : if( FD_UNLIKELY( err ) ) return err;
13209 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
13210 0 : if( FD_UNLIKELY( err ) ) return err;
13211 0 : err = fd_bincode_uint64_decode_footprint( ctx );
13212 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13213 0 : return 0;
13214 0 : }
13215 0 : int fd_gossip_prune_data_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13216 0 : *total_sz += sizeof(fd_gossip_prune_data_t);
13217 0 : void const * start_data = ctx->data;
13218 0 : int err = fd_gossip_prune_data_decode_footprint_inner( ctx, total_sz );
13219 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
13220 0 : ctx->data = start_data;
13221 0 : return err;
13222 0 : }
13223 0 : static void fd_gossip_prune_data_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
13224 0 : fd_gossip_prune_data_t * self = (fd_gossip_prune_data_t *)struct_mem;
13225 0 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
13226 0 : fd_bincode_uint64_decode_unsafe( &self->prunes_len, ctx );
13227 0 : if( self->prunes_len ) {
13228 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_ALIGN );
13229 0 : self->prunes = *alloc_mem;
13230 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_pubkey_t)*self->prunes_len;
13231 0 : for( ulong i=0; i < self->prunes_len; i++ ) {
13232 0 : fd_pubkey_new( self->prunes + i );
13233 0 : fd_pubkey_decode_inner( self->prunes + i, alloc_mem, ctx );
13234 0 : }
13235 0 : } else
13236 0 : self->prunes = NULL;
13237 0 : fd_signature_decode_inner( &self->signature, alloc_mem, ctx );
13238 0 : fd_pubkey_decode_inner( &self->destination, alloc_mem, ctx );
13239 0 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
13240 0 : }
13241 0 : void * fd_gossip_prune_data_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
13242 0 : fd_gossip_prune_data_t * self = (fd_gossip_prune_data_t *)mem;
13243 0 : fd_gossip_prune_data_new( self );
13244 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_prune_data_t);
13245 0 : void * * alloc_mem = &alloc_region;
13246 0 : fd_gossip_prune_data_decode_inner( mem, alloc_mem, ctx );
13247 0 : return self;
13248 0 : }
13249 0 : void fd_gossip_prune_data_new(fd_gossip_prune_data_t * self) {
13250 0 : fd_memset( self, 0, sizeof(fd_gossip_prune_data_t) );
13251 0 : fd_pubkey_new( &self->pubkey );
13252 0 : fd_signature_new( &self->signature );
13253 0 : fd_pubkey_new( &self->destination );
13254 0 : }
13255 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, uint varint ) {
13256 0 : (void) varint;
13257 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_prune_data", level++, 0 );
13258 0 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level, 0 );
13259 0 : if( self->prunes_len ) {
13260 0 : fun( w, NULL, "prunes", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
13261 0 : for( ulong i=0; i < self->prunes_len; i++ )
13262 0 : fd_pubkey_walk(w, self->prunes + i, fun, "pubkey", level, 0 );
13263 0 : fun( w, NULL, "prunes", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
13264 0 : }
13265 0 : fd_signature_walk( w, &self->signature, fun, "signature", level, 0 );
13266 0 : fd_pubkey_walk( w, &self->destination, fun, "destination", level, 0 );
13267 0 : fun( w, &self->wallclock, "wallclock", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
13268 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_prune_data", level--, 0 );
13269 0 : }
13270 0 : ulong fd_gossip_prune_data_size( fd_gossip_prune_data_t const * self ) {
13271 0 : ulong size = 0;
13272 0 : size += fd_pubkey_size( &self->pubkey );
13273 0 : do {
13274 0 : size += sizeof(ulong);
13275 0 : for( ulong i=0; i < self->prunes_len; i++ )
13276 0 : size += fd_pubkey_size( self->prunes + i );
13277 0 : } while(0);
13278 0 : size += fd_signature_size( &self->signature );
13279 0 : size += fd_pubkey_size( &self->destination );
13280 0 : size += sizeof(ulong);
13281 0 : return size;
13282 0 : }
13283 :
13284 0 : int fd_gossip_prune_sign_data_encode( fd_gossip_prune_sign_data_t const * self, fd_bincode_encode_ctx_t * ctx ) {
13285 0 : int err;
13286 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
13287 0 : if( FD_UNLIKELY( err ) ) return err;
13288 0 : err = fd_bincode_uint64_encode( self->prunes_len, ctx );
13289 0 : if( FD_UNLIKELY(err) ) return err;
13290 0 : if( self->prunes_len ) {
13291 0 : for( ulong i=0; i < self->prunes_len; i++ ) {
13292 0 : err = fd_pubkey_encode( self->prunes + i, ctx );
13293 0 : if( FD_UNLIKELY( err ) ) return err;
13294 0 : }
13295 0 : }
13296 0 : err = fd_pubkey_encode( &self->destination, ctx );
13297 0 : if( FD_UNLIKELY( err ) ) return err;
13298 0 : err = fd_bincode_uint64_encode( self->wallclock, ctx );
13299 0 : if( FD_UNLIKELY( err ) ) return err;
13300 0 : return FD_BINCODE_SUCCESS;
13301 0 : }
13302 0 : static int fd_gossip_prune_sign_data_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13303 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
13304 0 : int err = 0;
13305 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
13306 0 : if( FD_UNLIKELY( err ) ) return err;
13307 0 : ulong prunes_len;
13308 0 : err = fd_bincode_uint64_decode( &prunes_len, ctx );
13309 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13310 0 : if( prunes_len ) {
13311 0 : *total_sz += FD_PUBKEY_ALIGN + sizeof(fd_pubkey_t)*prunes_len;
13312 0 : for( ulong i=0; i < prunes_len; i++ ) {
13313 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
13314 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13315 0 : }
13316 0 : }
13317 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
13318 0 : if( FD_UNLIKELY( err ) ) return err;
13319 0 : err = fd_bincode_uint64_decode_footprint( ctx );
13320 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13321 0 : return 0;
13322 0 : }
13323 0 : int fd_gossip_prune_sign_data_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13324 0 : *total_sz += sizeof(fd_gossip_prune_sign_data_t);
13325 0 : void const * start_data = ctx->data;
13326 0 : int err = fd_gossip_prune_sign_data_decode_footprint_inner( ctx, total_sz );
13327 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
13328 0 : ctx->data = start_data;
13329 0 : return err;
13330 0 : }
13331 0 : static void fd_gossip_prune_sign_data_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
13332 0 : fd_gossip_prune_sign_data_t * self = (fd_gossip_prune_sign_data_t *)struct_mem;
13333 0 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
13334 0 : fd_bincode_uint64_decode_unsafe( &self->prunes_len, ctx );
13335 0 : if( self->prunes_len ) {
13336 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_ALIGN );
13337 0 : self->prunes = *alloc_mem;
13338 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_pubkey_t)*self->prunes_len;
13339 0 : for( ulong i=0; i < self->prunes_len; i++ ) {
13340 0 : fd_pubkey_new( self->prunes + i );
13341 0 : fd_pubkey_decode_inner( self->prunes + i, alloc_mem, ctx );
13342 0 : }
13343 0 : } else
13344 0 : self->prunes = NULL;
13345 0 : fd_pubkey_decode_inner( &self->destination, alloc_mem, ctx );
13346 0 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
13347 0 : }
13348 0 : void * fd_gossip_prune_sign_data_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
13349 0 : fd_gossip_prune_sign_data_t * self = (fd_gossip_prune_sign_data_t *)mem;
13350 0 : fd_gossip_prune_sign_data_new( self );
13351 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_prune_sign_data_t);
13352 0 : void * * alloc_mem = &alloc_region;
13353 0 : fd_gossip_prune_sign_data_decode_inner( mem, alloc_mem, ctx );
13354 0 : return self;
13355 0 : }
13356 0 : void fd_gossip_prune_sign_data_new(fd_gossip_prune_sign_data_t * self) {
13357 0 : fd_memset( self, 0, sizeof(fd_gossip_prune_sign_data_t) );
13358 0 : fd_pubkey_new( &self->pubkey );
13359 0 : fd_pubkey_new( &self->destination );
13360 0 : }
13361 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, uint varint ) {
13362 0 : (void) varint;
13363 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_prune_sign_data", level++, 0 );
13364 0 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level, 0 );
13365 0 : if( self->prunes_len ) {
13366 0 : fun( w, NULL, "prunes", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
13367 0 : for( ulong i=0; i < self->prunes_len; i++ )
13368 0 : fd_pubkey_walk(w, self->prunes + i, fun, "pubkey", level, 0 );
13369 0 : fun( w, NULL, "prunes", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
13370 0 : }
13371 0 : fd_pubkey_walk( w, &self->destination, fun, "destination", level, 0 );
13372 0 : fun( w, &self->wallclock, "wallclock", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
13373 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_prune_sign_data", level--, 0 );
13374 0 : }
13375 0 : ulong fd_gossip_prune_sign_data_size( fd_gossip_prune_sign_data_t const * self ) {
13376 0 : ulong size = 0;
13377 0 : size += fd_pubkey_size( &self->pubkey );
13378 0 : do {
13379 0 : size += sizeof(ulong);
13380 0 : for( ulong i=0; i < self->prunes_len; i++ )
13381 0 : size += fd_pubkey_size( self->prunes + i );
13382 0 : } while(0);
13383 0 : size += fd_pubkey_size( &self->destination );
13384 0 : size += sizeof(ulong);
13385 0 : return size;
13386 0 : }
13387 :
13388 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 ) {
13389 0 : int err;
13390 0 : err = fd_bincode_uint64_encode( self->prefix_len, ctx );
13391 0 : if( FD_UNLIKELY(err) ) return err;
13392 0 : if( self->prefix_len ) {
13393 0 : err = fd_bincode_bytes_encode( self->prefix, self->prefix_len, ctx );
13394 0 : if( FD_UNLIKELY( err ) ) return err;
13395 0 : }
13396 0 : err = fd_gossip_prune_sign_data_encode( &self->data, ctx );
13397 0 : if( FD_UNLIKELY( err ) ) return err;
13398 0 : return FD_BINCODE_SUCCESS;
13399 0 : }
13400 0 : static int fd_gossip_prune_sign_data_with_prefix_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13401 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
13402 0 : int err = 0;
13403 0 : ulong prefix_len;
13404 0 : err = fd_bincode_uint64_decode( &prefix_len, ctx );
13405 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13406 0 : *total_sz += prefix_len;
13407 0 : if( prefix_len ) {
13408 0 : err = fd_bincode_bytes_decode_footprint( prefix_len, ctx );
13409 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13410 0 : err = !fd_utf8_verify( (char const *) ctx->data - prefix_len, prefix_len );
13411 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13412 0 : }
13413 0 : err = fd_gossip_prune_sign_data_decode_footprint_inner( ctx, total_sz );
13414 0 : if( FD_UNLIKELY( err ) ) return err;
13415 0 : return 0;
13416 0 : }
13417 0 : int fd_gossip_prune_sign_data_with_prefix_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13418 0 : *total_sz += sizeof(fd_gossip_prune_sign_data_with_prefix_t);
13419 0 : void const * start_data = ctx->data;
13420 0 : int err = fd_gossip_prune_sign_data_with_prefix_decode_footprint_inner( ctx, total_sz );
13421 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
13422 0 : ctx->data = start_data;
13423 0 : return err;
13424 0 : }
13425 0 : static void fd_gossip_prune_sign_data_with_prefix_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
13426 0 : fd_gossip_prune_sign_data_with_prefix_t * self = (fd_gossip_prune_sign_data_with_prefix_t *)struct_mem;
13427 0 : fd_bincode_uint64_decode_unsafe( &self->prefix_len, ctx );
13428 0 : if( self->prefix_len ) {
13429 0 : self->prefix = *alloc_mem;
13430 0 : fd_bincode_bytes_decode_unsafe( self->prefix, self->prefix_len, ctx );
13431 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->prefix_len;
13432 0 : } else
13433 0 : self->prefix = NULL;
13434 0 : fd_gossip_prune_sign_data_decode_inner( &self->data, alloc_mem, ctx );
13435 0 : }
13436 0 : void * fd_gossip_prune_sign_data_with_prefix_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
13437 0 : fd_gossip_prune_sign_data_with_prefix_t * self = (fd_gossip_prune_sign_data_with_prefix_t *)mem;
13438 0 : fd_gossip_prune_sign_data_with_prefix_new( self );
13439 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_prune_sign_data_with_prefix_t);
13440 0 : void * * alloc_mem = &alloc_region;
13441 0 : fd_gossip_prune_sign_data_with_prefix_decode_inner( mem, alloc_mem, ctx );
13442 0 : return self;
13443 0 : }
13444 0 : void fd_gossip_prune_sign_data_with_prefix_new(fd_gossip_prune_sign_data_with_prefix_t * self) {
13445 0 : fd_memset( self, 0, sizeof(fd_gossip_prune_sign_data_with_prefix_t) );
13446 0 : fd_gossip_prune_sign_data_new( &self->data );
13447 0 : }
13448 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, uint varint ) {
13449 0 : (void) varint;
13450 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_prune_sign_data_with_prefix", level++, 0 );
13451 0 : if( self->prefix_len ) {
13452 0 : fun( w, NULL, "prefix", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
13453 0 : for( ulong i=0; i < self->prefix_len; i++ )
13454 0 : fun( w, self->prefix + i, "prefix", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
13455 0 : fun( w, NULL, "prefix", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
13456 0 : }
13457 0 : fd_gossip_prune_sign_data_walk( w, &self->data, fun, "data", level, 0 );
13458 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_prune_sign_data_with_prefix", level--, 0 );
13459 0 : }
13460 0 : ulong fd_gossip_prune_sign_data_with_prefix_size( fd_gossip_prune_sign_data_with_prefix_t const * self ) {
13461 0 : ulong size = 0;
13462 0 : do {
13463 0 : size += sizeof(ulong);
13464 0 : size += self->prefix_len;
13465 0 : } while(0);
13466 0 : size += fd_gossip_prune_sign_data_size( &self->data );
13467 0 : return size;
13468 0 : }
13469 :
13470 0 : int fd_gossip_socket_addr_old_encode( fd_gossip_socket_addr_old_t const * self, fd_bincode_encode_ctx_t * ctx ) {
13471 0 : int err;
13472 0 : err = fd_gossip_ip_addr_encode( &self->addr, ctx );
13473 0 : if( FD_UNLIKELY( err ) ) return err;
13474 0 : err = fd_bincode_uint16_encode( self->port, ctx );
13475 0 : if( FD_UNLIKELY( err ) ) return err;
13476 0 : return FD_BINCODE_SUCCESS;
13477 0 : }
13478 0 : static int fd_gossip_socket_addr_old_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13479 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
13480 0 : int err = 0;
13481 0 : err = fd_gossip_ip_addr_decode_footprint_inner( ctx, total_sz );
13482 0 : if( FD_UNLIKELY( err ) ) return err;
13483 0 : err = fd_bincode_uint16_decode_footprint( ctx );
13484 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13485 0 : return 0;
13486 0 : }
13487 0 : int fd_gossip_socket_addr_old_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13488 0 : *total_sz += sizeof(fd_gossip_socket_addr_old_t);
13489 0 : void const * start_data = ctx->data;
13490 0 : int err = fd_gossip_socket_addr_old_decode_footprint_inner( ctx, total_sz );
13491 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
13492 0 : ctx->data = start_data;
13493 0 : return err;
13494 0 : }
13495 0 : static void fd_gossip_socket_addr_old_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
13496 0 : fd_gossip_socket_addr_old_t * self = (fd_gossip_socket_addr_old_t *)struct_mem;
13497 0 : fd_gossip_ip_addr_decode_inner( &self->addr, alloc_mem, ctx );
13498 0 : fd_bincode_uint16_decode_unsafe( &self->port, ctx );
13499 0 : }
13500 0 : void * fd_gossip_socket_addr_old_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
13501 0 : fd_gossip_socket_addr_old_t * self = (fd_gossip_socket_addr_old_t *)mem;
13502 0 : fd_gossip_socket_addr_old_new( self );
13503 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_socket_addr_old_t);
13504 0 : void * * alloc_mem = &alloc_region;
13505 0 : fd_gossip_socket_addr_old_decode_inner( mem, alloc_mem, ctx );
13506 0 : return self;
13507 0 : }
13508 0 : void fd_gossip_socket_addr_old_new(fd_gossip_socket_addr_old_t * self) {
13509 0 : fd_memset( self, 0, sizeof(fd_gossip_socket_addr_old_t) );
13510 0 : fd_gossip_ip_addr_new( &self->addr );
13511 0 : }
13512 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, uint varint ) {
13513 0 : (void) varint;
13514 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_socket_addr_old", level++, 0 );
13515 0 : fd_gossip_ip_addr_walk( w, &self->addr, fun, "addr", level, 0 );
13516 0 : fun( w, &self->port, "port", FD_FLAMENCO_TYPE_USHORT, "ushort", level, 0 );
13517 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_socket_addr_old", level--, 0 );
13518 0 : }
13519 0 : ulong fd_gossip_socket_addr_old_size( fd_gossip_socket_addr_old_t const * self ) {
13520 0 : ulong size = 0;
13521 0 : size += fd_gossip_ip_addr_size( &self->addr );
13522 0 : size += sizeof(ushort);
13523 0 : return size;
13524 0 : }
13525 :
13526 0 : int fd_gossip_socket_addr_ip4_encode( fd_gossip_socket_addr_ip4_t const * self, fd_bincode_encode_ctx_t * ctx ) {
13527 0 : int err;
13528 0 : err = fd_gossip_ip4_addr_encode( &self->addr, ctx );
13529 0 : if( FD_UNLIKELY( err ) ) return err;
13530 0 : err = fd_bincode_uint16_encode( self->port, ctx );
13531 0 : if( FD_UNLIKELY( err ) ) return err;
13532 0 : return FD_BINCODE_SUCCESS;
13533 0 : }
13534 90 : static int fd_gossip_socket_addr_ip4_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13535 90 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
13536 90 : int err = 0;
13537 90 : err = fd_gossip_ip4_addr_decode_footprint_inner( ctx, total_sz );
13538 90 : if( FD_UNLIKELY( err ) ) return err;
13539 90 : err = fd_bincode_uint16_decode_footprint( ctx );
13540 90 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13541 90 : return 0;
13542 90 : }
13543 0 : int fd_gossip_socket_addr_ip4_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13544 0 : *total_sz += sizeof(fd_gossip_socket_addr_ip4_t);
13545 0 : void const * start_data = ctx->data;
13546 0 : int err = fd_gossip_socket_addr_ip4_decode_footprint_inner( ctx, total_sz );
13547 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
13548 0 : ctx->data = start_data;
13549 0 : return err;
13550 0 : }
13551 90 : static void fd_gossip_socket_addr_ip4_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
13552 90 : fd_gossip_socket_addr_ip4_t * self = (fd_gossip_socket_addr_ip4_t *)struct_mem;
13553 90 : fd_gossip_ip4_addr_decode_inner( &self->addr, alloc_mem, ctx );
13554 90 : fd_bincode_uint16_decode_unsafe( &self->port, ctx );
13555 90 : }
13556 0 : void * fd_gossip_socket_addr_ip4_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
13557 0 : fd_gossip_socket_addr_ip4_t * self = (fd_gossip_socket_addr_ip4_t *)mem;
13558 0 : fd_gossip_socket_addr_ip4_new( self );
13559 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_socket_addr_ip4_t);
13560 0 : void * * alloc_mem = &alloc_region;
13561 0 : fd_gossip_socket_addr_ip4_decode_inner( mem, alloc_mem, ctx );
13562 0 : return self;
13563 0 : }
13564 0 : void fd_gossip_socket_addr_ip4_new(fd_gossip_socket_addr_ip4_t * self) {
13565 0 : fd_memset( self, 0, sizeof(fd_gossip_socket_addr_ip4_t) );
13566 0 : fd_gossip_ip4_addr_new( &self->addr );
13567 0 : }
13568 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, uint varint ) {
13569 90 : (void) varint;
13570 90 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_socket_addr_ip4", level++, 0 );
13571 90 : fd_gossip_ip4_addr_walk( w, &self->addr, fun, "addr", level, 0 );
13572 90 : fun( w, &self->port, "port", FD_FLAMENCO_TYPE_USHORT, "ushort", level, 0 );
13573 90 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_socket_addr_ip4", level--, 0 );
13574 90 : }
13575 0 : ulong fd_gossip_socket_addr_ip4_size( fd_gossip_socket_addr_ip4_t const * self ) {
13576 0 : ulong size = 0;
13577 0 : size += fd_gossip_ip4_addr_size( &self->addr );
13578 0 : size += sizeof(ushort);
13579 0 : return size;
13580 0 : }
13581 :
13582 0 : int fd_gossip_socket_addr_ip6_encode( fd_gossip_socket_addr_ip6_t const * self, fd_bincode_encode_ctx_t * ctx ) {
13583 0 : int err;
13584 0 : err = fd_gossip_ip6_addr_encode( &self->addr, ctx );
13585 0 : if( FD_UNLIKELY( err ) ) return err;
13586 0 : err = fd_bincode_uint16_encode( self->port, ctx );
13587 0 : if( FD_UNLIKELY( err ) ) return err;
13588 0 : return FD_BINCODE_SUCCESS;
13589 0 : }
13590 0 : static int fd_gossip_socket_addr_ip6_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13591 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
13592 0 : int err = 0;
13593 0 : err = fd_gossip_ip6_addr_decode_footprint_inner( ctx, total_sz );
13594 0 : if( FD_UNLIKELY( err ) ) return err;
13595 0 : err = fd_bincode_uint16_decode_footprint( ctx );
13596 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13597 0 : return 0;
13598 0 : }
13599 0 : int fd_gossip_socket_addr_ip6_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13600 0 : *total_sz += sizeof(fd_gossip_socket_addr_ip6_t);
13601 0 : void const * start_data = ctx->data;
13602 0 : int err = fd_gossip_socket_addr_ip6_decode_footprint_inner( ctx, total_sz );
13603 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
13604 0 : ctx->data = start_data;
13605 0 : return err;
13606 0 : }
13607 0 : static void fd_gossip_socket_addr_ip6_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
13608 0 : fd_gossip_socket_addr_ip6_t * self = (fd_gossip_socket_addr_ip6_t *)struct_mem;
13609 0 : fd_gossip_ip6_addr_decode_inner( &self->addr, alloc_mem, ctx );
13610 0 : fd_bincode_uint16_decode_unsafe( &self->port, ctx );
13611 0 : }
13612 0 : void * fd_gossip_socket_addr_ip6_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
13613 0 : fd_gossip_socket_addr_ip6_t * self = (fd_gossip_socket_addr_ip6_t *)mem;
13614 0 : fd_gossip_socket_addr_ip6_new( self );
13615 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_socket_addr_ip6_t);
13616 0 : void * * alloc_mem = &alloc_region;
13617 0 : fd_gossip_socket_addr_ip6_decode_inner( mem, alloc_mem, ctx );
13618 0 : return self;
13619 0 : }
13620 0 : void fd_gossip_socket_addr_ip6_new(fd_gossip_socket_addr_ip6_t * self) {
13621 0 : fd_memset( self, 0, sizeof(fd_gossip_socket_addr_ip6_t) );
13622 0 : fd_gossip_ip6_addr_new( &self->addr );
13623 0 : }
13624 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, uint varint ) {
13625 0 : (void) varint;
13626 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_socket_addr_ip6", level++, 0 );
13627 0 : fd_gossip_ip6_addr_walk( w, &self->addr, fun, "addr", level, 0 );
13628 0 : fun( w, &self->port, "port", FD_FLAMENCO_TYPE_USHORT, "ushort", level, 0 );
13629 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_socket_addr_ip6", level--, 0 );
13630 0 : }
13631 0 : FD_FN_PURE uchar fd_gossip_socket_addr_is_ip4(fd_gossip_socket_addr_t const * self) {
13632 0 : return self->discriminant == 0;
13633 0 : }
13634 0 : FD_FN_PURE uchar fd_gossip_socket_addr_is_ip6(fd_gossip_socket_addr_t const * self) {
13635 0 : return self->discriminant == 1;
13636 0 : }
13637 : void fd_gossip_socket_addr_inner_new( fd_gossip_socket_addr_inner_t * self, uint discriminant );
13638 90 : int fd_gossip_socket_addr_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13639 90 : int err;
13640 90 : switch (discriminant) {
13641 90 : case 0: {
13642 90 : err = fd_gossip_socket_addr_ip4_decode_footprint_inner( ctx, total_sz );
13643 90 : if( FD_UNLIKELY( err ) ) return err;
13644 90 : return FD_BINCODE_SUCCESS;
13645 90 : }
13646 0 : case 1: {
13647 0 : err = fd_gossip_socket_addr_ip6_decode_footprint_inner( ctx, total_sz );
13648 0 : if( FD_UNLIKELY( err ) ) return err;
13649 0 : return FD_BINCODE_SUCCESS;
13650 0 : }
13651 0 : default: return FD_BINCODE_ERR_ENCODING;
13652 90 : }
13653 90 : }
13654 90 : static int fd_gossip_socket_addr_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13655 90 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
13656 90 : uint discriminant = 0;
13657 90 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
13658 90 : if( FD_UNLIKELY( err ) ) return err;
13659 90 : return fd_gossip_socket_addr_inner_decode_footprint( discriminant, ctx, total_sz );
13660 90 : }
13661 0 : int fd_gossip_socket_addr_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13662 0 : *total_sz += sizeof(fd_gossip_socket_addr_t);
13663 0 : void const * start_data = ctx->data;
13664 0 : int err = fd_gossip_socket_addr_decode_footprint_inner( ctx, total_sz );
13665 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
13666 0 : ctx->data = start_data;
13667 0 : return err;
13668 0 : }
13669 90 : static 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 ) {
13670 90 : switch (discriminant) {
13671 90 : case 0: {
13672 90 : fd_gossip_socket_addr_ip4_decode_inner( &self->ip4, alloc_mem, ctx );
13673 90 : break;
13674 0 : }
13675 0 : case 1: {
13676 0 : fd_gossip_socket_addr_ip6_decode_inner( &self->ip6, alloc_mem, ctx );
13677 0 : break;
13678 0 : }
13679 90 : }
13680 90 : }
13681 90 : static void fd_gossip_socket_addr_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
13682 90 : fd_gossip_socket_addr_t * self = (fd_gossip_socket_addr_t *)struct_mem;
13683 90 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
13684 90 : fd_gossip_socket_addr_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
13685 90 : }
13686 0 : void * fd_gossip_socket_addr_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
13687 0 : fd_gossip_socket_addr_t * self = (fd_gossip_socket_addr_t *)mem;
13688 0 : fd_gossip_socket_addr_new( self );
13689 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_socket_addr_t);
13690 0 : void * * alloc_mem = &alloc_region;
13691 0 : fd_gossip_socket_addr_decode_inner( mem, alloc_mem, ctx );
13692 0 : return self;
13693 0 : }
13694 0 : void fd_gossip_socket_addr_inner_new( fd_gossip_socket_addr_inner_t * self, uint discriminant ) {
13695 0 : switch( discriminant ) {
13696 0 : case 0: {
13697 0 : fd_gossip_socket_addr_ip4_new( &self->ip4 );
13698 0 : break;
13699 0 : }
13700 0 : case 1: {
13701 0 : fd_gossip_socket_addr_ip6_new( &self->ip6 );
13702 0 : break;
13703 0 : }
13704 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
13705 0 : }
13706 0 : }
13707 0 : void fd_gossip_socket_addr_new_disc( fd_gossip_socket_addr_t * self, uint discriminant ) {
13708 0 : self->discriminant = discriminant;
13709 0 : fd_gossip_socket_addr_inner_new( &self->inner, self->discriminant );
13710 0 : }
13711 0 : void fd_gossip_socket_addr_new( fd_gossip_socket_addr_t * self ) {
13712 0 : fd_memset( self, 0, sizeof(fd_gossip_socket_addr_t) );
13713 0 : fd_gossip_socket_addr_new_disc( self, UINT_MAX );
13714 0 : }
13715 :
13716 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, uint varint ) {
13717 90 : (void) varint;
13718 90 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_gossip_socket_addr", level++, 0);
13719 90 : switch( self->discriminant ) {
13720 90 : case 0: {
13721 90 : fun( w, self, "ip4", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
13722 90 : fd_gossip_socket_addr_ip4_walk( w, &self->inner.ip4, fun, "ip4", level, 0 );
13723 90 : break;
13724 0 : }
13725 0 : case 1: {
13726 0 : fun( w, self, "ip6", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
13727 0 : fd_gossip_socket_addr_ip6_walk( w, &self->inner.ip6, fun, "ip6", level, 0 );
13728 0 : break;
13729 0 : }
13730 90 : }
13731 90 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_gossip_socket_addr", level--, 0 );
13732 90 : }
13733 0 : ulong fd_gossip_socket_addr_size( fd_gossip_socket_addr_t const * self ) {
13734 0 : ulong size = 0;
13735 0 : size += sizeof(uint);
13736 0 : switch (self->discriminant) {
13737 0 : case 0: {
13738 0 : size += fd_gossip_socket_addr_ip4_size( &self->inner.ip4 );
13739 0 : break;
13740 0 : }
13741 0 : case 1: {
13742 0 : size += fd_gossip_socket_addr_ip6_size( &self->inner.ip6 );
13743 0 : break;
13744 0 : }
13745 0 : }
13746 0 : return size;
13747 0 : }
13748 :
13749 0 : int fd_gossip_socket_addr_inner_encode( fd_gossip_socket_addr_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
13750 0 : int err;
13751 0 : switch (discriminant) {
13752 0 : case 0: {
13753 0 : err = fd_gossip_socket_addr_ip4_encode( &self->ip4, ctx );
13754 0 : if( FD_UNLIKELY( err ) ) return err;
13755 0 : break;
13756 0 : }
13757 0 : case 1: {
13758 0 : err = fd_gossip_socket_addr_ip6_encode( &self->ip6, ctx );
13759 0 : if( FD_UNLIKELY( err ) ) return err;
13760 0 : break;
13761 0 : }
13762 0 : }
13763 0 : return FD_BINCODE_SUCCESS;
13764 0 : }
13765 0 : int fd_gossip_socket_addr_encode( fd_gossip_socket_addr_t const * self, fd_bincode_encode_ctx_t * ctx ) {
13766 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
13767 0 : if( FD_UNLIKELY( err ) ) return err;
13768 0 : return fd_gossip_socket_addr_inner_encode( &self->inner, self->discriminant, ctx );
13769 0 : }
13770 :
13771 0 : int fd_gossip_contact_info_v1_encode( fd_gossip_contact_info_v1_t const * self, fd_bincode_encode_ctx_t * ctx ) {
13772 0 : int err;
13773 0 : err = fd_pubkey_encode( &self->id, ctx );
13774 0 : if( FD_UNLIKELY( err ) ) return err;
13775 0 : err = fd_gossip_socket_addr_encode( &self->gossip, ctx );
13776 0 : if( FD_UNLIKELY( err ) ) return err;
13777 0 : err = fd_gossip_socket_addr_encode( &self->tvu, ctx );
13778 0 : if( FD_UNLIKELY( err ) ) return err;
13779 0 : err = fd_gossip_socket_addr_encode( &self->tvu_fwd, ctx );
13780 0 : if( FD_UNLIKELY( err ) ) return err;
13781 0 : err = fd_gossip_socket_addr_encode( &self->repair, ctx );
13782 0 : if( FD_UNLIKELY( err ) ) return err;
13783 0 : err = fd_gossip_socket_addr_encode( &self->tpu, ctx );
13784 0 : if( FD_UNLIKELY( err ) ) return err;
13785 0 : err = fd_gossip_socket_addr_encode( &self->tpu_fwd, ctx );
13786 0 : if( FD_UNLIKELY( err ) ) return err;
13787 0 : err = fd_gossip_socket_addr_encode( &self->tpu_vote, ctx );
13788 0 : if( FD_UNLIKELY( err ) ) return err;
13789 0 : err = fd_gossip_socket_addr_encode( &self->rpc, ctx );
13790 0 : if( FD_UNLIKELY( err ) ) return err;
13791 0 : err = fd_gossip_socket_addr_encode( &self->rpc_pubsub, ctx );
13792 0 : if( FD_UNLIKELY( err ) ) return err;
13793 0 : err = fd_gossip_socket_addr_encode( &self->serve_repair, ctx );
13794 0 : if( FD_UNLIKELY( err ) ) return err;
13795 0 : err = fd_bincode_uint64_encode( self->wallclock, ctx );
13796 0 : if( FD_UNLIKELY( err ) ) return err;
13797 0 : err = fd_bincode_uint16_encode( self->shred_version, ctx );
13798 0 : if( FD_UNLIKELY( err ) ) return err;
13799 0 : return FD_BINCODE_SUCCESS;
13800 0 : }
13801 9 : static int fd_gossip_contact_info_v1_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13802 9 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
13803 9 : int err = 0;
13804 9 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
13805 9 : if( FD_UNLIKELY( err ) ) return err;
13806 9 : err = fd_gossip_socket_addr_decode_footprint_inner( ctx, total_sz );
13807 9 : if( FD_UNLIKELY( err ) ) return err;
13808 9 : err = fd_gossip_socket_addr_decode_footprint_inner( ctx, total_sz );
13809 9 : if( FD_UNLIKELY( err ) ) return err;
13810 9 : err = fd_gossip_socket_addr_decode_footprint_inner( ctx, total_sz );
13811 9 : if( FD_UNLIKELY( err ) ) return err;
13812 9 : err = fd_gossip_socket_addr_decode_footprint_inner( ctx, total_sz );
13813 9 : if( FD_UNLIKELY( err ) ) return err;
13814 9 : err = fd_gossip_socket_addr_decode_footprint_inner( ctx, total_sz );
13815 9 : if( FD_UNLIKELY( err ) ) return err;
13816 9 : err = fd_gossip_socket_addr_decode_footprint_inner( ctx, total_sz );
13817 9 : if( FD_UNLIKELY( err ) ) return err;
13818 9 : err = fd_gossip_socket_addr_decode_footprint_inner( ctx, total_sz );
13819 9 : if( FD_UNLIKELY( err ) ) return err;
13820 9 : err = fd_gossip_socket_addr_decode_footprint_inner( ctx, total_sz );
13821 9 : if( FD_UNLIKELY( err ) ) return err;
13822 9 : err = fd_gossip_socket_addr_decode_footprint_inner( ctx, total_sz );
13823 9 : if( FD_UNLIKELY( err ) ) return err;
13824 9 : err = fd_gossip_socket_addr_decode_footprint_inner( ctx, total_sz );
13825 9 : if( FD_UNLIKELY( err ) ) return err;
13826 9 : err = fd_bincode_uint64_decode_footprint( ctx );
13827 9 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13828 9 : err = fd_bincode_uint16_decode_footprint( ctx );
13829 9 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13830 9 : return 0;
13831 9 : }
13832 0 : int fd_gossip_contact_info_v1_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13833 0 : *total_sz += sizeof(fd_gossip_contact_info_v1_t);
13834 0 : void const * start_data = ctx->data;
13835 0 : int err = fd_gossip_contact_info_v1_decode_footprint_inner( ctx, total_sz );
13836 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
13837 0 : ctx->data = start_data;
13838 0 : return err;
13839 0 : }
13840 9 : static void fd_gossip_contact_info_v1_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
13841 9 : fd_gossip_contact_info_v1_t * self = (fd_gossip_contact_info_v1_t *)struct_mem;
13842 9 : fd_pubkey_decode_inner( &self->id, alloc_mem, ctx );
13843 9 : fd_gossip_socket_addr_decode_inner( &self->gossip, alloc_mem, ctx );
13844 9 : fd_gossip_socket_addr_decode_inner( &self->tvu, alloc_mem, ctx );
13845 9 : fd_gossip_socket_addr_decode_inner( &self->tvu_fwd, alloc_mem, ctx );
13846 9 : fd_gossip_socket_addr_decode_inner( &self->repair, alloc_mem, ctx );
13847 9 : fd_gossip_socket_addr_decode_inner( &self->tpu, alloc_mem, ctx );
13848 9 : fd_gossip_socket_addr_decode_inner( &self->tpu_fwd, alloc_mem, ctx );
13849 9 : fd_gossip_socket_addr_decode_inner( &self->tpu_vote, alloc_mem, ctx );
13850 9 : fd_gossip_socket_addr_decode_inner( &self->rpc, alloc_mem, ctx );
13851 9 : fd_gossip_socket_addr_decode_inner( &self->rpc_pubsub, alloc_mem, ctx );
13852 9 : fd_gossip_socket_addr_decode_inner( &self->serve_repair, alloc_mem, ctx );
13853 9 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
13854 9 : fd_bincode_uint16_decode_unsafe( &self->shred_version, ctx );
13855 9 : }
13856 0 : void * fd_gossip_contact_info_v1_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
13857 0 : fd_gossip_contact_info_v1_t * self = (fd_gossip_contact_info_v1_t *)mem;
13858 0 : fd_gossip_contact_info_v1_new( self );
13859 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_contact_info_v1_t);
13860 0 : void * * alloc_mem = &alloc_region;
13861 0 : fd_gossip_contact_info_v1_decode_inner( mem, alloc_mem, ctx );
13862 0 : return self;
13863 0 : }
13864 0 : void fd_gossip_contact_info_v1_new(fd_gossip_contact_info_v1_t * self) {
13865 0 : fd_memset( self, 0, sizeof(fd_gossip_contact_info_v1_t) );
13866 0 : fd_pubkey_new( &self->id );
13867 0 : fd_gossip_socket_addr_new( &self->gossip );
13868 0 : fd_gossip_socket_addr_new( &self->tvu );
13869 0 : fd_gossip_socket_addr_new( &self->tvu_fwd );
13870 0 : fd_gossip_socket_addr_new( &self->repair );
13871 0 : fd_gossip_socket_addr_new( &self->tpu );
13872 0 : fd_gossip_socket_addr_new( &self->tpu_fwd );
13873 0 : fd_gossip_socket_addr_new( &self->tpu_vote );
13874 0 : fd_gossip_socket_addr_new( &self->rpc );
13875 0 : fd_gossip_socket_addr_new( &self->rpc_pubsub );
13876 0 : fd_gossip_socket_addr_new( &self->serve_repair );
13877 0 : }
13878 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, uint varint ) {
13879 9 : (void) varint;
13880 9 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_contact_info_v1", level++, 0 );
13881 9 : fd_pubkey_walk( w, &self->id, fun, "id", level, 0 );
13882 9 : fd_gossip_socket_addr_walk( w, &self->gossip, fun, "gossip", level, 0 );
13883 9 : fd_gossip_socket_addr_walk( w, &self->tvu, fun, "tvu", level, 0 );
13884 9 : fd_gossip_socket_addr_walk( w, &self->tvu_fwd, fun, "tvu_fwd", level, 0 );
13885 9 : fd_gossip_socket_addr_walk( w, &self->repair, fun, "repair", level, 0 );
13886 9 : fd_gossip_socket_addr_walk( w, &self->tpu, fun, "tpu", level, 0 );
13887 9 : fd_gossip_socket_addr_walk( w, &self->tpu_fwd, fun, "tpu_fwd", level, 0 );
13888 9 : fd_gossip_socket_addr_walk( w, &self->tpu_vote, fun, "tpu_vote", level, 0 );
13889 9 : fd_gossip_socket_addr_walk( w, &self->rpc, fun, "rpc", level, 0 );
13890 9 : fd_gossip_socket_addr_walk( w, &self->rpc_pubsub, fun, "rpc_pubsub", level, 0 );
13891 9 : fd_gossip_socket_addr_walk( w, &self->serve_repair, fun, "serve_repair", level, 0 );
13892 9 : fun( w, &self->wallclock, "wallclock", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
13893 9 : fun( w, &self->shred_version, "shred_version", FD_FLAMENCO_TYPE_USHORT, "ushort", level, 0 );
13894 9 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_contact_info_v1", level--, 0 );
13895 9 : }
13896 0 : ulong fd_gossip_contact_info_v1_size( fd_gossip_contact_info_v1_t const * self ) {
13897 0 : ulong size = 0;
13898 0 : size += fd_pubkey_size( &self->id );
13899 0 : size += fd_gossip_socket_addr_size( &self->gossip );
13900 0 : size += fd_gossip_socket_addr_size( &self->tvu );
13901 0 : size += fd_gossip_socket_addr_size( &self->tvu_fwd );
13902 0 : size += fd_gossip_socket_addr_size( &self->repair );
13903 0 : size += fd_gossip_socket_addr_size( &self->tpu );
13904 0 : size += fd_gossip_socket_addr_size( &self->tpu_fwd );
13905 0 : size += fd_gossip_socket_addr_size( &self->tpu_vote );
13906 0 : size += fd_gossip_socket_addr_size( &self->rpc );
13907 0 : size += fd_gossip_socket_addr_size( &self->rpc_pubsub );
13908 0 : size += fd_gossip_socket_addr_size( &self->serve_repair );
13909 0 : size += sizeof(ulong);
13910 0 : size += sizeof(ushort);
13911 0 : return size;
13912 0 : }
13913 :
13914 0 : int fd_gossip_vote_old_encode( fd_gossip_vote_old_t const * self, fd_bincode_encode_ctx_t * ctx ) {
13915 0 : int err;
13916 0 : err = fd_bincode_uint8_encode( (uchar)(self->index), ctx );
13917 0 : if( FD_UNLIKELY( err ) ) return err;
13918 0 : err = fd_pubkey_encode( &self->from, ctx );
13919 0 : if( FD_UNLIKELY( err ) ) return err;
13920 0 : err = fd_flamenco_txn_encode( &self->txn, ctx );
13921 0 : if( FD_UNLIKELY( err ) ) return err;
13922 0 : err = fd_bincode_uint64_encode( self->wallclock, ctx );
13923 0 : if( FD_UNLIKELY( err ) ) return err;
13924 0 : return FD_BINCODE_SUCCESS;
13925 0 : }
13926 6 : static int fd_gossip_vote_old_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13927 6 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
13928 6 : int err = 0;
13929 6 : err = fd_bincode_uint8_decode_footprint( ctx );
13930 6 : if( FD_UNLIKELY( err ) ) return err;
13931 6 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
13932 6 : if( FD_UNLIKELY( err ) ) return err;
13933 6 : err = fd_flamenco_txn_decode_footprint_inner( ctx, total_sz );
13934 6 : if( FD_UNLIKELY( err ) ) return err;
13935 6 : err = fd_bincode_uint64_decode_footprint( ctx );
13936 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13937 6 : return 0;
13938 6 : }
13939 0 : int fd_gossip_vote_old_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13940 0 : *total_sz += sizeof(fd_gossip_vote_old_t);
13941 0 : void const * start_data = ctx->data;
13942 0 : int err = fd_gossip_vote_old_decode_footprint_inner( ctx, total_sz );
13943 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
13944 0 : ctx->data = start_data;
13945 0 : return err;
13946 0 : }
13947 6 : static void fd_gossip_vote_old_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
13948 6 : fd_gossip_vote_old_t * self = (fd_gossip_vote_old_t *)struct_mem;
13949 6 : fd_bincode_uint8_decode_unsafe( &self->index, ctx );
13950 6 : fd_pubkey_decode_inner( &self->from, alloc_mem, ctx );
13951 6 : fd_flamenco_txn_decode_inner( &self->txn, alloc_mem, ctx );
13952 6 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
13953 6 : }
13954 0 : void * fd_gossip_vote_old_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
13955 0 : fd_gossip_vote_old_t * self = (fd_gossip_vote_old_t *)mem;
13956 0 : fd_gossip_vote_old_new( self );
13957 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_vote_old_t);
13958 0 : void * * alloc_mem = &alloc_region;
13959 0 : fd_gossip_vote_old_decode_inner( mem, alloc_mem, ctx );
13960 0 : return self;
13961 0 : }
13962 0 : void fd_gossip_vote_old_new(fd_gossip_vote_old_t * self) {
13963 0 : fd_memset( self, 0, sizeof(fd_gossip_vote_old_t) );
13964 0 : fd_pubkey_new( &self->from );
13965 0 : fd_flamenco_txn_new( &self->txn );
13966 0 : }
13967 6 : void fd_gossip_vote_old_walk( void * w, fd_gossip_vote_old_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
13968 6 : (void) varint;
13969 6 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_vote_old", level++, 0 );
13970 6 : fun( w, &self->index, "index", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
13971 6 : fd_pubkey_walk( w, &self->from, fun, "from", level, 0 );
13972 6 : fd_flamenco_txn_walk( w, &self->txn, fun, "txn", level, 0 );
13973 6 : fun( w, &self->wallclock, "wallclock", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
13974 6 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_vote_old", level--, 0 );
13975 6 : }
13976 0 : ulong fd_gossip_vote_old_size( fd_gossip_vote_old_t const * self ) {
13977 0 : ulong size = 0;
13978 0 : size += sizeof(char);
13979 0 : size += fd_pubkey_size( &self->from );
13980 0 : size += fd_flamenco_txn_size( &self->txn );
13981 0 : size += sizeof(ulong);
13982 0 : return size;
13983 0 : }
13984 :
13985 0 : FD_FN_PURE uchar fd_gossip_deprecated_compression_type_is_Uncompressed(fd_gossip_deprecated_compression_type_t const * self) {
13986 0 : return self->discriminant == 0;
13987 0 : }
13988 0 : FD_FN_PURE uchar fd_gossip_deprecated_compression_type_is_GZip(fd_gossip_deprecated_compression_type_t const * self) {
13989 0 : return self->discriminant == 1;
13990 0 : }
13991 0 : FD_FN_PURE uchar fd_gossip_deprecated_compression_type_is_BZip2(fd_gossip_deprecated_compression_type_t const * self) {
13992 0 : return self->discriminant == 2;
13993 0 : }
13994 0 : int fd_gossip_deprecated_compression_type_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13995 0 : int err;
13996 0 : switch (discriminant) {
13997 0 : case 0: {
13998 0 : return FD_BINCODE_SUCCESS;
13999 0 : }
14000 0 : case 1: {
14001 0 : return FD_BINCODE_SUCCESS;
14002 0 : }
14003 0 : case 2: {
14004 0 : return FD_BINCODE_SUCCESS;
14005 0 : }
14006 0 : default: return FD_BINCODE_ERR_ENCODING;
14007 0 : }
14008 0 : }
14009 0 : static int fd_gossip_deprecated_compression_type_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
14010 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
14011 0 : uint discriminant = 0;
14012 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
14013 0 : if( FD_UNLIKELY( err ) ) return err;
14014 0 : return fd_gossip_deprecated_compression_type_inner_decode_footprint( discriminant, ctx, total_sz );
14015 0 : }
14016 0 : int fd_gossip_deprecated_compression_type_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
14017 0 : *total_sz += sizeof(fd_gossip_deprecated_compression_type_t);
14018 0 : void const * start_data = ctx->data;
14019 0 : int err = fd_gossip_deprecated_compression_type_decode_footprint_inner( ctx, total_sz );
14020 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
14021 0 : ctx->data = start_data;
14022 0 : return err;
14023 0 : }
14024 0 : static void fd_gossip_deprecated_compression_type_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
14025 0 : fd_gossip_deprecated_compression_type_t * self = (fd_gossip_deprecated_compression_type_t *)struct_mem;
14026 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
14027 0 : }
14028 0 : void * fd_gossip_deprecated_compression_type_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
14029 0 : fd_gossip_deprecated_compression_type_t * self = (fd_gossip_deprecated_compression_type_t *)mem;
14030 0 : fd_gossip_deprecated_compression_type_new( self );
14031 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_deprecated_compression_type_t);
14032 0 : void * * alloc_mem = &alloc_region;
14033 0 : fd_gossip_deprecated_compression_type_decode_inner( mem, alloc_mem, ctx );
14034 0 : return self;
14035 0 : }
14036 :
14037 0 : void fd_gossip_deprecated_compression_type_walk( void * w, fd_gossip_deprecated_compression_type_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
14038 0 : (void) varint;
14039 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_gossip_deprecated_compression_type", level++, 0);
14040 0 : switch( self->discriminant ) {
14041 0 : case 0: {
14042 0 : fun( w, self, "Uncompressed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14043 0 : break;
14044 0 : }
14045 0 : case 1: {
14046 0 : fun( w, self, "GZip", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14047 0 : break;
14048 0 : }
14049 0 : case 2: {
14050 0 : fun( w, self, "BZip2", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14051 0 : break;
14052 0 : }
14053 0 : }
14054 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_gossip_deprecated_compression_type", level--, 0 );
14055 0 : }
14056 0 : ulong fd_gossip_deprecated_compression_type_size( fd_gossip_deprecated_compression_type_t const * self ) {
14057 0 : ulong size = 0;
14058 0 : size += sizeof(uint);
14059 0 : switch (self->discriminant) {
14060 0 : }
14061 0 : return size;
14062 0 : }
14063 :
14064 0 : int fd_gossip_deprecated_compression_type_encode( fd_gossip_deprecated_compression_type_t const * self, fd_bincode_encode_ctx_t * ctx ) {
14065 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
14066 0 : if( FD_UNLIKELY( err ) ) return err;
14067 0 : return err;
14068 0 : }
14069 :
14070 0 : int fd_gossip_deprecated_epoch_incomplete_slots_encode( fd_gossip_deprecated_epoch_incomplete_slots_t const * self, fd_bincode_encode_ctx_t * ctx ) {
14071 0 : int err;
14072 0 : err = fd_bincode_uint64_encode( self->first, ctx );
14073 0 : if( FD_UNLIKELY( err ) ) return err;
14074 0 : err = fd_gossip_deprecated_compression_type_encode( &self->compression, ctx );
14075 0 : if( FD_UNLIKELY( err ) ) return err;
14076 0 : err = fd_bincode_uint64_encode( self->compressed_list_len, ctx );
14077 0 : if( FD_UNLIKELY(err) ) return err;
14078 0 : if( self->compressed_list_len ) {
14079 0 : err = fd_bincode_bytes_encode( self->compressed_list, self->compressed_list_len, ctx );
14080 0 : if( FD_UNLIKELY( err ) ) return err;
14081 0 : }
14082 0 : return FD_BINCODE_SUCCESS;
14083 0 : }
14084 0 : static int fd_gossip_deprecated_epoch_incomplete_slots_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
14085 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
14086 0 : int err = 0;
14087 0 : err = fd_bincode_uint64_decode_footprint( ctx );
14088 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14089 0 : err = fd_gossip_deprecated_compression_type_decode_footprint_inner( ctx, total_sz );
14090 0 : if( FD_UNLIKELY( err ) ) return err;
14091 0 : ulong compressed_list_len;
14092 0 : err = fd_bincode_uint64_decode( &compressed_list_len, ctx );
14093 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14094 0 : if( compressed_list_len ) {
14095 0 : *total_sz += 8UL + compressed_list_len;
14096 0 : err = fd_bincode_bytes_decode_footprint( compressed_list_len, ctx );
14097 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14098 0 : }
14099 0 : return 0;
14100 0 : }
14101 0 : int fd_gossip_deprecated_epoch_incomplete_slots_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
14102 0 : *total_sz += sizeof(fd_gossip_deprecated_epoch_incomplete_slots_t);
14103 0 : void const * start_data = ctx->data;
14104 0 : int err = fd_gossip_deprecated_epoch_incomplete_slots_decode_footprint_inner( ctx, total_sz );
14105 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
14106 0 : ctx->data = start_data;
14107 0 : return err;
14108 0 : }
14109 0 : static void fd_gossip_deprecated_epoch_incomplete_slots_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
14110 0 : fd_gossip_deprecated_epoch_incomplete_slots_t * self = (fd_gossip_deprecated_epoch_incomplete_slots_t *)struct_mem;
14111 0 : fd_bincode_uint64_decode_unsafe( &self->first, ctx );
14112 0 : fd_gossip_deprecated_compression_type_decode_inner( &self->compression, alloc_mem, ctx );
14113 0 : fd_bincode_uint64_decode_unsafe( &self->compressed_list_len, ctx );
14114 0 : if( self->compressed_list_len ) {
14115 0 : self->compressed_list = *alloc_mem;
14116 0 : fd_bincode_bytes_decode_unsafe( self->compressed_list, self->compressed_list_len, ctx );
14117 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->compressed_list_len;
14118 0 : } else
14119 0 : self->compressed_list = NULL;
14120 0 : }
14121 0 : void * fd_gossip_deprecated_epoch_incomplete_slots_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
14122 0 : fd_gossip_deprecated_epoch_incomplete_slots_t * self = (fd_gossip_deprecated_epoch_incomplete_slots_t *)mem;
14123 0 : fd_gossip_deprecated_epoch_incomplete_slots_new( self );
14124 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_deprecated_epoch_incomplete_slots_t);
14125 0 : void * * alloc_mem = &alloc_region;
14126 0 : fd_gossip_deprecated_epoch_incomplete_slots_decode_inner( mem, alloc_mem, ctx );
14127 0 : return self;
14128 0 : }
14129 0 : void fd_gossip_deprecated_epoch_incomplete_slots_new(fd_gossip_deprecated_epoch_incomplete_slots_t * self) {
14130 0 : fd_memset( self, 0, sizeof(fd_gossip_deprecated_epoch_incomplete_slots_t) );
14131 0 : fd_gossip_deprecated_compression_type_new( &self->compression );
14132 0 : }
14133 0 : void fd_gossip_deprecated_epoch_incomplete_slots_walk( void * w, fd_gossip_deprecated_epoch_incomplete_slots_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
14134 0 : (void) varint;
14135 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_deprecated_epoch_incomplete_slots", level++, 0 );
14136 0 : fun( w, &self->first, "first", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
14137 0 : fd_gossip_deprecated_compression_type_walk( w, &self->compression, fun, "compression", level, 0 );
14138 0 : if( self->compressed_list_len ) {
14139 0 : fun( w, NULL, "compressed_list", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
14140 0 : for( ulong i=0; i < self->compressed_list_len; i++ )
14141 0 : fun( w, self->compressed_list + i, "compressed_list", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
14142 0 : fun( w, NULL, "compressed_list", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
14143 0 : }
14144 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_deprecated_epoch_incomplete_slots", level--, 0 );
14145 0 : }
14146 0 : ulong fd_gossip_deprecated_epoch_incomplete_slots_size( fd_gossip_deprecated_epoch_incomplete_slots_t const * self ) {
14147 0 : ulong size = 0;
14148 0 : size += sizeof(ulong);
14149 0 : size += fd_gossip_deprecated_compression_type_size( &self->compression );
14150 0 : do {
14151 0 : size += sizeof(ulong);
14152 0 : size += self->compressed_list_len;
14153 0 : } while(0);
14154 0 : return size;
14155 0 : }
14156 :
14157 0 : int fd_gossip_lowest_slot_encode( fd_gossip_lowest_slot_t const * self, fd_bincode_encode_ctx_t * ctx ) {
14158 0 : int err;
14159 0 : err = fd_bincode_uint8_encode( (uchar)(self->u8), ctx );
14160 0 : if( FD_UNLIKELY( err ) ) return err;
14161 0 : err = fd_pubkey_encode( &self->from, ctx );
14162 0 : if( FD_UNLIKELY( err ) ) return err;
14163 0 : err = fd_bincode_uint64_encode( self->root, ctx );
14164 0 : if( FD_UNLIKELY( err ) ) return err;
14165 0 : err = fd_bincode_uint64_encode( self->lowest, ctx );
14166 0 : if( FD_UNLIKELY( err ) ) return err;
14167 0 : err = fd_bincode_uint64_encode( self->slots_len, ctx );
14168 0 : if( FD_UNLIKELY(err) ) return err;
14169 0 : if( self->slots_len ) {
14170 0 : for( ulong i=0; i < self->slots_len; i++ ) {
14171 0 : err = fd_bincode_uint64_encode( self->slots[i], ctx );
14172 0 : }
14173 0 : }
14174 0 : err = fd_bincode_uint64_encode( self->stash_len, ctx );
14175 0 : if( FD_UNLIKELY(err) ) return err;
14176 0 : if( self->stash_len ) {
14177 0 : for( ulong i=0; i < self->stash_len; i++ ) {
14178 0 : err = fd_gossip_deprecated_epoch_incomplete_slots_encode( self->stash + i, ctx );
14179 0 : if( FD_UNLIKELY( err ) ) return err;
14180 0 : }
14181 0 : }
14182 0 : err = fd_bincode_uint64_encode( self->wallclock, ctx );
14183 0 : if( FD_UNLIKELY( err ) ) return err;
14184 0 : return FD_BINCODE_SUCCESS;
14185 0 : }
14186 0 : static int fd_gossip_lowest_slot_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
14187 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
14188 0 : int err = 0;
14189 0 : err = fd_bincode_uint8_decode_footprint( ctx );
14190 0 : if( FD_UNLIKELY( err ) ) return err;
14191 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
14192 0 : if( FD_UNLIKELY( err ) ) return err;
14193 0 : err = fd_bincode_uint64_decode_footprint( ctx );
14194 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14195 0 : err = fd_bincode_uint64_decode_footprint( ctx );
14196 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14197 0 : ulong slots_len;
14198 0 : err = fd_bincode_uint64_decode( &slots_len, ctx );
14199 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14200 0 : if( slots_len ) {
14201 0 : *total_sz += 8UL + sizeof(ulong)*slots_len;
14202 0 : for( ulong i=0; i < slots_len; i++ ) {
14203 0 : err = fd_bincode_uint64_decode_footprint( ctx );
14204 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14205 0 : }
14206 0 : }
14207 0 : ulong stash_len;
14208 0 : err = fd_bincode_uint64_decode( &stash_len, ctx );
14209 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14210 0 : if( stash_len ) {
14211 0 : *total_sz += FD_GOSSIP_DEPRECATED_EPOCH_INCOMPLETE_SLOTS_ALIGN + sizeof(fd_gossip_deprecated_epoch_incomplete_slots_t)*stash_len;
14212 0 : for( ulong i=0; i < stash_len; i++ ) {
14213 0 : err = fd_gossip_deprecated_epoch_incomplete_slots_decode_footprint_inner( ctx, total_sz );
14214 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14215 0 : }
14216 0 : }
14217 0 : err = fd_bincode_uint64_decode_footprint( ctx );
14218 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14219 0 : return 0;
14220 0 : }
14221 0 : int fd_gossip_lowest_slot_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
14222 0 : *total_sz += sizeof(fd_gossip_lowest_slot_t);
14223 0 : void const * start_data = ctx->data;
14224 0 : int err = fd_gossip_lowest_slot_decode_footprint_inner( ctx, total_sz );
14225 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
14226 0 : ctx->data = start_data;
14227 0 : return err;
14228 0 : }
14229 0 : static void fd_gossip_lowest_slot_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
14230 0 : fd_gossip_lowest_slot_t * self = (fd_gossip_lowest_slot_t *)struct_mem;
14231 0 : fd_bincode_uint8_decode_unsafe( &self->u8, ctx );
14232 0 : fd_pubkey_decode_inner( &self->from, alloc_mem, ctx );
14233 0 : fd_bincode_uint64_decode_unsafe( &self->root, ctx );
14234 0 : fd_bincode_uint64_decode_unsafe( &self->lowest, ctx );
14235 0 : fd_bincode_uint64_decode_unsafe( &self->slots_len, ctx );
14236 0 : if( self->slots_len ) {
14237 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), 8UL );
14238 0 : self->slots = *alloc_mem;
14239 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(ulong)*self->slots_len;
14240 0 : for( ulong i=0; i < self->slots_len; i++ ) {
14241 0 : fd_bincode_uint64_decode_unsafe( self->slots + i, ctx );
14242 0 : }
14243 0 : } else
14244 0 : self->slots = NULL;
14245 0 : fd_bincode_uint64_decode_unsafe( &self->stash_len, ctx );
14246 0 : if( self->stash_len ) {
14247 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_GOSSIP_DEPRECATED_EPOCH_INCOMPLETE_SLOTS_ALIGN );
14248 0 : self->stash = *alloc_mem;
14249 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_gossip_deprecated_epoch_incomplete_slots_t)*self->stash_len;
14250 0 : for( ulong i=0; i < self->stash_len; i++ ) {
14251 0 : fd_gossip_deprecated_epoch_incomplete_slots_new( self->stash + i );
14252 0 : fd_gossip_deprecated_epoch_incomplete_slots_decode_inner( self->stash + i, alloc_mem, ctx );
14253 0 : }
14254 0 : } else
14255 0 : self->stash = NULL;
14256 0 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
14257 0 : }
14258 0 : void * fd_gossip_lowest_slot_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
14259 0 : fd_gossip_lowest_slot_t * self = (fd_gossip_lowest_slot_t *)mem;
14260 0 : fd_gossip_lowest_slot_new( self );
14261 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_lowest_slot_t);
14262 0 : void * * alloc_mem = &alloc_region;
14263 0 : fd_gossip_lowest_slot_decode_inner( mem, alloc_mem, ctx );
14264 0 : return self;
14265 0 : }
14266 0 : void fd_gossip_lowest_slot_new(fd_gossip_lowest_slot_t * self) {
14267 0 : fd_memset( self, 0, sizeof(fd_gossip_lowest_slot_t) );
14268 0 : fd_pubkey_new( &self->from );
14269 0 : }
14270 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, uint varint ) {
14271 0 : (void) varint;
14272 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_lowest_slot", level++, 0 );
14273 0 : fun( w, &self->u8, "u8", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
14274 0 : fd_pubkey_walk( w, &self->from, fun, "from", level, 0 );
14275 0 : fun( w, &self->root, "root", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
14276 0 : fun( w, &self->lowest, "lowest", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
14277 0 : if( self->slots_len ) {
14278 0 : fun( w, NULL, "slots", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
14279 0 : for( ulong i=0; i < self->slots_len; i++ )
14280 0 : fun( w, self->slots + i, "slots", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
14281 0 : fun( w, NULL, "slots", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
14282 0 : }
14283 0 : if( self->stash_len ) {
14284 0 : fun( w, NULL, "stash", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
14285 0 : for( ulong i=0; i < self->stash_len; i++ )
14286 0 : fd_gossip_deprecated_epoch_incomplete_slots_walk(w, self->stash + i, fun, "gossip_deprecated_epoch_incomplete_slots", level, 0 );
14287 0 : fun( w, NULL, "stash", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
14288 0 : }
14289 0 : fun( w, &self->wallclock, "wallclock", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
14290 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_lowest_slot", level--, 0 );
14291 0 : }
14292 0 : ulong fd_gossip_lowest_slot_size( fd_gossip_lowest_slot_t const * self ) {
14293 0 : ulong size = 0;
14294 0 : size += sizeof(char);
14295 0 : size += fd_pubkey_size( &self->from );
14296 0 : size += sizeof(ulong);
14297 0 : size += sizeof(ulong);
14298 0 : do {
14299 0 : size += sizeof(ulong);
14300 0 : size += self->slots_len * sizeof(ulong);
14301 0 : } while(0);
14302 0 : do {
14303 0 : size += sizeof(ulong);
14304 0 : for( ulong i=0; i < self->stash_len; i++ )
14305 0 : size += fd_gossip_deprecated_epoch_incomplete_slots_size( self->stash + i );
14306 0 : } while(0);
14307 0 : size += sizeof(ulong);
14308 0 : return size;
14309 0 : }
14310 :
14311 0 : int fd_gossip_slot_hashes_encode( fd_gossip_slot_hashes_t const * self, fd_bincode_encode_ctx_t * ctx ) {
14312 0 : int err;
14313 0 : err = fd_pubkey_encode( &self->from, ctx );
14314 0 : if( FD_UNLIKELY( err ) ) return err;
14315 0 : err = fd_bincode_uint64_encode( self->hashes_len, ctx );
14316 0 : if( FD_UNLIKELY(err) ) return err;
14317 0 : if( self->hashes_len ) {
14318 0 : for( ulong i=0; i < self->hashes_len; i++ ) {
14319 0 : err = fd_slot_hash_encode( self->hashes + i, ctx );
14320 0 : if( FD_UNLIKELY( err ) ) return err;
14321 0 : }
14322 0 : }
14323 0 : err = fd_bincode_uint64_encode( self->wallclock, ctx );
14324 0 : if( FD_UNLIKELY( err ) ) return err;
14325 0 : return FD_BINCODE_SUCCESS;
14326 0 : }
14327 3 : static int fd_gossip_slot_hashes_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
14328 3 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
14329 3 : int err = 0;
14330 3 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
14331 3 : if( FD_UNLIKELY( err ) ) return err;
14332 3 : ulong hashes_len;
14333 3 : err = fd_bincode_uint64_decode( &hashes_len, ctx );
14334 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14335 3 : if( hashes_len ) {
14336 3 : *total_sz += FD_SLOT_HASH_ALIGN + sizeof(fd_slot_hash_t)*hashes_len;
14337 6 : for( ulong i=0; i < hashes_len; i++ ) {
14338 3 : err = fd_slot_hash_decode_footprint_inner( ctx, total_sz );
14339 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14340 3 : }
14341 3 : }
14342 3 : err = fd_bincode_uint64_decode_footprint( ctx );
14343 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14344 3 : return 0;
14345 3 : }
14346 0 : int fd_gossip_slot_hashes_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
14347 0 : *total_sz += sizeof(fd_gossip_slot_hashes_t);
14348 0 : void const * start_data = ctx->data;
14349 0 : int err = fd_gossip_slot_hashes_decode_footprint_inner( ctx, total_sz );
14350 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
14351 0 : ctx->data = start_data;
14352 0 : return err;
14353 0 : }
14354 3 : static void fd_gossip_slot_hashes_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
14355 3 : fd_gossip_slot_hashes_t * self = (fd_gossip_slot_hashes_t *)struct_mem;
14356 3 : fd_pubkey_decode_inner( &self->from, alloc_mem, ctx );
14357 3 : fd_bincode_uint64_decode_unsafe( &self->hashes_len, ctx );
14358 3 : if( self->hashes_len ) {
14359 3 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_SLOT_HASH_ALIGN );
14360 3 : self->hashes = *alloc_mem;
14361 3 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_slot_hash_t)*self->hashes_len;
14362 6 : for( ulong i=0; i < self->hashes_len; i++ ) {
14363 3 : fd_slot_hash_new( self->hashes + i );
14364 3 : fd_slot_hash_decode_inner( self->hashes + i, alloc_mem, ctx );
14365 3 : }
14366 3 : } else
14367 0 : self->hashes = NULL;
14368 3 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
14369 3 : }
14370 0 : void * fd_gossip_slot_hashes_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
14371 0 : fd_gossip_slot_hashes_t * self = (fd_gossip_slot_hashes_t *)mem;
14372 0 : fd_gossip_slot_hashes_new( self );
14373 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_slot_hashes_t);
14374 0 : void * * alloc_mem = &alloc_region;
14375 0 : fd_gossip_slot_hashes_decode_inner( mem, alloc_mem, ctx );
14376 0 : return self;
14377 0 : }
14378 0 : void fd_gossip_slot_hashes_new(fd_gossip_slot_hashes_t * self) {
14379 0 : fd_memset( self, 0, sizeof(fd_gossip_slot_hashes_t) );
14380 0 : fd_pubkey_new( &self->from );
14381 0 : }
14382 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, uint varint ) {
14383 3 : (void) varint;
14384 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_slot_hashes", level++, 0 );
14385 3 : fd_pubkey_walk( w, &self->from, fun, "from", level, 0 );
14386 3 : if( self->hashes_len ) {
14387 3 : fun( w, NULL, "hashes", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
14388 6 : for( ulong i=0; i < self->hashes_len; i++ )
14389 3 : fd_slot_hash_walk(w, self->hashes + i, fun, "slot_hash", level, 0 );
14390 3 : fun( w, NULL, "hashes", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
14391 3 : }
14392 3 : fun( w, &self->wallclock, "wallclock", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
14393 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_slot_hashes", level--, 0 );
14394 3 : }
14395 0 : ulong fd_gossip_slot_hashes_size( fd_gossip_slot_hashes_t const * self ) {
14396 0 : ulong size = 0;
14397 0 : size += fd_pubkey_size( &self->from );
14398 0 : do {
14399 0 : size += sizeof(ulong);
14400 0 : for( ulong i=0; i < self->hashes_len; i++ )
14401 0 : size += fd_slot_hash_size( self->hashes + i );
14402 0 : } while(0);
14403 0 : size += sizeof(ulong);
14404 0 : return size;
14405 0 : }
14406 :
14407 0 : int fd_gossip_slots_encode( fd_gossip_slots_t const * self, fd_bincode_encode_ctx_t * ctx ) {
14408 0 : int err;
14409 0 : err = fd_bincode_uint64_encode( self->first_slot, ctx );
14410 0 : if( FD_UNLIKELY( err ) ) return err;
14411 0 : err = fd_bincode_uint64_encode( self->num, ctx );
14412 0 : if( FD_UNLIKELY( err ) ) return err;
14413 0 : err = fd_bincode_bool_encode( self->has_slots, ctx );
14414 0 : if( FD_UNLIKELY( err ) ) return err;
14415 0 : if( self->has_slots ) {
14416 0 : err = fd_bincode_uint64_encode( self->slots_bitvec_len, ctx );
14417 0 : if( FD_UNLIKELY(err) ) return err;
14418 0 : if( self->slots_bitvec_len ) {
14419 0 : err = fd_bincode_bytes_encode( self->slots_bitvec, self->slots_bitvec_len, ctx );
14420 0 : if( FD_UNLIKELY( err ) ) return err;
14421 0 : }
14422 0 : if( FD_UNLIKELY( err ) ) return err;
14423 0 : }
14424 0 : err = fd_bincode_uint64_encode( self->slots_len, ctx );
14425 0 : if( FD_UNLIKELY( err ) ) return err;
14426 0 : return FD_BINCODE_SUCCESS;
14427 0 : }
14428 0 : static int fd_gossip_slots_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
14429 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
14430 0 : int err = 0;
14431 0 : err = fd_bincode_uint64_decode_footprint( ctx );
14432 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14433 0 : err = fd_bincode_uint64_decode_footprint( ctx );
14434 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14435 0 : {
14436 0 : uchar o;
14437 0 : ulong inner_len = 0UL;
14438 0 : err = fd_bincode_bool_decode( &o, ctx );
14439 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14440 0 : if( o ) {
14441 0 : ulong slots_bitvec_len;
14442 0 : err = fd_bincode_uint64_decode( &slots_bitvec_len, ctx );
14443 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14444 0 : if( slots_bitvec_len ) {
14445 0 : *total_sz += 8UL + slots_bitvec_len;
14446 0 : err = fd_bincode_bytes_decode_footprint( slots_bitvec_len, ctx );
14447 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14448 0 : }
14449 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14450 0 : inner_len = slots_bitvec_len;
14451 0 : if( inner_len==0 ) return FD_BINCODE_ERR_ENCODING;
14452 0 : }
14453 0 : ulong len;
14454 0 : err = fd_bincode_uint64_decode( &len, ctx );
14455 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14456 0 : if( len > inner_len * sizeof(uchar) * 8UL ) return FD_BINCODE_ERR_ENCODING;
14457 0 : }
14458 0 : return 0;
14459 0 : }
14460 0 : int fd_gossip_slots_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
14461 0 : *total_sz += sizeof(fd_gossip_slots_t);
14462 0 : void const * start_data = ctx->data;
14463 0 : int err = fd_gossip_slots_decode_footprint_inner( ctx, total_sz );
14464 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
14465 0 : ctx->data = start_data;
14466 0 : return err;
14467 0 : }
14468 0 : static void fd_gossip_slots_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
14469 0 : fd_gossip_slots_t * self = (fd_gossip_slots_t *)struct_mem;
14470 0 : fd_bincode_uint64_decode_unsafe( &self->first_slot, ctx );
14471 0 : fd_bincode_uint64_decode_unsafe( &self->num, ctx );
14472 0 : {
14473 0 : uchar o;
14474 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
14475 0 : self->has_slots = !!o;
14476 0 : if( o ) {
14477 0 : fd_bincode_uint64_decode_unsafe( &self->slots_bitvec_len, ctx );
14478 0 : if( self->slots_bitvec_len ) {
14479 0 : self->slots_bitvec = *alloc_mem;
14480 0 : fd_bincode_bytes_decode_unsafe( self->slots_bitvec, self->slots_bitvec_len, ctx );
14481 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->slots_bitvec_len;
14482 0 : } else
14483 0 : self->slots_bitvec = NULL;
14484 0 : } else {
14485 0 : self->slots_bitvec = NULL;
14486 0 : }
14487 0 : fd_bincode_uint64_decode_unsafe( &self->slots_len, ctx );
14488 0 : }
14489 0 : }
14490 0 : void * fd_gossip_slots_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
14491 0 : fd_gossip_slots_t * self = (fd_gossip_slots_t *)mem;
14492 0 : fd_gossip_slots_new( self );
14493 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_slots_t);
14494 0 : void * * alloc_mem = &alloc_region;
14495 0 : fd_gossip_slots_decode_inner( mem, alloc_mem, ctx );
14496 0 : return self;
14497 0 : }
14498 0 : void fd_gossip_slots_new(fd_gossip_slots_t * self) {
14499 0 : fd_memset( self, 0, sizeof(fd_gossip_slots_t) );
14500 0 : }
14501 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, uint varint ) {
14502 0 : (void) varint;
14503 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_slots", level++, 0 );
14504 0 : fun( w, &self->first_slot, "first_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
14505 0 : fun( w, &self->num, "num", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
14506 0 : if( !self->has_slots ) {
14507 0 : fun( w, NULL, "slots", FD_FLAMENCO_TYPE_NULL, "uchar", level, 0 );
14508 0 : } else {
14509 0 : if( self->slots_bitvec_len ) {
14510 0 : fun( w, NULL, "slots_bitvec", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
14511 0 : for( ulong i=0; i < self->slots_bitvec_len; i++ )
14512 0 : fun( w, self->slots_bitvec + i, "slots_bitvec", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
14513 0 : fun( w, NULL, "slots_bitvec", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
14514 0 : }
14515 0 : }
14516 0 : fun( w, &self->slots_len, "slots_len", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
14517 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_slots", level--, 0 );
14518 0 : }
14519 0 : ulong fd_gossip_slots_size( fd_gossip_slots_t const * self ) {
14520 0 : ulong size = 0;
14521 0 : size += sizeof(ulong);
14522 0 : size += sizeof(ulong);
14523 0 : size += sizeof(char);
14524 0 : if( self->has_slots ) {
14525 0 : do {
14526 0 : size += sizeof(ulong);
14527 0 : size += self->slots_bitvec_len;
14528 0 : } while(0);
14529 0 : }
14530 0 : size += sizeof(ulong);
14531 0 : return size;
14532 0 : }
14533 :
14534 0 : int fd_gossip_flate2_slots_encode( fd_gossip_flate2_slots_t const * self, fd_bincode_encode_ctx_t * ctx ) {
14535 0 : int err;
14536 0 : err = fd_bincode_uint64_encode( self->first_slot, ctx );
14537 0 : if( FD_UNLIKELY( err ) ) return err;
14538 0 : err = fd_bincode_uint64_encode( self->num, ctx );
14539 0 : if( FD_UNLIKELY( err ) ) return err;
14540 0 : err = fd_bincode_uint64_encode( self->compressed_len, ctx );
14541 0 : if( FD_UNLIKELY(err) ) return err;
14542 0 : if( self->compressed_len ) {
14543 0 : err = fd_bincode_bytes_encode( self->compressed, self->compressed_len, ctx );
14544 0 : if( FD_UNLIKELY( err ) ) return err;
14545 0 : }
14546 0 : return FD_BINCODE_SUCCESS;
14547 0 : }
14548 0 : static int fd_gossip_flate2_slots_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
14549 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
14550 0 : int err = 0;
14551 0 : err = fd_bincode_uint64_decode_footprint( ctx );
14552 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14553 0 : err = fd_bincode_uint64_decode_footprint( ctx );
14554 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14555 0 : ulong compressed_len;
14556 0 : err = fd_bincode_uint64_decode( &compressed_len, ctx );
14557 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14558 0 : if( compressed_len ) {
14559 0 : *total_sz += 8UL + compressed_len;
14560 0 : err = fd_bincode_bytes_decode_footprint( compressed_len, ctx );
14561 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14562 0 : }
14563 0 : return 0;
14564 0 : }
14565 0 : int fd_gossip_flate2_slots_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
14566 0 : *total_sz += sizeof(fd_gossip_flate2_slots_t);
14567 0 : void const * start_data = ctx->data;
14568 0 : int err = fd_gossip_flate2_slots_decode_footprint_inner( ctx, total_sz );
14569 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
14570 0 : ctx->data = start_data;
14571 0 : return err;
14572 0 : }
14573 0 : static void fd_gossip_flate2_slots_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
14574 0 : fd_gossip_flate2_slots_t * self = (fd_gossip_flate2_slots_t *)struct_mem;
14575 0 : fd_bincode_uint64_decode_unsafe( &self->first_slot, ctx );
14576 0 : fd_bincode_uint64_decode_unsafe( &self->num, ctx );
14577 0 : fd_bincode_uint64_decode_unsafe( &self->compressed_len, ctx );
14578 0 : if( self->compressed_len ) {
14579 0 : self->compressed = *alloc_mem;
14580 0 : fd_bincode_bytes_decode_unsafe( self->compressed, self->compressed_len, ctx );
14581 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->compressed_len;
14582 0 : } else
14583 0 : self->compressed = NULL;
14584 0 : }
14585 0 : void * fd_gossip_flate2_slots_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
14586 0 : fd_gossip_flate2_slots_t * self = (fd_gossip_flate2_slots_t *)mem;
14587 0 : fd_gossip_flate2_slots_new( self );
14588 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_flate2_slots_t);
14589 0 : void * * alloc_mem = &alloc_region;
14590 0 : fd_gossip_flate2_slots_decode_inner( mem, alloc_mem, ctx );
14591 0 : return self;
14592 0 : }
14593 0 : void fd_gossip_flate2_slots_new(fd_gossip_flate2_slots_t * self) {
14594 0 : fd_memset( self, 0, sizeof(fd_gossip_flate2_slots_t) );
14595 0 : }
14596 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, uint varint ) {
14597 0 : (void) varint;
14598 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_flate2_slots", level++, 0 );
14599 0 : fun( w, &self->first_slot, "first_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
14600 0 : fun( w, &self->num, "num", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
14601 0 : if( self->compressed_len ) {
14602 0 : fun( w, NULL, "compressed", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
14603 0 : for( ulong i=0; i < self->compressed_len; i++ )
14604 0 : fun( w, self->compressed + i, "compressed", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
14605 0 : fun( w, NULL, "compressed", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
14606 0 : }
14607 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_flate2_slots", level--, 0 );
14608 0 : }
14609 0 : ulong fd_gossip_flate2_slots_size( fd_gossip_flate2_slots_t const * self ) {
14610 0 : ulong size = 0;
14611 0 : size += sizeof(ulong);
14612 0 : size += sizeof(ulong);
14613 0 : do {
14614 0 : size += sizeof(ulong);
14615 0 : size += self->compressed_len;
14616 0 : } while(0);
14617 0 : return size;
14618 0 : }
14619 :
14620 0 : FD_FN_PURE uchar fd_gossip_slots_enum_is_flate2(fd_gossip_slots_enum_t const * self) {
14621 0 : return self->discriminant == 0;
14622 0 : }
14623 0 : FD_FN_PURE uchar fd_gossip_slots_enum_is_uncompressed(fd_gossip_slots_enum_t const * self) {
14624 0 : return self->discriminant == 1;
14625 0 : }
14626 : void fd_gossip_slots_enum_inner_new( fd_gossip_slots_enum_inner_t * self, uint discriminant );
14627 0 : int fd_gossip_slots_enum_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
14628 0 : int err;
14629 0 : switch (discriminant) {
14630 0 : case 0: {
14631 0 : err = fd_gossip_flate2_slots_decode_footprint_inner( ctx, total_sz );
14632 0 : if( FD_UNLIKELY( err ) ) return err;
14633 0 : return FD_BINCODE_SUCCESS;
14634 0 : }
14635 0 : case 1: {
14636 0 : err = fd_gossip_slots_decode_footprint_inner( ctx, total_sz );
14637 0 : if( FD_UNLIKELY( err ) ) return err;
14638 0 : return FD_BINCODE_SUCCESS;
14639 0 : }
14640 0 : default: return FD_BINCODE_ERR_ENCODING;
14641 0 : }
14642 0 : }
14643 0 : static int fd_gossip_slots_enum_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
14644 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
14645 0 : uint discriminant = 0;
14646 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
14647 0 : if( FD_UNLIKELY( err ) ) return err;
14648 0 : return fd_gossip_slots_enum_inner_decode_footprint( discriminant, ctx, total_sz );
14649 0 : }
14650 0 : int fd_gossip_slots_enum_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
14651 0 : *total_sz += sizeof(fd_gossip_slots_enum_t);
14652 0 : void const * start_data = ctx->data;
14653 0 : int err = fd_gossip_slots_enum_decode_footprint_inner( ctx, total_sz );
14654 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
14655 0 : ctx->data = start_data;
14656 0 : return err;
14657 0 : }
14658 0 : static 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 ) {
14659 0 : switch (discriminant) {
14660 0 : case 0: {
14661 0 : fd_gossip_flate2_slots_decode_inner( &self->flate2, alloc_mem, ctx );
14662 0 : break;
14663 0 : }
14664 0 : case 1: {
14665 0 : fd_gossip_slots_decode_inner( &self->uncompressed, alloc_mem, ctx );
14666 0 : break;
14667 0 : }
14668 0 : }
14669 0 : }
14670 0 : static void fd_gossip_slots_enum_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
14671 0 : fd_gossip_slots_enum_t * self = (fd_gossip_slots_enum_t *)struct_mem;
14672 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
14673 0 : fd_gossip_slots_enum_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
14674 0 : }
14675 0 : void * fd_gossip_slots_enum_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
14676 0 : fd_gossip_slots_enum_t * self = (fd_gossip_slots_enum_t *)mem;
14677 0 : fd_gossip_slots_enum_new( self );
14678 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_slots_enum_t);
14679 0 : void * * alloc_mem = &alloc_region;
14680 0 : fd_gossip_slots_enum_decode_inner( mem, alloc_mem, ctx );
14681 0 : return self;
14682 0 : }
14683 0 : void fd_gossip_slots_enum_inner_new( fd_gossip_slots_enum_inner_t * self, uint discriminant ) {
14684 0 : switch( discriminant ) {
14685 0 : case 0: {
14686 0 : fd_gossip_flate2_slots_new( &self->flate2 );
14687 0 : break;
14688 0 : }
14689 0 : case 1: {
14690 0 : fd_gossip_slots_new( &self->uncompressed );
14691 0 : break;
14692 0 : }
14693 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
14694 0 : }
14695 0 : }
14696 0 : void fd_gossip_slots_enum_new_disc( fd_gossip_slots_enum_t * self, uint discriminant ) {
14697 0 : self->discriminant = discriminant;
14698 0 : fd_gossip_slots_enum_inner_new( &self->inner, self->discriminant );
14699 0 : }
14700 0 : void fd_gossip_slots_enum_new( fd_gossip_slots_enum_t * self ) {
14701 0 : fd_memset( self, 0, sizeof(fd_gossip_slots_enum_t) );
14702 0 : fd_gossip_slots_enum_new_disc( self, UINT_MAX );
14703 0 : }
14704 :
14705 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, uint varint ) {
14706 0 : (void) varint;
14707 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_gossip_slots_enum", level++, 0);
14708 0 : switch( self->discriminant ) {
14709 0 : case 0: {
14710 0 : fun( w, self, "flate2", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14711 0 : fd_gossip_flate2_slots_walk( w, &self->inner.flate2, fun, "flate2", level, 0 );
14712 0 : break;
14713 0 : }
14714 0 : case 1: {
14715 0 : fun( w, self, "uncompressed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14716 0 : fd_gossip_slots_walk( w, &self->inner.uncompressed, fun, "uncompressed", level, 0 );
14717 0 : break;
14718 0 : }
14719 0 : }
14720 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_gossip_slots_enum", level--, 0 );
14721 0 : }
14722 0 : ulong fd_gossip_slots_enum_size( fd_gossip_slots_enum_t const * self ) {
14723 0 : ulong size = 0;
14724 0 : size += sizeof(uint);
14725 0 : switch (self->discriminant) {
14726 0 : case 0: {
14727 0 : size += fd_gossip_flate2_slots_size( &self->inner.flate2 );
14728 0 : break;
14729 0 : }
14730 0 : case 1: {
14731 0 : size += fd_gossip_slots_size( &self->inner.uncompressed );
14732 0 : break;
14733 0 : }
14734 0 : }
14735 0 : return size;
14736 0 : }
14737 :
14738 0 : int fd_gossip_slots_enum_inner_encode( fd_gossip_slots_enum_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
14739 0 : int err;
14740 0 : switch (discriminant) {
14741 0 : case 0: {
14742 0 : err = fd_gossip_flate2_slots_encode( &self->flate2, ctx );
14743 0 : if( FD_UNLIKELY( err ) ) return err;
14744 0 : break;
14745 0 : }
14746 0 : case 1: {
14747 0 : err = fd_gossip_slots_encode( &self->uncompressed, ctx );
14748 0 : if( FD_UNLIKELY( err ) ) return err;
14749 0 : break;
14750 0 : }
14751 0 : }
14752 0 : return FD_BINCODE_SUCCESS;
14753 0 : }
14754 0 : int fd_gossip_slots_enum_encode( fd_gossip_slots_enum_t const * self, fd_bincode_encode_ctx_t * ctx ) {
14755 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
14756 0 : if( FD_UNLIKELY( err ) ) return err;
14757 0 : return fd_gossip_slots_enum_inner_encode( &self->inner, self->discriminant, ctx );
14758 0 : }
14759 :
14760 0 : int fd_gossip_epoch_slots_encode( fd_gossip_epoch_slots_t const * self, fd_bincode_encode_ctx_t * ctx ) {
14761 0 : int err;
14762 0 : err = fd_bincode_uint8_encode( (uchar)(self->u8), ctx );
14763 0 : if( FD_UNLIKELY( err ) ) return err;
14764 0 : err = fd_pubkey_encode( &self->from, ctx );
14765 0 : if( FD_UNLIKELY( err ) ) return err;
14766 0 : err = fd_bincode_uint64_encode( self->slots_len, ctx );
14767 0 : if( FD_UNLIKELY(err) ) return err;
14768 0 : if( self->slots_len ) {
14769 0 : for( ulong i=0; i < self->slots_len; i++ ) {
14770 0 : err = fd_gossip_slots_enum_encode( self->slots + i, ctx );
14771 0 : if( FD_UNLIKELY( err ) ) return err;
14772 0 : }
14773 0 : }
14774 0 : err = fd_bincode_uint64_encode( self->wallclock, ctx );
14775 0 : if( FD_UNLIKELY( err ) ) return err;
14776 0 : return FD_BINCODE_SUCCESS;
14777 0 : }
14778 0 : static int fd_gossip_epoch_slots_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
14779 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
14780 0 : int err = 0;
14781 0 : err = fd_bincode_uint8_decode_footprint( ctx );
14782 0 : if( FD_UNLIKELY( err ) ) return err;
14783 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
14784 0 : if( FD_UNLIKELY( err ) ) return err;
14785 0 : ulong slots_len;
14786 0 : err = fd_bincode_uint64_decode( &slots_len, ctx );
14787 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14788 0 : if( slots_len ) {
14789 0 : *total_sz += FD_GOSSIP_SLOTS_ENUM_ALIGN + sizeof(fd_gossip_slots_enum_t)*slots_len;
14790 0 : for( ulong i=0; i < slots_len; i++ ) {
14791 0 : err = fd_gossip_slots_enum_decode_footprint_inner( ctx, total_sz );
14792 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14793 0 : }
14794 0 : }
14795 0 : err = fd_bincode_uint64_decode_footprint( ctx );
14796 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14797 0 : return 0;
14798 0 : }
14799 0 : int fd_gossip_epoch_slots_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
14800 0 : *total_sz += sizeof(fd_gossip_epoch_slots_t);
14801 0 : void const * start_data = ctx->data;
14802 0 : int err = fd_gossip_epoch_slots_decode_footprint_inner( ctx, total_sz );
14803 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
14804 0 : ctx->data = start_data;
14805 0 : return err;
14806 0 : }
14807 0 : static void fd_gossip_epoch_slots_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
14808 0 : fd_gossip_epoch_slots_t * self = (fd_gossip_epoch_slots_t *)struct_mem;
14809 0 : fd_bincode_uint8_decode_unsafe( &self->u8, ctx );
14810 0 : fd_pubkey_decode_inner( &self->from, alloc_mem, ctx );
14811 0 : fd_bincode_uint64_decode_unsafe( &self->slots_len, ctx );
14812 0 : if( self->slots_len ) {
14813 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_GOSSIP_SLOTS_ENUM_ALIGN );
14814 0 : self->slots = *alloc_mem;
14815 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_gossip_slots_enum_t)*self->slots_len;
14816 0 : for( ulong i=0; i < self->slots_len; i++ ) {
14817 0 : fd_gossip_slots_enum_new( self->slots + i );
14818 0 : fd_gossip_slots_enum_decode_inner( self->slots + i, alloc_mem, ctx );
14819 0 : }
14820 0 : } else
14821 0 : self->slots = NULL;
14822 0 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
14823 0 : }
14824 0 : void * fd_gossip_epoch_slots_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
14825 0 : fd_gossip_epoch_slots_t * self = (fd_gossip_epoch_slots_t *)mem;
14826 0 : fd_gossip_epoch_slots_new( self );
14827 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_epoch_slots_t);
14828 0 : void * * alloc_mem = &alloc_region;
14829 0 : fd_gossip_epoch_slots_decode_inner( mem, alloc_mem, ctx );
14830 0 : return self;
14831 0 : }
14832 0 : void fd_gossip_epoch_slots_new(fd_gossip_epoch_slots_t * self) {
14833 0 : fd_memset( self, 0, sizeof(fd_gossip_epoch_slots_t) );
14834 0 : fd_pubkey_new( &self->from );
14835 0 : }
14836 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, uint varint ) {
14837 0 : (void) varint;
14838 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_epoch_slots", level++, 0 );
14839 0 : fun( w, &self->u8, "u8", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
14840 0 : fd_pubkey_walk( w, &self->from, fun, "from", level, 0 );
14841 0 : if( self->slots_len ) {
14842 0 : fun( w, NULL, "slots", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
14843 0 : for( ulong i=0; i < self->slots_len; i++ )
14844 0 : fd_gossip_slots_enum_walk(w, self->slots + i, fun, "gossip_slots_enum", level, 0 );
14845 0 : fun( w, NULL, "slots", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
14846 0 : }
14847 0 : fun( w, &self->wallclock, "wallclock", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
14848 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_epoch_slots", level--, 0 );
14849 0 : }
14850 0 : ulong fd_gossip_epoch_slots_size( fd_gossip_epoch_slots_t const * self ) {
14851 0 : ulong size = 0;
14852 0 : size += sizeof(char);
14853 0 : size += fd_pubkey_size( &self->from );
14854 0 : do {
14855 0 : size += sizeof(ulong);
14856 0 : for( ulong i=0; i < self->slots_len; i++ )
14857 0 : size += fd_gossip_slots_enum_size( self->slots + i );
14858 0 : } while(0);
14859 0 : size += sizeof(ulong);
14860 0 : return size;
14861 0 : }
14862 :
14863 0 : int fd_gossip_version_v1_encode( fd_gossip_version_v1_t const * self, fd_bincode_encode_ctx_t * ctx ) {
14864 0 : int err;
14865 0 : err = fd_pubkey_encode( &self->from, ctx );
14866 0 : if( FD_UNLIKELY( err ) ) return err;
14867 0 : err = fd_bincode_uint64_encode( self->wallclock, ctx );
14868 0 : if( FD_UNLIKELY( err ) ) return err;
14869 0 : err = fd_bincode_uint16_encode( self->major, ctx );
14870 0 : if( FD_UNLIKELY( err ) ) return err;
14871 0 : err = fd_bincode_uint16_encode( self->minor, ctx );
14872 0 : if( FD_UNLIKELY( err ) ) return err;
14873 0 : err = fd_bincode_uint16_encode( self->patch, ctx );
14874 0 : if( FD_UNLIKELY( err ) ) return err;
14875 0 : err = fd_bincode_bool_encode( self->has_commit, ctx );
14876 0 : if( FD_UNLIKELY( err ) ) return err;
14877 0 : if( self->has_commit ) {
14878 0 : err = fd_bincode_uint32_encode( self->commit, ctx );
14879 0 : if( FD_UNLIKELY( err ) ) return err;
14880 0 : }
14881 0 : return FD_BINCODE_SUCCESS;
14882 0 : }
14883 0 : static int fd_gossip_version_v1_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
14884 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
14885 0 : int err = 0;
14886 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
14887 0 : if( FD_UNLIKELY( err ) ) return err;
14888 0 : err = fd_bincode_uint64_decode_footprint( ctx );
14889 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14890 0 : err = fd_bincode_uint16_decode_footprint( ctx );
14891 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14892 0 : err = fd_bincode_uint16_decode_footprint( ctx );
14893 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14894 0 : err = fd_bincode_uint16_decode_footprint( ctx );
14895 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14896 0 : {
14897 0 : uchar o;
14898 0 : err = fd_bincode_bool_decode( &o, ctx );
14899 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14900 0 : if( o ) {
14901 0 : err = fd_bincode_uint32_decode_footprint( ctx );
14902 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14903 0 : }
14904 0 : }
14905 0 : return 0;
14906 0 : }
14907 0 : int fd_gossip_version_v1_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
14908 0 : *total_sz += sizeof(fd_gossip_version_v1_t);
14909 0 : void const * start_data = ctx->data;
14910 0 : int err = fd_gossip_version_v1_decode_footprint_inner( ctx, total_sz );
14911 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
14912 0 : ctx->data = start_data;
14913 0 : return err;
14914 0 : }
14915 0 : static void fd_gossip_version_v1_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
14916 0 : fd_gossip_version_v1_t * self = (fd_gossip_version_v1_t *)struct_mem;
14917 0 : fd_pubkey_decode_inner( &self->from, alloc_mem, ctx );
14918 0 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
14919 0 : fd_bincode_uint16_decode_unsafe( &self->major, ctx );
14920 0 : fd_bincode_uint16_decode_unsafe( &self->minor, ctx );
14921 0 : fd_bincode_uint16_decode_unsafe( &self->patch, ctx );
14922 0 : {
14923 0 : uchar o;
14924 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
14925 0 : self->has_commit = !!o;
14926 0 : if( o ) {
14927 0 : fd_bincode_uint32_decode_unsafe( &self->commit, ctx );
14928 0 : }
14929 0 : }
14930 0 : }
14931 0 : void * fd_gossip_version_v1_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
14932 0 : fd_gossip_version_v1_t * self = (fd_gossip_version_v1_t *)mem;
14933 0 : fd_gossip_version_v1_new( self );
14934 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_version_v1_t);
14935 0 : void * * alloc_mem = &alloc_region;
14936 0 : fd_gossip_version_v1_decode_inner( mem, alloc_mem, ctx );
14937 0 : return self;
14938 0 : }
14939 0 : void fd_gossip_version_v1_new(fd_gossip_version_v1_t * self) {
14940 0 : fd_memset( self, 0, sizeof(fd_gossip_version_v1_t) );
14941 0 : fd_pubkey_new( &self->from );
14942 0 : }
14943 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, uint varint ) {
14944 0 : (void) varint;
14945 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_version_v1", level++, 0 );
14946 0 : fd_pubkey_walk( w, &self->from, fun, "from", level, 0 );
14947 0 : fun( w, &self->wallclock, "wallclock", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
14948 0 : fun( w, &self->major, "major", FD_FLAMENCO_TYPE_USHORT, "ushort", level, 0 );
14949 0 : fun( w, &self->minor, "minor", FD_FLAMENCO_TYPE_USHORT, "ushort", level, 0 );
14950 0 : fun( w, &self->patch, "patch", FD_FLAMENCO_TYPE_USHORT, "ushort", level, 0 );
14951 0 : if( !self->has_commit ) {
14952 0 : fun( w, NULL, "commit", FD_FLAMENCO_TYPE_NULL, "uint", level, 0 );
14953 0 : } else {
14954 0 : fun( w, &self->commit, "commit", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
14955 0 : }
14956 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_version_v1", level--, 0 );
14957 0 : }
14958 0 : ulong fd_gossip_version_v1_size( fd_gossip_version_v1_t const * self ) {
14959 0 : ulong size = 0;
14960 0 : size += fd_pubkey_size( &self->from );
14961 0 : size += sizeof(ulong);
14962 0 : size += sizeof(ushort);
14963 0 : size += sizeof(ushort);
14964 0 : size += sizeof(ushort);
14965 0 : size += sizeof(char);
14966 0 : if( self->has_commit ) {
14967 0 : size += sizeof(uint);
14968 0 : }
14969 0 : return size;
14970 0 : }
14971 :
14972 0 : int fd_gossip_version_v2_encode( fd_gossip_version_v2_t const * self, fd_bincode_encode_ctx_t * ctx ) {
14973 0 : int err;
14974 0 : err = fd_pubkey_encode( &self->from, ctx );
14975 0 : if( FD_UNLIKELY( err ) ) return err;
14976 0 : err = fd_bincode_uint64_encode( self->wallclock, ctx );
14977 0 : if( FD_UNLIKELY( err ) ) return err;
14978 0 : err = fd_bincode_uint16_encode( self->major, ctx );
14979 0 : if( FD_UNLIKELY( err ) ) return err;
14980 0 : err = fd_bincode_uint16_encode( self->minor, ctx );
14981 0 : if( FD_UNLIKELY( err ) ) return err;
14982 0 : err = fd_bincode_uint16_encode( self->patch, ctx );
14983 0 : if( FD_UNLIKELY( err ) ) return err;
14984 0 : err = fd_bincode_bool_encode( self->has_commit, ctx );
14985 0 : if( FD_UNLIKELY( err ) ) return err;
14986 0 : if( self->has_commit ) {
14987 0 : err = fd_bincode_uint32_encode( self->commit, ctx );
14988 0 : if( FD_UNLIKELY( err ) ) return err;
14989 0 : }
14990 0 : err = fd_bincode_uint32_encode( self->feature_set, ctx );
14991 0 : if( FD_UNLIKELY( err ) ) return err;
14992 0 : return FD_BINCODE_SUCCESS;
14993 0 : }
14994 3 : static int fd_gossip_version_v2_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
14995 3 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
14996 3 : int err = 0;
14997 3 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
14998 3 : if( FD_UNLIKELY( err ) ) return err;
14999 3 : err = fd_bincode_uint64_decode_footprint( ctx );
15000 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15001 3 : err = fd_bincode_uint16_decode_footprint( ctx );
15002 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15003 3 : err = fd_bincode_uint16_decode_footprint( ctx );
15004 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15005 3 : err = fd_bincode_uint16_decode_footprint( ctx );
15006 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15007 3 : {
15008 3 : uchar o;
15009 3 : err = fd_bincode_bool_decode( &o, ctx );
15010 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15011 3 : if( o ) {
15012 0 : err = fd_bincode_uint32_decode_footprint( ctx );
15013 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15014 0 : }
15015 3 : }
15016 3 : err = fd_bincode_uint32_decode_footprint( ctx );
15017 3 : if( FD_UNLIKELY( err ) ) return err;
15018 3 : return 0;
15019 3 : }
15020 0 : int fd_gossip_version_v2_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
15021 0 : *total_sz += sizeof(fd_gossip_version_v2_t);
15022 0 : void const * start_data = ctx->data;
15023 0 : int err = fd_gossip_version_v2_decode_footprint_inner( ctx, total_sz );
15024 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
15025 0 : ctx->data = start_data;
15026 0 : return err;
15027 0 : }
15028 3 : static void fd_gossip_version_v2_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
15029 3 : fd_gossip_version_v2_t * self = (fd_gossip_version_v2_t *)struct_mem;
15030 3 : fd_pubkey_decode_inner( &self->from, alloc_mem, ctx );
15031 3 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
15032 3 : fd_bincode_uint16_decode_unsafe( &self->major, ctx );
15033 3 : fd_bincode_uint16_decode_unsafe( &self->minor, ctx );
15034 3 : fd_bincode_uint16_decode_unsafe( &self->patch, ctx );
15035 3 : {
15036 3 : uchar o;
15037 3 : fd_bincode_bool_decode_unsafe( &o, ctx );
15038 3 : self->has_commit = !!o;
15039 3 : if( o ) {
15040 0 : fd_bincode_uint32_decode_unsafe( &self->commit, ctx );
15041 0 : }
15042 3 : }
15043 3 : fd_bincode_uint32_decode_unsafe( &self->feature_set, ctx );
15044 3 : }
15045 0 : void * fd_gossip_version_v2_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
15046 0 : fd_gossip_version_v2_t * self = (fd_gossip_version_v2_t *)mem;
15047 0 : fd_gossip_version_v2_new( self );
15048 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_version_v2_t);
15049 0 : void * * alloc_mem = &alloc_region;
15050 0 : fd_gossip_version_v2_decode_inner( mem, alloc_mem, ctx );
15051 0 : return self;
15052 0 : }
15053 0 : void fd_gossip_version_v2_new(fd_gossip_version_v2_t * self) {
15054 0 : fd_memset( self, 0, sizeof(fd_gossip_version_v2_t) );
15055 0 : fd_pubkey_new( &self->from );
15056 0 : }
15057 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, uint varint ) {
15058 3 : (void) varint;
15059 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_version_v2", level++, 0 );
15060 3 : fd_pubkey_walk( w, &self->from, fun, "from", level, 0 );
15061 3 : fun( w, &self->wallclock, "wallclock", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
15062 3 : fun( w, &self->major, "major", FD_FLAMENCO_TYPE_USHORT, "ushort", level, 0 );
15063 3 : fun( w, &self->minor, "minor", FD_FLAMENCO_TYPE_USHORT, "ushort", level, 0 );
15064 3 : fun( w, &self->patch, "patch", FD_FLAMENCO_TYPE_USHORT, "ushort", level, 0 );
15065 3 : if( !self->has_commit ) {
15066 3 : fun( w, NULL, "commit", FD_FLAMENCO_TYPE_NULL, "uint", level, 0 );
15067 3 : } else {
15068 0 : fun( w, &self->commit, "commit", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
15069 0 : }
15070 3 : fun( w, &self->feature_set, "feature_set", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
15071 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_version_v2", level--, 0 );
15072 3 : }
15073 0 : ulong fd_gossip_version_v2_size( fd_gossip_version_v2_t const * self ) {
15074 0 : ulong size = 0;
15075 0 : size += fd_pubkey_size( &self->from );
15076 0 : size += sizeof(ulong);
15077 0 : size += sizeof(ushort);
15078 0 : size += sizeof(ushort);
15079 0 : size += sizeof(ushort);
15080 0 : size += sizeof(char);
15081 0 : if( self->has_commit ) {
15082 0 : size += sizeof(uint);
15083 0 : }
15084 0 : size += sizeof(uint);
15085 0 : return size;
15086 0 : }
15087 :
15088 0 : int fd_gossip_version_v3_encode( fd_gossip_version_v3_t const * self, fd_bincode_encode_ctx_t * ctx ) {
15089 0 : int err;
15090 0 : err = fd_bincode_compact_u16_encode( &self->major, ctx );
15091 0 : if( FD_UNLIKELY( err ) ) return err;
15092 0 : err = fd_bincode_compact_u16_encode( &self->minor, ctx );
15093 0 : if( FD_UNLIKELY( err ) ) return err;
15094 0 : err = fd_bincode_compact_u16_encode( &self->patch, ctx );
15095 0 : if( FD_UNLIKELY( err ) ) return err;
15096 0 : err = fd_bincode_uint32_encode( self->commit, ctx );
15097 0 : if( FD_UNLIKELY( err ) ) return err;
15098 0 : err = fd_bincode_uint32_encode( self->feature_set, ctx );
15099 0 : if( FD_UNLIKELY( err ) ) return err;
15100 0 : err = fd_bincode_compact_u16_encode( &self->client, ctx );
15101 0 : if( FD_UNLIKELY( err ) ) return err;
15102 0 : return FD_BINCODE_SUCCESS;
15103 0 : }
15104 3 : static int fd_gossip_version_v3_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
15105 3 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
15106 3 : int err = 0;
15107 3 : do { ushort _tmp; err = fd_bincode_compact_u16_decode( &_tmp, ctx ); } while(0);
15108 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15109 3 : do { ushort _tmp; err = fd_bincode_compact_u16_decode( &_tmp, ctx ); } while(0);
15110 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15111 3 : do { ushort _tmp; err = fd_bincode_compact_u16_decode( &_tmp, ctx ); } while(0);
15112 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15113 3 : err = fd_bincode_uint32_decode_footprint( ctx );
15114 3 : if( FD_UNLIKELY( err ) ) return err;
15115 3 : err = fd_bincode_uint32_decode_footprint( ctx );
15116 3 : if( FD_UNLIKELY( err ) ) return err;
15117 3 : do { ushort _tmp; err = fd_bincode_compact_u16_decode( &_tmp, ctx ); } while(0);
15118 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15119 3 : return 0;
15120 3 : }
15121 0 : int fd_gossip_version_v3_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
15122 0 : *total_sz += sizeof(fd_gossip_version_v3_t);
15123 0 : void const * start_data = ctx->data;
15124 0 : int err = fd_gossip_version_v3_decode_footprint_inner( ctx, total_sz );
15125 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
15126 0 : ctx->data = start_data;
15127 0 : return err;
15128 0 : }
15129 3 : static void fd_gossip_version_v3_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
15130 3 : fd_gossip_version_v3_t * self = (fd_gossip_version_v3_t *)struct_mem;
15131 3 : fd_bincode_compact_u16_decode_unsafe( &self->major, ctx );
15132 3 : fd_bincode_compact_u16_decode_unsafe( &self->minor, ctx );
15133 3 : fd_bincode_compact_u16_decode_unsafe( &self->patch, ctx );
15134 3 : fd_bincode_uint32_decode_unsafe( &self->commit, ctx );
15135 3 : fd_bincode_uint32_decode_unsafe( &self->feature_set, ctx );
15136 3 : fd_bincode_compact_u16_decode_unsafe( &self->client, ctx );
15137 3 : }
15138 0 : void * fd_gossip_version_v3_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
15139 0 : fd_gossip_version_v3_t * self = (fd_gossip_version_v3_t *)mem;
15140 0 : fd_gossip_version_v3_new( self );
15141 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_version_v3_t);
15142 0 : void * * alloc_mem = &alloc_region;
15143 0 : fd_gossip_version_v3_decode_inner( mem, alloc_mem, ctx );
15144 0 : return self;
15145 0 : }
15146 0 : void fd_gossip_version_v3_new(fd_gossip_version_v3_t * self) {
15147 0 : fd_memset( self, 0, sizeof(fd_gossip_version_v3_t) );
15148 0 : }
15149 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, uint varint ) {
15150 3 : (void) varint;
15151 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_version_v3", level++, 0 );
15152 3 : fun( w, &self->major, "major", FD_FLAMENCO_TYPE_USHORT, "ushort", level, 1 );
15153 3 : fun( w, &self->minor, "minor", FD_FLAMENCO_TYPE_USHORT, "ushort", level, 1 );
15154 3 : fun( w, &self->patch, "patch", FD_FLAMENCO_TYPE_USHORT, "ushort", level, 1 );
15155 3 : fun( w, &self->commit, "commit", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
15156 3 : fun( w, &self->feature_set, "feature_set", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
15157 3 : fun( w, &self->client, "client", FD_FLAMENCO_TYPE_USHORT, "ushort", level, 1 );
15158 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_version_v3", level--, 0 );
15159 3 : }
15160 0 : ulong fd_gossip_version_v3_size( fd_gossip_version_v3_t const * self ) {
15161 0 : ulong size = 0;
15162 0 : size += fd_bincode_compact_u16_size( &self->major );
15163 0 : size += fd_bincode_compact_u16_size( &self->minor );
15164 0 : size += fd_bincode_compact_u16_size( &self->patch );
15165 0 : size += sizeof(uint);
15166 0 : size += sizeof(uint);
15167 0 : size += fd_bincode_compact_u16_size( &self->client );
15168 0 : return size;
15169 0 : }
15170 :
15171 0 : int fd_gossip_node_instance_encode( fd_gossip_node_instance_t const * self, fd_bincode_encode_ctx_t * ctx ) {
15172 0 : int err;
15173 0 : err = fd_pubkey_encode( &self->from, ctx );
15174 0 : if( FD_UNLIKELY( err ) ) return err;
15175 0 : err = fd_bincode_uint64_encode( self->wallclock, ctx );
15176 0 : if( FD_UNLIKELY( err ) ) return err;
15177 0 : err = fd_bincode_uint64_encode( self->timestamp, ctx );
15178 0 : if( FD_UNLIKELY( err ) ) return err;
15179 0 : err = fd_bincode_uint64_encode( self->token, ctx );
15180 0 : if( FD_UNLIKELY( err ) ) return err;
15181 0 : return FD_BINCODE_SUCCESS;
15182 0 : }
15183 6 : static inline int fd_gossip_node_instance_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
15184 6 : if( (ulong)ctx->data + 56UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
15185 6 : ctx->data = (void *)( (ulong)ctx->data + 56UL );
15186 6 : return 0;
15187 6 : }
15188 6 : static void fd_gossip_node_instance_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
15189 6 : fd_gossip_node_instance_t * self = (fd_gossip_node_instance_t *)struct_mem;
15190 6 : fd_pubkey_decode_inner( &self->from, alloc_mem, ctx );
15191 6 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
15192 6 : fd_bincode_uint64_decode_unsafe( &self->timestamp, ctx );
15193 6 : fd_bincode_uint64_decode_unsafe( &self->token, ctx );
15194 6 : }
15195 0 : void * fd_gossip_node_instance_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
15196 0 : fd_gossip_node_instance_t * self = (fd_gossip_node_instance_t *)mem;
15197 0 : fd_gossip_node_instance_new( self );
15198 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_node_instance_t);
15199 0 : void * * alloc_mem = &alloc_region;
15200 0 : fd_gossip_node_instance_decode_inner( mem, alloc_mem, ctx );
15201 0 : return self;
15202 0 : }
15203 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, uint varint ) {
15204 6 : (void) varint;
15205 6 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_node_instance", level++, 0 );
15206 6 : fd_pubkey_walk( w, &self->from, fun, "from", level, 0 );
15207 6 : fun( w, &self->wallclock, "wallclock", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
15208 6 : fun( w, &self->timestamp, "timestamp", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
15209 6 : fun( w, &self->token, "token", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
15210 6 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_node_instance", level--, 0 );
15211 6 : }
15212 0 : int fd_gossip_duplicate_shred_old_encode( fd_gossip_duplicate_shred_old_t const * self, fd_bincode_encode_ctx_t * ctx ) {
15213 0 : int err;
15214 0 : err = fd_bincode_uint16_encode( self->duplicate_shred_index, ctx );
15215 0 : if( FD_UNLIKELY( err ) ) return err;
15216 0 : err = fd_pubkey_encode( &self->from, ctx );
15217 0 : if( FD_UNLIKELY( err ) ) return err;
15218 0 : err = fd_bincode_uint64_encode( self->wallclock, ctx );
15219 0 : if( FD_UNLIKELY( err ) ) return err;
15220 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
15221 0 : if( FD_UNLIKELY( err ) ) return err;
15222 0 : err = fd_bincode_uint32_encode( self->_unused, ctx );
15223 0 : if( FD_UNLIKELY( err ) ) return err;
15224 0 : err = fd_bincode_uint8_encode( (uchar)(self->_unused_shred_type), ctx );
15225 0 : if( FD_UNLIKELY( err ) ) return err;
15226 0 : err = fd_bincode_uint8_encode( (uchar)(self->num_chunks), ctx );
15227 0 : if( FD_UNLIKELY( err ) ) return err;
15228 0 : err = fd_bincode_uint8_encode( (uchar)(self->chunk_index), ctx );
15229 0 : if( FD_UNLIKELY( err ) ) return err;
15230 0 : err = fd_bincode_uint64_encode( self->chunk_len, ctx );
15231 0 : if( FD_UNLIKELY(err) ) return err;
15232 0 : if( self->chunk_len ) {
15233 0 : err = fd_bincode_bytes_encode( self->chunk, self->chunk_len, ctx );
15234 0 : if( FD_UNLIKELY( err ) ) return err;
15235 0 : }
15236 0 : return FD_BINCODE_SUCCESS;
15237 0 : }
15238 0 : static int fd_gossip_duplicate_shred_old_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
15239 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
15240 0 : int err = 0;
15241 0 : err = fd_bincode_uint16_decode_footprint( ctx );
15242 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15243 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
15244 0 : if( FD_UNLIKELY( err ) ) return err;
15245 0 : err = fd_bincode_uint64_decode_footprint( ctx );
15246 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15247 0 : err = fd_bincode_uint64_decode_footprint( ctx );
15248 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15249 0 : err = fd_bincode_uint32_decode_footprint( ctx );
15250 0 : if( FD_UNLIKELY( err ) ) return err;
15251 0 : err = fd_bincode_uint8_decode_footprint( ctx );
15252 0 : if( FD_UNLIKELY( err ) ) return err;
15253 0 : err = fd_bincode_uint8_decode_footprint( ctx );
15254 0 : if( FD_UNLIKELY( err ) ) return err;
15255 0 : err = fd_bincode_uint8_decode_footprint( ctx );
15256 0 : if( FD_UNLIKELY( err ) ) return err;
15257 0 : ulong chunk_len;
15258 0 : err = fd_bincode_uint64_decode( &chunk_len, ctx );
15259 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15260 0 : if( chunk_len ) {
15261 0 : *total_sz += 8UL + chunk_len;
15262 0 : err = fd_bincode_bytes_decode_footprint( chunk_len, ctx );
15263 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15264 0 : }
15265 0 : return 0;
15266 0 : }
15267 0 : int fd_gossip_duplicate_shred_old_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
15268 0 : *total_sz += sizeof(fd_gossip_duplicate_shred_old_t);
15269 0 : void const * start_data = ctx->data;
15270 0 : int err = fd_gossip_duplicate_shred_old_decode_footprint_inner( ctx, total_sz );
15271 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
15272 0 : ctx->data = start_data;
15273 0 : return err;
15274 0 : }
15275 0 : static void fd_gossip_duplicate_shred_old_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
15276 0 : fd_gossip_duplicate_shred_old_t * self = (fd_gossip_duplicate_shred_old_t *)struct_mem;
15277 0 : fd_bincode_uint16_decode_unsafe( &self->duplicate_shred_index, ctx );
15278 0 : fd_pubkey_decode_inner( &self->from, alloc_mem, ctx );
15279 0 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
15280 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
15281 0 : fd_bincode_uint32_decode_unsafe( &self->_unused, ctx );
15282 0 : fd_bincode_uint8_decode_unsafe( &self->_unused_shred_type, ctx );
15283 0 : fd_bincode_uint8_decode_unsafe( &self->num_chunks, ctx );
15284 0 : fd_bincode_uint8_decode_unsafe( &self->chunk_index, ctx );
15285 0 : fd_bincode_uint64_decode_unsafe( &self->chunk_len, ctx );
15286 0 : if( self->chunk_len ) {
15287 0 : self->chunk = *alloc_mem;
15288 0 : fd_bincode_bytes_decode_unsafe( self->chunk, self->chunk_len, ctx );
15289 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->chunk_len;
15290 0 : } else
15291 0 : self->chunk = NULL;
15292 0 : }
15293 0 : void * fd_gossip_duplicate_shred_old_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
15294 0 : fd_gossip_duplicate_shred_old_t * self = (fd_gossip_duplicate_shred_old_t *)mem;
15295 0 : fd_gossip_duplicate_shred_old_new( self );
15296 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_duplicate_shred_old_t);
15297 0 : void * * alloc_mem = &alloc_region;
15298 0 : fd_gossip_duplicate_shred_old_decode_inner( mem, alloc_mem, ctx );
15299 0 : return self;
15300 0 : }
15301 0 : void fd_gossip_duplicate_shred_old_new(fd_gossip_duplicate_shred_old_t * self) {
15302 0 : fd_memset( self, 0, sizeof(fd_gossip_duplicate_shred_old_t) );
15303 0 : fd_pubkey_new( &self->from );
15304 0 : }
15305 0 : void fd_gossip_duplicate_shred_old_walk( void * w, fd_gossip_duplicate_shred_old_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
15306 0 : (void) varint;
15307 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_duplicate_shred_old", level++, 0 );
15308 0 : fun( w, &self->duplicate_shred_index, "duplicate_shred_index", FD_FLAMENCO_TYPE_USHORT, "ushort", level, 0 );
15309 0 : fd_pubkey_walk( w, &self->from, fun, "from", level, 0 );
15310 0 : fun( w, &self->wallclock, "wallclock", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
15311 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
15312 0 : fun( w, &self->_unused, "_unused", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
15313 0 : fun( w, &self->_unused_shred_type, "_unused_shred_type", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
15314 0 : fun( w, &self->num_chunks, "num_chunks", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
15315 0 : fun( w, &self->chunk_index, "chunk_index", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
15316 0 : if( self->chunk_len ) {
15317 0 : fun( w, NULL, "chunk", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
15318 0 : for( ulong i=0; i < self->chunk_len; i++ )
15319 0 : fun( w, self->chunk + i, "chunk", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
15320 0 : fun( w, NULL, "chunk", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
15321 0 : }
15322 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_duplicate_shred_old", level--, 0 );
15323 0 : }
15324 0 : ulong fd_gossip_duplicate_shred_old_size( fd_gossip_duplicate_shred_old_t const * self ) {
15325 0 : ulong size = 0;
15326 0 : size += sizeof(ushort);
15327 0 : size += fd_pubkey_size( &self->from );
15328 0 : size += sizeof(ulong);
15329 0 : size += sizeof(ulong);
15330 0 : size += sizeof(uint);
15331 0 : size += sizeof(char);
15332 0 : size += sizeof(char);
15333 0 : size += sizeof(char);
15334 0 : do {
15335 0 : size += sizeof(ulong);
15336 0 : size += self->chunk_len;
15337 0 : } while(0);
15338 0 : return size;
15339 0 : }
15340 :
15341 0 : int fd_gossip_incremental_snapshot_hashes_encode( fd_gossip_incremental_snapshot_hashes_t const * self, fd_bincode_encode_ctx_t * ctx ) {
15342 0 : int err;
15343 0 : err = fd_pubkey_encode( &self->from, ctx );
15344 0 : if( FD_UNLIKELY( err ) ) return err;
15345 0 : err = fd_slot_hash_encode( &self->base_hash, ctx );
15346 0 : if( FD_UNLIKELY( err ) ) return err;
15347 0 : err = fd_bincode_uint64_encode( self->hashes_len, ctx );
15348 0 : if( FD_UNLIKELY(err) ) return err;
15349 0 : if( self->hashes_len ) {
15350 0 : for( ulong i=0; i < self->hashes_len; i++ ) {
15351 0 : err = fd_slot_hash_encode( self->hashes + i, ctx );
15352 0 : if( FD_UNLIKELY( err ) ) return err;
15353 0 : }
15354 0 : }
15355 0 : err = fd_bincode_uint64_encode( self->wallclock, ctx );
15356 0 : if( FD_UNLIKELY( err ) ) return err;
15357 0 : return FD_BINCODE_SUCCESS;
15358 0 : }
15359 0 : static int fd_gossip_incremental_snapshot_hashes_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
15360 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
15361 0 : int err = 0;
15362 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
15363 0 : if( FD_UNLIKELY( err ) ) return err;
15364 0 : err = fd_slot_hash_decode_footprint_inner( ctx, total_sz );
15365 0 : if( FD_UNLIKELY( err ) ) return err;
15366 0 : ulong hashes_len;
15367 0 : err = fd_bincode_uint64_decode( &hashes_len, ctx );
15368 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15369 0 : if( hashes_len ) {
15370 0 : *total_sz += FD_SLOT_HASH_ALIGN + sizeof(fd_slot_hash_t)*hashes_len;
15371 0 : for( ulong i=0; i < hashes_len; i++ ) {
15372 0 : err = fd_slot_hash_decode_footprint_inner( ctx, total_sz );
15373 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15374 0 : }
15375 0 : }
15376 0 : err = fd_bincode_uint64_decode_footprint( ctx );
15377 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15378 0 : return 0;
15379 0 : }
15380 0 : int fd_gossip_incremental_snapshot_hashes_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
15381 0 : *total_sz += sizeof(fd_gossip_incremental_snapshot_hashes_t);
15382 0 : void const * start_data = ctx->data;
15383 0 : int err = fd_gossip_incremental_snapshot_hashes_decode_footprint_inner( ctx, total_sz );
15384 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
15385 0 : ctx->data = start_data;
15386 0 : return err;
15387 0 : }
15388 0 : static void fd_gossip_incremental_snapshot_hashes_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
15389 0 : fd_gossip_incremental_snapshot_hashes_t * self = (fd_gossip_incremental_snapshot_hashes_t *)struct_mem;
15390 0 : fd_pubkey_decode_inner( &self->from, alloc_mem, ctx );
15391 0 : fd_slot_hash_decode_inner( &self->base_hash, alloc_mem, ctx );
15392 0 : fd_bincode_uint64_decode_unsafe( &self->hashes_len, ctx );
15393 0 : if( self->hashes_len ) {
15394 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_SLOT_HASH_ALIGN );
15395 0 : self->hashes = *alloc_mem;
15396 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_slot_hash_t)*self->hashes_len;
15397 0 : for( ulong i=0; i < self->hashes_len; i++ ) {
15398 0 : fd_slot_hash_new( self->hashes + i );
15399 0 : fd_slot_hash_decode_inner( self->hashes + i, alloc_mem, ctx );
15400 0 : }
15401 0 : } else
15402 0 : self->hashes = NULL;
15403 0 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
15404 0 : }
15405 0 : void * fd_gossip_incremental_snapshot_hashes_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
15406 0 : fd_gossip_incremental_snapshot_hashes_t * self = (fd_gossip_incremental_snapshot_hashes_t *)mem;
15407 0 : fd_gossip_incremental_snapshot_hashes_new( self );
15408 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_incremental_snapshot_hashes_t);
15409 0 : void * * alloc_mem = &alloc_region;
15410 0 : fd_gossip_incremental_snapshot_hashes_decode_inner( mem, alloc_mem, ctx );
15411 0 : return self;
15412 0 : }
15413 0 : void fd_gossip_incremental_snapshot_hashes_new(fd_gossip_incremental_snapshot_hashes_t * self) {
15414 0 : fd_memset( self, 0, sizeof(fd_gossip_incremental_snapshot_hashes_t) );
15415 0 : fd_pubkey_new( &self->from );
15416 0 : fd_slot_hash_new( &self->base_hash );
15417 0 : }
15418 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, uint varint ) {
15419 0 : (void) varint;
15420 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_incremental_snapshot_hashes", level++, 0 );
15421 0 : fd_pubkey_walk( w, &self->from, fun, "from", level, 0 );
15422 0 : fd_slot_hash_walk( w, &self->base_hash, fun, "base_hash", level, 0 );
15423 0 : if( self->hashes_len ) {
15424 0 : fun( w, NULL, "hashes", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
15425 0 : for( ulong i=0; i < self->hashes_len; i++ )
15426 0 : fd_slot_hash_walk(w, self->hashes + i, fun, "slot_hash", level, 0 );
15427 0 : fun( w, NULL, "hashes", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
15428 0 : }
15429 0 : fun( w, &self->wallclock, "wallclock", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
15430 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_incremental_snapshot_hashes", level--, 0 );
15431 0 : }
15432 0 : ulong fd_gossip_incremental_snapshot_hashes_size( fd_gossip_incremental_snapshot_hashes_t const * self ) {
15433 0 : ulong size = 0;
15434 0 : size += fd_pubkey_size( &self->from );
15435 0 : size += fd_slot_hash_size( &self->base_hash );
15436 0 : do {
15437 0 : size += sizeof(ulong);
15438 0 : for( ulong i=0; i < self->hashes_len; i++ )
15439 0 : size += fd_slot_hash_size( self->hashes + i );
15440 0 : } while(0);
15441 0 : size += sizeof(ulong);
15442 0 : return size;
15443 0 : }
15444 :
15445 0 : int fd_gossip_socket_entry_encode( fd_gossip_socket_entry_t const * self, fd_bincode_encode_ctx_t * ctx ) {
15446 0 : int err;
15447 0 : err = fd_bincode_uint8_encode( (uchar)(self->key), ctx );
15448 0 : if( FD_UNLIKELY( err ) ) return err;
15449 0 : err = fd_bincode_uint8_encode( (uchar)(self->index), ctx );
15450 0 : if( FD_UNLIKELY( err ) ) return err;
15451 0 : err = fd_bincode_compact_u16_encode( &self->offset, ctx );
15452 0 : if( FD_UNLIKELY( err ) ) return err;
15453 0 : return FD_BINCODE_SUCCESS;
15454 0 : }
15455 36 : static int fd_gossip_socket_entry_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
15456 36 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
15457 36 : int err = 0;
15458 36 : err = fd_bincode_uint8_decode_footprint( ctx );
15459 36 : if( FD_UNLIKELY( err ) ) return err;
15460 36 : err = fd_bincode_uint8_decode_footprint( ctx );
15461 36 : if( FD_UNLIKELY( err ) ) return err;
15462 36 : do { ushort _tmp; err = fd_bincode_compact_u16_decode( &_tmp, ctx ); } while(0);
15463 36 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15464 36 : return 0;
15465 36 : }
15466 0 : int fd_gossip_socket_entry_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
15467 0 : *total_sz += sizeof(fd_gossip_socket_entry_t);
15468 0 : void const * start_data = ctx->data;
15469 0 : int err = fd_gossip_socket_entry_decode_footprint_inner( ctx, total_sz );
15470 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
15471 0 : ctx->data = start_data;
15472 0 : return err;
15473 0 : }
15474 36 : static void fd_gossip_socket_entry_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
15475 36 : fd_gossip_socket_entry_t * self = (fd_gossip_socket_entry_t *)struct_mem;
15476 36 : fd_bincode_uint8_decode_unsafe( &self->key, ctx );
15477 36 : fd_bincode_uint8_decode_unsafe( &self->index, ctx );
15478 36 : fd_bincode_compact_u16_decode_unsafe( &self->offset, ctx );
15479 36 : }
15480 0 : void * fd_gossip_socket_entry_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
15481 0 : fd_gossip_socket_entry_t * self = (fd_gossip_socket_entry_t *)mem;
15482 0 : fd_gossip_socket_entry_new( self );
15483 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_socket_entry_t);
15484 0 : void * * alloc_mem = &alloc_region;
15485 0 : fd_gossip_socket_entry_decode_inner( mem, alloc_mem, ctx );
15486 0 : return self;
15487 0 : }
15488 36 : void fd_gossip_socket_entry_new(fd_gossip_socket_entry_t * self) {
15489 36 : fd_memset( self, 0, sizeof(fd_gossip_socket_entry_t) );
15490 36 : }
15491 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, uint varint ) {
15492 36 : (void) varint;
15493 36 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_socket_entry", level++, 0 );
15494 36 : fun( w, &self->key, "key", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
15495 36 : fun( w, &self->index, "index", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
15496 36 : fun( w, &self->offset, "offset", FD_FLAMENCO_TYPE_USHORT, "ushort", level, 1 );
15497 36 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_socket_entry", level--, 0 );
15498 36 : }
15499 0 : ulong fd_gossip_socket_entry_size( fd_gossip_socket_entry_t const * self ) {
15500 0 : ulong size = 0;
15501 0 : size += sizeof(char);
15502 0 : size += sizeof(char);
15503 0 : size += fd_bincode_compact_u16_size( &self->offset );
15504 0 : return size;
15505 0 : }
15506 :
15507 0 : int fd_gossip_contact_info_v2_encode( fd_gossip_contact_info_v2_t const * self, fd_bincode_encode_ctx_t * ctx ) {
15508 0 : int err;
15509 0 : err = fd_pubkey_encode( &self->from, ctx );
15510 0 : if( FD_UNLIKELY( err ) ) return err;
15511 0 : err = fd_bincode_varint_encode( self->wallclock, ctx );
15512 0 : if( FD_UNLIKELY( err ) ) return err;
15513 0 : err = fd_bincode_uint64_encode( self->outset, ctx );
15514 0 : if( FD_UNLIKELY( err ) ) return err;
15515 0 : err = fd_bincode_uint16_encode( self->shred_version, ctx );
15516 0 : if( FD_UNLIKELY( err ) ) return err;
15517 0 : err = fd_gossip_version_v3_encode( &self->version, ctx );
15518 0 : if( FD_UNLIKELY( err ) ) return err;
15519 0 : err = fd_bincode_compact_u16_encode( &self->addrs_len, ctx );
15520 0 : if( FD_UNLIKELY(err) ) return err;
15521 0 : if( self->addrs_len ) {
15522 0 : for( ulong i=0; i < self->addrs_len; i++ ) {
15523 0 : err = fd_gossip_ip_addr_encode( self->addrs + i, ctx );
15524 0 : if( FD_UNLIKELY( err ) ) return err;
15525 0 : }
15526 0 : }
15527 0 : err = fd_bincode_compact_u16_encode( &self->sockets_len, ctx );
15528 0 : if( FD_UNLIKELY(err) ) return err;
15529 0 : if( self->sockets_len ) {
15530 0 : for( ulong i=0; i < self->sockets_len; i++ ) {
15531 0 : err = fd_gossip_socket_entry_encode( self->sockets + i, ctx );
15532 0 : if( FD_UNLIKELY( err ) ) return err;
15533 0 : }
15534 0 : }
15535 0 : err = fd_bincode_compact_u16_encode( &self->extensions_len, ctx );
15536 0 : if( FD_UNLIKELY(err) ) return err;
15537 0 : if( self->extensions_len ) {
15538 0 : for( ulong i=0; i < self->extensions_len; i++ ) {
15539 0 : err = fd_bincode_uint32_encode( self->extensions[i], ctx );
15540 0 : }
15541 0 : }
15542 0 : return FD_BINCODE_SUCCESS;
15543 0 : }
15544 3 : static int fd_gossip_contact_info_v2_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
15545 3 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
15546 3 : int err = 0;
15547 3 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
15548 3 : if( FD_UNLIKELY( err ) ) return err;
15549 3 : err = fd_bincode_varint_decode_footprint( ctx );
15550 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15551 3 : err = fd_bincode_uint64_decode_footprint( ctx );
15552 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15553 3 : err = fd_bincode_uint16_decode_footprint( ctx );
15554 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15555 3 : err = fd_gossip_version_v3_decode_footprint_inner( ctx, total_sz );
15556 3 : if( FD_UNLIKELY( err ) ) return err;
15557 3 : ushort addrs_len;
15558 3 : err = fd_bincode_compact_u16_decode( &addrs_len, ctx );
15559 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15560 3 : if( addrs_len ) {
15561 3 : *total_sz += FD_GOSSIP_IP_ADDR_ALIGN + sizeof(fd_gossip_ip_addr_t)*addrs_len;
15562 6 : for( ulong i=0; i < addrs_len; i++ ) {
15563 3 : err = fd_gossip_ip_addr_decode_footprint_inner( ctx, total_sz );
15564 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15565 3 : }
15566 3 : }
15567 3 : ushort sockets_len;
15568 3 : err = fd_bincode_compact_u16_decode( &sockets_len, ctx );
15569 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15570 3 : if( sockets_len ) {
15571 3 : *total_sz += FD_GOSSIP_SOCKET_ENTRY_ALIGN + sizeof(fd_gossip_socket_entry_t)*sockets_len;
15572 39 : for( ulong i=0; i < sockets_len; i++ ) {
15573 36 : err = fd_gossip_socket_entry_decode_footprint_inner( ctx, total_sz );
15574 36 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15575 36 : }
15576 3 : }
15577 3 : ushort extensions_len;
15578 3 : err = fd_bincode_compact_u16_decode( &extensions_len, ctx );
15579 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15580 3 : if( extensions_len ) {
15581 0 : *total_sz += 8UL + sizeof(uint)*extensions_len;
15582 0 : for( ulong i=0; i < extensions_len; i++ ) {
15583 0 : err = fd_bincode_uint32_decode_footprint( ctx );
15584 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15585 0 : }
15586 0 : }
15587 3 : return 0;
15588 3 : }
15589 0 : int fd_gossip_contact_info_v2_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
15590 0 : *total_sz += sizeof(fd_gossip_contact_info_v2_t);
15591 0 : void const * start_data = ctx->data;
15592 0 : int err = fd_gossip_contact_info_v2_decode_footprint_inner( ctx, total_sz );
15593 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
15594 0 : ctx->data = start_data;
15595 0 : return err;
15596 0 : }
15597 3 : static void fd_gossip_contact_info_v2_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
15598 3 : fd_gossip_contact_info_v2_t * self = (fd_gossip_contact_info_v2_t *)struct_mem;
15599 3 : fd_pubkey_decode_inner( &self->from, alloc_mem, ctx );
15600 3 : fd_bincode_varint_decode_unsafe( &self->wallclock, ctx );
15601 3 : fd_bincode_uint64_decode_unsafe( &self->outset, ctx );
15602 3 : fd_bincode_uint16_decode_unsafe( &self->shred_version, ctx );
15603 3 : fd_gossip_version_v3_decode_inner( &self->version, alloc_mem, ctx );
15604 3 : fd_bincode_compact_u16_decode_unsafe( &self->addrs_len, ctx );
15605 3 : if( self->addrs_len ) {
15606 3 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_GOSSIP_IP_ADDR_ALIGN );
15607 3 : self->addrs = *alloc_mem;
15608 3 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_gossip_ip_addr_t)*self->addrs_len;
15609 6 : for( ulong i=0; i < self->addrs_len; i++ ) {
15610 3 : fd_gossip_ip_addr_new( self->addrs + i );
15611 3 : fd_gossip_ip_addr_decode_inner( self->addrs + i, alloc_mem, ctx );
15612 3 : }
15613 3 : } else
15614 0 : self->addrs = NULL;
15615 3 : fd_bincode_compact_u16_decode_unsafe( &self->sockets_len, ctx );
15616 3 : if( self->sockets_len ) {
15617 3 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_GOSSIP_SOCKET_ENTRY_ALIGN );
15618 3 : self->sockets = *alloc_mem;
15619 3 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_gossip_socket_entry_t)*self->sockets_len;
15620 39 : for( ulong i=0; i < self->sockets_len; i++ ) {
15621 36 : fd_gossip_socket_entry_new( self->sockets + i );
15622 36 : fd_gossip_socket_entry_decode_inner( self->sockets + i, alloc_mem, ctx );
15623 36 : }
15624 3 : } else
15625 0 : self->sockets = NULL;
15626 3 : fd_bincode_compact_u16_decode_unsafe( &self->extensions_len, ctx );
15627 3 : if( self->extensions_len ) {
15628 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), 8UL );
15629 0 : self->extensions = *alloc_mem;
15630 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(uint)*self->extensions_len;
15631 0 : for( ulong i=0; i < self->extensions_len; i++ ) {
15632 0 : fd_bincode_uint32_decode_unsafe( self->extensions + i, ctx );
15633 0 : }
15634 0 : } else
15635 3 : self->extensions = NULL;
15636 3 : }
15637 0 : void * fd_gossip_contact_info_v2_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
15638 0 : fd_gossip_contact_info_v2_t * self = (fd_gossip_contact_info_v2_t *)mem;
15639 0 : fd_gossip_contact_info_v2_new( self );
15640 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_contact_info_v2_t);
15641 0 : void * * alloc_mem = &alloc_region;
15642 0 : fd_gossip_contact_info_v2_decode_inner( mem, alloc_mem, ctx );
15643 0 : return self;
15644 0 : }
15645 0 : void fd_gossip_contact_info_v2_new(fd_gossip_contact_info_v2_t * self) {
15646 0 : fd_memset( self, 0, sizeof(fd_gossip_contact_info_v2_t) );
15647 0 : fd_pubkey_new( &self->from );
15648 0 : fd_gossip_version_v3_new( &self->version );
15649 0 : }
15650 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, uint varint ) {
15651 3 : (void) varint;
15652 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_contact_info_v2", level++, 0 );
15653 3 : fd_pubkey_walk( w, &self->from, fun, "from", level, 0 );
15654 3 : fun( w, &self->wallclock, "wallclock", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 1 );
15655 3 : fun( w, &self->outset, "outset", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
15656 3 : fun( w, &self->shred_version, "shred_version", FD_FLAMENCO_TYPE_USHORT, "ushort", level, 0 );
15657 3 : fd_gossip_version_v3_walk( w, &self->version, fun, "version", level, 0 );
15658 3 : fun( w, &self->addrs_len, "addrs_len", FD_FLAMENCO_TYPE_USHORT, "ushort", level, 1 );
15659 3 : if( self->addrs_len ) {
15660 3 : fun( w, NULL, "addrs", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
15661 6 : for( ulong i=0; i < self->addrs_len; i++ )
15662 3 : fd_gossip_ip_addr_walk(w, self->addrs + i, fun, "gossip_ip_addr", level, 0 );
15663 3 : fun( w, NULL, "addrs", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
15664 3 : }
15665 3 : fun( w, &self->sockets_len, "sockets_len", FD_FLAMENCO_TYPE_USHORT, "ushort", level, 1 );
15666 3 : if( self->sockets_len ) {
15667 3 : fun( w, NULL, "sockets", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
15668 39 : for( ulong i=0; i < self->sockets_len; i++ )
15669 36 : fd_gossip_socket_entry_walk(w, self->sockets + i, fun, "gossip_socket_entry", level, 0 );
15670 3 : fun( w, NULL, "sockets", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
15671 3 : }
15672 3 : fun( w, &self->extensions_len, "extensions_len", FD_FLAMENCO_TYPE_USHORT, "ushort", level, 1 );
15673 3 : if( self->extensions_len ) {
15674 0 : fun( w, NULL, "extensions", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
15675 0 : for( ulong i=0; i < self->extensions_len; i++ )
15676 0 : fun( w, self->extensions + i, "extensions", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
15677 0 : fun( w, NULL, "extensions", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
15678 0 : }
15679 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_contact_info_v2", level--, 0 );
15680 3 : }
15681 0 : ulong fd_gossip_contact_info_v2_size( fd_gossip_contact_info_v2_t const * self ) {
15682 0 : ulong size = 0;
15683 0 : size += fd_pubkey_size( &self->from );
15684 0 : size += fd_bincode_varint_size( self->wallclock );
15685 0 : size += sizeof(ulong);
15686 0 : size += sizeof(ushort);
15687 0 : size += fd_gossip_version_v3_size( &self->version );
15688 0 : do {
15689 0 : ushort tmp = (ushort)self->addrs_len;
15690 0 : size += fd_bincode_compact_u16_size( &tmp );
15691 0 : for( ulong i=0; i < self->addrs_len; i++ )
15692 0 : size += fd_gossip_ip_addr_size( self->addrs + i );
15693 0 : } while(0);
15694 0 : do {
15695 0 : ushort tmp = (ushort)self->sockets_len;
15696 0 : size += fd_bincode_compact_u16_size( &tmp );
15697 0 : for( ulong i=0; i < self->sockets_len; i++ )
15698 0 : size += fd_gossip_socket_entry_size( self->sockets + i );
15699 0 : } while(0);
15700 0 : do {
15701 0 : ushort tmp = (ushort)self->extensions_len;
15702 0 : size += fd_bincode_compact_u16_size( &tmp );
15703 0 : size += self->extensions_len * sizeof(uint);
15704 0 : } while(0);
15705 0 : return size;
15706 0 : }
15707 :
15708 0 : int fd_restart_run_length_encoding_inner_encode( fd_restart_run_length_encoding_inner_t const * self, fd_bincode_encode_ctx_t * ctx ) {
15709 0 : int err;
15710 0 : err = fd_bincode_compact_u16_encode( &self->bits, ctx );
15711 0 : if( FD_UNLIKELY( err ) ) return err;
15712 0 : return FD_BINCODE_SUCCESS;
15713 0 : }
15714 0 : static int fd_restart_run_length_encoding_inner_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
15715 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
15716 0 : int err = 0;
15717 0 : do { ushort _tmp; err = fd_bincode_compact_u16_decode( &_tmp, ctx ); } while(0);
15718 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15719 0 : return 0;
15720 0 : }
15721 0 : int fd_restart_run_length_encoding_inner_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
15722 0 : *total_sz += sizeof(fd_restart_run_length_encoding_inner_t);
15723 0 : void const * start_data = ctx->data;
15724 0 : int err = fd_restart_run_length_encoding_inner_decode_footprint_inner( ctx, total_sz );
15725 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
15726 0 : ctx->data = start_data;
15727 0 : return err;
15728 0 : }
15729 0 : static void fd_restart_run_length_encoding_inner_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
15730 0 : fd_restart_run_length_encoding_inner_t * self = (fd_restart_run_length_encoding_inner_t *)struct_mem;
15731 0 : fd_bincode_compact_u16_decode_unsafe( &self->bits, ctx );
15732 0 : }
15733 0 : void * fd_restart_run_length_encoding_inner_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
15734 0 : fd_restart_run_length_encoding_inner_t * self = (fd_restart_run_length_encoding_inner_t *)mem;
15735 0 : fd_restart_run_length_encoding_inner_new( self );
15736 0 : void * alloc_region = (uchar *)mem + sizeof(fd_restart_run_length_encoding_inner_t);
15737 0 : void * * alloc_mem = &alloc_region;
15738 0 : fd_restart_run_length_encoding_inner_decode_inner( mem, alloc_mem, ctx );
15739 0 : return self;
15740 0 : }
15741 0 : void fd_restart_run_length_encoding_inner_new(fd_restart_run_length_encoding_inner_t * self) {
15742 0 : fd_memset( self, 0, sizeof(fd_restart_run_length_encoding_inner_t) );
15743 0 : }
15744 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, uint varint ) {
15745 0 : (void) varint;
15746 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_restart_run_length_encoding_inner", level++, 0 );
15747 0 : fun( w, &self->bits, "bits", FD_FLAMENCO_TYPE_USHORT, "ushort", level, 1 );
15748 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_restart_run_length_encoding_inner", level--, 0 );
15749 0 : }
15750 0 : ulong fd_restart_run_length_encoding_inner_size( fd_restart_run_length_encoding_inner_t const * self ) {
15751 0 : ulong size = 0;
15752 0 : size += fd_bincode_compact_u16_size( &self->bits );
15753 0 : return size;
15754 0 : }
15755 :
15756 0 : int fd_restart_run_length_encoding_encode( fd_restart_run_length_encoding_t const * self, fd_bincode_encode_ctx_t * ctx ) {
15757 0 : int err;
15758 0 : err = fd_bincode_uint64_encode( self->offsets_len, ctx );
15759 0 : if( FD_UNLIKELY(err) ) return err;
15760 0 : if( self->offsets_len ) {
15761 0 : for( ulong i=0; i < self->offsets_len; i++ ) {
15762 0 : err = fd_restart_run_length_encoding_inner_encode( self->offsets + i, ctx );
15763 0 : if( FD_UNLIKELY( err ) ) return err;
15764 0 : }
15765 0 : }
15766 0 : return FD_BINCODE_SUCCESS;
15767 0 : }
15768 0 : static int fd_restart_run_length_encoding_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
15769 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
15770 0 : int err = 0;
15771 0 : ulong offsets_len;
15772 0 : err = fd_bincode_uint64_decode( &offsets_len, ctx );
15773 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15774 0 : if( offsets_len ) {
15775 0 : *total_sz += FD_RESTART_RUN_LENGTH_ENCODING_INNER_ALIGN + sizeof(fd_restart_run_length_encoding_inner_t)*offsets_len;
15776 0 : for( ulong i=0; i < offsets_len; i++ ) {
15777 0 : err = fd_restart_run_length_encoding_inner_decode_footprint_inner( ctx, total_sz );
15778 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15779 0 : }
15780 0 : }
15781 0 : return 0;
15782 0 : }
15783 0 : int fd_restart_run_length_encoding_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
15784 0 : *total_sz += sizeof(fd_restart_run_length_encoding_t);
15785 0 : void const * start_data = ctx->data;
15786 0 : int err = fd_restart_run_length_encoding_decode_footprint_inner( ctx, total_sz );
15787 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
15788 0 : ctx->data = start_data;
15789 0 : return err;
15790 0 : }
15791 0 : static void fd_restart_run_length_encoding_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
15792 0 : fd_restart_run_length_encoding_t * self = (fd_restart_run_length_encoding_t *)struct_mem;
15793 0 : fd_bincode_uint64_decode_unsafe( &self->offsets_len, ctx );
15794 0 : if( self->offsets_len ) {
15795 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_RESTART_RUN_LENGTH_ENCODING_INNER_ALIGN );
15796 0 : self->offsets = *alloc_mem;
15797 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_restart_run_length_encoding_inner_t)*self->offsets_len;
15798 0 : for( ulong i=0; i < self->offsets_len; i++ ) {
15799 0 : fd_restart_run_length_encoding_inner_new( self->offsets + i );
15800 0 : fd_restart_run_length_encoding_inner_decode_inner( self->offsets + i, alloc_mem, ctx );
15801 0 : }
15802 0 : } else
15803 0 : self->offsets = NULL;
15804 0 : }
15805 0 : void * fd_restart_run_length_encoding_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
15806 0 : fd_restart_run_length_encoding_t * self = (fd_restart_run_length_encoding_t *)mem;
15807 0 : fd_restart_run_length_encoding_new( self );
15808 0 : void * alloc_region = (uchar *)mem + sizeof(fd_restart_run_length_encoding_t);
15809 0 : void * * alloc_mem = &alloc_region;
15810 0 : fd_restart_run_length_encoding_decode_inner( mem, alloc_mem, ctx );
15811 0 : return self;
15812 0 : }
15813 0 : void fd_restart_run_length_encoding_new(fd_restart_run_length_encoding_t * self) {
15814 0 : fd_memset( self, 0, sizeof(fd_restart_run_length_encoding_t) );
15815 0 : }
15816 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, uint varint ) {
15817 0 : (void) varint;
15818 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_restart_run_length_encoding", level++, 0 );
15819 0 : if( self->offsets_len ) {
15820 0 : fun( w, NULL, "offsets", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
15821 0 : for( ulong i=0; i < self->offsets_len; i++ )
15822 0 : fd_restart_run_length_encoding_inner_walk(w, self->offsets + i, fun, "restart_run_length_encoding_inner", level, 0 );
15823 0 : fun( w, NULL, "offsets", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
15824 0 : }
15825 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_restart_run_length_encoding", level--, 0 );
15826 0 : }
15827 0 : ulong fd_restart_run_length_encoding_size( fd_restart_run_length_encoding_t const * self ) {
15828 0 : ulong size = 0;
15829 0 : do {
15830 0 : size += sizeof(ulong);
15831 0 : for( ulong i=0; i < self->offsets_len; i++ )
15832 0 : size += fd_restart_run_length_encoding_inner_size( self->offsets + i );
15833 0 : } while(0);
15834 0 : return size;
15835 0 : }
15836 :
15837 0 : int fd_restart_raw_offsets_encode( fd_restart_raw_offsets_t const * self, fd_bincode_encode_ctx_t * ctx ) {
15838 0 : int err;
15839 0 : err = fd_bincode_bool_encode( self->has_offsets, ctx );
15840 0 : if( FD_UNLIKELY( err ) ) return err;
15841 0 : if( self->has_offsets ) {
15842 0 : err = fd_bincode_uint64_encode( self->offsets_bitvec_len, ctx );
15843 0 : if( FD_UNLIKELY(err) ) return err;
15844 0 : if( self->offsets_bitvec_len ) {
15845 0 : err = fd_bincode_bytes_encode( self->offsets_bitvec, self->offsets_bitvec_len, ctx );
15846 0 : if( FD_UNLIKELY( err ) ) return err;
15847 0 : }
15848 0 : if( FD_UNLIKELY( err ) ) return err;
15849 0 : }
15850 0 : err = fd_bincode_uint64_encode( self->offsets_len, ctx );
15851 0 : if( FD_UNLIKELY( err ) ) return err;
15852 0 : return FD_BINCODE_SUCCESS;
15853 0 : }
15854 0 : static int fd_restart_raw_offsets_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
15855 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
15856 0 : int err = 0;
15857 0 : {
15858 0 : uchar o;
15859 0 : ulong inner_len = 0UL;
15860 0 : err = fd_bincode_bool_decode( &o, ctx );
15861 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15862 0 : if( o ) {
15863 0 : ulong offsets_bitvec_len;
15864 0 : err = fd_bincode_uint64_decode( &offsets_bitvec_len, ctx );
15865 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15866 0 : if( offsets_bitvec_len ) {
15867 0 : *total_sz += 8UL + offsets_bitvec_len;
15868 0 : err = fd_bincode_bytes_decode_footprint( offsets_bitvec_len, ctx );
15869 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15870 0 : }
15871 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15872 0 : inner_len = offsets_bitvec_len;
15873 0 : if( inner_len==0 ) return FD_BINCODE_ERR_ENCODING;
15874 0 : }
15875 0 : ulong len;
15876 0 : err = fd_bincode_uint64_decode( &len, ctx );
15877 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15878 0 : if( len > inner_len * sizeof(uchar) * 8UL ) return FD_BINCODE_ERR_ENCODING;
15879 0 : }
15880 0 : return 0;
15881 0 : }
15882 0 : int fd_restart_raw_offsets_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
15883 0 : *total_sz += sizeof(fd_restart_raw_offsets_t);
15884 0 : void const * start_data = ctx->data;
15885 0 : int err = fd_restart_raw_offsets_decode_footprint_inner( ctx, total_sz );
15886 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
15887 0 : ctx->data = start_data;
15888 0 : return err;
15889 0 : }
15890 0 : static void fd_restart_raw_offsets_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
15891 0 : fd_restart_raw_offsets_t * self = (fd_restart_raw_offsets_t *)struct_mem;
15892 0 : {
15893 0 : uchar o;
15894 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
15895 0 : self->has_offsets = !!o;
15896 0 : if( o ) {
15897 0 : fd_bincode_uint64_decode_unsafe( &self->offsets_bitvec_len, ctx );
15898 0 : if( self->offsets_bitvec_len ) {
15899 0 : self->offsets_bitvec = *alloc_mem;
15900 0 : fd_bincode_bytes_decode_unsafe( self->offsets_bitvec, self->offsets_bitvec_len, ctx );
15901 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->offsets_bitvec_len;
15902 0 : } else
15903 0 : self->offsets_bitvec = NULL;
15904 0 : } else {
15905 0 : self->offsets_bitvec = NULL;
15906 0 : }
15907 0 : fd_bincode_uint64_decode_unsafe( &self->offsets_len, ctx );
15908 0 : }
15909 0 : }
15910 0 : void * fd_restart_raw_offsets_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
15911 0 : fd_restart_raw_offsets_t * self = (fd_restart_raw_offsets_t *)mem;
15912 0 : fd_restart_raw_offsets_new( self );
15913 0 : void * alloc_region = (uchar *)mem + sizeof(fd_restart_raw_offsets_t);
15914 0 : void * * alloc_mem = &alloc_region;
15915 0 : fd_restart_raw_offsets_decode_inner( mem, alloc_mem, ctx );
15916 0 : return self;
15917 0 : }
15918 0 : void fd_restart_raw_offsets_new(fd_restart_raw_offsets_t * self) {
15919 0 : fd_memset( self, 0, sizeof(fd_restart_raw_offsets_t) );
15920 0 : }
15921 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, uint varint ) {
15922 0 : (void) varint;
15923 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_restart_raw_offsets", level++, 0 );
15924 0 : if( !self->has_offsets ) {
15925 0 : fun( w, NULL, "offsets", FD_FLAMENCO_TYPE_NULL, "uchar", level, 0 );
15926 0 : } else {
15927 0 : if( self->offsets_bitvec_len ) {
15928 0 : fun( w, NULL, "offsets_bitvec", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
15929 0 : for( ulong i=0; i < self->offsets_bitvec_len; i++ )
15930 0 : fun( w, self->offsets_bitvec + i, "offsets_bitvec", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
15931 0 : fun( w, NULL, "offsets_bitvec", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
15932 0 : }
15933 0 : }
15934 0 : fun( w, &self->offsets_len, "offsets_len", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
15935 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_restart_raw_offsets", level--, 0 );
15936 0 : }
15937 0 : ulong fd_restart_raw_offsets_size( fd_restart_raw_offsets_t const * self ) {
15938 0 : ulong size = 0;
15939 0 : size += sizeof(char);
15940 0 : if( self->has_offsets ) {
15941 0 : do {
15942 0 : size += sizeof(ulong);
15943 0 : size += self->offsets_bitvec_len;
15944 0 : } while(0);
15945 0 : }
15946 0 : size += sizeof(ulong);
15947 0 : return size;
15948 0 : }
15949 :
15950 0 : FD_FN_PURE uchar fd_restart_slots_offsets_is_run_length_encoding(fd_restart_slots_offsets_t const * self) {
15951 0 : return self->discriminant == 0;
15952 0 : }
15953 0 : FD_FN_PURE uchar fd_restart_slots_offsets_is_raw_offsets(fd_restart_slots_offsets_t const * self) {
15954 0 : return self->discriminant == 1;
15955 0 : }
15956 : void fd_restart_slots_offsets_inner_new( fd_restart_slots_offsets_inner_t * self, uint discriminant );
15957 0 : int fd_restart_slots_offsets_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
15958 0 : int err;
15959 0 : switch (discriminant) {
15960 0 : case 0: {
15961 0 : err = fd_restart_run_length_encoding_decode_footprint_inner( ctx, total_sz );
15962 0 : if( FD_UNLIKELY( err ) ) return err;
15963 0 : return FD_BINCODE_SUCCESS;
15964 0 : }
15965 0 : case 1: {
15966 0 : err = fd_restart_raw_offsets_decode_footprint_inner( ctx, total_sz );
15967 0 : if( FD_UNLIKELY( err ) ) return err;
15968 0 : return FD_BINCODE_SUCCESS;
15969 0 : }
15970 0 : default: return FD_BINCODE_ERR_ENCODING;
15971 0 : }
15972 0 : }
15973 0 : static int fd_restart_slots_offsets_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
15974 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
15975 0 : uint discriminant = 0;
15976 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
15977 0 : if( FD_UNLIKELY( err ) ) return err;
15978 0 : return fd_restart_slots_offsets_inner_decode_footprint( discriminant, ctx, total_sz );
15979 0 : }
15980 0 : int fd_restart_slots_offsets_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
15981 0 : *total_sz += sizeof(fd_restart_slots_offsets_t);
15982 0 : void const * start_data = ctx->data;
15983 0 : int err = fd_restart_slots_offsets_decode_footprint_inner( ctx, total_sz );
15984 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
15985 0 : ctx->data = start_data;
15986 0 : return err;
15987 0 : }
15988 0 : static 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 ) {
15989 0 : switch (discriminant) {
15990 0 : case 0: {
15991 0 : fd_restart_run_length_encoding_decode_inner( &self->run_length_encoding, alloc_mem, ctx );
15992 0 : break;
15993 0 : }
15994 0 : case 1: {
15995 0 : fd_restart_raw_offsets_decode_inner( &self->raw_offsets, alloc_mem, ctx );
15996 0 : break;
15997 0 : }
15998 0 : }
15999 0 : }
16000 0 : static void fd_restart_slots_offsets_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
16001 0 : fd_restart_slots_offsets_t * self = (fd_restart_slots_offsets_t *)struct_mem;
16002 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
16003 0 : fd_restart_slots_offsets_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
16004 0 : }
16005 0 : void * fd_restart_slots_offsets_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
16006 0 : fd_restart_slots_offsets_t * self = (fd_restart_slots_offsets_t *)mem;
16007 0 : fd_restart_slots_offsets_new( self );
16008 0 : void * alloc_region = (uchar *)mem + sizeof(fd_restart_slots_offsets_t);
16009 0 : void * * alloc_mem = &alloc_region;
16010 0 : fd_restart_slots_offsets_decode_inner( mem, alloc_mem, ctx );
16011 0 : return self;
16012 0 : }
16013 0 : void fd_restart_slots_offsets_inner_new( fd_restart_slots_offsets_inner_t * self, uint discriminant ) {
16014 0 : switch( discriminant ) {
16015 0 : case 0: {
16016 0 : fd_restart_run_length_encoding_new( &self->run_length_encoding );
16017 0 : break;
16018 0 : }
16019 0 : case 1: {
16020 0 : fd_restart_raw_offsets_new( &self->raw_offsets );
16021 0 : break;
16022 0 : }
16023 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
16024 0 : }
16025 0 : }
16026 0 : void fd_restart_slots_offsets_new_disc( fd_restart_slots_offsets_t * self, uint discriminant ) {
16027 0 : self->discriminant = discriminant;
16028 0 : fd_restart_slots_offsets_inner_new( &self->inner, self->discriminant );
16029 0 : }
16030 0 : void fd_restart_slots_offsets_new( fd_restart_slots_offsets_t * self ) {
16031 0 : fd_memset( self, 0, sizeof(fd_restart_slots_offsets_t) );
16032 0 : fd_restart_slots_offsets_new_disc( self, UINT_MAX );
16033 0 : }
16034 :
16035 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, uint varint ) {
16036 0 : (void) varint;
16037 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_restart_slots_offsets", level++, 0);
16038 0 : switch( self->discriminant ) {
16039 0 : case 0: {
16040 0 : fun( w, self, "run_length_encoding", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
16041 0 : fd_restart_run_length_encoding_walk( w, &self->inner.run_length_encoding, fun, "run_length_encoding", level, 0 );
16042 0 : break;
16043 0 : }
16044 0 : case 1: {
16045 0 : fun( w, self, "raw_offsets", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
16046 0 : fd_restart_raw_offsets_walk( w, &self->inner.raw_offsets, fun, "raw_offsets", level, 0 );
16047 0 : break;
16048 0 : }
16049 0 : }
16050 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_restart_slots_offsets", level--, 0 );
16051 0 : }
16052 0 : ulong fd_restart_slots_offsets_size( fd_restart_slots_offsets_t const * self ) {
16053 0 : ulong size = 0;
16054 0 : size += sizeof(uint);
16055 0 : switch (self->discriminant) {
16056 0 : case 0: {
16057 0 : size += fd_restart_run_length_encoding_size( &self->inner.run_length_encoding );
16058 0 : break;
16059 0 : }
16060 0 : case 1: {
16061 0 : size += fd_restart_raw_offsets_size( &self->inner.raw_offsets );
16062 0 : break;
16063 0 : }
16064 0 : }
16065 0 : return size;
16066 0 : }
16067 :
16068 0 : int fd_restart_slots_offsets_inner_encode( fd_restart_slots_offsets_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
16069 0 : int err;
16070 0 : switch (discriminant) {
16071 0 : case 0: {
16072 0 : err = fd_restart_run_length_encoding_encode( &self->run_length_encoding, ctx );
16073 0 : if( FD_UNLIKELY( err ) ) return err;
16074 0 : break;
16075 0 : }
16076 0 : case 1: {
16077 0 : err = fd_restart_raw_offsets_encode( &self->raw_offsets, ctx );
16078 0 : if( FD_UNLIKELY( err ) ) return err;
16079 0 : break;
16080 0 : }
16081 0 : }
16082 0 : return FD_BINCODE_SUCCESS;
16083 0 : }
16084 0 : int fd_restart_slots_offsets_encode( fd_restart_slots_offsets_t const * self, fd_bincode_encode_ctx_t * ctx ) {
16085 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
16086 0 : if( FD_UNLIKELY( err ) ) return err;
16087 0 : return fd_restart_slots_offsets_inner_encode( &self->inner, self->discriminant, ctx );
16088 0 : }
16089 :
16090 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 ) {
16091 0 : int err;
16092 0 : err = fd_pubkey_encode( &self->from, ctx );
16093 0 : if( FD_UNLIKELY( err ) ) return err;
16094 0 : err = fd_bincode_uint64_encode( self->wallclock, ctx );
16095 0 : if( FD_UNLIKELY( err ) ) return err;
16096 0 : err = fd_restart_slots_offsets_encode( &self->offsets, ctx );
16097 0 : if( FD_UNLIKELY( err ) ) return err;
16098 0 : err = fd_bincode_uint64_encode( self->last_voted_slot, ctx );
16099 0 : if( FD_UNLIKELY( err ) ) return err;
16100 0 : err = fd_hash_encode( &self->last_voted_hash, ctx );
16101 0 : if( FD_UNLIKELY( err ) ) return err;
16102 0 : err = fd_bincode_uint16_encode( self->shred_version, ctx );
16103 0 : if( FD_UNLIKELY( err ) ) return err;
16104 0 : return FD_BINCODE_SUCCESS;
16105 0 : }
16106 0 : static int fd_gossip_restart_last_voted_fork_slots_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
16107 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
16108 0 : int err = 0;
16109 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
16110 0 : if( FD_UNLIKELY( err ) ) return err;
16111 0 : err = fd_bincode_uint64_decode_footprint( ctx );
16112 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
16113 0 : err = fd_restart_slots_offsets_decode_footprint_inner( ctx, total_sz );
16114 0 : if( FD_UNLIKELY( err ) ) return err;
16115 0 : err = fd_bincode_uint64_decode_footprint( ctx );
16116 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
16117 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
16118 0 : if( FD_UNLIKELY( err ) ) return err;
16119 0 : err = fd_bincode_uint16_decode_footprint( ctx );
16120 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
16121 0 : return 0;
16122 0 : }
16123 0 : int fd_gossip_restart_last_voted_fork_slots_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
16124 0 : *total_sz += sizeof(fd_gossip_restart_last_voted_fork_slots_t);
16125 0 : void const * start_data = ctx->data;
16126 0 : int err = fd_gossip_restart_last_voted_fork_slots_decode_footprint_inner( ctx, total_sz );
16127 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
16128 0 : ctx->data = start_data;
16129 0 : return err;
16130 0 : }
16131 0 : static void fd_gossip_restart_last_voted_fork_slots_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
16132 0 : fd_gossip_restart_last_voted_fork_slots_t * self = (fd_gossip_restart_last_voted_fork_slots_t *)struct_mem;
16133 0 : fd_pubkey_decode_inner( &self->from, alloc_mem, ctx );
16134 0 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
16135 0 : fd_restart_slots_offsets_decode_inner( &self->offsets, alloc_mem, ctx );
16136 0 : fd_bincode_uint64_decode_unsafe( &self->last_voted_slot, ctx );
16137 0 : fd_hash_decode_inner( &self->last_voted_hash, alloc_mem, ctx );
16138 0 : fd_bincode_uint16_decode_unsafe( &self->shred_version, ctx );
16139 0 : }
16140 0 : void * fd_gossip_restart_last_voted_fork_slots_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
16141 0 : fd_gossip_restart_last_voted_fork_slots_t * self = (fd_gossip_restart_last_voted_fork_slots_t *)mem;
16142 0 : fd_gossip_restart_last_voted_fork_slots_new( self );
16143 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_restart_last_voted_fork_slots_t);
16144 0 : void * * alloc_mem = &alloc_region;
16145 0 : fd_gossip_restart_last_voted_fork_slots_decode_inner( mem, alloc_mem, ctx );
16146 0 : return self;
16147 0 : }
16148 0 : void fd_gossip_restart_last_voted_fork_slots_new(fd_gossip_restart_last_voted_fork_slots_t * self) {
16149 0 : fd_memset( self, 0, sizeof(fd_gossip_restart_last_voted_fork_slots_t) );
16150 0 : fd_pubkey_new( &self->from );
16151 0 : fd_restart_slots_offsets_new( &self->offsets );
16152 0 : fd_hash_new( &self->last_voted_hash );
16153 0 : }
16154 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, uint varint ) {
16155 0 : (void) varint;
16156 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_restart_last_voted_fork_slots", level++, 0 );
16157 0 : fd_pubkey_walk( w, &self->from, fun, "from", level, 0 );
16158 0 : fun( w, &self->wallclock, "wallclock", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
16159 0 : fd_restart_slots_offsets_walk( w, &self->offsets, fun, "offsets", level, 0 );
16160 0 : fun( w, &self->last_voted_slot, "last_voted_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
16161 0 : fd_hash_walk( w, &self->last_voted_hash, fun, "last_voted_hash", level, 0 );
16162 0 : fun( w, &self->shred_version, "shred_version", FD_FLAMENCO_TYPE_USHORT, "ushort", level, 0 );
16163 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_restart_last_voted_fork_slots", level--, 0 );
16164 0 : }
16165 0 : ulong fd_gossip_restart_last_voted_fork_slots_size( fd_gossip_restart_last_voted_fork_slots_t const * self ) {
16166 0 : ulong size = 0;
16167 0 : size += fd_pubkey_size( &self->from );
16168 0 : size += sizeof(ulong);
16169 0 : size += fd_restart_slots_offsets_size( &self->offsets );
16170 0 : size += sizeof(ulong);
16171 0 : size += fd_hash_size( &self->last_voted_hash );
16172 0 : size += sizeof(ushort);
16173 0 : return size;
16174 0 : }
16175 :
16176 0 : int fd_gossip_restart_heaviest_fork_encode( fd_gossip_restart_heaviest_fork_t const * self, fd_bincode_encode_ctx_t * ctx ) {
16177 0 : int err;
16178 0 : err = fd_pubkey_encode( &self->from, ctx );
16179 0 : if( FD_UNLIKELY( err ) ) return err;
16180 0 : err = fd_bincode_uint64_encode( self->wallclock, ctx );
16181 0 : if( FD_UNLIKELY( err ) ) return err;
16182 0 : err = fd_bincode_uint64_encode( self->last_slot, ctx );
16183 0 : if( FD_UNLIKELY( err ) ) return err;
16184 0 : err = fd_hash_encode( &self->last_slot_hash, ctx );
16185 0 : if( FD_UNLIKELY( err ) ) return err;
16186 0 : err = fd_bincode_uint64_encode( self->observed_stake, ctx );
16187 0 : if( FD_UNLIKELY( err ) ) return err;
16188 0 : err = fd_bincode_uint16_encode( self->shred_version, ctx );
16189 0 : if( FD_UNLIKELY( err ) ) return err;
16190 0 : return FD_BINCODE_SUCCESS;
16191 0 : }
16192 0 : static inline int fd_gossip_restart_heaviest_fork_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
16193 0 : if( (ulong)ctx->data + 90UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
16194 0 : ctx->data = (void *)( (ulong)ctx->data + 90UL );
16195 0 : return 0;
16196 0 : }
16197 0 : static void fd_gossip_restart_heaviest_fork_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
16198 0 : fd_gossip_restart_heaviest_fork_t * self = (fd_gossip_restart_heaviest_fork_t *)struct_mem;
16199 0 : fd_pubkey_decode_inner( &self->from, alloc_mem, ctx );
16200 0 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
16201 0 : fd_bincode_uint64_decode_unsafe( &self->last_slot, ctx );
16202 0 : fd_hash_decode_inner( &self->last_slot_hash, alloc_mem, ctx );
16203 0 : fd_bincode_uint64_decode_unsafe( &self->observed_stake, ctx );
16204 0 : fd_bincode_uint16_decode_unsafe( &self->shred_version, ctx );
16205 0 : }
16206 0 : void * fd_gossip_restart_heaviest_fork_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
16207 0 : fd_gossip_restart_heaviest_fork_t * self = (fd_gossip_restart_heaviest_fork_t *)mem;
16208 0 : fd_gossip_restart_heaviest_fork_new( self );
16209 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_restart_heaviest_fork_t);
16210 0 : void * * alloc_mem = &alloc_region;
16211 0 : fd_gossip_restart_heaviest_fork_decode_inner( mem, alloc_mem, ctx );
16212 0 : return self;
16213 0 : }
16214 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, uint varint ) {
16215 0 : (void) varint;
16216 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_restart_heaviest_fork", level++, 0 );
16217 0 : fd_pubkey_walk( w, &self->from, fun, "from", level, 0 );
16218 0 : fun( w, &self->wallclock, "wallclock", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
16219 0 : fun( w, &self->last_slot, "last_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
16220 0 : fd_hash_walk( w, &self->last_slot_hash, fun, "last_slot_hash", level, 0 );
16221 0 : fun( w, &self->observed_stake, "observed_stake", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
16222 0 : fun( w, &self->shred_version, "shred_version", FD_FLAMENCO_TYPE_USHORT, "ushort", level, 0 );
16223 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_restart_heaviest_fork", level--, 0 );
16224 0 : }
16225 0 : FD_FN_PURE uchar fd_crds_data_is_contact_info_v1(fd_crds_data_t const * self) {
16226 0 : return self->discriminant == 0;
16227 0 : }
16228 0 : FD_FN_PURE uchar fd_crds_data_is_vote(fd_crds_data_t const * self) {
16229 0 : return self->discriminant == 1;
16230 0 : }
16231 0 : FD_FN_PURE uchar fd_crds_data_is_lowest_slot(fd_crds_data_t const * self) {
16232 0 : return self->discriminant == 2;
16233 0 : }
16234 0 : FD_FN_PURE uchar fd_crds_data_is_snapshot_hashes(fd_crds_data_t const * self) {
16235 0 : return self->discriminant == 3;
16236 0 : }
16237 0 : FD_FN_PURE uchar fd_crds_data_is_accounts_hashes(fd_crds_data_t const * self) {
16238 0 : return self->discriminant == 4;
16239 0 : }
16240 0 : FD_FN_PURE uchar fd_crds_data_is_epoch_slots(fd_crds_data_t const * self) {
16241 0 : return self->discriminant == 5;
16242 0 : }
16243 0 : FD_FN_PURE uchar fd_crds_data_is_version_v1(fd_crds_data_t const * self) {
16244 0 : return self->discriminant == 6;
16245 0 : }
16246 0 : FD_FN_PURE uchar fd_crds_data_is_version_v2(fd_crds_data_t const * self) {
16247 0 : return self->discriminant == 7;
16248 0 : }
16249 0 : FD_FN_PURE uchar fd_crds_data_is_node_instance(fd_crds_data_t const * self) {
16250 0 : return self->discriminant == 8;
16251 0 : }
16252 0 : FD_FN_PURE uchar fd_crds_data_is_duplicate_shred(fd_crds_data_t const * self) {
16253 0 : return self->discriminant == 9;
16254 0 : }
16255 0 : FD_FN_PURE uchar fd_crds_data_is_incremental_snapshot_hashes(fd_crds_data_t const * self) {
16256 0 : return self->discriminant == 10;
16257 0 : }
16258 0 : FD_FN_PURE uchar fd_crds_data_is_contact_info_v2(fd_crds_data_t const * self) {
16259 0 : return self->discriminant == 11;
16260 0 : }
16261 0 : FD_FN_PURE uchar fd_crds_data_is_restart_last_voted_fork_slots(fd_crds_data_t const * self) {
16262 0 : return self->discriminant == 12;
16263 0 : }
16264 0 : FD_FN_PURE uchar fd_crds_data_is_restart_heaviest_fork(fd_crds_data_t const * self) {
16265 0 : return self->discriminant == 13;
16266 0 : }
16267 : void fd_crds_data_inner_new( fd_crds_data_inner_t * self, uint discriminant );
16268 30 : int fd_crds_data_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
16269 30 : int err;
16270 30 : switch (discriminant) {
16271 9 : case 0: {
16272 9 : err = fd_gossip_contact_info_v1_decode_footprint_inner( ctx, total_sz );
16273 9 : if( FD_UNLIKELY( err ) ) return err;
16274 9 : return FD_BINCODE_SUCCESS;
16275 9 : }
16276 6 : case 1: {
16277 6 : err = fd_gossip_vote_old_decode_footprint_inner( ctx, total_sz );
16278 6 : if( FD_UNLIKELY( err ) ) return err;
16279 6 : return FD_BINCODE_SUCCESS;
16280 6 : }
16281 0 : case 2: {
16282 0 : err = fd_gossip_lowest_slot_decode_footprint_inner( ctx, total_sz );
16283 0 : if( FD_UNLIKELY( err ) ) return err;
16284 0 : return FD_BINCODE_SUCCESS;
16285 0 : }
16286 3 : case 3: {
16287 3 : err = fd_gossip_slot_hashes_decode_footprint_inner( ctx, total_sz );
16288 3 : if( FD_UNLIKELY( err ) ) return err;
16289 3 : return FD_BINCODE_SUCCESS;
16290 3 : }
16291 0 : case 4: {
16292 0 : err = fd_gossip_slot_hashes_decode_footprint_inner( ctx, total_sz );
16293 0 : if( FD_UNLIKELY( err ) ) return err;
16294 0 : return FD_BINCODE_SUCCESS;
16295 0 : }
16296 0 : case 5: {
16297 0 : err = fd_gossip_epoch_slots_decode_footprint_inner( ctx, total_sz );
16298 0 : if( FD_UNLIKELY( err ) ) return err;
16299 0 : return FD_BINCODE_SUCCESS;
16300 0 : }
16301 0 : case 6: {
16302 0 : err = fd_gossip_version_v1_decode_footprint_inner( ctx, total_sz );
16303 0 : if( FD_UNLIKELY( err ) ) return err;
16304 0 : return FD_BINCODE_SUCCESS;
16305 0 : }
16306 3 : case 7: {
16307 3 : err = fd_gossip_version_v2_decode_footprint_inner( ctx, total_sz );
16308 3 : if( FD_UNLIKELY( err ) ) return err;
16309 3 : return FD_BINCODE_SUCCESS;
16310 3 : }
16311 6 : case 8: {
16312 6 : err = fd_gossip_node_instance_decode_footprint_inner( ctx, total_sz );
16313 6 : if( FD_UNLIKELY( err ) ) return err;
16314 6 : return FD_BINCODE_SUCCESS;
16315 6 : }
16316 0 : case 9: {
16317 0 : err = fd_gossip_duplicate_shred_old_decode_footprint_inner( ctx, total_sz );
16318 0 : if( FD_UNLIKELY( err ) ) return err;
16319 0 : return FD_BINCODE_SUCCESS;
16320 0 : }
16321 0 : case 10: {
16322 0 : err = fd_gossip_incremental_snapshot_hashes_decode_footprint_inner( ctx, total_sz );
16323 0 : if( FD_UNLIKELY( err ) ) return err;
16324 0 : return FD_BINCODE_SUCCESS;
16325 0 : }
16326 3 : case 11: {
16327 3 : err = fd_gossip_contact_info_v2_decode_footprint_inner( ctx, total_sz );
16328 3 : if( FD_UNLIKELY( err ) ) return err;
16329 3 : return FD_BINCODE_SUCCESS;
16330 3 : }
16331 0 : case 12: {
16332 0 : err = fd_gossip_restart_last_voted_fork_slots_decode_footprint_inner( ctx, total_sz );
16333 0 : if( FD_UNLIKELY( err ) ) return err;
16334 0 : return FD_BINCODE_SUCCESS;
16335 0 : }
16336 0 : case 13: {
16337 0 : err = fd_gossip_restart_heaviest_fork_decode_footprint_inner( ctx, total_sz );
16338 0 : if( FD_UNLIKELY( err ) ) return err;
16339 0 : return FD_BINCODE_SUCCESS;
16340 0 : }
16341 0 : default: return FD_BINCODE_ERR_ENCODING;
16342 30 : }
16343 30 : }
16344 30 : static int fd_crds_data_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
16345 30 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
16346 30 : uint discriminant = 0;
16347 30 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
16348 30 : if( FD_UNLIKELY( err ) ) return err;
16349 30 : return fd_crds_data_inner_decode_footprint( discriminant, ctx, total_sz );
16350 30 : }
16351 0 : int fd_crds_data_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
16352 0 : *total_sz += sizeof(fd_crds_data_t);
16353 0 : void const * start_data = ctx->data;
16354 0 : int err = fd_crds_data_decode_footprint_inner( ctx, total_sz );
16355 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
16356 0 : ctx->data = start_data;
16357 0 : return err;
16358 0 : }
16359 30 : static void fd_crds_data_inner_decode_inner( fd_crds_data_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
16360 30 : switch (discriminant) {
16361 9 : case 0: {
16362 9 : fd_gossip_contact_info_v1_decode_inner( &self->contact_info_v1, alloc_mem, ctx );
16363 9 : break;
16364 0 : }
16365 6 : case 1: {
16366 6 : fd_gossip_vote_old_decode_inner( &self->vote, alloc_mem, ctx );
16367 6 : break;
16368 0 : }
16369 0 : case 2: {
16370 0 : fd_gossip_lowest_slot_decode_inner( &self->lowest_slot, alloc_mem, ctx );
16371 0 : break;
16372 0 : }
16373 3 : case 3: {
16374 3 : fd_gossip_slot_hashes_decode_inner( &self->snapshot_hashes, alloc_mem, ctx );
16375 3 : break;
16376 0 : }
16377 0 : case 4: {
16378 0 : fd_gossip_slot_hashes_decode_inner( &self->accounts_hashes, alloc_mem, ctx );
16379 0 : break;
16380 0 : }
16381 0 : case 5: {
16382 0 : fd_gossip_epoch_slots_decode_inner( &self->epoch_slots, alloc_mem, ctx );
16383 0 : break;
16384 0 : }
16385 0 : case 6: {
16386 0 : fd_gossip_version_v1_decode_inner( &self->version_v1, alloc_mem, ctx );
16387 0 : break;
16388 0 : }
16389 3 : case 7: {
16390 3 : fd_gossip_version_v2_decode_inner( &self->version_v2, alloc_mem, ctx );
16391 3 : break;
16392 0 : }
16393 6 : case 8: {
16394 6 : fd_gossip_node_instance_decode_inner( &self->node_instance, alloc_mem, ctx );
16395 6 : break;
16396 0 : }
16397 0 : case 9: {
16398 0 : fd_gossip_duplicate_shred_old_decode_inner( &self->duplicate_shred, alloc_mem, ctx );
16399 0 : break;
16400 0 : }
16401 0 : case 10: {
16402 0 : fd_gossip_incremental_snapshot_hashes_decode_inner( &self->incremental_snapshot_hashes, alloc_mem, ctx );
16403 0 : break;
16404 0 : }
16405 3 : case 11: {
16406 3 : fd_gossip_contact_info_v2_decode_inner( &self->contact_info_v2, alloc_mem, ctx );
16407 3 : break;
16408 0 : }
16409 0 : case 12: {
16410 0 : fd_gossip_restart_last_voted_fork_slots_decode_inner( &self->restart_last_voted_fork_slots, alloc_mem, ctx );
16411 0 : break;
16412 0 : }
16413 0 : case 13: {
16414 0 : fd_gossip_restart_heaviest_fork_decode_inner( &self->restart_heaviest_fork, alloc_mem, ctx );
16415 0 : break;
16416 0 : }
16417 30 : }
16418 30 : }
16419 30 : static void fd_crds_data_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
16420 30 : fd_crds_data_t * self = (fd_crds_data_t *)struct_mem;
16421 30 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
16422 30 : fd_crds_data_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
16423 30 : }
16424 0 : void * fd_crds_data_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
16425 0 : fd_crds_data_t * self = (fd_crds_data_t *)mem;
16426 0 : fd_crds_data_new( self );
16427 0 : void * alloc_region = (uchar *)mem + sizeof(fd_crds_data_t);
16428 0 : void * * alloc_mem = &alloc_region;
16429 0 : fd_crds_data_decode_inner( mem, alloc_mem, ctx );
16430 0 : return self;
16431 0 : }
16432 27 : void fd_crds_data_inner_new( fd_crds_data_inner_t * self, uint discriminant ) {
16433 27 : switch( discriminant ) {
16434 0 : case 0: {
16435 0 : fd_gossip_contact_info_v1_new( &self->contact_info_v1 );
16436 0 : break;
16437 0 : }
16438 0 : case 1: {
16439 0 : fd_gossip_vote_old_new( &self->vote );
16440 0 : break;
16441 0 : }
16442 0 : case 2: {
16443 0 : fd_gossip_lowest_slot_new( &self->lowest_slot );
16444 0 : break;
16445 0 : }
16446 0 : case 3: {
16447 0 : fd_gossip_slot_hashes_new( &self->snapshot_hashes );
16448 0 : break;
16449 0 : }
16450 0 : case 4: {
16451 0 : fd_gossip_slot_hashes_new( &self->accounts_hashes );
16452 0 : break;
16453 0 : }
16454 0 : case 5: {
16455 0 : fd_gossip_epoch_slots_new( &self->epoch_slots );
16456 0 : break;
16457 0 : }
16458 0 : case 6: {
16459 0 : fd_gossip_version_v1_new( &self->version_v1 );
16460 0 : break;
16461 0 : }
16462 0 : case 7: {
16463 0 : fd_gossip_version_v2_new( &self->version_v2 );
16464 0 : break;
16465 0 : }
16466 0 : case 8: {
16467 0 : fd_gossip_node_instance_new( &self->node_instance );
16468 0 : break;
16469 0 : }
16470 0 : case 9: {
16471 0 : fd_gossip_duplicate_shred_old_new( &self->duplicate_shred );
16472 0 : break;
16473 0 : }
16474 0 : case 10: {
16475 0 : fd_gossip_incremental_snapshot_hashes_new( &self->incremental_snapshot_hashes );
16476 0 : break;
16477 0 : }
16478 0 : case 11: {
16479 0 : fd_gossip_contact_info_v2_new( &self->contact_info_v2 );
16480 0 : break;
16481 0 : }
16482 0 : case 12: {
16483 0 : fd_gossip_restart_last_voted_fork_slots_new( &self->restart_last_voted_fork_slots );
16484 0 : break;
16485 0 : }
16486 0 : case 13: {
16487 0 : fd_gossip_restart_heaviest_fork_new( &self->restart_heaviest_fork );
16488 0 : break;
16489 0 : }
16490 27 : default: break; // FD_LOG_ERR(( "unhandled type"));
16491 27 : }
16492 27 : }
16493 27 : void fd_crds_data_new_disc( fd_crds_data_t * self, uint discriminant ) {
16494 27 : self->discriminant = discriminant;
16495 27 : fd_crds_data_inner_new( &self->inner, self->discriminant );
16496 27 : }
16497 27 : void fd_crds_data_new( fd_crds_data_t * self ) {
16498 27 : fd_memset( self, 0, sizeof(fd_crds_data_t) );
16499 27 : fd_crds_data_new_disc( self, UINT_MAX );
16500 27 : }
16501 :
16502 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, uint varint ) {
16503 30 : (void) varint;
16504 30 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_crds_data", level++, 0);
16505 30 : switch( self->discriminant ) {
16506 9 : case 0: {
16507 9 : fun( w, self, "contact_info_v1", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
16508 9 : fd_gossip_contact_info_v1_walk( w, &self->inner.contact_info_v1, fun, "contact_info_v1", level, 0 );
16509 9 : break;
16510 0 : }
16511 6 : case 1: {
16512 6 : fun( w, self, "vote", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
16513 6 : fd_gossip_vote_old_walk( w, &self->inner.vote, fun, "vote", level, 0 );
16514 6 : break;
16515 0 : }
16516 0 : case 2: {
16517 0 : fun( w, self, "lowest_slot", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
16518 0 : fd_gossip_lowest_slot_walk( w, &self->inner.lowest_slot, fun, "lowest_slot", level, 0 );
16519 0 : break;
16520 0 : }
16521 3 : case 3: {
16522 3 : fun( w, self, "snapshot_hashes", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
16523 3 : fd_gossip_slot_hashes_walk( w, &self->inner.snapshot_hashes, fun, "snapshot_hashes", level, 0 );
16524 3 : break;
16525 0 : }
16526 0 : case 4: {
16527 0 : fun( w, self, "accounts_hashes", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
16528 0 : fd_gossip_slot_hashes_walk( w, &self->inner.accounts_hashes, fun, "accounts_hashes", level, 0 );
16529 0 : break;
16530 0 : }
16531 0 : case 5: {
16532 0 : fun( w, self, "epoch_slots", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
16533 0 : fd_gossip_epoch_slots_walk( w, &self->inner.epoch_slots, fun, "epoch_slots", level, 0 );
16534 0 : break;
16535 0 : }
16536 0 : case 6: {
16537 0 : fun( w, self, "version_v1", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
16538 0 : fd_gossip_version_v1_walk( w, &self->inner.version_v1, fun, "version_v1", level, 0 );
16539 0 : break;
16540 0 : }
16541 3 : case 7: {
16542 3 : fun( w, self, "version_v2", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
16543 3 : fd_gossip_version_v2_walk( w, &self->inner.version_v2, fun, "version_v2", level, 0 );
16544 3 : break;
16545 0 : }
16546 6 : case 8: {
16547 6 : fun( w, self, "node_instance", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
16548 6 : fd_gossip_node_instance_walk( w, &self->inner.node_instance, fun, "node_instance", level, 0 );
16549 6 : break;
16550 0 : }
16551 0 : case 9: {
16552 0 : fun( w, self, "duplicate_shred", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
16553 0 : fd_gossip_duplicate_shred_old_walk( w, &self->inner.duplicate_shred, fun, "duplicate_shred", level, 0 );
16554 0 : break;
16555 0 : }
16556 0 : case 10: {
16557 0 : fun( w, self, "incremental_snapshot_hashes", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
16558 0 : fd_gossip_incremental_snapshot_hashes_walk( w, &self->inner.incremental_snapshot_hashes, fun, "incremental_snapshot_hashes", level, 0 );
16559 0 : break;
16560 0 : }
16561 3 : case 11: {
16562 3 : fun( w, self, "contact_info_v2", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
16563 3 : fd_gossip_contact_info_v2_walk( w, &self->inner.contact_info_v2, fun, "contact_info_v2", level, 0 );
16564 3 : break;
16565 0 : }
16566 0 : case 12: {
16567 0 : fun( w, self, "restart_last_voted_fork_slots", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
16568 0 : fd_gossip_restart_last_voted_fork_slots_walk( w, &self->inner.restart_last_voted_fork_slots, fun, "restart_last_voted_fork_slots", level, 0 );
16569 0 : break;
16570 0 : }
16571 0 : case 13: {
16572 0 : fun( w, self, "restart_heaviest_fork", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
16573 0 : fd_gossip_restart_heaviest_fork_walk( w, &self->inner.restart_heaviest_fork, fun, "restart_heaviest_fork", level, 0 );
16574 0 : break;
16575 0 : }
16576 30 : }
16577 30 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_crds_data", level--, 0 );
16578 30 : }
16579 0 : ulong fd_crds_data_size( fd_crds_data_t const * self ) {
16580 0 : ulong size = 0;
16581 0 : size += sizeof(uint);
16582 0 : switch (self->discriminant) {
16583 0 : case 0: {
16584 0 : size += fd_gossip_contact_info_v1_size( &self->inner.contact_info_v1 );
16585 0 : break;
16586 0 : }
16587 0 : case 1: {
16588 0 : size += fd_gossip_vote_old_size( &self->inner.vote );
16589 0 : break;
16590 0 : }
16591 0 : case 2: {
16592 0 : size += fd_gossip_lowest_slot_size( &self->inner.lowest_slot );
16593 0 : break;
16594 0 : }
16595 0 : case 3: {
16596 0 : size += fd_gossip_slot_hashes_size( &self->inner.snapshot_hashes );
16597 0 : break;
16598 0 : }
16599 0 : case 4: {
16600 0 : size += fd_gossip_slot_hashes_size( &self->inner.accounts_hashes );
16601 0 : break;
16602 0 : }
16603 0 : case 5: {
16604 0 : size += fd_gossip_epoch_slots_size( &self->inner.epoch_slots );
16605 0 : break;
16606 0 : }
16607 0 : case 6: {
16608 0 : size += fd_gossip_version_v1_size( &self->inner.version_v1 );
16609 0 : break;
16610 0 : }
16611 0 : case 7: {
16612 0 : size += fd_gossip_version_v2_size( &self->inner.version_v2 );
16613 0 : break;
16614 0 : }
16615 0 : case 8: {
16616 0 : size += fd_gossip_node_instance_size( &self->inner.node_instance );
16617 0 : break;
16618 0 : }
16619 0 : case 9: {
16620 0 : size += fd_gossip_duplicate_shred_old_size( &self->inner.duplicate_shred );
16621 0 : break;
16622 0 : }
16623 0 : case 10: {
16624 0 : size += fd_gossip_incremental_snapshot_hashes_size( &self->inner.incremental_snapshot_hashes );
16625 0 : break;
16626 0 : }
16627 0 : case 11: {
16628 0 : size += fd_gossip_contact_info_v2_size( &self->inner.contact_info_v2 );
16629 0 : break;
16630 0 : }
16631 0 : case 12: {
16632 0 : size += fd_gossip_restart_last_voted_fork_slots_size( &self->inner.restart_last_voted_fork_slots );
16633 0 : break;
16634 0 : }
16635 0 : case 13: {
16636 0 : size += fd_gossip_restart_heaviest_fork_size( &self->inner.restart_heaviest_fork );
16637 0 : break;
16638 0 : }
16639 0 : }
16640 0 : return size;
16641 0 : }
16642 :
16643 0 : int fd_crds_data_inner_encode( fd_crds_data_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
16644 0 : int err;
16645 0 : switch (discriminant) {
16646 0 : case 0: {
16647 0 : err = fd_gossip_contact_info_v1_encode( &self->contact_info_v1, ctx );
16648 0 : if( FD_UNLIKELY( err ) ) return err;
16649 0 : break;
16650 0 : }
16651 0 : case 1: {
16652 0 : err = fd_gossip_vote_old_encode( &self->vote, ctx );
16653 0 : if( FD_UNLIKELY( err ) ) return err;
16654 0 : break;
16655 0 : }
16656 0 : case 2: {
16657 0 : err = fd_gossip_lowest_slot_encode( &self->lowest_slot, ctx );
16658 0 : if( FD_UNLIKELY( err ) ) return err;
16659 0 : break;
16660 0 : }
16661 0 : case 3: {
16662 0 : err = fd_gossip_slot_hashes_encode( &self->snapshot_hashes, ctx );
16663 0 : if( FD_UNLIKELY( err ) ) return err;
16664 0 : break;
16665 0 : }
16666 0 : case 4: {
16667 0 : err = fd_gossip_slot_hashes_encode( &self->accounts_hashes, ctx );
16668 0 : if( FD_UNLIKELY( err ) ) return err;
16669 0 : break;
16670 0 : }
16671 0 : case 5: {
16672 0 : err = fd_gossip_epoch_slots_encode( &self->epoch_slots, ctx );
16673 0 : if( FD_UNLIKELY( err ) ) return err;
16674 0 : break;
16675 0 : }
16676 0 : case 6: {
16677 0 : err = fd_gossip_version_v1_encode( &self->version_v1, ctx );
16678 0 : if( FD_UNLIKELY( err ) ) return err;
16679 0 : break;
16680 0 : }
16681 0 : case 7: {
16682 0 : err = fd_gossip_version_v2_encode( &self->version_v2, ctx );
16683 0 : if( FD_UNLIKELY( err ) ) return err;
16684 0 : break;
16685 0 : }
16686 0 : case 8: {
16687 0 : err = fd_gossip_node_instance_encode( &self->node_instance, ctx );
16688 0 : if( FD_UNLIKELY( err ) ) return err;
16689 0 : break;
16690 0 : }
16691 0 : case 9: {
16692 0 : err = fd_gossip_duplicate_shred_old_encode( &self->duplicate_shred, ctx );
16693 0 : if( FD_UNLIKELY( err ) ) return err;
16694 0 : break;
16695 0 : }
16696 0 : case 10: {
16697 0 : err = fd_gossip_incremental_snapshot_hashes_encode( &self->incremental_snapshot_hashes, ctx );
16698 0 : if( FD_UNLIKELY( err ) ) return err;
16699 0 : break;
16700 0 : }
16701 0 : case 11: {
16702 0 : err = fd_gossip_contact_info_v2_encode( &self->contact_info_v2, ctx );
16703 0 : if( FD_UNLIKELY( err ) ) return err;
16704 0 : break;
16705 0 : }
16706 0 : case 12: {
16707 0 : err = fd_gossip_restart_last_voted_fork_slots_encode( &self->restart_last_voted_fork_slots, ctx );
16708 0 : if( FD_UNLIKELY( err ) ) return err;
16709 0 : break;
16710 0 : }
16711 0 : case 13: {
16712 0 : err = fd_gossip_restart_heaviest_fork_encode( &self->restart_heaviest_fork, ctx );
16713 0 : if( FD_UNLIKELY( err ) ) return err;
16714 0 : break;
16715 0 : }
16716 0 : }
16717 0 : return FD_BINCODE_SUCCESS;
16718 0 : }
16719 0 : int fd_crds_data_encode( fd_crds_data_t const * self, fd_bincode_encode_ctx_t * ctx ) {
16720 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
16721 0 : if( FD_UNLIKELY( err ) ) return err;
16722 0 : return fd_crds_data_inner_encode( &self->inner, self->discriminant, ctx );
16723 0 : }
16724 :
16725 0 : int fd_crds_bloom_encode( fd_crds_bloom_t const * self, fd_bincode_encode_ctx_t * ctx ) {
16726 0 : int err;
16727 0 : err = fd_bincode_uint64_encode( self->keys_len, ctx );
16728 0 : if( FD_UNLIKELY(err) ) return err;
16729 0 : if( self->keys_len ) {
16730 0 : for( ulong i=0; i < self->keys_len; i++ ) {
16731 0 : err = fd_bincode_uint64_encode( self->keys[i], ctx );
16732 0 : }
16733 0 : }
16734 0 : err = fd_bincode_bool_encode( self->has_bits, ctx );
16735 0 : if( FD_UNLIKELY( err ) ) return err;
16736 0 : if( self->has_bits ) {
16737 0 : err = fd_bincode_uint64_encode( self->bits_bitvec_len, ctx );
16738 0 : if( FD_UNLIKELY(err) ) return err;
16739 0 : if( self->bits_bitvec_len ) {
16740 0 : for( ulong i=0; i < self->bits_bitvec_len; i++ ) {
16741 0 : err = fd_bincode_uint64_encode( self->bits_bitvec[i], ctx );
16742 0 : }
16743 0 : }
16744 0 : if( FD_UNLIKELY( err ) ) return err;
16745 0 : }
16746 0 : err = fd_bincode_uint64_encode( self->bits_len, ctx );
16747 0 : if( FD_UNLIKELY( err ) ) return err;
16748 0 : err = fd_bincode_uint64_encode( self->num_bits_set, ctx );
16749 0 : if( FD_UNLIKELY( err ) ) return err;
16750 0 : return FD_BINCODE_SUCCESS;
16751 0 : }
16752 3 : static int fd_crds_bloom_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
16753 3 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
16754 3 : int err = 0;
16755 3 : ulong keys_len;
16756 3 : err = fd_bincode_uint64_decode( &keys_len, ctx );
16757 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
16758 3 : if( keys_len ) {
16759 3 : *total_sz += 8UL + sizeof(ulong)*keys_len;
16760 12 : for( ulong i=0; i < keys_len; i++ ) {
16761 9 : err = fd_bincode_uint64_decode_footprint( ctx );
16762 9 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
16763 9 : }
16764 3 : }
16765 3 : {
16766 3 : uchar o;
16767 3 : ulong inner_len = 0UL;
16768 3 : err = fd_bincode_bool_decode( &o, ctx );
16769 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
16770 3 : if( o ) {
16771 3 : ulong bits_bitvec_len;
16772 3 : err = fd_bincode_uint64_decode( &bits_bitvec_len, ctx );
16773 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
16774 3 : if( bits_bitvec_len ) {
16775 3 : *total_sz += 8UL + sizeof(ulong)*bits_bitvec_len;
16776 294 : for( ulong i=0; i < bits_bitvec_len; i++ ) {
16777 291 : err = fd_bincode_uint64_decode_footprint( ctx );
16778 291 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
16779 291 : }
16780 3 : }
16781 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
16782 3 : inner_len = bits_bitvec_len;
16783 3 : if( inner_len==0 ) return FD_BINCODE_ERR_ENCODING;
16784 3 : }
16785 3 : ulong len;
16786 3 : err = fd_bincode_uint64_decode( &len, ctx );
16787 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
16788 3 : if( len > inner_len * sizeof(ulong) * 8UL ) return FD_BINCODE_ERR_ENCODING;
16789 3 : }
16790 3 : err = fd_bincode_uint64_decode_footprint( ctx );
16791 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
16792 3 : return 0;
16793 3 : }
16794 0 : int fd_crds_bloom_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
16795 0 : *total_sz += sizeof(fd_crds_bloom_t);
16796 0 : void const * start_data = ctx->data;
16797 0 : int err = fd_crds_bloom_decode_footprint_inner( ctx, total_sz );
16798 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
16799 0 : ctx->data = start_data;
16800 0 : return err;
16801 0 : }
16802 3 : static void fd_crds_bloom_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
16803 3 : fd_crds_bloom_t * self = (fd_crds_bloom_t *)struct_mem;
16804 3 : fd_bincode_uint64_decode_unsafe( &self->keys_len, ctx );
16805 3 : if( self->keys_len ) {
16806 3 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), 8UL );
16807 3 : self->keys = *alloc_mem;
16808 3 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(ulong)*self->keys_len;
16809 12 : for( ulong i=0; i < self->keys_len; i++ ) {
16810 9 : fd_bincode_uint64_decode_unsafe( self->keys + i, ctx );
16811 9 : }
16812 3 : } else
16813 0 : self->keys = NULL;
16814 3 : {
16815 3 : uchar o;
16816 3 : fd_bincode_bool_decode_unsafe( &o, ctx );
16817 3 : self->has_bits = !!o;
16818 3 : if( o ) {
16819 3 : fd_bincode_uint64_decode_unsafe( &self->bits_bitvec_len, ctx );
16820 3 : if( self->bits_bitvec_len ) {
16821 3 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), 8UL );
16822 3 : self->bits_bitvec = *alloc_mem;
16823 3 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(ulong)*self->bits_bitvec_len;
16824 294 : for( ulong i=0; i < self->bits_bitvec_len; i++ ) {
16825 291 : fd_bincode_uint64_decode_unsafe( self->bits_bitvec + i, ctx );
16826 291 : }
16827 3 : } else
16828 0 : self->bits_bitvec = NULL;
16829 3 : } else {
16830 0 : self->bits_bitvec = NULL;
16831 0 : }
16832 3 : fd_bincode_uint64_decode_unsafe( &self->bits_len, ctx );
16833 3 : }
16834 3 : fd_bincode_uint64_decode_unsafe( &self->num_bits_set, ctx );
16835 3 : }
16836 0 : void * fd_crds_bloom_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
16837 0 : fd_crds_bloom_t * self = (fd_crds_bloom_t *)mem;
16838 0 : fd_crds_bloom_new( self );
16839 0 : void * alloc_region = (uchar *)mem + sizeof(fd_crds_bloom_t);
16840 0 : void * * alloc_mem = &alloc_region;
16841 0 : fd_crds_bloom_decode_inner( mem, alloc_mem, ctx );
16842 0 : return self;
16843 0 : }
16844 0 : void fd_crds_bloom_new(fd_crds_bloom_t * self) {
16845 0 : fd_memset( self, 0, sizeof(fd_crds_bloom_t) );
16846 0 : }
16847 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, uint varint ) {
16848 3 : (void) varint;
16849 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_crds_bloom", level++, 0 );
16850 3 : if( self->keys_len ) {
16851 3 : fun( w, NULL, "keys", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
16852 12 : for( ulong i=0; i < self->keys_len; i++ )
16853 9 : fun( w, self->keys + i, "keys", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
16854 3 : fun( w, NULL, "keys", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
16855 3 : }
16856 3 : if( !self->has_bits ) {
16857 0 : fun( w, NULL, "bits", FD_FLAMENCO_TYPE_NULL, "ulong", level, 0 );
16858 3 : } else {
16859 3 : if( self->bits_bitvec_len ) {
16860 3 : fun( w, NULL, "bits_bitvec", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
16861 294 : for( ulong i=0; i < self->bits_bitvec_len; i++ )
16862 291 : fun( w, self->bits_bitvec + i, "bits_bitvec", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
16863 3 : fun( w, NULL, "bits_bitvec", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
16864 3 : }
16865 3 : }
16866 3 : fun( w, &self->bits_len, "bits_len", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
16867 3 : fun( w, &self->num_bits_set, "num_bits_set", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
16868 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_crds_bloom", level--, 0 );
16869 3 : }
16870 0 : ulong fd_crds_bloom_size( fd_crds_bloom_t const * self ) {
16871 0 : ulong size = 0;
16872 0 : do {
16873 0 : size += sizeof(ulong);
16874 0 : size += self->keys_len * sizeof(ulong);
16875 0 : } while(0);
16876 0 : size += sizeof(char);
16877 0 : if( self->has_bits ) {
16878 0 : do {
16879 0 : size += sizeof(ulong);
16880 0 : size += self->bits_bitvec_len * sizeof(ulong);
16881 0 : } while(0);
16882 0 : }
16883 0 : size += sizeof(ulong);
16884 0 : size += sizeof(ulong);
16885 0 : return size;
16886 0 : }
16887 :
16888 0 : int fd_crds_filter_encode( fd_crds_filter_t const * self, fd_bincode_encode_ctx_t * ctx ) {
16889 0 : int err;
16890 0 : err = fd_crds_bloom_encode( &self->filter, ctx );
16891 0 : if( FD_UNLIKELY( err ) ) return err;
16892 0 : err = fd_bincode_uint64_encode( self->mask, ctx );
16893 0 : if( FD_UNLIKELY( err ) ) return err;
16894 0 : err = fd_bincode_uint32_encode( self->mask_bits, ctx );
16895 0 : if( FD_UNLIKELY( err ) ) return err;
16896 0 : return FD_BINCODE_SUCCESS;
16897 0 : }
16898 3 : static int fd_crds_filter_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
16899 3 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
16900 3 : int err = 0;
16901 3 : err = fd_crds_bloom_decode_footprint_inner( ctx, total_sz );
16902 3 : if( FD_UNLIKELY( err ) ) return err;
16903 3 : err = fd_bincode_uint64_decode_footprint( ctx );
16904 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
16905 3 : err = fd_bincode_uint32_decode_footprint( ctx );
16906 3 : if( FD_UNLIKELY( err ) ) return err;
16907 3 : return 0;
16908 3 : }
16909 0 : int fd_crds_filter_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
16910 0 : *total_sz += sizeof(fd_crds_filter_t);
16911 0 : void const * start_data = ctx->data;
16912 0 : int err = fd_crds_filter_decode_footprint_inner( ctx, total_sz );
16913 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
16914 0 : ctx->data = start_data;
16915 0 : return err;
16916 0 : }
16917 3 : static void fd_crds_filter_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
16918 3 : fd_crds_filter_t * self = (fd_crds_filter_t *)struct_mem;
16919 3 : fd_crds_bloom_decode_inner( &self->filter, alloc_mem, ctx );
16920 3 : fd_bincode_uint64_decode_unsafe( &self->mask, ctx );
16921 3 : fd_bincode_uint32_decode_unsafe( &self->mask_bits, ctx );
16922 3 : }
16923 0 : void * fd_crds_filter_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
16924 0 : fd_crds_filter_t * self = (fd_crds_filter_t *)mem;
16925 0 : fd_crds_filter_new( self );
16926 0 : void * alloc_region = (uchar *)mem + sizeof(fd_crds_filter_t);
16927 0 : void * * alloc_mem = &alloc_region;
16928 0 : fd_crds_filter_decode_inner( mem, alloc_mem, ctx );
16929 0 : return self;
16930 0 : }
16931 0 : void fd_crds_filter_new(fd_crds_filter_t * self) {
16932 0 : fd_memset( self, 0, sizeof(fd_crds_filter_t) );
16933 0 : fd_crds_bloom_new( &self->filter );
16934 0 : }
16935 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, uint varint ) {
16936 3 : (void) varint;
16937 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_crds_filter", level++, 0 );
16938 3 : fd_crds_bloom_walk( w, &self->filter, fun, "filter", level, 0 );
16939 3 : fun( w, &self->mask, "mask", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
16940 3 : fun( w, &self->mask_bits, "mask_bits", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
16941 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_crds_filter", level--, 0 );
16942 3 : }
16943 0 : ulong fd_crds_filter_size( fd_crds_filter_t const * self ) {
16944 0 : ulong size = 0;
16945 0 : size += fd_crds_bloom_size( &self->filter );
16946 0 : size += sizeof(ulong);
16947 0 : size += sizeof(uint);
16948 0 : return size;
16949 0 : }
16950 :
16951 0 : int fd_crds_value_encode( fd_crds_value_t const * self, fd_bincode_encode_ctx_t * ctx ) {
16952 0 : int err;
16953 0 : err = fd_signature_encode( &self->signature, ctx );
16954 0 : if( FD_UNLIKELY( err ) ) return err;
16955 0 : err = fd_crds_data_encode( &self->data, ctx );
16956 0 : if( FD_UNLIKELY( err ) ) return err;
16957 0 : return FD_BINCODE_SUCCESS;
16958 0 : }
16959 30 : static int fd_crds_value_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
16960 30 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
16961 30 : int err = 0;
16962 30 : err = fd_signature_decode_footprint_inner( ctx, total_sz );
16963 30 : if( FD_UNLIKELY( err ) ) return err;
16964 30 : err = fd_crds_data_decode_footprint_inner( ctx, total_sz );
16965 30 : if( FD_UNLIKELY( err ) ) return err;
16966 30 : return 0;
16967 30 : }
16968 0 : int fd_crds_value_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
16969 0 : *total_sz += sizeof(fd_crds_value_t);
16970 0 : void const * start_data = ctx->data;
16971 0 : int err = fd_crds_value_decode_footprint_inner( ctx, total_sz );
16972 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
16973 0 : ctx->data = start_data;
16974 0 : return err;
16975 0 : }
16976 30 : static void fd_crds_value_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
16977 30 : fd_crds_value_t * self = (fd_crds_value_t *)struct_mem;
16978 30 : fd_signature_decode_inner( &self->signature, alloc_mem, ctx );
16979 30 : fd_crds_data_decode_inner( &self->data, alloc_mem, ctx );
16980 30 : }
16981 0 : void * fd_crds_value_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
16982 0 : fd_crds_value_t * self = (fd_crds_value_t *)mem;
16983 0 : fd_crds_value_new( self );
16984 0 : void * alloc_region = (uchar *)mem + sizeof(fd_crds_value_t);
16985 0 : void * * alloc_mem = &alloc_region;
16986 0 : fd_crds_value_decode_inner( mem, alloc_mem, ctx );
16987 0 : return self;
16988 0 : }
16989 27 : void fd_crds_value_new(fd_crds_value_t * self) {
16990 27 : fd_memset( self, 0, sizeof(fd_crds_value_t) );
16991 27 : fd_signature_new( &self->signature );
16992 27 : fd_crds_data_new( &self->data );
16993 27 : }
16994 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, uint varint ) {
16995 30 : (void) varint;
16996 30 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_crds_value", level++, 0 );
16997 30 : fd_signature_walk( w, &self->signature, fun, "signature", level, 0 );
16998 30 : fd_crds_data_walk( w, &self->data, fun, "data", level, 0 );
16999 30 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_crds_value", level--, 0 );
17000 30 : }
17001 0 : ulong fd_crds_value_size( fd_crds_value_t const * self ) {
17002 0 : ulong size = 0;
17003 0 : size += fd_signature_size( &self->signature );
17004 0 : size += fd_crds_data_size( &self->data );
17005 0 : return size;
17006 0 : }
17007 :
17008 0 : int fd_gossip_pull_req_encode( fd_gossip_pull_req_t const * self, fd_bincode_encode_ctx_t * ctx ) {
17009 0 : int err;
17010 0 : err = fd_crds_filter_encode( &self->filter, ctx );
17011 0 : if( FD_UNLIKELY( err ) ) return err;
17012 0 : err = fd_crds_value_encode( &self->value, ctx );
17013 0 : if( FD_UNLIKELY( err ) ) return err;
17014 0 : return FD_BINCODE_SUCCESS;
17015 0 : }
17016 3 : static int fd_gossip_pull_req_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
17017 3 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
17018 3 : int err = 0;
17019 3 : err = fd_crds_filter_decode_footprint_inner( ctx, total_sz );
17020 3 : if( FD_UNLIKELY( err ) ) return err;
17021 3 : err = fd_crds_value_decode_footprint_inner( ctx, total_sz );
17022 3 : if( FD_UNLIKELY( err ) ) return err;
17023 3 : return 0;
17024 3 : }
17025 0 : int fd_gossip_pull_req_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
17026 0 : *total_sz += sizeof(fd_gossip_pull_req_t);
17027 0 : void const * start_data = ctx->data;
17028 0 : int err = fd_gossip_pull_req_decode_footprint_inner( ctx, total_sz );
17029 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
17030 0 : ctx->data = start_data;
17031 0 : return err;
17032 0 : }
17033 3 : static void fd_gossip_pull_req_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
17034 3 : fd_gossip_pull_req_t * self = (fd_gossip_pull_req_t *)struct_mem;
17035 3 : fd_crds_filter_decode_inner( &self->filter, alloc_mem, ctx );
17036 3 : fd_crds_value_decode_inner( &self->value, alloc_mem, ctx );
17037 3 : }
17038 0 : void * fd_gossip_pull_req_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
17039 0 : fd_gossip_pull_req_t * self = (fd_gossip_pull_req_t *)mem;
17040 0 : fd_gossip_pull_req_new( self );
17041 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_pull_req_t);
17042 0 : void * * alloc_mem = &alloc_region;
17043 0 : fd_gossip_pull_req_decode_inner( mem, alloc_mem, ctx );
17044 0 : return self;
17045 0 : }
17046 0 : void fd_gossip_pull_req_new(fd_gossip_pull_req_t * self) {
17047 0 : fd_memset( self, 0, sizeof(fd_gossip_pull_req_t) );
17048 0 : fd_crds_filter_new( &self->filter );
17049 0 : fd_crds_value_new( &self->value );
17050 0 : }
17051 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, uint varint ) {
17052 3 : (void) varint;
17053 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_pull_req", level++, 0 );
17054 3 : fd_crds_filter_walk( w, &self->filter, fun, "filter", level, 0 );
17055 3 : fd_crds_value_walk( w, &self->value, fun, "value", level, 0 );
17056 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_pull_req", level--, 0 );
17057 3 : }
17058 0 : ulong fd_gossip_pull_req_size( fd_gossip_pull_req_t const * self ) {
17059 0 : ulong size = 0;
17060 0 : size += fd_crds_filter_size( &self->filter );
17061 0 : size += fd_crds_value_size( &self->value );
17062 0 : return size;
17063 0 : }
17064 :
17065 0 : int fd_gossip_pull_resp_encode( fd_gossip_pull_resp_t const * self, fd_bincode_encode_ctx_t * ctx ) {
17066 0 : int err;
17067 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
17068 0 : if( FD_UNLIKELY( err ) ) return err;
17069 0 : err = fd_bincode_uint64_encode( self->crds_len, ctx );
17070 0 : if( FD_UNLIKELY(err) ) return err;
17071 0 : if( self->crds_len ) {
17072 0 : for( ulong i=0; i < self->crds_len; i++ ) {
17073 0 : err = fd_crds_value_encode( self->crds + i, ctx );
17074 0 : if( FD_UNLIKELY( err ) ) return err;
17075 0 : }
17076 0 : }
17077 0 : return FD_BINCODE_SUCCESS;
17078 0 : }
17079 12 : static int fd_gossip_pull_resp_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
17080 12 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
17081 12 : int err = 0;
17082 12 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
17083 12 : if( FD_UNLIKELY( err ) ) return err;
17084 12 : ulong crds_len;
17085 12 : err = fd_bincode_uint64_decode( &crds_len, ctx );
17086 12 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
17087 12 : if( crds_len ) {
17088 12 : *total_sz += FD_CRDS_VALUE_ALIGN + sizeof(fd_crds_value_t)*crds_len;
17089 24 : for( ulong i=0; i < crds_len; i++ ) {
17090 12 : err = fd_crds_value_decode_footprint_inner( ctx, total_sz );
17091 12 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
17092 12 : }
17093 12 : }
17094 12 : return 0;
17095 12 : }
17096 0 : int fd_gossip_pull_resp_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
17097 0 : *total_sz += sizeof(fd_gossip_pull_resp_t);
17098 0 : void const * start_data = ctx->data;
17099 0 : int err = fd_gossip_pull_resp_decode_footprint_inner( ctx, total_sz );
17100 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
17101 0 : ctx->data = start_data;
17102 0 : return err;
17103 0 : }
17104 12 : static void fd_gossip_pull_resp_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
17105 12 : fd_gossip_pull_resp_t * self = (fd_gossip_pull_resp_t *)struct_mem;
17106 12 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
17107 12 : fd_bincode_uint64_decode_unsafe( &self->crds_len, ctx );
17108 12 : if( self->crds_len ) {
17109 12 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_CRDS_VALUE_ALIGN );
17110 12 : self->crds = *alloc_mem;
17111 12 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_crds_value_t)*self->crds_len;
17112 24 : for( ulong i=0; i < self->crds_len; i++ ) {
17113 12 : fd_crds_value_new( self->crds + i );
17114 12 : fd_crds_value_decode_inner( self->crds + i, alloc_mem, ctx );
17115 12 : }
17116 12 : } else
17117 0 : self->crds = NULL;
17118 12 : }
17119 0 : void * fd_gossip_pull_resp_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
17120 0 : fd_gossip_pull_resp_t * self = (fd_gossip_pull_resp_t *)mem;
17121 0 : fd_gossip_pull_resp_new( self );
17122 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_pull_resp_t);
17123 0 : void * * alloc_mem = &alloc_region;
17124 0 : fd_gossip_pull_resp_decode_inner( mem, alloc_mem, ctx );
17125 0 : return self;
17126 0 : }
17127 0 : void fd_gossip_pull_resp_new(fd_gossip_pull_resp_t * self) {
17128 0 : fd_memset( self, 0, sizeof(fd_gossip_pull_resp_t) );
17129 0 : fd_pubkey_new( &self->pubkey );
17130 0 : }
17131 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, uint varint ) {
17132 12 : (void) varint;
17133 12 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_pull_resp", level++, 0 );
17134 12 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level, 0 );
17135 12 : if( self->crds_len ) {
17136 12 : fun( w, NULL, "crds", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
17137 24 : for( ulong i=0; i < self->crds_len; i++ )
17138 12 : fd_crds_value_walk(w, self->crds + i, fun, "crds_value", level, 0 );
17139 12 : fun( w, NULL, "crds", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
17140 12 : }
17141 12 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_pull_resp", level--, 0 );
17142 12 : }
17143 0 : ulong fd_gossip_pull_resp_size( fd_gossip_pull_resp_t const * self ) {
17144 0 : ulong size = 0;
17145 0 : size += fd_pubkey_size( &self->pubkey );
17146 0 : do {
17147 0 : size += sizeof(ulong);
17148 0 : for( ulong i=0; i < self->crds_len; i++ )
17149 0 : size += fd_crds_value_size( self->crds + i );
17150 0 : } while(0);
17151 0 : return size;
17152 0 : }
17153 :
17154 0 : int fd_gossip_push_msg_encode( fd_gossip_push_msg_t const * self, fd_bincode_encode_ctx_t * ctx ) {
17155 0 : int err;
17156 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
17157 0 : if( FD_UNLIKELY( err ) ) return err;
17158 0 : err = fd_bincode_uint64_encode( self->crds_len, ctx );
17159 0 : if( FD_UNLIKELY(err) ) return err;
17160 0 : if( self->crds_len ) {
17161 0 : for( ulong i=0; i < self->crds_len; i++ ) {
17162 0 : err = fd_crds_value_encode( self->crds + i, ctx );
17163 0 : if( FD_UNLIKELY( err ) ) return err;
17164 0 : }
17165 0 : }
17166 0 : return FD_BINCODE_SUCCESS;
17167 0 : }
17168 6 : static int fd_gossip_push_msg_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
17169 6 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
17170 6 : int err = 0;
17171 6 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
17172 6 : if( FD_UNLIKELY( err ) ) return err;
17173 6 : ulong crds_len;
17174 6 : err = fd_bincode_uint64_decode( &crds_len, ctx );
17175 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
17176 6 : if( crds_len ) {
17177 6 : *total_sz += FD_CRDS_VALUE_ALIGN + sizeof(fd_crds_value_t)*crds_len;
17178 21 : for( ulong i=0; i < crds_len; i++ ) {
17179 15 : err = fd_crds_value_decode_footprint_inner( ctx, total_sz );
17180 15 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
17181 15 : }
17182 6 : }
17183 6 : return 0;
17184 6 : }
17185 0 : int fd_gossip_push_msg_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
17186 0 : *total_sz += sizeof(fd_gossip_push_msg_t);
17187 0 : void const * start_data = ctx->data;
17188 0 : int err = fd_gossip_push_msg_decode_footprint_inner( ctx, total_sz );
17189 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
17190 0 : ctx->data = start_data;
17191 0 : return err;
17192 0 : }
17193 6 : static void fd_gossip_push_msg_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
17194 6 : fd_gossip_push_msg_t * self = (fd_gossip_push_msg_t *)struct_mem;
17195 6 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
17196 6 : fd_bincode_uint64_decode_unsafe( &self->crds_len, ctx );
17197 6 : if( self->crds_len ) {
17198 6 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_CRDS_VALUE_ALIGN );
17199 6 : self->crds = *alloc_mem;
17200 6 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_crds_value_t)*self->crds_len;
17201 21 : for( ulong i=0; i < self->crds_len; i++ ) {
17202 15 : fd_crds_value_new( self->crds + i );
17203 15 : fd_crds_value_decode_inner( self->crds + i, alloc_mem, ctx );
17204 15 : }
17205 6 : } else
17206 0 : self->crds = NULL;
17207 6 : }
17208 0 : void * fd_gossip_push_msg_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
17209 0 : fd_gossip_push_msg_t * self = (fd_gossip_push_msg_t *)mem;
17210 0 : fd_gossip_push_msg_new( self );
17211 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_push_msg_t);
17212 0 : void * * alloc_mem = &alloc_region;
17213 0 : fd_gossip_push_msg_decode_inner( mem, alloc_mem, ctx );
17214 0 : return self;
17215 0 : }
17216 0 : void fd_gossip_push_msg_new(fd_gossip_push_msg_t * self) {
17217 0 : fd_memset( self, 0, sizeof(fd_gossip_push_msg_t) );
17218 0 : fd_pubkey_new( &self->pubkey );
17219 0 : }
17220 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, uint varint ) {
17221 6 : (void) varint;
17222 6 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_push_msg", level++, 0 );
17223 6 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level, 0 );
17224 6 : if( self->crds_len ) {
17225 6 : fun( w, NULL, "crds", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
17226 21 : for( ulong i=0; i < self->crds_len; i++ )
17227 15 : fd_crds_value_walk(w, self->crds + i, fun, "crds_value", level, 0 );
17228 6 : fun( w, NULL, "crds", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
17229 6 : }
17230 6 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_push_msg", level--, 0 );
17231 6 : }
17232 0 : ulong fd_gossip_push_msg_size( fd_gossip_push_msg_t const * self ) {
17233 0 : ulong size = 0;
17234 0 : size += fd_pubkey_size( &self->pubkey );
17235 0 : do {
17236 0 : size += sizeof(ulong);
17237 0 : for( ulong i=0; i < self->crds_len; i++ )
17238 0 : size += fd_crds_value_size( self->crds + i );
17239 0 : } while(0);
17240 0 : return size;
17241 0 : }
17242 :
17243 0 : int fd_gossip_prune_msg_encode( fd_gossip_prune_msg_t const * self, fd_bincode_encode_ctx_t * ctx ) {
17244 0 : int err;
17245 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
17246 0 : if( FD_UNLIKELY( err ) ) return err;
17247 0 : err = fd_gossip_prune_data_encode( &self->data, ctx );
17248 0 : if( FD_UNLIKELY( err ) ) return err;
17249 0 : return FD_BINCODE_SUCCESS;
17250 0 : }
17251 0 : static int fd_gossip_prune_msg_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
17252 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
17253 0 : int err = 0;
17254 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
17255 0 : if( FD_UNLIKELY( err ) ) return err;
17256 0 : err = fd_gossip_prune_data_decode_footprint_inner( ctx, total_sz );
17257 0 : if( FD_UNLIKELY( err ) ) return err;
17258 0 : return 0;
17259 0 : }
17260 0 : int fd_gossip_prune_msg_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
17261 0 : *total_sz += sizeof(fd_gossip_prune_msg_t);
17262 0 : void const * start_data = ctx->data;
17263 0 : int err = fd_gossip_prune_msg_decode_footprint_inner( ctx, total_sz );
17264 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
17265 0 : ctx->data = start_data;
17266 0 : return err;
17267 0 : }
17268 0 : static void fd_gossip_prune_msg_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
17269 0 : fd_gossip_prune_msg_t * self = (fd_gossip_prune_msg_t *)struct_mem;
17270 0 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
17271 0 : fd_gossip_prune_data_decode_inner( &self->data, alloc_mem, ctx );
17272 0 : }
17273 0 : void * fd_gossip_prune_msg_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
17274 0 : fd_gossip_prune_msg_t * self = (fd_gossip_prune_msg_t *)mem;
17275 0 : fd_gossip_prune_msg_new( self );
17276 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_prune_msg_t);
17277 0 : void * * alloc_mem = &alloc_region;
17278 0 : fd_gossip_prune_msg_decode_inner( mem, alloc_mem, ctx );
17279 0 : return self;
17280 0 : }
17281 0 : void fd_gossip_prune_msg_new(fd_gossip_prune_msg_t * self) {
17282 0 : fd_memset( self, 0, sizeof(fd_gossip_prune_msg_t) );
17283 0 : fd_pubkey_new( &self->pubkey );
17284 0 : fd_gossip_prune_data_new( &self->data );
17285 0 : }
17286 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, uint varint ) {
17287 0 : (void) varint;
17288 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_prune_msg", level++, 0 );
17289 0 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level, 0 );
17290 0 : fd_gossip_prune_data_walk( w, &self->data, fun, "data", level, 0 );
17291 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_prune_msg", level--, 0 );
17292 0 : }
17293 0 : ulong fd_gossip_prune_msg_size( fd_gossip_prune_msg_t const * self ) {
17294 0 : ulong size = 0;
17295 0 : size += fd_pubkey_size( &self->pubkey );
17296 0 : size += fd_gossip_prune_data_size( &self->data );
17297 0 : return size;
17298 0 : }
17299 :
17300 0 : FD_FN_PURE uchar fd_gossip_msg_is_pull_req(fd_gossip_msg_t const * self) {
17301 0 : return self->discriminant == 0;
17302 0 : }
17303 0 : FD_FN_PURE uchar fd_gossip_msg_is_pull_resp(fd_gossip_msg_t const * self) {
17304 0 : return self->discriminant == 1;
17305 0 : }
17306 0 : FD_FN_PURE uchar fd_gossip_msg_is_push_msg(fd_gossip_msg_t const * self) {
17307 0 : return self->discriminant == 2;
17308 0 : }
17309 0 : FD_FN_PURE uchar fd_gossip_msg_is_prune_msg(fd_gossip_msg_t const * self) {
17310 0 : return self->discriminant == 3;
17311 0 : }
17312 0 : FD_FN_PURE uchar fd_gossip_msg_is_ping(fd_gossip_msg_t const * self) {
17313 0 : return self->discriminant == 4;
17314 0 : }
17315 0 : FD_FN_PURE uchar fd_gossip_msg_is_pong(fd_gossip_msg_t const * self) {
17316 0 : return self->discriminant == 5;
17317 0 : }
17318 : void fd_gossip_msg_inner_new( fd_gossip_msg_inner_t * self, uint discriminant );
17319 21 : int fd_gossip_msg_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
17320 21 : int err;
17321 21 : switch (discriminant) {
17322 3 : case 0: {
17323 3 : err = fd_gossip_pull_req_decode_footprint_inner( ctx, total_sz );
17324 3 : if( FD_UNLIKELY( err ) ) return err;
17325 3 : return FD_BINCODE_SUCCESS;
17326 3 : }
17327 12 : case 1: {
17328 12 : err = fd_gossip_pull_resp_decode_footprint_inner( ctx, total_sz );
17329 12 : if( FD_UNLIKELY( err ) ) return err;
17330 12 : return FD_BINCODE_SUCCESS;
17331 12 : }
17332 6 : case 2: {
17333 6 : err = fd_gossip_push_msg_decode_footprint_inner( ctx, total_sz );
17334 6 : if( FD_UNLIKELY( err ) ) return err;
17335 6 : return FD_BINCODE_SUCCESS;
17336 6 : }
17337 0 : case 3: {
17338 0 : err = fd_gossip_prune_msg_decode_footprint_inner( ctx, total_sz );
17339 0 : if( FD_UNLIKELY( err ) ) return err;
17340 0 : return FD_BINCODE_SUCCESS;
17341 0 : }
17342 0 : case 4: {
17343 0 : err = fd_gossip_ping_decode_footprint_inner( ctx, total_sz );
17344 0 : if( FD_UNLIKELY( err ) ) return err;
17345 0 : return FD_BINCODE_SUCCESS;
17346 0 : }
17347 0 : case 5: {
17348 0 : err = fd_gossip_ping_decode_footprint_inner( ctx, total_sz );
17349 0 : if( FD_UNLIKELY( err ) ) return err;
17350 0 : return FD_BINCODE_SUCCESS;
17351 0 : }
17352 0 : default: return FD_BINCODE_ERR_ENCODING;
17353 21 : }
17354 21 : }
17355 21 : static int fd_gossip_msg_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
17356 21 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
17357 21 : uint discriminant = 0;
17358 21 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
17359 21 : if( FD_UNLIKELY( err ) ) return err;
17360 21 : return fd_gossip_msg_inner_decode_footprint( discriminant, ctx, total_sz );
17361 21 : }
17362 21 : int fd_gossip_msg_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
17363 21 : *total_sz += sizeof(fd_gossip_msg_t);
17364 21 : void const * start_data = ctx->data;
17365 21 : int err = fd_gossip_msg_decode_footprint_inner( ctx, total_sz );
17366 21 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
17367 21 : ctx->data = start_data;
17368 21 : return err;
17369 21 : }
17370 21 : static void fd_gossip_msg_inner_decode_inner( fd_gossip_msg_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
17371 21 : switch (discriminant) {
17372 3 : case 0: {
17373 3 : fd_gossip_pull_req_decode_inner( &self->pull_req, alloc_mem, ctx );
17374 3 : break;
17375 0 : }
17376 12 : case 1: {
17377 12 : fd_gossip_pull_resp_decode_inner( &self->pull_resp, alloc_mem, ctx );
17378 12 : break;
17379 0 : }
17380 6 : case 2: {
17381 6 : fd_gossip_push_msg_decode_inner( &self->push_msg, alloc_mem, ctx );
17382 6 : break;
17383 0 : }
17384 0 : case 3: {
17385 0 : fd_gossip_prune_msg_decode_inner( &self->prune_msg, alloc_mem, ctx );
17386 0 : break;
17387 0 : }
17388 0 : case 4: {
17389 0 : fd_gossip_ping_decode_inner( &self->ping, alloc_mem, ctx );
17390 0 : break;
17391 0 : }
17392 0 : case 5: {
17393 0 : fd_gossip_ping_decode_inner( &self->pong, alloc_mem, ctx );
17394 0 : break;
17395 0 : }
17396 21 : }
17397 21 : }
17398 21 : static void fd_gossip_msg_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
17399 21 : fd_gossip_msg_t * self = (fd_gossip_msg_t *)struct_mem;
17400 21 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
17401 21 : fd_gossip_msg_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
17402 21 : }
17403 21 : void * fd_gossip_msg_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
17404 21 : fd_gossip_msg_t * self = (fd_gossip_msg_t *)mem;
17405 21 : fd_gossip_msg_new( self );
17406 21 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_msg_t);
17407 21 : void * * alloc_mem = &alloc_region;
17408 21 : fd_gossip_msg_decode_inner( mem, alloc_mem, ctx );
17409 21 : return self;
17410 21 : }
17411 21 : void fd_gossip_msg_inner_new( fd_gossip_msg_inner_t * self, uint discriminant ) {
17412 21 : switch( discriminant ) {
17413 0 : case 0: {
17414 0 : fd_gossip_pull_req_new( &self->pull_req );
17415 0 : break;
17416 0 : }
17417 0 : case 1: {
17418 0 : fd_gossip_pull_resp_new( &self->pull_resp );
17419 0 : break;
17420 0 : }
17421 0 : case 2: {
17422 0 : fd_gossip_push_msg_new( &self->push_msg );
17423 0 : break;
17424 0 : }
17425 0 : case 3: {
17426 0 : fd_gossip_prune_msg_new( &self->prune_msg );
17427 0 : break;
17428 0 : }
17429 0 : case 4: {
17430 0 : fd_gossip_ping_new( &self->ping );
17431 0 : break;
17432 0 : }
17433 0 : case 5: {
17434 0 : fd_gossip_ping_new( &self->pong );
17435 0 : break;
17436 0 : }
17437 21 : default: break; // FD_LOG_ERR(( "unhandled type"));
17438 21 : }
17439 21 : }
17440 21 : void fd_gossip_msg_new_disc( fd_gossip_msg_t * self, uint discriminant ) {
17441 21 : self->discriminant = discriminant;
17442 21 : fd_gossip_msg_inner_new( &self->inner, self->discriminant );
17443 21 : }
17444 21 : void fd_gossip_msg_new( fd_gossip_msg_t * self ) {
17445 21 : fd_memset( self, 0, sizeof(fd_gossip_msg_t) );
17446 21 : fd_gossip_msg_new_disc( self, UINT_MAX );
17447 21 : }
17448 :
17449 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, uint varint ) {
17450 21 : (void) varint;
17451 21 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_gossip_msg", level++, 0);
17452 21 : switch( self->discriminant ) {
17453 3 : case 0: {
17454 3 : fun( w, self, "pull_req", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
17455 3 : fd_gossip_pull_req_walk( w, &self->inner.pull_req, fun, "pull_req", level, 0 );
17456 3 : break;
17457 0 : }
17458 12 : case 1: {
17459 12 : fun( w, self, "pull_resp", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
17460 12 : fd_gossip_pull_resp_walk( w, &self->inner.pull_resp, fun, "pull_resp", level, 0 );
17461 12 : break;
17462 0 : }
17463 6 : case 2: {
17464 6 : fun( w, self, "push_msg", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
17465 6 : fd_gossip_push_msg_walk( w, &self->inner.push_msg, fun, "push_msg", level, 0 );
17466 6 : break;
17467 0 : }
17468 0 : case 3: {
17469 0 : fun( w, self, "prune_msg", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
17470 0 : fd_gossip_prune_msg_walk( w, &self->inner.prune_msg, fun, "prune_msg", level, 0 );
17471 0 : break;
17472 0 : }
17473 0 : case 4: {
17474 0 : fun( w, self, "ping", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
17475 0 : fd_gossip_ping_walk( w, &self->inner.ping, fun, "ping", level, 0 );
17476 0 : break;
17477 0 : }
17478 0 : case 5: {
17479 0 : fun( w, self, "pong", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
17480 0 : fd_gossip_ping_walk( w, &self->inner.pong, fun, "pong", level, 0 );
17481 0 : break;
17482 0 : }
17483 21 : }
17484 21 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_gossip_msg", level--, 0 );
17485 21 : }
17486 0 : ulong fd_gossip_msg_size( fd_gossip_msg_t const * self ) {
17487 0 : ulong size = 0;
17488 0 : size += sizeof(uint);
17489 0 : switch (self->discriminant) {
17490 0 : case 0: {
17491 0 : size += fd_gossip_pull_req_size( &self->inner.pull_req );
17492 0 : break;
17493 0 : }
17494 0 : case 1: {
17495 0 : size += fd_gossip_pull_resp_size( &self->inner.pull_resp );
17496 0 : break;
17497 0 : }
17498 0 : case 2: {
17499 0 : size += fd_gossip_push_msg_size( &self->inner.push_msg );
17500 0 : break;
17501 0 : }
17502 0 : case 3: {
17503 0 : size += fd_gossip_prune_msg_size( &self->inner.prune_msg );
17504 0 : break;
17505 0 : }
17506 0 : case 4: {
17507 0 : size += fd_gossip_ping_size( &self->inner.ping );
17508 0 : break;
17509 0 : }
17510 0 : case 5: {
17511 0 : size += fd_gossip_ping_size( &self->inner.pong );
17512 0 : break;
17513 0 : }
17514 0 : }
17515 0 : return size;
17516 0 : }
17517 :
17518 0 : int fd_gossip_msg_inner_encode( fd_gossip_msg_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
17519 0 : int err;
17520 0 : switch (discriminant) {
17521 0 : case 0: {
17522 0 : err = fd_gossip_pull_req_encode( &self->pull_req, ctx );
17523 0 : if( FD_UNLIKELY( err ) ) return err;
17524 0 : break;
17525 0 : }
17526 0 : case 1: {
17527 0 : err = fd_gossip_pull_resp_encode( &self->pull_resp, ctx );
17528 0 : if( FD_UNLIKELY( err ) ) return err;
17529 0 : break;
17530 0 : }
17531 0 : case 2: {
17532 0 : err = fd_gossip_push_msg_encode( &self->push_msg, ctx );
17533 0 : if( FD_UNLIKELY( err ) ) return err;
17534 0 : break;
17535 0 : }
17536 0 : case 3: {
17537 0 : err = fd_gossip_prune_msg_encode( &self->prune_msg, ctx );
17538 0 : if( FD_UNLIKELY( err ) ) return err;
17539 0 : break;
17540 0 : }
17541 0 : case 4: {
17542 0 : err = fd_gossip_ping_encode( &self->ping, ctx );
17543 0 : if( FD_UNLIKELY( err ) ) return err;
17544 0 : break;
17545 0 : }
17546 0 : case 5: {
17547 0 : err = fd_gossip_ping_encode( &self->pong, ctx );
17548 0 : if( FD_UNLIKELY( err ) ) return err;
17549 0 : break;
17550 0 : }
17551 0 : }
17552 0 : return FD_BINCODE_SUCCESS;
17553 0 : }
17554 0 : int fd_gossip_msg_encode( fd_gossip_msg_t const * self, fd_bincode_encode_ctx_t * ctx ) {
17555 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
17556 0 : if( FD_UNLIKELY( err ) ) return err;
17557 0 : return fd_gossip_msg_inner_encode( &self->inner, self->discriminant, ctx );
17558 0 : }
17559 :
17560 0 : int fd_addrlut_create_encode( fd_addrlut_create_t const * self, fd_bincode_encode_ctx_t * ctx ) {
17561 0 : int err;
17562 0 : err = fd_bincode_uint64_encode( self->recent_slot, ctx );
17563 0 : if( FD_UNLIKELY( err ) ) return err;
17564 0 : err = fd_bincode_uint8_encode( (uchar)(self->bump_seed), ctx );
17565 0 : if( FD_UNLIKELY( err ) ) return err;
17566 0 : return FD_BINCODE_SUCCESS;
17567 0 : }
17568 0 : static inline int fd_addrlut_create_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
17569 0 : if( (ulong)ctx->data + 9UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
17570 0 : ctx->data = (void *)( (ulong)ctx->data + 9UL );
17571 0 : return 0;
17572 0 : }
17573 0 : static void fd_addrlut_create_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
17574 0 : fd_addrlut_create_t * self = (fd_addrlut_create_t *)struct_mem;
17575 0 : fd_bincode_uint64_decode_unsafe( &self->recent_slot, ctx );
17576 0 : fd_bincode_uint8_decode_unsafe( &self->bump_seed, ctx );
17577 0 : }
17578 0 : void * fd_addrlut_create_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
17579 0 : fd_addrlut_create_t * self = (fd_addrlut_create_t *)mem;
17580 0 : fd_addrlut_create_new( self );
17581 0 : void * alloc_region = (uchar *)mem + sizeof(fd_addrlut_create_t);
17582 0 : void * * alloc_mem = &alloc_region;
17583 0 : fd_addrlut_create_decode_inner( mem, alloc_mem, ctx );
17584 0 : return self;
17585 0 : }
17586 0 : void fd_addrlut_create_walk( void * w, fd_addrlut_create_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
17587 0 : (void) varint;
17588 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_addrlut_create", level++, 0 );
17589 0 : fun( w, &self->recent_slot, "recent_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
17590 0 : fun( w, &self->bump_seed, "bump_seed", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
17591 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_addrlut_create", level--, 0 );
17592 0 : }
17593 0 : int fd_addrlut_extend_encode( fd_addrlut_extend_t const * self, fd_bincode_encode_ctx_t * ctx ) {
17594 0 : int err;
17595 0 : err = fd_bincode_uint64_encode( self->new_addrs_len, ctx );
17596 0 : if( FD_UNLIKELY(err) ) return err;
17597 0 : if( self->new_addrs_len ) {
17598 0 : for( ulong i=0; i < self->new_addrs_len; i++ ) {
17599 0 : err = fd_pubkey_encode( self->new_addrs + i, ctx );
17600 0 : if( FD_UNLIKELY( err ) ) return err;
17601 0 : }
17602 0 : }
17603 0 : return FD_BINCODE_SUCCESS;
17604 0 : }
17605 0 : static int fd_addrlut_extend_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
17606 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
17607 0 : int err = 0;
17608 0 : ulong new_addrs_len;
17609 0 : err = fd_bincode_uint64_decode( &new_addrs_len, ctx );
17610 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
17611 0 : if( new_addrs_len ) {
17612 0 : *total_sz += FD_PUBKEY_ALIGN + sizeof(fd_pubkey_t)*new_addrs_len;
17613 0 : for( ulong i=0; i < new_addrs_len; i++ ) {
17614 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
17615 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
17616 0 : }
17617 0 : }
17618 0 : return 0;
17619 0 : }
17620 0 : int fd_addrlut_extend_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
17621 0 : *total_sz += sizeof(fd_addrlut_extend_t);
17622 0 : void const * start_data = ctx->data;
17623 0 : int err = fd_addrlut_extend_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 : static void fd_addrlut_extend_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
17629 0 : fd_addrlut_extend_t * self = (fd_addrlut_extend_t *)struct_mem;
17630 0 : fd_bincode_uint64_decode_unsafe( &self->new_addrs_len, ctx );
17631 0 : if( self->new_addrs_len ) {
17632 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_ALIGN );
17633 0 : self->new_addrs = *alloc_mem;
17634 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_pubkey_t)*self->new_addrs_len;
17635 0 : for( ulong i=0; i < self->new_addrs_len; i++ ) {
17636 0 : fd_pubkey_new( self->new_addrs + i );
17637 0 : fd_pubkey_decode_inner( self->new_addrs + i, alloc_mem, ctx );
17638 0 : }
17639 0 : } else
17640 0 : self->new_addrs = NULL;
17641 0 : }
17642 0 : void * fd_addrlut_extend_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
17643 0 : fd_addrlut_extend_t * self = (fd_addrlut_extend_t *)mem;
17644 0 : fd_addrlut_extend_new( self );
17645 0 : void * alloc_region = (uchar *)mem + sizeof(fd_addrlut_extend_t);
17646 0 : void * * alloc_mem = &alloc_region;
17647 0 : fd_addrlut_extend_decode_inner( mem, alloc_mem, ctx );
17648 0 : return self;
17649 0 : }
17650 0 : void fd_addrlut_extend_new(fd_addrlut_extend_t * self) {
17651 0 : fd_memset( self, 0, sizeof(fd_addrlut_extend_t) );
17652 0 : }
17653 0 : void fd_addrlut_extend_walk( void * w, fd_addrlut_extend_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
17654 0 : (void) varint;
17655 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_addrlut_extend", level++, 0 );
17656 0 : if( self->new_addrs_len ) {
17657 0 : fun( w, NULL, "new_addrs", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
17658 0 : for( ulong i=0; i < self->new_addrs_len; i++ )
17659 0 : fd_pubkey_walk(w, self->new_addrs + i, fun, "pubkey", level, 0 );
17660 0 : fun( w, NULL, "new_addrs", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
17661 0 : }
17662 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_addrlut_extend", level--, 0 );
17663 0 : }
17664 0 : ulong fd_addrlut_extend_size( fd_addrlut_extend_t const * self ) {
17665 0 : ulong size = 0;
17666 0 : do {
17667 0 : size += sizeof(ulong);
17668 0 : for( ulong i=0; i < self->new_addrs_len; i++ )
17669 0 : size += fd_pubkey_size( self->new_addrs + i );
17670 0 : } while(0);
17671 0 : return size;
17672 0 : }
17673 :
17674 0 : FD_FN_PURE uchar fd_addrlut_instruction_is_create_lut(fd_addrlut_instruction_t const * self) {
17675 0 : return self->discriminant == 0;
17676 0 : }
17677 0 : FD_FN_PURE uchar fd_addrlut_instruction_is_freeze_lut(fd_addrlut_instruction_t const * self) {
17678 0 : return self->discriminant == 1;
17679 0 : }
17680 0 : FD_FN_PURE uchar fd_addrlut_instruction_is_extend_lut(fd_addrlut_instruction_t const * self) {
17681 0 : return self->discriminant == 2;
17682 0 : }
17683 0 : FD_FN_PURE uchar fd_addrlut_instruction_is_deactivate_lut(fd_addrlut_instruction_t const * self) {
17684 0 : return self->discriminant == 3;
17685 0 : }
17686 0 : FD_FN_PURE uchar fd_addrlut_instruction_is_close_lut(fd_addrlut_instruction_t const * self) {
17687 0 : return self->discriminant == 4;
17688 0 : }
17689 : void fd_addrlut_instruction_inner_new( fd_addrlut_instruction_inner_t * self, uint discriminant );
17690 0 : int fd_addrlut_instruction_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
17691 0 : int err;
17692 0 : switch (discriminant) {
17693 0 : case 0: {
17694 0 : err = fd_addrlut_create_decode_footprint_inner( ctx, total_sz );
17695 0 : if( FD_UNLIKELY( err ) ) return err;
17696 0 : return FD_BINCODE_SUCCESS;
17697 0 : }
17698 0 : case 1: {
17699 0 : return FD_BINCODE_SUCCESS;
17700 0 : }
17701 0 : case 2: {
17702 0 : err = fd_addrlut_extend_decode_footprint_inner( ctx, total_sz );
17703 0 : if( FD_UNLIKELY( err ) ) return err;
17704 0 : return FD_BINCODE_SUCCESS;
17705 0 : }
17706 0 : case 3: {
17707 0 : return FD_BINCODE_SUCCESS;
17708 0 : }
17709 0 : case 4: {
17710 0 : return FD_BINCODE_SUCCESS;
17711 0 : }
17712 0 : default: return FD_BINCODE_ERR_ENCODING;
17713 0 : }
17714 0 : }
17715 0 : static int fd_addrlut_instruction_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
17716 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
17717 0 : uint discriminant = 0;
17718 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
17719 0 : if( FD_UNLIKELY( err ) ) return err;
17720 0 : return fd_addrlut_instruction_inner_decode_footprint( discriminant, ctx, total_sz );
17721 0 : }
17722 0 : int fd_addrlut_instruction_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
17723 0 : *total_sz += sizeof(fd_addrlut_instruction_t);
17724 0 : void const * start_data = ctx->data;
17725 0 : int err = fd_addrlut_instruction_decode_footprint_inner( ctx, total_sz );
17726 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
17727 0 : ctx->data = start_data;
17728 0 : return err;
17729 0 : }
17730 0 : static void fd_addrlut_instruction_inner_decode_inner( fd_addrlut_instruction_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
17731 0 : switch (discriminant) {
17732 0 : case 0: {
17733 0 : fd_addrlut_create_decode_inner( &self->create_lut, alloc_mem, ctx );
17734 0 : break;
17735 0 : }
17736 0 : case 1: {
17737 0 : break;
17738 0 : }
17739 0 : case 2: {
17740 0 : fd_addrlut_extend_decode_inner( &self->extend_lut, alloc_mem, ctx );
17741 0 : break;
17742 0 : }
17743 0 : case 3: {
17744 0 : break;
17745 0 : }
17746 0 : case 4: {
17747 0 : break;
17748 0 : }
17749 0 : }
17750 0 : }
17751 0 : static void fd_addrlut_instruction_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
17752 0 : fd_addrlut_instruction_t * self = (fd_addrlut_instruction_t *)struct_mem;
17753 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
17754 0 : fd_addrlut_instruction_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
17755 0 : }
17756 0 : void * fd_addrlut_instruction_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
17757 0 : fd_addrlut_instruction_t * self = (fd_addrlut_instruction_t *)mem;
17758 0 : fd_addrlut_instruction_new( self );
17759 0 : void * alloc_region = (uchar *)mem + sizeof(fd_addrlut_instruction_t);
17760 0 : void * * alloc_mem = &alloc_region;
17761 0 : fd_addrlut_instruction_decode_inner( mem, alloc_mem, ctx );
17762 0 : return self;
17763 0 : }
17764 0 : void fd_addrlut_instruction_inner_new( fd_addrlut_instruction_inner_t * self, uint discriminant ) {
17765 0 : switch( discriminant ) {
17766 0 : case 0: {
17767 0 : fd_addrlut_create_new( &self->create_lut );
17768 0 : break;
17769 0 : }
17770 0 : case 1: {
17771 0 : break;
17772 0 : }
17773 0 : case 2: {
17774 0 : fd_addrlut_extend_new( &self->extend_lut );
17775 0 : break;
17776 0 : }
17777 0 : case 3: {
17778 0 : break;
17779 0 : }
17780 0 : case 4: {
17781 0 : break;
17782 0 : }
17783 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
17784 0 : }
17785 0 : }
17786 0 : void fd_addrlut_instruction_new_disc( fd_addrlut_instruction_t * self, uint discriminant ) {
17787 0 : self->discriminant = discriminant;
17788 0 : fd_addrlut_instruction_inner_new( &self->inner, self->discriminant );
17789 0 : }
17790 0 : void fd_addrlut_instruction_new( fd_addrlut_instruction_t * self ) {
17791 0 : fd_memset( self, 0, sizeof(fd_addrlut_instruction_t) );
17792 0 : fd_addrlut_instruction_new_disc( self, UINT_MAX );
17793 0 : }
17794 :
17795 0 : void fd_addrlut_instruction_walk( void * w, fd_addrlut_instruction_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
17796 0 : (void) varint;
17797 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_addrlut_instruction", level++, 0);
17798 0 : switch( self->discriminant ) {
17799 0 : case 0: {
17800 0 : fun( w, self, "create_lut", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
17801 0 : fd_addrlut_create_walk( w, &self->inner.create_lut, fun, "create_lut", level, 0 );
17802 0 : break;
17803 0 : }
17804 0 : case 1: {
17805 0 : fun( w, self, "freeze_lut", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
17806 0 : break;
17807 0 : }
17808 0 : case 2: {
17809 0 : fun( w, self, "extend_lut", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
17810 0 : fd_addrlut_extend_walk( w, &self->inner.extend_lut, fun, "extend_lut", level, 0 );
17811 0 : break;
17812 0 : }
17813 0 : case 3: {
17814 0 : fun( w, self, "deactivate_lut", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
17815 0 : break;
17816 0 : }
17817 0 : case 4: {
17818 0 : fun( w, self, "close_lut", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
17819 0 : break;
17820 0 : }
17821 0 : }
17822 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_addrlut_instruction", level--, 0 );
17823 0 : }
17824 0 : ulong fd_addrlut_instruction_size( fd_addrlut_instruction_t const * self ) {
17825 0 : ulong size = 0;
17826 0 : size += sizeof(uint);
17827 0 : switch (self->discriminant) {
17828 0 : case 0: {
17829 0 : size += fd_addrlut_create_size( &self->inner.create_lut );
17830 0 : break;
17831 0 : }
17832 0 : case 2: {
17833 0 : size += fd_addrlut_extend_size( &self->inner.extend_lut );
17834 0 : break;
17835 0 : }
17836 0 : }
17837 0 : return size;
17838 0 : }
17839 :
17840 0 : int fd_addrlut_instruction_inner_encode( fd_addrlut_instruction_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
17841 0 : int err;
17842 0 : switch (discriminant) {
17843 0 : case 0: {
17844 0 : err = fd_addrlut_create_encode( &self->create_lut, ctx );
17845 0 : if( FD_UNLIKELY( err ) ) return err;
17846 0 : break;
17847 0 : }
17848 0 : case 2: {
17849 0 : err = fd_addrlut_extend_encode( &self->extend_lut, ctx );
17850 0 : if( FD_UNLIKELY( err ) ) return err;
17851 0 : break;
17852 0 : }
17853 0 : }
17854 0 : return FD_BINCODE_SUCCESS;
17855 0 : }
17856 0 : int fd_addrlut_instruction_encode( fd_addrlut_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
17857 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
17858 0 : if( FD_UNLIKELY( err ) ) return err;
17859 0 : return fd_addrlut_instruction_inner_encode( &self->inner, self->discriminant, ctx );
17860 0 : }
17861 :
17862 0 : int fd_repair_request_header_encode( fd_repair_request_header_t const * self, fd_bincode_encode_ctx_t * ctx ) {
17863 0 : int err;
17864 0 : err = fd_signature_encode( &self->signature, ctx );
17865 0 : if( FD_UNLIKELY( err ) ) return err;
17866 0 : err = fd_pubkey_encode( &self->sender, ctx );
17867 0 : if( FD_UNLIKELY( err ) ) return err;
17868 0 : err = fd_pubkey_encode( &self->recipient, ctx );
17869 0 : if( FD_UNLIKELY( err ) ) return err;
17870 0 : err = fd_bincode_uint64_encode( self->timestamp, ctx );
17871 0 : if( FD_UNLIKELY( err ) ) return err;
17872 0 : err = fd_bincode_uint32_encode( self->nonce, ctx );
17873 0 : if( FD_UNLIKELY( err ) ) return err;
17874 0 : return FD_BINCODE_SUCCESS;
17875 0 : }
17876 0 : static inline int fd_repair_request_header_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
17877 0 : if( (ulong)ctx->data + 140UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
17878 0 : ctx->data = (void *)( (ulong)ctx->data + 140UL );
17879 0 : return 0;
17880 0 : }
17881 6 : static void fd_repair_request_header_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
17882 6 : fd_repair_request_header_t * self = (fd_repair_request_header_t *)struct_mem;
17883 6 : fd_signature_decode_inner( &self->signature, alloc_mem, ctx );
17884 6 : fd_pubkey_decode_inner( &self->sender, alloc_mem, ctx );
17885 6 : fd_pubkey_decode_inner( &self->recipient, alloc_mem, ctx );
17886 6 : fd_bincode_uint64_decode_unsafe( &self->timestamp, ctx );
17887 6 : fd_bincode_uint32_decode_unsafe( &self->nonce, ctx );
17888 6 : }
17889 0 : void * fd_repair_request_header_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
17890 0 : fd_repair_request_header_t * self = (fd_repair_request_header_t *)mem;
17891 0 : fd_repair_request_header_new( self );
17892 0 : void * alloc_region = (uchar *)mem + sizeof(fd_repair_request_header_t);
17893 0 : void * * alloc_mem = &alloc_region;
17894 0 : fd_repair_request_header_decode_inner( mem, alloc_mem, ctx );
17895 0 : return self;
17896 0 : }
17897 6 : 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, uint varint ) {
17898 6 : (void) varint;
17899 6 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_repair_request_header", level++, 0 );
17900 6 : fd_signature_walk( w, &self->signature, fun, "signature", level, 0 );
17901 6 : fd_pubkey_walk( w, &self->sender, fun, "sender", level, 0 );
17902 6 : fd_pubkey_walk( w, &self->recipient, fun, "recipient", level, 0 );
17903 6 : fun( w, &self->timestamp, "timestamp", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
17904 6 : fun( w, &self->nonce, "nonce", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
17905 6 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_repair_request_header", level--, 0 );
17906 6 : }
17907 0 : int fd_repair_window_index_encode( fd_repair_window_index_t const * self, fd_bincode_encode_ctx_t * ctx ) {
17908 0 : int err;
17909 0 : err = fd_repair_request_header_encode( &self->header, ctx );
17910 0 : if( FD_UNLIKELY( err ) ) return err;
17911 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
17912 0 : if( FD_UNLIKELY( err ) ) return err;
17913 0 : err = fd_bincode_uint64_encode( self->shred_index, ctx );
17914 0 : if( FD_UNLIKELY( err ) ) return err;
17915 0 : return FD_BINCODE_SUCCESS;
17916 0 : }
17917 3 : static inline int fd_repair_window_index_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
17918 3 : if( (ulong)ctx->data + 156UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
17919 3 : ctx->data = (void *)( (ulong)ctx->data + 156UL );
17920 3 : return 0;
17921 3 : }
17922 3 : static void fd_repair_window_index_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
17923 3 : fd_repair_window_index_t * self = (fd_repair_window_index_t *)struct_mem;
17924 3 : fd_repair_request_header_decode_inner( &self->header, alloc_mem, ctx );
17925 3 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
17926 3 : fd_bincode_uint64_decode_unsafe( &self->shred_index, ctx );
17927 3 : }
17928 0 : void * fd_repair_window_index_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
17929 0 : fd_repair_window_index_t * self = (fd_repair_window_index_t *)mem;
17930 0 : fd_repair_window_index_new( self );
17931 0 : void * alloc_region = (uchar *)mem + sizeof(fd_repair_window_index_t);
17932 0 : void * * alloc_mem = &alloc_region;
17933 0 : fd_repair_window_index_decode_inner( mem, alloc_mem, ctx );
17934 0 : return self;
17935 0 : }
17936 3 : 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, uint varint ) {
17937 3 : (void) varint;
17938 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_repair_window_index", level++, 0 );
17939 3 : fd_repair_request_header_walk( w, &self->header, fun, "header", level, 0 );
17940 3 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
17941 3 : fun( w, &self->shred_index, "shred_index", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
17942 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_repair_window_index", level--, 0 );
17943 3 : }
17944 0 : int fd_repair_highest_window_index_encode( fd_repair_highest_window_index_t const * self, fd_bincode_encode_ctx_t * ctx ) {
17945 0 : int err;
17946 0 : err = fd_repair_request_header_encode( &self->header, ctx );
17947 0 : if( FD_UNLIKELY( err ) ) return err;
17948 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
17949 0 : if( FD_UNLIKELY( err ) ) return err;
17950 0 : err = fd_bincode_uint64_encode( self->shred_index, ctx );
17951 0 : if( FD_UNLIKELY( err ) ) return err;
17952 0 : return FD_BINCODE_SUCCESS;
17953 0 : }
17954 3 : static inline int fd_repair_highest_window_index_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
17955 3 : if( (ulong)ctx->data + 156UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
17956 3 : ctx->data = (void *)( (ulong)ctx->data + 156UL );
17957 3 : return 0;
17958 3 : }
17959 3 : static void fd_repair_highest_window_index_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
17960 3 : fd_repair_highest_window_index_t * self = (fd_repair_highest_window_index_t *)struct_mem;
17961 3 : fd_repair_request_header_decode_inner( &self->header, alloc_mem, ctx );
17962 3 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
17963 3 : fd_bincode_uint64_decode_unsafe( &self->shred_index, ctx );
17964 3 : }
17965 0 : void * fd_repair_highest_window_index_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
17966 0 : fd_repair_highest_window_index_t * self = (fd_repair_highest_window_index_t *)mem;
17967 0 : fd_repair_highest_window_index_new( self );
17968 0 : void * alloc_region = (uchar *)mem + sizeof(fd_repair_highest_window_index_t);
17969 0 : void * * alloc_mem = &alloc_region;
17970 0 : fd_repair_highest_window_index_decode_inner( mem, alloc_mem, ctx );
17971 0 : return self;
17972 0 : }
17973 3 : 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, uint varint ) {
17974 3 : (void) varint;
17975 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_repair_highest_window_index", level++, 0 );
17976 3 : fd_repair_request_header_walk( w, &self->header, fun, "header", level, 0 );
17977 3 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
17978 3 : fun( w, &self->shred_index, "shred_index", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
17979 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_repair_highest_window_index", level--, 0 );
17980 3 : }
17981 0 : int fd_repair_orphan_encode( fd_repair_orphan_t const * self, fd_bincode_encode_ctx_t * ctx ) {
17982 0 : int err;
17983 0 : err = fd_repair_request_header_encode( &self->header, ctx );
17984 0 : if( FD_UNLIKELY( err ) ) return err;
17985 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
17986 0 : if( FD_UNLIKELY( err ) ) return err;
17987 0 : return FD_BINCODE_SUCCESS;
17988 0 : }
17989 0 : static inline int fd_repair_orphan_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
17990 0 : if( (ulong)ctx->data + 148UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
17991 0 : ctx->data = (void *)( (ulong)ctx->data + 148UL );
17992 0 : return 0;
17993 0 : }
17994 0 : static void fd_repair_orphan_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
17995 0 : fd_repair_orphan_t * self = (fd_repair_orphan_t *)struct_mem;
17996 0 : fd_repair_request_header_decode_inner( &self->header, alloc_mem, ctx );
17997 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
17998 0 : }
17999 0 : void * fd_repair_orphan_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
18000 0 : fd_repair_orphan_t * self = (fd_repair_orphan_t *)mem;
18001 0 : fd_repair_orphan_new( self );
18002 0 : void * alloc_region = (uchar *)mem + sizeof(fd_repair_orphan_t);
18003 0 : void * * alloc_mem = &alloc_region;
18004 0 : fd_repair_orphan_decode_inner( mem, alloc_mem, ctx );
18005 0 : return self;
18006 0 : }
18007 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, uint varint ) {
18008 0 : (void) varint;
18009 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_repair_orphan", level++, 0 );
18010 0 : fd_repair_request_header_walk( w, &self->header, fun, "header", level, 0 );
18011 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
18012 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_repair_orphan", level--, 0 );
18013 0 : }
18014 0 : int fd_repair_ancestor_hashes_encode( fd_repair_ancestor_hashes_t const * self, fd_bincode_encode_ctx_t * ctx ) {
18015 0 : int err;
18016 0 : err = fd_repair_request_header_encode( &self->header, ctx );
18017 0 : if( FD_UNLIKELY( err ) ) return err;
18018 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
18019 0 : if( FD_UNLIKELY( err ) ) return err;
18020 0 : return FD_BINCODE_SUCCESS;
18021 0 : }
18022 0 : static inline int fd_repair_ancestor_hashes_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
18023 0 : if( (ulong)ctx->data + 148UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
18024 0 : ctx->data = (void *)( (ulong)ctx->data + 148UL );
18025 0 : return 0;
18026 0 : }
18027 0 : static void fd_repair_ancestor_hashes_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
18028 0 : fd_repair_ancestor_hashes_t * self = (fd_repair_ancestor_hashes_t *)struct_mem;
18029 0 : fd_repair_request_header_decode_inner( &self->header, alloc_mem, ctx );
18030 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
18031 0 : }
18032 0 : void * fd_repair_ancestor_hashes_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
18033 0 : fd_repair_ancestor_hashes_t * self = (fd_repair_ancestor_hashes_t *)mem;
18034 0 : fd_repair_ancestor_hashes_new( self );
18035 0 : void * alloc_region = (uchar *)mem + sizeof(fd_repair_ancestor_hashes_t);
18036 0 : void * * alloc_mem = &alloc_region;
18037 0 : fd_repair_ancestor_hashes_decode_inner( mem, alloc_mem, ctx );
18038 0 : return self;
18039 0 : }
18040 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, uint varint ) {
18041 0 : (void) varint;
18042 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_repair_ancestor_hashes", level++, 0 );
18043 0 : fd_repair_request_header_walk( w, &self->header, fun, "header", level, 0 );
18044 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
18045 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_repair_ancestor_hashes", level--, 0 );
18046 0 : }
18047 0 : FD_FN_PURE uchar fd_repair_protocol_is_LegacyWindowIndex(fd_repair_protocol_t const * self) {
18048 0 : return self->discriminant == 0;
18049 0 : }
18050 0 : FD_FN_PURE uchar fd_repair_protocol_is_LegacyHighestWindowIndex(fd_repair_protocol_t const * self) {
18051 0 : return self->discriminant == 1;
18052 0 : }
18053 0 : FD_FN_PURE uchar fd_repair_protocol_is_LegacyOrphan(fd_repair_protocol_t const * self) {
18054 0 : return self->discriminant == 2;
18055 0 : }
18056 0 : FD_FN_PURE uchar fd_repair_protocol_is_LegacyWindowIndexWithNonce(fd_repair_protocol_t const * self) {
18057 0 : return self->discriminant == 3;
18058 0 : }
18059 0 : FD_FN_PURE uchar fd_repair_protocol_is_LegacyHighestWindowIndexWithNonce(fd_repair_protocol_t const * self) {
18060 0 : return self->discriminant == 4;
18061 0 : }
18062 0 : FD_FN_PURE uchar fd_repair_protocol_is_LegacyOrphanWithNonce(fd_repair_protocol_t const * self) {
18063 0 : return self->discriminant == 5;
18064 0 : }
18065 0 : FD_FN_PURE uchar fd_repair_protocol_is_LegacyAncestorHashes(fd_repair_protocol_t const * self) {
18066 0 : return self->discriminant == 6;
18067 0 : }
18068 0 : FD_FN_PURE uchar fd_repair_protocol_is_pong(fd_repair_protocol_t const * self) {
18069 0 : return self->discriminant == 7;
18070 0 : }
18071 0 : FD_FN_PURE uchar fd_repair_protocol_is_window_index(fd_repair_protocol_t const * self) {
18072 0 : return self->discriminant == 8;
18073 0 : }
18074 0 : FD_FN_PURE uchar fd_repair_protocol_is_highest_window_index(fd_repair_protocol_t const * self) {
18075 0 : return self->discriminant == 9;
18076 0 : }
18077 0 : FD_FN_PURE uchar fd_repair_protocol_is_orphan(fd_repair_protocol_t const * self) {
18078 0 : return self->discriminant == 10;
18079 0 : }
18080 0 : FD_FN_PURE uchar fd_repair_protocol_is_ancestor_hashes(fd_repair_protocol_t const * self) {
18081 0 : return self->discriminant == 11;
18082 0 : }
18083 : void fd_repair_protocol_inner_new( fd_repair_protocol_inner_t * self, uint discriminant );
18084 9 : int fd_repair_protocol_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
18085 9 : int err;
18086 9 : switch (discriminant) {
18087 0 : case 0: {
18088 0 : return FD_BINCODE_SUCCESS;
18089 0 : }
18090 0 : case 1: {
18091 0 : return FD_BINCODE_SUCCESS;
18092 0 : }
18093 0 : case 2: {
18094 0 : return FD_BINCODE_SUCCESS;
18095 0 : }
18096 0 : case 3: {
18097 0 : return FD_BINCODE_SUCCESS;
18098 0 : }
18099 0 : case 4: {
18100 0 : return FD_BINCODE_SUCCESS;
18101 0 : }
18102 0 : case 5: {
18103 0 : return FD_BINCODE_SUCCESS;
18104 0 : }
18105 0 : case 6: {
18106 0 : return FD_BINCODE_SUCCESS;
18107 0 : }
18108 3 : case 7: {
18109 3 : err = fd_gossip_ping_decode_footprint_inner( ctx, total_sz );
18110 3 : if( FD_UNLIKELY( err ) ) return err;
18111 3 : return FD_BINCODE_SUCCESS;
18112 3 : }
18113 3 : case 8: {
18114 3 : err = fd_repair_window_index_decode_footprint_inner( ctx, total_sz );
18115 3 : if( FD_UNLIKELY( err ) ) return err;
18116 3 : return FD_BINCODE_SUCCESS;
18117 3 : }
18118 3 : case 9: {
18119 3 : err = fd_repair_highest_window_index_decode_footprint_inner( ctx, total_sz );
18120 3 : if( FD_UNLIKELY( err ) ) return err;
18121 3 : return FD_BINCODE_SUCCESS;
18122 3 : }
18123 0 : case 10: {
18124 0 : err = fd_repair_orphan_decode_footprint_inner( ctx, total_sz );
18125 0 : if( FD_UNLIKELY( err ) ) return err;
18126 0 : return FD_BINCODE_SUCCESS;
18127 0 : }
18128 0 : case 11: {
18129 0 : err = fd_repair_ancestor_hashes_decode_footprint_inner( ctx, total_sz );
18130 0 : if( FD_UNLIKELY( err ) ) return err;
18131 0 : return FD_BINCODE_SUCCESS;
18132 0 : }
18133 0 : default: return FD_BINCODE_ERR_ENCODING;
18134 9 : }
18135 9 : }
18136 9 : static int fd_repair_protocol_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
18137 9 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
18138 9 : uint discriminant = 0;
18139 9 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
18140 9 : if( FD_UNLIKELY( err ) ) return err;
18141 9 : return fd_repair_protocol_inner_decode_footprint( discriminant, ctx, total_sz );
18142 9 : }
18143 9 : int fd_repair_protocol_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
18144 9 : *total_sz += sizeof(fd_repair_protocol_t);
18145 9 : void const * start_data = ctx->data;
18146 9 : int err = fd_repair_protocol_decode_footprint_inner( ctx, total_sz );
18147 9 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
18148 9 : ctx->data = start_data;
18149 9 : return err;
18150 9 : }
18151 9 : static void fd_repair_protocol_inner_decode_inner( fd_repair_protocol_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
18152 9 : switch (discriminant) {
18153 0 : case 0: {
18154 0 : break;
18155 0 : }
18156 0 : case 1: {
18157 0 : break;
18158 0 : }
18159 0 : case 2: {
18160 0 : break;
18161 0 : }
18162 0 : case 3: {
18163 0 : break;
18164 0 : }
18165 0 : case 4: {
18166 0 : break;
18167 0 : }
18168 0 : case 5: {
18169 0 : break;
18170 0 : }
18171 0 : case 6: {
18172 0 : break;
18173 0 : }
18174 3 : case 7: {
18175 3 : fd_gossip_ping_decode_inner( &self->pong, alloc_mem, ctx );
18176 3 : break;
18177 0 : }
18178 3 : case 8: {
18179 3 : fd_repair_window_index_decode_inner( &self->window_index, alloc_mem, ctx );
18180 3 : break;
18181 0 : }
18182 3 : case 9: {
18183 3 : fd_repair_highest_window_index_decode_inner( &self->highest_window_index, alloc_mem, ctx );
18184 3 : break;
18185 0 : }
18186 0 : case 10: {
18187 0 : fd_repair_orphan_decode_inner( &self->orphan, alloc_mem, ctx );
18188 0 : break;
18189 0 : }
18190 0 : case 11: {
18191 0 : fd_repair_ancestor_hashes_decode_inner( &self->ancestor_hashes, alloc_mem, ctx );
18192 0 : break;
18193 0 : }
18194 9 : }
18195 9 : }
18196 9 : static void fd_repair_protocol_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
18197 9 : fd_repair_protocol_t * self = (fd_repair_protocol_t *)struct_mem;
18198 9 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
18199 9 : fd_repair_protocol_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
18200 9 : }
18201 9 : void * fd_repair_protocol_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
18202 9 : fd_repair_protocol_t * self = (fd_repair_protocol_t *)mem;
18203 9 : fd_repair_protocol_new( self );
18204 9 : void * alloc_region = (uchar *)mem + sizeof(fd_repair_protocol_t);
18205 9 : void * * alloc_mem = &alloc_region;
18206 9 : fd_repair_protocol_decode_inner( mem, alloc_mem, ctx );
18207 9 : return self;
18208 9 : }
18209 9 : void fd_repair_protocol_inner_new( fd_repair_protocol_inner_t * self, uint discriminant ) {
18210 9 : switch( discriminant ) {
18211 0 : case 0: {
18212 0 : break;
18213 0 : }
18214 0 : case 1: {
18215 0 : break;
18216 0 : }
18217 0 : case 2: {
18218 0 : break;
18219 0 : }
18220 0 : case 3: {
18221 0 : break;
18222 0 : }
18223 0 : case 4: {
18224 0 : break;
18225 0 : }
18226 0 : case 5: {
18227 0 : break;
18228 0 : }
18229 0 : case 6: {
18230 0 : break;
18231 0 : }
18232 0 : case 7: {
18233 0 : fd_gossip_ping_new( &self->pong );
18234 0 : break;
18235 0 : }
18236 0 : case 8: {
18237 0 : fd_repair_window_index_new( &self->window_index );
18238 0 : break;
18239 0 : }
18240 0 : case 9: {
18241 0 : fd_repair_highest_window_index_new( &self->highest_window_index );
18242 0 : break;
18243 0 : }
18244 0 : case 10: {
18245 0 : fd_repair_orphan_new( &self->orphan );
18246 0 : break;
18247 0 : }
18248 0 : case 11: {
18249 0 : fd_repair_ancestor_hashes_new( &self->ancestor_hashes );
18250 0 : break;
18251 0 : }
18252 9 : default: break; // FD_LOG_ERR(( "unhandled type"));
18253 9 : }
18254 9 : }
18255 9 : void fd_repair_protocol_new_disc( fd_repair_protocol_t * self, uint discriminant ) {
18256 9 : self->discriminant = discriminant;
18257 9 : fd_repair_protocol_inner_new( &self->inner, self->discriminant );
18258 9 : }
18259 9 : void fd_repair_protocol_new( fd_repair_protocol_t * self ) {
18260 9 : fd_memset( self, 0, sizeof(fd_repair_protocol_t) );
18261 9 : fd_repair_protocol_new_disc( self, UINT_MAX );
18262 9 : }
18263 :
18264 9 : void fd_repair_protocol_walk( void * w, fd_repair_protocol_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
18265 9 : (void) varint;
18266 9 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_repair_protocol", level++, 0);
18267 9 : switch( self->discriminant ) {
18268 0 : case 0: {
18269 0 : fun( w, self, "LegacyWindowIndex", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
18270 0 : break;
18271 0 : }
18272 0 : case 1: {
18273 0 : fun( w, self, "LegacyHighestWindowIndex", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
18274 0 : break;
18275 0 : }
18276 0 : case 2: {
18277 0 : fun( w, self, "LegacyOrphan", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
18278 0 : break;
18279 0 : }
18280 0 : case 3: {
18281 0 : fun( w, self, "LegacyWindowIndexWithNonce", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
18282 0 : break;
18283 0 : }
18284 0 : case 4: {
18285 0 : fun( w, self, "LegacyHighestWindowIndexWithNonce", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
18286 0 : break;
18287 0 : }
18288 0 : case 5: {
18289 0 : fun( w, self, "LegacyOrphanWithNonce", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
18290 0 : break;
18291 0 : }
18292 0 : case 6: {
18293 0 : fun( w, self, "LegacyAncestorHashes", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
18294 0 : break;
18295 0 : }
18296 3 : case 7: {
18297 3 : fun( w, self, "pong", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
18298 3 : fd_gossip_ping_walk( w, &self->inner.pong, fun, "pong", level, 0 );
18299 3 : break;
18300 0 : }
18301 3 : case 8: {
18302 3 : fun( w, self, "window_index", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
18303 3 : fd_repair_window_index_walk( w, &self->inner.window_index, fun, "window_index", level, 0 );
18304 3 : break;
18305 0 : }
18306 3 : case 9: {
18307 3 : fun( w, self, "highest_window_index", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
18308 3 : fd_repair_highest_window_index_walk( w, &self->inner.highest_window_index, fun, "highest_window_index", level, 0 );
18309 3 : break;
18310 0 : }
18311 0 : case 10: {
18312 0 : fun( w, self, "orphan", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
18313 0 : fd_repair_orphan_walk( w, &self->inner.orphan, fun, "orphan", level, 0 );
18314 0 : break;
18315 0 : }
18316 0 : case 11: {
18317 0 : fun( w, self, "ancestor_hashes", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
18318 0 : fd_repair_ancestor_hashes_walk( w, &self->inner.ancestor_hashes, fun, "ancestor_hashes", level, 0 );
18319 0 : break;
18320 0 : }
18321 9 : }
18322 9 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_repair_protocol", level--, 0 );
18323 9 : }
18324 0 : ulong fd_repair_protocol_size( fd_repair_protocol_t const * self ) {
18325 0 : ulong size = 0;
18326 0 : size += sizeof(uint);
18327 0 : switch (self->discriminant) {
18328 0 : case 7: {
18329 0 : size += fd_gossip_ping_size( &self->inner.pong );
18330 0 : break;
18331 0 : }
18332 0 : case 8: {
18333 0 : size += fd_repair_window_index_size( &self->inner.window_index );
18334 0 : break;
18335 0 : }
18336 0 : case 9: {
18337 0 : size += fd_repair_highest_window_index_size( &self->inner.highest_window_index );
18338 0 : break;
18339 0 : }
18340 0 : case 10: {
18341 0 : size += fd_repair_orphan_size( &self->inner.orphan );
18342 0 : break;
18343 0 : }
18344 0 : case 11: {
18345 0 : size += fd_repair_ancestor_hashes_size( &self->inner.ancestor_hashes );
18346 0 : break;
18347 0 : }
18348 0 : }
18349 0 : return size;
18350 0 : }
18351 :
18352 0 : int fd_repair_protocol_inner_encode( fd_repair_protocol_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
18353 0 : int err;
18354 0 : switch (discriminant) {
18355 0 : case 7: {
18356 0 : err = fd_gossip_ping_encode( &self->pong, ctx );
18357 0 : if( FD_UNLIKELY( err ) ) return err;
18358 0 : break;
18359 0 : }
18360 0 : case 8: {
18361 0 : err = fd_repair_window_index_encode( &self->window_index, ctx );
18362 0 : if( FD_UNLIKELY( err ) ) return err;
18363 0 : break;
18364 0 : }
18365 0 : case 9: {
18366 0 : err = fd_repair_highest_window_index_encode( &self->highest_window_index, ctx );
18367 0 : if( FD_UNLIKELY( err ) ) return err;
18368 0 : break;
18369 0 : }
18370 0 : case 10: {
18371 0 : err = fd_repair_orphan_encode( &self->orphan, ctx );
18372 0 : if( FD_UNLIKELY( err ) ) return err;
18373 0 : break;
18374 0 : }
18375 0 : case 11: {
18376 0 : err = fd_repair_ancestor_hashes_encode( &self->ancestor_hashes, ctx );
18377 0 : if( FD_UNLIKELY( err ) ) return err;
18378 0 : break;
18379 0 : }
18380 0 : }
18381 0 : return FD_BINCODE_SUCCESS;
18382 0 : }
18383 0 : int fd_repair_protocol_encode( fd_repair_protocol_t const * self, fd_bincode_encode_ctx_t * ctx ) {
18384 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
18385 0 : if( FD_UNLIKELY( err ) ) return err;
18386 0 : return fd_repair_protocol_inner_encode( &self->inner, self->discriminant, ctx );
18387 0 : }
18388 :
18389 0 : FD_FN_PURE uchar fd_repair_response_is_ping(fd_repair_response_t const * self) {
18390 0 : return self->discriminant == 0;
18391 0 : }
18392 : void fd_repair_response_inner_new( fd_repair_response_inner_t * self, uint discriminant );
18393 0 : int fd_repair_response_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
18394 0 : int err;
18395 0 : switch (discriminant) {
18396 0 : case 0: {
18397 0 : err = fd_gossip_ping_decode_footprint_inner( ctx, total_sz );
18398 0 : if( FD_UNLIKELY( err ) ) return err;
18399 0 : return FD_BINCODE_SUCCESS;
18400 0 : }
18401 0 : default: return FD_BINCODE_ERR_ENCODING;
18402 0 : }
18403 0 : }
18404 0 : static int fd_repair_response_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
18405 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
18406 0 : uint discriminant = 0;
18407 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
18408 0 : if( FD_UNLIKELY( err ) ) return err;
18409 0 : return fd_repair_response_inner_decode_footprint( discriminant, ctx, total_sz );
18410 0 : }
18411 0 : int fd_repair_response_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
18412 0 : *total_sz += sizeof(fd_repair_response_t);
18413 0 : void const * start_data = ctx->data;
18414 0 : int err = fd_repair_response_decode_footprint_inner( ctx, total_sz );
18415 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
18416 0 : ctx->data = start_data;
18417 0 : return err;
18418 0 : }
18419 0 : static void fd_repair_response_inner_decode_inner( fd_repair_response_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
18420 0 : switch (discriminant) {
18421 0 : case 0: {
18422 0 : fd_gossip_ping_decode_inner( &self->ping, alloc_mem, ctx );
18423 0 : break;
18424 0 : }
18425 0 : }
18426 0 : }
18427 0 : static void fd_repair_response_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
18428 0 : fd_repair_response_t * self = (fd_repair_response_t *)struct_mem;
18429 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
18430 0 : fd_repair_response_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
18431 0 : }
18432 0 : void * fd_repair_response_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
18433 0 : fd_repair_response_t * self = (fd_repair_response_t *)mem;
18434 0 : fd_repair_response_new( self );
18435 0 : void * alloc_region = (uchar *)mem + sizeof(fd_repair_response_t);
18436 0 : void * * alloc_mem = &alloc_region;
18437 0 : fd_repair_response_decode_inner( mem, alloc_mem, ctx );
18438 0 : return self;
18439 0 : }
18440 0 : void fd_repair_response_inner_new( fd_repair_response_inner_t * self, uint discriminant ) {
18441 0 : switch( discriminant ) {
18442 0 : case 0: {
18443 0 : fd_gossip_ping_new( &self->ping );
18444 0 : break;
18445 0 : }
18446 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
18447 0 : }
18448 0 : }
18449 0 : void fd_repair_response_new_disc( fd_repair_response_t * self, uint discriminant ) {
18450 0 : self->discriminant = discriminant;
18451 0 : fd_repair_response_inner_new( &self->inner, self->discriminant );
18452 0 : }
18453 0 : void fd_repair_response_new( fd_repair_response_t * self ) {
18454 0 : fd_memset( self, 0, sizeof(fd_repair_response_t) );
18455 0 : fd_repair_response_new_disc( self, UINT_MAX );
18456 0 : }
18457 :
18458 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, uint varint ) {
18459 0 : (void) varint;
18460 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_repair_response", level++, 0);
18461 0 : switch( self->discriminant ) {
18462 0 : case 0: {
18463 0 : fun( w, self, "ping", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
18464 0 : fd_gossip_ping_walk( w, &self->inner.ping, fun, "ping", level, 0 );
18465 0 : break;
18466 0 : }
18467 0 : }
18468 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_repair_response", level--, 0 );
18469 0 : }
18470 0 : ulong fd_repair_response_size( fd_repair_response_t const * self ) {
18471 0 : ulong size = 0;
18472 0 : size += sizeof(uint);
18473 0 : switch (self->discriminant) {
18474 0 : case 0: {
18475 0 : size += fd_gossip_ping_size( &self->inner.ping );
18476 0 : break;
18477 0 : }
18478 0 : }
18479 0 : return size;
18480 0 : }
18481 :
18482 0 : int fd_repair_response_inner_encode( fd_repair_response_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
18483 0 : int err;
18484 0 : switch (discriminant) {
18485 0 : case 0: {
18486 0 : err = fd_gossip_ping_encode( &self->ping, ctx );
18487 0 : if( FD_UNLIKELY( err ) ) return err;
18488 0 : break;
18489 0 : }
18490 0 : }
18491 0 : return FD_BINCODE_SUCCESS;
18492 0 : }
18493 0 : int fd_repair_response_encode( fd_repair_response_t const * self, fd_bincode_encode_ctx_t * ctx ) {
18494 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
18495 0 : if( FD_UNLIKELY( err ) ) return err;
18496 0 : return fd_repair_response_inner_encode( &self->inner, self->discriminant, ctx );
18497 0 : }
18498 :
18499 0 : FD_FN_PURE uchar fd_instr_error_enum_is_generic_error(fd_instr_error_enum_t const * self) {
18500 0 : return self->discriminant == 0;
18501 0 : }
18502 0 : FD_FN_PURE uchar fd_instr_error_enum_is_invalid_argument(fd_instr_error_enum_t const * self) {
18503 0 : return self->discriminant == 1;
18504 0 : }
18505 0 : FD_FN_PURE uchar fd_instr_error_enum_is_invalid_instruction_data(fd_instr_error_enum_t const * self) {
18506 0 : return self->discriminant == 2;
18507 0 : }
18508 0 : FD_FN_PURE uchar fd_instr_error_enum_is_invalid_account_data(fd_instr_error_enum_t const * self) {
18509 0 : return self->discriminant == 3;
18510 0 : }
18511 0 : FD_FN_PURE uchar fd_instr_error_enum_is_account_data_too_small(fd_instr_error_enum_t const * self) {
18512 0 : return self->discriminant == 4;
18513 0 : }
18514 0 : FD_FN_PURE uchar fd_instr_error_enum_is_insufficient_funds(fd_instr_error_enum_t const * self) {
18515 0 : return self->discriminant == 5;
18516 0 : }
18517 0 : FD_FN_PURE uchar fd_instr_error_enum_is_incorrect_program_id(fd_instr_error_enum_t const * self) {
18518 0 : return self->discriminant == 6;
18519 0 : }
18520 0 : FD_FN_PURE uchar fd_instr_error_enum_is_missing_required_signature(fd_instr_error_enum_t const * self) {
18521 0 : return self->discriminant == 7;
18522 0 : }
18523 0 : FD_FN_PURE uchar fd_instr_error_enum_is_account_already_initialized(fd_instr_error_enum_t const * self) {
18524 0 : return self->discriminant == 8;
18525 0 : }
18526 0 : FD_FN_PURE uchar fd_instr_error_enum_is_uninitialized_account(fd_instr_error_enum_t const * self) {
18527 0 : return self->discriminant == 9;
18528 0 : }
18529 0 : FD_FN_PURE uchar fd_instr_error_enum_is_unbalanced_instruction(fd_instr_error_enum_t const * self) {
18530 0 : return self->discriminant == 10;
18531 0 : }
18532 0 : FD_FN_PURE uchar fd_instr_error_enum_is_modified_program_id(fd_instr_error_enum_t const * self) {
18533 0 : return self->discriminant == 11;
18534 0 : }
18535 0 : FD_FN_PURE uchar fd_instr_error_enum_is_external_account_lamport_spend(fd_instr_error_enum_t const * self) {
18536 0 : return self->discriminant == 12;
18537 0 : }
18538 0 : FD_FN_PURE uchar fd_instr_error_enum_is_external_account_data_modified(fd_instr_error_enum_t const * self) {
18539 0 : return self->discriminant == 13;
18540 0 : }
18541 0 : FD_FN_PURE uchar fd_instr_error_enum_is_readonly_lamport_change(fd_instr_error_enum_t const * self) {
18542 0 : return self->discriminant == 14;
18543 0 : }
18544 0 : FD_FN_PURE uchar fd_instr_error_enum_is_readonly_data_modified(fd_instr_error_enum_t const * self) {
18545 0 : return self->discriminant == 15;
18546 0 : }
18547 0 : FD_FN_PURE uchar fd_instr_error_enum_is_duplicate_account_index(fd_instr_error_enum_t const * self) {
18548 0 : return self->discriminant == 16;
18549 0 : }
18550 0 : FD_FN_PURE uchar fd_instr_error_enum_is_executable_modified(fd_instr_error_enum_t const * self) {
18551 0 : return self->discriminant == 17;
18552 0 : }
18553 0 : FD_FN_PURE uchar fd_instr_error_enum_is_rent_epoch_modified(fd_instr_error_enum_t const * self) {
18554 0 : return self->discriminant == 18;
18555 0 : }
18556 0 : FD_FN_PURE uchar fd_instr_error_enum_is_not_enough_account_keys(fd_instr_error_enum_t const * self) {
18557 0 : return self->discriminant == 19;
18558 0 : }
18559 0 : FD_FN_PURE uchar fd_instr_error_enum_is_account_data_size_changed(fd_instr_error_enum_t const * self) {
18560 0 : return self->discriminant == 20;
18561 0 : }
18562 0 : FD_FN_PURE uchar fd_instr_error_enum_is_account_not_executable(fd_instr_error_enum_t const * self) {
18563 0 : return self->discriminant == 21;
18564 0 : }
18565 0 : FD_FN_PURE uchar fd_instr_error_enum_is_account_borrow_failed(fd_instr_error_enum_t const * self) {
18566 0 : return self->discriminant == 22;
18567 0 : }
18568 0 : FD_FN_PURE uchar fd_instr_error_enum_is_account_borrow_outstanding(fd_instr_error_enum_t const * self) {
18569 0 : return self->discriminant == 23;
18570 0 : }
18571 0 : FD_FN_PURE uchar fd_instr_error_enum_is_duplicate_account_out_of_sync(fd_instr_error_enum_t const * self) {
18572 0 : return self->discriminant == 24;
18573 0 : }
18574 0 : FD_FN_PURE uchar fd_instr_error_enum_is_custom(fd_instr_error_enum_t const * self) {
18575 0 : return self->discriminant == 25;
18576 0 : }
18577 0 : FD_FN_PURE uchar fd_instr_error_enum_is_invalid_error(fd_instr_error_enum_t const * self) {
18578 0 : return self->discriminant == 26;
18579 0 : }
18580 0 : FD_FN_PURE uchar fd_instr_error_enum_is_executable_data_modified(fd_instr_error_enum_t const * self) {
18581 0 : return self->discriminant == 27;
18582 0 : }
18583 0 : FD_FN_PURE uchar fd_instr_error_enum_is_executable_lamport_change(fd_instr_error_enum_t const * self) {
18584 0 : return self->discriminant == 28;
18585 0 : }
18586 0 : FD_FN_PURE uchar fd_instr_error_enum_is_executable_account_not_rent_exempt(fd_instr_error_enum_t const * self) {
18587 0 : return self->discriminant == 29;
18588 0 : }
18589 0 : FD_FN_PURE uchar fd_instr_error_enum_is_unsupported_program_id(fd_instr_error_enum_t const * self) {
18590 0 : return self->discriminant == 30;
18591 0 : }
18592 0 : FD_FN_PURE uchar fd_instr_error_enum_is_call_depth(fd_instr_error_enum_t const * self) {
18593 0 : return self->discriminant == 31;
18594 0 : }
18595 0 : FD_FN_PURE uchar fd_instr_error_enum_is_missing_account(fd_instr_error_enum_t const * self) {
18596 0 : return self->discriminant == 32;
18597 0 : }
18598 0 : FD_FN_PURE uchar fd_instr_error_enum_is_reentrancy_not_allowed(fd_instr_error_enum_t const * self) {
18599 0 : return self->discriminant == 33;
18600 0 : }
18601 0 : FD_FN_PURE uchar fd_instr_error_enum_is_max_seed_length_exceeded(fd_instr_error_enum_t const * self) {
18602 0 : return self->discriminant == 34;
18603 0 : }
18604 0 : FD_FN_PURE uchar fd_instr_error_enum_is_invalid_seeds(fd_instr_error_enum_t const * self) {
18605 0 : return self->discriminant == 35;
18606 0 : }
18607 0 : FD_FN_PURE uchar fd_instr_error_enum_is_invalid_realloc(fd_instr_error_enum_t const * self) {
18608 0 : return self->discriminant == 36;
18609 0 : }
18610 0 : FD_FN_PURE uchar fd_instr_error_enum_is_computational_budget_exceeded(fd_instr_error_enum_t const * self) {
18611 0 : return self->discriminant == 37;
18612 0 : }
18613 0 : FD_FN_PURE uchar fd_instr_error_enum_is_privilege_escalation(fd_instr_error_enum_t const * self) {
18614 0 : return self->discriminant == 38;
18615 0 : }
18616 0 : FD_FN_PURE uchar fd_instr_error_enum_is_program_environment_setup_failure(fd_instr_error_enum_t const * self) {
18617 0 : return self->discriminant == 39;
18618 0 : }
18619 0 : FD_FN_PURE uchar fd_instr_error_enum_is_program_failed_to_complete(fd_instr_error_enum_t const * self) {
18620 0 : return self->discriminant == 40;
18621 0 : }
18622 0 : FD_FN_PURE uchar fd_instr_error_enum_is_program_failed_to_compile(fd_instr_error_enum_t const * self) {
18623 0 : return self->discriminant == 41;
18624 0 : }
18625 0 : FD_FN_PURE uchar fd_instr_error_enum_is_immutable(fd_instr_error_enum_t const * self) {
18626 0 : return self->discriminant == 42;
18627 0 : }
18628 0 : FD_FN_PURE uchar fd_instr_error_enum_is_incorrect_authority(fd_instr_error_enum_t const * self) {
18629 0 : return self->discriminant == 43;
18630 0 : }
18631 0 : FD_FN_PURE uchar fd_instr_error_enum_is_borsh_io_error(fd_instr_error_enum_t const * self) {
18632 0 : return self->discriminant == 44;
18633 0 : }
18634 0 : FD_FN_PURE uchar fd_instr_error_enum_is_account_not_rent_exempt(fd_instr_error_enum_t const * self) {
18635 0 : return self->discriminant == 45;
18636 0 : }
18637 0 : FD_FN_PURE uchar fd_instr_error_enum_is_invalid_account_owner(fd_instr_error_enum_t const * self) {
18638 0 : return self->discriminant == 46;
18639 0 : }
18640 0 : FD_FN_PURE uchar fd_instr_error_enum_is_arithmetic_overflow(fd_instr_error_enum_t const * self) {
18641 0 : return self->discriminant == 47;
18642 0 : }
18643 0 : FD_FN_PURE uchar fd_instr_error_enum_is_unsupported_sysvar(fd_instr_error_enum_t const * self) {
18644 0 : return self->discriminant == 48;
18645 0 : }
18646 0 : FD_FN_PURE uchar fd_instr_error_enum_is_illegal_owner(fd_instr_error_enum_t const * self) {
18647 0 : return self->discriminant == 49;
18648 0 : }
18649 0 : FD_FN_PURE uchar fd_instr_error_enum_is_max_accounts_data_allocations_exceeded(fd_instr_error_enum_t const * self) {
18650 0 : return self->discriminant == 50;
18651 0 : }
18652 0 : FD_FN_PURE uchar fd_instr_error_enum_is_max_accounts_exceeded(fd_instr_error_enum_t const * self) {
18653 0 : return self->discriminant == 51;
18654 0 : }
18655 0 : FD_FN_PURE uchar fd_instr_error_enum_is_max_instruction_trace_length_exceeded(fd_instr_error_enum_t const * self) {
18656 0 : return self->discriminant == 52;
18657 0 : }
18658 0 : FD_FN_PURE uchar fd_instr_error_enum_is_builtin_programs_must_consume_compute_units(fd_instr_error_enum_t const * self) {
18659 0 : return self->discriminant == 53;
18660 0 : }
18661 : void fd_instr_error_enum_inner_new( fd_instr_error_enum_inner_t * self, uint discriminant );
18662 0 : int fd_instr_error_enum_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
18663 0 : int err;
18664 0 : switch (discriminant) {
18665 0 : case 0: {
18666 0 : return FD_BINCODE_SUCCESS;
18667 0 : }
18668 0 : case 1: {
18669 0 : return FD_BINCODE_SUCCESS;
18670 0 : }
18671 0 : case 2: {
18672 0 : return FD_BINCODE_SUCCESS;
18673 0 : }
18674 0 : case 3: {
18675 0 : return FD_BINCODE_SUCCESS;
18676 0 : }
18677 0 : case 4: {
18678 0 : return FD_BINCODE_SUCCESS;
18679 0 : }
18680 0 : case 5: {
18681 0 : return FD_BINCODE_SUCCESS;
18682 0 : }
18683 0 : case 6: {
18684 0 : return FD_BINCODE_SUCCESS;
18685 0 : }
18686 0 : case 7: {
18687 0 : return FD_BINCODE_SUCCESS;
18688 0 : }
18689 0 : case 8: {
18690 0 : return FD_BINCODE_SUCCESS;
18691 0 : }
18692 0 : case 9: {
18693 0 : return FD_BINCODE_SUCCESS;
18694 0 : }
18695 0 : case 10: {
18696 0 : return FD_BINCODE_SUCCESS;
18697 0 : }
18698 0 : case 11: {
18699 0 : return FD_BINCODE_SUCCESS;
18700 0 : }
18701 0 : case 12: {
18702 0 : return FD_BINCODE_SUCCESS;
18703 0 : }
18704 0 : case 13: {
18705 0 : return FD_BINCODE_SUCCESS;
18706 0 : }
18707 0 : case 14: {
18708 0 : return FD_BINCODE_SUCCESS;
18709 0 : }
18710 0 : case 15: {
18711 0 : return FD_BINCODE_SUCCESS;
18712 0 : }
18713 0 : case 16: {
18714 0 : return FD_BINCODE_SUCCESS;
18715 0 : }
18716 0 : case 17: {
18717 0 : return FD_BINCODE_SUCCESS;
18718 0 : }
18719 0 : case 18: {
18720 0 : return FD_BINCODE_SUCCESS;
18721 0 : }
18722 0 : case 19: {
18723 0 : return FD_BINCODE_SUCCESS;
18724 0 : }
18725 0 : case 20: {
18726 0 : return FD_BINCODE_SUCCESS;
18727 0 : }
18728 0 : case 21: {
18729 0 : return FD_BINCODE_SUCCESS;
18730 0 : }
18731 0 : case 22: {
18732 0 : return FD_BINCODE_SUCCESS;
18733 0 : }
18734 0 : case 23: {
18735 0 : return FD_BINCODE_SUCCESS;
18736 0 : }
18737 0 : case 24: {
18738 0 : return FD_BINCODE_SUCCESS;
18739 0 : }
18740 0 : case 25: {
18741 0 : err = fd_bincode_uint32_decode_footprint( ctx );
18742 0 : if( FD_UNLIKELY( err ) ) return err;
18743 0 : return FD_BINCODE_SUCCESS;
18744 0 : }
18745 0 : case 26: {
18746 0 : return FD_BINCODE_SUCCESS;
18747 0 : }
18748 0 : case 27: {
18749 0 : return FD_BINCODE_SUCCESS;
18750 0 : }
18751 0 : case 28: {
18752 0 : return FD_BINCODE_SUCCESS;
18753 0 : }
18754 0 : case 29: {
18755 0 : return FD_BINCODE_SUCCESS;
18756 0 : }
18757 0 : case 30: {
18758 0 : return FD_BINCODE_SUCCESS;
18759 0 : }
18760 0 : case 31: {
18761 0 : return FD_BINCODE_SUCCESS;
18762 0 : }
18763 0 : case 32: {
18764 0 : return FD_BINCODE_SUCCESS;
18765 0 : }
18766 0 : case 33: {
18767 0 : return FD_BINCODE_SUCCESS;
18768 0 : }
18769 0 : case 34: {
18770 0 : return FD_BINCODE_SUCCESS;
18771 0 : }
18772 0 : case 35: {
18773 0 : return FD_BINCODE_SUCCESS;
18774 0 : }
18775 0 : case 36: {
18776 0 : return FD_BINCODE_SUCCESS;
18777 0 : }
18778 0 : case 37: {
18779 0 : return FD_BINCODE_SUCCESS;
18780 0 : }
18781 0 : case 38: {
18782 0 : return FD_BINCODE_SUCCESS;
18783 0 : }
18784 0 : case 39: {
18785 0 : return FD_BINCODE_SUCCESS;
18786 0 : }
18787 0 : case 40: {
18788 0 : return FD_BINCODE_SUCCESS;
18789 0 : }
18790 0 : case 41: {
18791 0 : return FD_BINCODE_SUCCESS;
18792 0 : }
18793 0 : case 42: {
18794 0 : return FD_BINCODE_SUCCESS;
18795 0 : }
18796 0 : case 43: {
18797 0 : return FD_BINCODE_SUCCESS;
18798 0 : }
18799 0 : case 44: {
18800 0 : ulong slen;
18801 0 : err = fd_bincode_uint64_decode( &slen, ctx );
18802 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18803 0 : err = fd_bincode_bytes_decode_footprint( slen, ctx );
18804 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18805 0 : *total_sz += slen + 1; // Need an extra byte for null termination
18806 0 : return FD_BINCODE_SUCCESS;
18807 0 : }
18808 0 : case 45: {
18809 0 : return FD_BINCODE_SUCCESS;
18810 0 : }
18811 0 : case 46: {
18812 0 : return FD_BINCODE_SUCCESS;
18813 0 : }
18814 0 : case 47: {
18815 0 : return FD_BINCODE_SUCCESS;
18816 0 : }
18817 0 : case 48: {
18818 0 : return FD_BINCODE_SUCCESS;
18819 0 : }
18820 0 : case 49: {
18821 0 : return FD_BINCODE_SUCCESS;
18822 0 : }
18823 0 : case 50: {
18824 0 : return FD_BINCODE_SUCCESS;
18825 0 : }
18826 0 : case 51: {
18827 0 : return FD_BINCODE_SUCCESS;
18828 0 : }
18829 0 : case 52: {
18830 0 : return FD_BINCODE_SUCCESS;
18831 0 : }
18832 0 : case 53: {
18833 0 : return FD_BINCODE_SUCCESS;
18834 0 : }
18835 0 : default: return FD_BINCODE_ERR_ENCODING;
18836 0 : }
18837 0 : }
18838 0 : static int fd_instr_error_enum_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
18839 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
18840 0 : uint discriminant = 0;
18841 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
18842 0 : if( FD_UNLIKELY( err ) ) return err;
18843 0 : return fd_instr_error_enum_inner_decode_footprint( discriminant, ctx, total_sz );
18844 0 : }
18845 0 : int fd_instr_error_enum_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
18846 0 : *total_sz += sizeof(fd_instr_error_enum_t);
18847 0 : void const * start_data = ctx->data;
18848 0 : int err = fd_instr_error_enum_decode_footprint_inner( ctx, total_sz );
18849 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
18850 0 : ctx->data = start_data;
18851 0 : return err;
18852 0 : }
18853 0 : static 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 ) {
18854 0 : switch (discriminant) {
18855 0 : case 0: {
18856 0 : break;
18857 0 : }
18858 0 : case 1: {
18859 0 : break;
18860 0 : }
18861 0 : case 2: {
18862 0 : break;
18863 0 : }
18864 0 : case 3: {
18865 0 : break;
18866 0 : }
18867 0 : case 4: {
18868 0 : break;
18869 0 : }
18870 0 : case 5: {
18871 0 : break;
18872 0 : }
18873 0 : case 6: {
18874 0 : break;
18875 0 : }
18876 0 : case 7: {
18877 0 : break;
18878 0 : }
18879 0 : case 8: {
18880 0 : break;
18881 0 : }
18882 0 : case 9: {
18883 0 : break;
18884 0 : }
18885 0 : case 10: {
18886 0 : break;
18887 0 : }
18888 0 : case 11: {
18889 0 : break;
18890 0 : }
18891 0 : case 12: {
18892 0 : break;
18893 0 : }
18894 0 : case 13: {
18895 0 : break;
18896 0 : }
18897 0 : case 14: {
18898 0 : break;
18899 0 : }
18900 0 : case 15: {
18901 0 : break;
18902 0 : }
18903 0 : case 16: {
18904 0 : break;
18905 0 : }
18906 0 : case 17: {
18907 0 : break;
18908 0 : }
18909 0 : case 18: {
18910 0 : break;
18911 0 : }
18912 0 : case 19: {
18913 0 : break;
18914 0 : }
18915 0 : case 20: {
18916 0 : break;
18917 0 : }
18918 0 : case 21: {
18919 0 : break;
18920 0 : }
18921 0 : case 22: {
18922 0 : break;
18923 0 : }
18924 0 : case 23: {
18925 0 : break;
18926 0 : }
18927 0 : case 24: {
18928 0 : break;
18929 0 : }
18930 0 : case 25: {
18931 0 : fd_bincode_uint32_decode_unsafe( &self->custom, ctx );
18932 0 : break;
18933 0 : }
18934 0 : case 26: {
18935 0 : break;
18936 0 : }
18937 0 : case 27: {
18938 0 : break;
18939 0 : }
18940 0 : case 28: {
18941 0 : break;
18942 0 : }
18943 0 : case 29: {
18944 0 : break;
18945 0 : }
18946 0 : case 30: {
18947 0 : break;
18948 0 : }
18949 0 : case 31: {
18950 0 : break;
18951 0 : }
18952 0 : case 32: {
18953 0 : break;
18954 0 : }
18955 0 : case 33: {
18956 0 : break;
18957 0 : }
18958 0 : case 34: {
18959 0 : break;
18960 0 : }
18961 0 : case 35: {
18962 0 : break;
18963 0 : }
18964 0 : case 36: {
18965 0 : break;
18966 0 : }
18967 0 : case 37: {
18968 0 : break;
18969 0 : }
18970 0 : case 38: {
18971 0 : break;
18972 0 : }
18973 0 : case 39: {
18974 0 : break;
18975 0 : }
18976 0 : case 40: {
18977 0 : break;
18978 0 : }
18979 0 : case 41: {
18980 0 : break;
18981 0 : }
18982 0 : case 42: {
18983 0 : break;
18984 0 : }
18985 0 : case 43: {
18986 0 : break;
18987 0 : }
18988 0 : case 44: {
18989 0 : ulong slen;
18990 0 : fd_bincode_uint64_decode_unsafe( &slen, ctx );
18991 0 : self->borsh_io_error = *alloc_mem;
18992 0 : fd_bincode_bytes_decode_unsafe( (uchar *)self->borsh_io_error, slen, ctx );
18993 0 : self->borsh_io_error[slen] = '\0';
18994 0 : *alloc_mem = (uchar *)(*alloc_mem) + (slen + 1); // extra byte for null termination
18995 0 : break;
18996 0 : }
18997 0 : case 45: {
18998 0 : break;
18999 0 : }
19000 0 : case 46: {
19001 0 : break;
19002 0 : }
19003 0 : case 47: {
19004 0 : break;
19005 0 : }
19006 0 : case 48: {
19007 0 : break;
19008 0 : }
19009 0 : case 49: {
19010 0 : break;
19011 0 : }
19012 0 : case 50: {
19013 0 : break;
19014 0 : }
19015 0 : case 51: {
19016 0 : break;
19017 0 : }
19018 0 : case 52: {
19019 0 : break;
19020 0 : }
19021 0 : case 53: {
19022 0 : break;
19023 0 : }
19024 0 : }
19025 0 : }
19026 0 : static void fd_instr_error_enum_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
19027 0 : fd_instr_error_enum_t * self = (fd_instr_error_enum_t *)struct_mem;
19028 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
19029 0 : fd_instr_error_enum_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
19030 0 : }
19031 0 : void * fd_instr_error_enum_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
19032 0 : fd_instr_error_enum_t * self = (fd_instr_error_enum_t *)mem;
19033 0 : fd_instr_error_enum_new( self );
19034 0 : void * alloc_region = (uchar *)mem + sizeof(fd_instr_error_enum_t);
19035 0 : void * * alloc_mem = &alloc_region;
19036 0 : fd_instr_error_enum_decode_inner( mem, alloc_mem, ctx );
19037 0 : return self;
19038 0 : }
19039 0 : void fd_instr_error_enum_inner_new( fd_instr_error_enum_inner_t * self, uint discriminant ) {
19040 0 : switch( discriminant ) {
19041 0 : case 0: {
19042 0 : break;
19043 0 : }
19044 0 : case 1: {
19045 0 : break;
19046 0 : }
19047 0 : case 2: {
19048 0 : break;
19049 0 : }
19050 0 : case 3: {
19051 0 : break;
19052 0 : }
19053 0 : case 4: {
19054 0 : break;
19055 0 : }
19056 0 : case 5: {
19057 0 : break;
19058 0 : }
19059 0 : case 6: {
19060 0 : break;
19061 0 : }
19062 0 : case 7: {
19063 0 : break;
19064 0 : }
19065 0 : case 8: {
19066 0 : break;
19067 0 : }
19068 0 : case 9: {
19069 0 : break;
19070 0 : }
19071 0 : case 10: {
19072 0 : break;
19073 0 : }
19074 0 : case 11: {
19075 0 : break;
19076 0 : }
19077 0 : case 12: {
19078 0 : break;
19079 0 : }
19080 0 : case 13: {
19081 0 : break;
19082 0 : }
19083 0 : case 14: {
19084 0 : break;
19085 0 : }
19086 0 : case 15: {
19087 0 : break;
19088 0 : }
19089 0 : case 16: {
19090 0 : break;
19091 0 : }
19092 0 : case 17: {
19093 0 : break;
19094 0 : }
19095 0 : case 18: {
19096 0 : break;
19097 0 : }
19098 0 : case 19: {
19099 0 : break;
19100 0 : }
19101 0 : case 20: {
19102 0 : break;
19103 0 : }
19104 0 : case 21: {
19105 0 : break;
19106 0 : }
19107 0 : case 22: {
19108 0 : break;
19109 0 : }
19110 0 : case 23: {
19111 0 : break;
19112 0 : }
19113 0 : case 24: {
19114 0 : break;
19115 0 : }
19116 0 : case 25: {
19117 0 : break;
19118 0 : }
19119 0 : case 26: {
19120 0 : break;
19121 0 : }
19122 0 : case 27: {
19123 0 : break;
19124 0 : }
19125 0 : case 28: {
19126 0 : break;
19127 0 : }
19128 0 : case 29: {
19129 0 : break;
19130 0 : }
19131 0 : case 30: {
19132 0 : break;
19133 0 : }
19134 0 : case 31: {
19135 0 : break;
19136 0 : }
19137 0 : case 32: {
19138 0 : break;
19139 0 : }
19140 0 : case 33: {
19141 0 : break;
19142 0 : }
19143 0 : case 34: {
19144 0 : break;
19145 0 : }
19146 0 : case 35: {
19147 0 : break;
19148 0 : }
19149 0 : case 36: {
19150 0 : break;
19151 0 : }
19152 0 : case 37: {
19153 0 : break;
19154 0 : }
19155 0 : case 38: {
19156 0 : break;
19157 0 : }
19158 0 : case 39: {
19159 0 : break;
19160 0 : }
19161 0 : case 40: {
19162 0 : break;
19163 0 : }
19164 0 : case 41: {
19165 0 : break;
19166 0 : }
19167 0 : case 42: {
19168 0 : break;
19169 0 : }
19170 0 : case 43: {
19171 0 : break;
19172 0 : }
19173 0 : case 44: {
19174 0 : break;
19175 0 : }
19176 0 : case 45: {
19177 0 : break;
19178 0 : }
19179 0 : case 46: {
19180 0 : break;
19181 0 : }
19182 0 : case 47: {
19183 0 : break;
19184 0 : }
19185 0 : case 48: {
19186 0 : break;
19187 0 : }
19188 0 : case 49: {
19189 0 : break;
19190 0 : }
19191 0 : case 50: {
19192 0 : break;
19193 0 : }
19194 0 : case 51: {
19195 0 : break;
19196 0 : }
19197 0 : case 52: {
19198 0 : break;
19199 0 : }
19200 0 : case 53: {
19201 0 : break;
19202 0 : }
19203 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
19204 0 : }
19205 0 : }
19206 0 : void fd_instr_error_enum_new_disc( fd_instr_error_enum_t * self, uint discriminant ) {
19207 0 : self->discriminant = discriminant;
19208 0 : fd_instr_error_enum_inner_new( &self->inner, self->discriminant );
19209 0 : }
19210 0 : void fd_instr_error_enum_new( fd_instr_error_enum_t * self ) {
19211 0 : fd_memset( self, 0, sizeof(fd_instr_error_enum_t) );
19212 0 : fd_instr_error_enum_new_disc( self, UINT_MAX );
19213 0 : }
19214 :
19215 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, uint varint ) {
19216 0 : (void) varint;
19217 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_instr_error_enum", level++, 0);
19218 0 : switch( self->discriminant ) {
19219 0 : case 0: {
19220 0 : fun( w, self, "generic_error", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
19221 0 : break;
19222 0 : }
19223 0 : case 1: {
19224 0 : fun( w, self, "invalid_argument", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
19225 0 : break;
19226 0 : }
19227 0 : case 2: {
19228 0 : fun( w, self, "invalid_instruction_data", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
19229 0 : break;
19230 0 : }
19231 0 : case 3: {
19232 0 : fun( w, self, "invalid_account_data", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
19233 0 : break;
19234 0 : }
19235 0 : case 4: {
19236 0 : fun( w, self, "account_data_too_small", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
19237 0 : break;
19238 0 : }
19239 0 : case 5: {
19240 0 : fun( w, self, "insufficient_funds", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
19241 0 : break;
19242 0 : }
19243 0 : case 6: {
19244 0 : fun( w, self, "incorrect_program_id", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
19245 0 : break;
19246 0 : }
19247 0 : case 7: {
19248 0 : fun( w, self, "missing_required_signature", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
19249 0 : break;
19250 0 : }
19251 0 : case 8: {
19252 0 : fun( w, self, "account_already_initialized", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
19253 0 : break;
19254 0 : }
19255 0 : case 9: {
19256 0 : fun( w, self, "uninitialized_account", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
19257 0 : break;
19258 0 : }
19259 0 : case 10: {
19260 0 : fun( w, self, "unbalanced_instruction", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
19261 0 : break;
19262 0 : }
19263 0 : case 11: {
19264 0 : fun( w, self, "modified_program_id", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
19265 0 : break;
19266 0 : }
19267 0 : case 12: {
19268 0 : fun( w, self, "external_account_lamport_spend", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
19269 0 : break;
19270 0 : }
19271 0 : case 13: {
19272 0 : fun( w, self, "external_account_data_modified", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
19273 0 : break;
19274 0 : }
19275 0 : case 14: {
19276 0 : fun( w, self, "readonly_lamport_change", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
19277 0 : break;
19278 0 : }
19279 0 : case 15: {
19280 0 : fun( w, self, "readonly_data_modified", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
19281 0 : break;
19282 0 : }
19283 0 : case 16: {
19284 0 : fun( w, self, "duplicate_account_index", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
19285 0 : break;
19286 0 : }
19287 0 : case 17: {
19288 0 : fun( w, self, "executable_modified", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
19289 0 : break;
19290 0 : }
19291 0 : case 18: {
19292 0 : fun( w, self, "rent_epoch_modified", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
19293 0 : break;
19294 0 : }
19295 0 : case 19: {
19296 0 : fun( w, self, "not_enough_account_keys", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
19297 0 : break;
19298 0 : }
19299 0 : case 20: {
19300 0 : fun( w, self, "account_data_size_changed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
19301 0 : break;
19302 0 : }
19303 0 : case 21: {
19304 0 : fun( w, self, "account_not_executable", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
19305 0 : break;
19306 0 : }
19307 0 : case 22: {
19308 0 : fun( w, self, "account_borrow_failed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
19309 0 : break;
19310 0 : }
19311 0 : case 23: {
19312 0 : fun( w, self, "account_borrow_outstanding", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
19313 0 : break;
19314 0 : }
19315 0 : case 24: {
19316 0 : fun( w, self, "duplicate_account_out_of_sync", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
19317 0 : break;
19318 0 : }
19319 0 : case 25: {
19320 0 : fun( w, self, "custom", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
19321 0 : fun( w, &self->inner.custom, "custom", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
19322 0 : break;
19323 0 : }
19324 0 : case 26: {
19325 0 : fun( w, self, "invalid_error", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
19326 0 : break;
19327 0 : }
19328 0 : case 27: {
19329 0 : fun( w, self, "executable_data_modified", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
19330 0 : break;
19331 0 : }
19332 0 : case 28: {
19333 0 : fun( w, self, "executable_lamport_change", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
19334 0 : break;
19335 0 : }
19336 0 : case 29: {
19337 0 : fun( w, self, "executable_account_not_rent_exempt", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
19338 0 : break;
19339 0 : }
19340 0 : case 30: {
19341 0 : fun( w, self, "unsupported_program_id", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
19342 0 : break;
19343 0 : }
19344 0 : case 31: {
19345 0 : fun( w, self, "call_depth", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
19346 0 : break;
19347 0 : }
19348 0 : case 32: {
19349 0 : fun( w, self, "missing_account", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
19350 0 : break;
19351 0 : }
19352 0 : case 33: {
19353 0 : fun( w, self, "reentrancy_not_allowed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
19354 0 : break;
19355 0 : }
19356 0 : case 34: {
19357 0 : fun( w, self, "max_seed_length_exceeded", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
19358 0 : break;
19359 0 : }
19360 0 : case 35: {
19361 0 : fun( w, self, "invalid_seeds", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
19362 0 : break;
19363 0 : }
19364 0 : case 36: {
19365 0 : fun( w, self, "invalid_realloc", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
19366 0 : break;
19367 0 : }
19368 0 : case 37: {
19369 0 : fun( w, self, "computational_budget_exceeded", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
19370 0 : break;
19371 0 : }
19372 0 : case 38: {
19373 0 : fun( w, self, "privilege_escalation", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
19374 0 : break;
19375 0 : }
19376 0 : case 39: {
19377 0 : fun( w, self, "program_environment_setup_failure", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
19378 0 : break;
19379 0 : }
19380 0 : case 40: {
19381 0 : fun( w, self, "program_failed_to_complete", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
19382 0 : break;
19383 0 : }
19384 0 : case 41: {
19385 0 : fun( w, self, "program_failed_to_compile", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
19386 0 : break;
19387 0 : }
19388 0 : case 42: {
19389 0 : fun( w, self, "immutable", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
19390 0 : break;
19391 0 : }
19392 0 : case 43: {
19393 0 : fun( w, self, "incorrect_authority", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
19394 0 : break;
19395 0 : }
19396 0 : case 44: {
19397 0 : fun( w, self, "borsh_io_error", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
19398 0 : fun( w, self->inner.borsh_io_error, "borsh_io_error", FD_FLAMENCO_TYPE_CSTR, "char*", level, 0 );
19399 0 : break;
19400 0 : }
19401 0 : case 45: {
19402 0 : fun( w, self, "account_not_rent_exempt", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
19403 0 : break;
19404 0 : }
19405 0 : case 46: {
19406 0 : fun( w, self, "invalid_account_owner", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
19407 0 : break;
19408 0 : }
19409 0 : case 47: {
19410 0 : fun( w, self, "arithmetic_overflow", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
19411 0 : break;
19412 0 : }
19413 0 : case 48: {
19414 0 : fun( w, self, "unsupported_sysvar", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
19415 0 : break;
19416 0 : }
19417 0 : case 49: {
19418 0 : fun( w, self, "illegal_owner", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
19419 0 : break;
19420 0 : }
19421 0 : case 50: {
19422 0 : fun( w, self, "max_accounts_data_allocations_exceeded", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
19423 0 : break;
19424 0 : }
19425 0 : case 51: {
19426 0 : fun( w, self, "max_accounts_exceeded", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
19427 0 : break;
19428 0 : }
19429 0 : case 52: {
19430 0 : fun( w, self, "max_instruction_trace_length_exceeded", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
19431 0 : break;
19432 0 : }
19433 0 : case 53: {
19434 0 : fun( w, self, "builtin_programs_must_consume_compute_units", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
19435 0 : break;
19436 0 : }
19437 0 : }
19438 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_instr_error_enum", level--, 0 );
19439 0 : }
19440 0 : ulong fd_instr_error_enum_size( fd_instr_error_enum_t const * self ) {
19441 0 : ulong size = 0;
19442 0 : size += sizeof(uint);
19443 0 : switch (self->discriminant) {
19444 0 : case 25: {
19445 0 : size += sizeof(uint);
19446 0 : break;
19447 0 : }
19448 0 : case 44: {
19449 0 : size += sizeof(ulong) + strlen(self->inner.borsh_io_error);
19450 0 : break;
19451 0 : }
19452 0 : }
19453 0 : return size;
19454 0 : }
19455 :
19456 0 : int fd_instr_error_enum_inner_encode( fd_instr_error_enum_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
19457 0 : int err;
19458 0 : switch (discriminant) {
19459 0 : case 25: {
19460 0 : err = fd_bincode_uint32_encode( self->custom, ctx );
19461 0 : if( FD_UNLIKELY( err ) ) return err;
19462 0 : break;
19463 0 : }
19464 0 : case 44: {
19465 0 : ulong slen = strlen( (char *) self->borsh_io_error );
19466 0 : err = fd_bincode_uint64_encode( slen, ctx );
19467 0 : if( FD_UNLIKELY( err ) ) return err;
19468 0 : err = fd_bincode_bytes_encode( (uchar *) self->borsh_io_error, slen, ctx );
19469 0 : if( FD_UNLIKELY( err ) ) return err;
19470 0 : break;
19471 0 : }
19472 0 : }
19473 0 : return FD_BINCODE_SUCCESS;
19474 0 : }
19475 0 : int fd_instr_error_enum_encode( fd_instr_error_enum_t const * self, fd_bincode_encode_ctx_t * ctx ) {
19476 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
19477 0 : if( FD_UNLIKELY( err ) ) return err;
19478 0 : return fd_instr_error_enum_inner_encode( &self->inner, self->discriminant, ctx );
19479 0 : }
19480 :
19481 0 : int fd_txn_instr_error_encode( fd_txn_instr_error_t const * self, fd_bincode_encode_ctx_t * ctx ) {
19482 0 : int err;
19483 0 : err = fd_bincode_uint8_encode( (uchar)(self->instr_idx), ctx );
19484 0 : if( FD_UNLIKELY( err ) ) return err;
19485 0 : err = fd_instr_error_enum_encode( &self->error, ctx );
19486 0 : if( FD_UNLIKELY( err ) ) return err;
19487 0 : return FD_BINCODE_SUCCESS;
19488 0 : }
19489 0 : static int fd_txn_instr_error_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
19490 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
19491 0 : int err = 0;
19492 0 : err = fd_bincode_uint8_decode_footprint( ctx );
19493 0 : if( FD_UNLIKELY( err ) ) return err;
19494 0 : err = fd_instr_error_enum_decode_footprint_inner( ctx, total_sz );
19495 0 : if( FD_UNLIKELY( err ) ) return err;
19496 0 : return 0;
19497 0 : }
19498 0 : int fd_txn_instr_error_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
19499 0 : *total_sz += sizeof(fd_txn_instr_error_t);
19500 0 : void const * start_data = ctx->data;
19501 0 : int err = fd_txn_instr_error_decode_footprint_inner( ctx, total_sz );
19502 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
19503 0 : ctx->data = start_data;
19504 0 : return err;
19505 0 : }
19506 0 : static void fd_txn_instr_error_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
19507 0 : fd_txn_instr_error_t * self = (fd_txn_instr_error_t *)struct_mem;
19508 0 : fd_bincode_uint8_decode_unsafe( &self->instr_idx, ctx );
19509 0 : fd_instr_error_enum_decode_inner( &self->error, alloc_mem, ctx );
19510 0 : }
19511 0 : void * fd_txn_instr_error_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
19512 0 : fd_txn_instr_error_t * self = (fd_txn_instr_error_t *)mem;
19513 0 : fd_txn_instr_error_new( self );
19514 0 : void * alloc_region = (uchar *)mem + sizeof(fd_txn_instr_error_t);
19515 0 : void * * alloc_mem = &alloc_region;
19516 0 : fd_txn_instr_error_decode_inner( mem, alloc_mem, ctx );
19517 0 : return self;
19518 0 : }
19519 0 : void fd_txn_instr_error_new(fd_txn_instr_error_t * self) {
19520 0 : fd_memset( self, 0, sizeof(fd_txn_instr_error_t) );
19521 0 : fd_instr_error_enum_new( &self->error );
19522 0 : }
19523 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, uint varint ) {
19524 0 : (void) varint;
19525 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_txn_instr_error", level++, 0 );
19526 0 : fun( w, &self->instr_idx, "instr_idx", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
19527 0 : fd_instr_error_enum_walk( w, &self->error, fun, "error", level, 0 );
19528 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_txn_instr_error", level--, 0 );
19529 0 : }
19530 0 : ulong fd_txn_instr_error_size( fd_txn_instr_error_t const * self ) {
19531 0 : ulong size = 0;
19532 0 : size += sizeof(char);
19533 0 : size += fd_instr_error_enum_size( &self->error );
19534 0 : return size;
19535 0 : }
19536 :
19537 0 : FD_FN_PURE uchar fd_txn_error_enum_is_account_in_use(fd_txn_error_enum_t const * self) {
19538 0 : return self->discriminant == 0;
19539 0 : }
19540 0 : FD_FN_PURE uchar fd_txn_error_enum_is_account_loaded_twice(fd_txn_error_enum_t const * self) {
19541 0 : return self->discriminant == 1;
19542 0 : }
19543 0 : FD_FN_PURE uchar fd_txn_error_enum_is_account_not_found(fd_txn_error_enum_t const * self) {
19544 0 : return self->discriminant == 2;
19545 0 : }
19546 0 : FD_FN_PURE uchar fd_txn_error_enum_is_program_account_not_found(fd_txn_error_enum_t const * self) {
19547 0 : return self->discriminant == 3;
19548 0 : }
19549 0 : FD_FN_PURE uchar fd_txn_error_enum_is_insufficient_funds_for_fee(fd_txn_error_enum_t const * self) {
19550 0 : return self->discriminant == 4;
19551 0 : }
19552 0 : FD_FN_PURE uchar fd_txn_error_enum_is_invalid_account_for_fee(fd_txn_error_enum_t const * self) {
19553 0 : return self->discriminant == 5;
19554 0 : }
19555 0 : FD_FN_PURE uchar fd_txn_error_enum_is_already_processed(fd_txn_error_enum_t const * self) {
19556 0 : return self->discriminant == 6;
19557 0 : }
19558 0 : FD_FN_PURE uchar fd_txn_error_enum_is_blockhash_not_found(fd_txn_error_enum_t const * self) {
19559 0 : return self->discriminant == 7;
19560 0 : }
19561 0 : FD_FN_PURE uchar fd_txn_error_enum_is_instruction_error(fd_txn_error_enum_t const * self) {
19562 0 : return self->discriminant == 8;
19563 0 : }
19564 0 : FD_FN_PURE uchar fd_txn_error_enum_is_call_chain_too_deep(fd_txn_error_enum_t const * self) {
19565 0 : return self->discriminant == 9;
19566 0 : }
19567 0 : FD_FN_PURE uchar fd_txn_error_enum_is_missing_signature_for_fee(fd_txn_error_enum_t const * self) {
19568 0 : return self->discriminant == 10;
19569 0 : }
19570 0 : FD_FN_PURE uchar fd_txn_error_enum_is_invalid_account_index(fd_txn_error_enum_t const * self) {
19571 0 : return self->discriminant == 11;
19572 0 : }
19573 0 : FD_FN_PURE uchar fd_txn_error_enum_is_signature_failure(fd_txn_error_enum_t const * self) {
19574 0 : return self->discriminant == 12;
19575 0 : }
19576 0 : FD_FN_PURE uchar fd_txn_error_enum_is_invalid_program_for_execution(fd_txn_error_enum_t const * self) {
19577 0 : return self->discriminant == 13;
19578 0 : }
19579 0 : FD_FN_PURE uchar fd_txn_error_enum_is_sanitize_failure(fd_txn_error_enum_t const * self) {
19580 0 : return self->discriminant == 14;
19581 0 : }
19582 0 : FD_FN_PURE uchar fd_txn_error_enum_is_cluster_maintenance(fd_txn_error_enum_t const * self) {
19583 0 : return self->discriminant == 15;
19584 0 : }
19585 0 : FD_FN_PURE uchar fd_txn_error_enum_is_account_borrow_outstanding(fd_txn_error_enum_t const * self) {
19586 0 : return self->discriminant == 16;
19587 0 : }
19588 0 : FD_FN_PURE uchar fd_txn_error_enum_is_would_exceed_max_block_cost_limit(fd_txn_error_enum_t const * self) {
19589 0 : return self->discriminant == 17;
19590 0 : }
19591 0 : FD_FN_PURE uchar fd_txn_error_enum_is_unsupported_version(fd_txn_error_enum_t const * self) {
19592 0 : return self->discriminant == 18;
19593 0 : }
19594 0 : FD_FN_PURE uchar fd_txn_error_enum_is_invalid_writable_account(fd_txn_error_enum_t const * self) {
19595 0 : return self->discriminant == 19;
19596 0 : }
19597 0 : FD_FN_PURE uchar fd_txn_error_enum_is_would_exceed_max_account_cost_limit(fd_txn_error_enum_t const * self) {
19598 0 : return self->discriminant == 20;
19599 0 : }
19600 0 : FD_FN_PURE uchar fd_txn_error_enum_is_would_exceed_account_data_block_limit(fd_txn_error_enum_t const * self) {
19601 0 : return self->discriminant == 21;
19602 0 : }
19603 0 : FD_FN_PURE uchar fd_txn_error_enum_is_too_many_account_locks(fd_txn_error_enum_t const * self) {
19604 0 : return self->discriminant == 22;
19605 0 : }
19606 0 : FD_FN_PURE uchar fd_txn_error_enum_is_address_lookup_table_not_found(fd_txn_error_enum_t const * self) {
19607 0 : return self->discriminant == 23;
19608 0 : }
19609 0 : FD_FN_PURE uchar fd_txn_error_enum_is_invalid_address_lookup_table_owner(fd_txn_error_enum_t const * self) {
19610 0 : return self->discriminant == 24;
19611 0 : }
19612 0 : FD_FN_PURE uchar fd_txn_error_enum_is_invalid_address_lookup_table_data(fd_txn_error_enum_t const * self) {
19613 0 : return self->discriminant == 25;
19614 0 : }
19615 0 : FD_FN_PURE uchar fd_txn_error_enum_is_invalid_address_lookup_table_index(fd_txn_error_enum_t const * self) {
19616 0 : return self->discriminant == 26;
19617 0 : }
19618 0 : FD_FN_PURE uchar fd_txn_error_enum_is_invalid_rent_paying_account(fd_txn_error_enum_t const * self) {
19619 0 : return self->discriminant == 27;
19620 0 : }
19621 0 : FD_FN_PURE uchar fd_txn_error_enum_is_would_exceed_max_vote_cost_limit(fd_txn_error_enum_t const * self) {
19622 0 : return self->discriminant == 28;
19623 0 : }
19624 0 : FD_FN_PURE uchar fd_txn_error_enum_is_would_exceed_account_data_total_limit(fd_txn_error_enum_t const * self) {
19625 0 : return self->discriminant == 29;
19626 0 : }
19627 0 : FD_FN_PURE uchar fd_txn_error_enum_is_duplicate_instruction(fd_txn_error_enum_t const * self) {
19628 0 : return self->discriminant == 30;
19629 0 : }
19630 0 : FD_FN_PURE uchar fd_txn_error_enum_is_insufficient_funds_for_rent(fd_txn_error_enum_t const * self) {
19631 0 : return self->discriminant == 31;
19632 0 : }
19633 0 : FD_FN_PURE uchar fd_txn_error_enum_is_max_loaded_accounts_data_size_exceeded(fd_txn_error_enum_t const * self) {
19634 0 : return self->discriminant == 32;
19635 0 : }
19636 0 : FD_FN_PURE uchar fd_txn_error_enum_is_invalid_loaded_accounts_data_size_limit(fd_txn_error_enum_t const * self) {
19637 0 : return self->discriminant == 33;
19638 0 : }
19639 0 : FD_FN_PURE uchar fd_txn_error_enum_is_resanitization_needed(fd_txn_error_enum_t const * self) {
19640 0 : return self->discriminant == 34;
19641 0 : }
19642 0 : FD_FN_PURE uchar fd_txn_error_enum_is_program_execution_temporarily_restricted(fd_txn_error_enum_t const * self) {
19643 0 : return self->discriminant == 35;
19644 0 : }
19645 0 : FD_FN_PURE uchar fd_txn_error_enum_is_unbalanced_transaction(fd_txn_error_enum_t const * self) {
19646 0 : return self->discriminant == 36;
19647 0 : }
19648 : void fd_txn_error_enum_inner_new( fd_txn_error_enum_inner_t * self, uint discriminant );
19649 0 : int fd_txn_error_enum_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
19650 0 : int err;
19651 0 : switch (discriminant) {
19652 0 : case 0: {
19653 0 : return FD_BINCODE_SUCCESS;
19654 0 : }
19655 0 : case 1: {
19656 0 : return FD_BINCODE_SUCCESS;
19657 0 : }
19658 0 : case 2: {
19659 0 : return FD_BINCODE_SUCCESS;
19660 0 : }
19661 0 : case 3: {
19662 0 : return FD_BINCODE_SUCCESS;
19663 0 : }
19664 0 : case 4: {
19665 0 : return FD_BINCODE_SUCCESS;
19666 0 : }
19667 0 : case 5: {
19668 0 : return FD_BINCODE_SUCCESS;
19669 0 : }
19670 0 : case 6: {
19671 0 : return FD_BINCODE_SUCCESS;
19672 0 : }
19673 0 : case 7: {
19674 0 : return FD_BINCODE_SUCCESS;
19675 0 : }
19676 0 : case 8: {
19677 0 : err = fd_txn_instr_error_decode_footprint_inner( ctx, total_sz );
19678 0 : if( FD_UNLIKELY( err ) ) return err;
19679 0 : return FD_BINCODE_SUCCESS;
19680 0 : }
19681 0 : case 9: {
19682 0 : return FD_BINCODE_SUCCESS;
19683 0 : }
19684 0 : case 10: {
19685 0 : return FD_BINCODE_SUCCESS;
19686 0 : }
19687 0 : case 11: {
19688 0 : return FD_BINCODE_SUCCESS;
19689 0 : }
19690 0 : case 12: {
19691 0 : return FD_BINCODE_SUCCESS;
19692 0 : }
19693 0 : case 13: {
19694 0 : return FD_BINCODE_SUCCESS;
19695 0 : }
19696 0 : case 14: {
19697 0 : return FD_BINCODE_SUCCESS;
19698 0 : }
19699 0 : case 15: {
19700 0 : return FD_BINCODE_SUCCESS;
19701 0 : }
19702 0 : case 16: {
19703 0 : return FD_BINCODE_SUCCESS;
19704 0 : }
19705 0 : case 17: {
19706 0 : return FD_BINCODE_SUCCESS;
19707 0 : }
19708 0 : case 18: {
19709 0 : return FD_BINCODE_SUCCESS;
19710 0 : }
19711 0 : case 19: {
19712 0 : return FD_BINCODE_SUCCESS;
19713 0 : }
19714 0 : case 20: {
19715 0 : return FD_BINCODE_SUCCESS;
19716 0 : }
19717 0 : case 21: {
19718 0 : return FD_BINCODE_SUCCESS;
19719 0 : }
19720 0 : case 22: {
19721 0 : return FD_BINCODE_SUCCESS;
19722 0 : }
19723 0 : case 23: {
19724 0 : return FD_BINCODE_SUCCESS;
19725 0 : }
19726 0 : case 24: {
19727 0 : return FD_BINCODE_SUCCESS;
19728 0 : }
19729 0 : case 25: {
19730 0 : return FD_BINCODE_SUCCESS;
19731 0 : }
19732 0 : case 26: {
19733 0 : return FD_BINCODE_SUCCESS;
19734 0 : }
19735 0 : case 27: {
19736 0 : return FD_BINCODE_SUCCESS;
19737 0 : }
19738 0 : case 28: {
19739 0 : return FD_BINCODE_SUCCESS;
19740 0 : }
19741 0 : case 29: {
19742 0 : return FD_BINCODE_SUCCESS;
19743 0 : }
19744 0 : case 30: {
19745 0 : err = fd_bincode_uint8_decode_footprint( ctx );
19746 0 : if( FD_UNLIKELY( err ) ) return err;
19747 0 : return FD_BINCODE_SUCCESS;
19748 0 : }
19749 0 : case 31: {
19750 0 : err = fd_bincode_uint8_decode_footprint( ctx );
19751 0 : if( FD_UNLIKELY( err ) ) return err;
19752 0 : return FD_BINCODE_SUCCESS;
19753 0 : }
19754 0 : case 32: {
19755 0 : return FD_BINCODE_SUCCESS;
19756 0 : }
19757 0 : case 33: {
19758 0 : return FD_BINCODE_SUCCESS;
19759 0 : }
19760 0 : case 34: {
19761 0 : return FD_BINCODE_SUCCESS;
19762 0 : }
19763 0 : case 35: {
19764 0 : err = fd_bincode_uint8_decode_footprint( ctx );
19765 0 : if( FD_UNLIKELY( err ) ) return err;
19766 0 : return FD_BINCODE_SUCCESS;
19767 0 : }
19768 0 : case 36: {
19769 0 : return FD_BINCODE_SUCCESS;
19770 0 : }
19771 0 : default: return FD_BINCODE_ERR_ENCODING;
19772 0 : }
19773 0 : }
19774 0 : static int fd_txn_error_enum_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
19775 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
19776 0 : uint discriminant = 0;
19777 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
19778 0 : if( FD_UNLIKELY( err ) ) return err;
19779 0 : return fd_txn_error_enum_inner_decode_footprint( discriminant, ctx, total_sz );
19780 0 : }
19781 0 : int fd_txn_error_enum_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
19782 0 : *total_sz += sizeof(fd_txn_error_enum_t);
19783 0 : void const * start_data = ctx->data;
19784 0 : int err = fd_txn_error_enum_decode_footprint_inner( ctx, total_sz );
19785 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
19786 0 : ctx->data = start_data;
19787 0 : return err;
19788 0 : }
19789 0 : static 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 ) {
19790 0 : switch (discriminant) {
19791 0 : case 0: {
19792 0 : break;
19793 0 : }
19794 0 : case 1: {
19795 0 : break;
19796 0 : }
19797 0 : case 2: {
19798 0 : break;
19799 0 : }
19800 0 : case 3: {
19801 0 : break;
19802 0 : }
19803 0 : case 4: {
19804 0 : break;
19805 0 : }
19806 0 : case 5: {
19807 0 : break;
19808 0 : }
19809 0 : case 6: {
19810 0 : break;
19811 0 : }
19812 0 : case 7: {
19813 0 : break;
19814 0 : }
19815 0 : case 8: {
19816 0 : fd_txn_instr_error_decode_inner( &self->instruction_error, alloc_mem, ctx );
19817 0 : break;
19818 0 : }
19819 0 : case 9: {
19820 0 : break;
19821 0 : }
19822 0 : case 10: {
19823 0 : break;
19824 0 : }
19825 0 : case 11: {
19826 0 : break;
19827 0 : }
19828 0 : case 12: {
19829 0 : break;
19830 0 : }
19831 0 : case 13: {
19832 0 : break;
19833 0 : }
19834 0 : case 14: {
19835 0 : break;
19836 0 : }
19837 0 : case 15: {
19838 0 : break;
19839 0 : }
19840 0 : case 16: {
19841 0 : break;
19842 0 : }
19843 0 : case 17: {
19844 0 : break;
19845 0 : }
19846 0 : case 18: {
19847 0 : break;
19848 0 : }
19849 0 : case 19: {
19850 0 : break;
19851 0 : }
19852 0 : case 20: {
19853 0 : break;
19854 0 : }
19855 0 : case 21: {
19856 0 : break;
19857 0 : }
19858 0 : case 22: {
19859 0 : break;
19860 0 : }
19861 0 : case 23: {
19862 0 : break;
19863 0 : }
19864 0 : case 24: {
19865 0 : break;
19866 0 : }
19867 0 : case 25: {
19868 0 : break;
19869 0 : }
19870 0 : case 26: {
19871 0 : break;
19872 0 : }
19873 0 : case 27: {
19874 0 : break;
19875 0 : }
19876 0 : case 28: {
19877 0 : break;
19878 0 : }
19879 0 : case 29: {
19880 0 : break;
19881 0 : }
19882 0 : case 30: {
19883 0 : fd_bincode_uint8_decode_unsafe( &self->duplicate_instruction, ctx );
19884 0 : break;
19885 0 : }
19886 0 : case 31: {
19887 0 : fd_bincode_uint8_decode_unsafe( &self->insufficient_funds_for_rent, ctx );
19888 0 : break;
19889 0 : }
19890 0 : case 32: {
19891 0 : break;
19892 0 : }
19893 0 : case 33: {
19894 0 : break;
19895 0 : }
19896 0 : case 34: {
19897 0 : break;
19898 0 : }
19899 0 : case 35: {
19900 0 : fd_bincode_uint8_decode_unsafe( &self->program_execution_temporarily_restricted, ctx );
19901 0 : break;
19902 0 : }
19903 0 : case 36: {
19904 0 : break;
19905 0 : }
19906 0 : }
19907 0 : }
19908 0 : static void fd_txn_error_enum_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
19909 0 : fd_txn_error_enum_t * self = (fd_txn_error_enum_t *)struct_mem;
19910 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
19911 0 : fd_txn_error_enum_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
19912 0 : }
19913 0 : void * fd_txn_error_enum_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
19914 0 : fd_txn_error_enum_t * self = (fd_txn_error_enum_t *)mem;
19915 0 : fd_txn_error_enum_new( self );
19916 0 : void * alloc_region = (uchar *)mem + sizeof(fd_txn_error_enum_t);
19917 0 : void * * alloc_mem = &alloc_region;
19918 0 : fd_txn_error_enum_decode_inner( mem, alloc_mem, ctx );
19919 0 : return self;
19920 0 : }
19921 0 : void fd_txn_error_enum_inner_new( fd_txn_error_enum_inner_t * self, uint discriminant ) {
19922 0 : switch( discriminant ) {
19923 0 : case 0: {
19924 0 : break;
19925 0 : }
19926 0 : case 1: {
19927 0 : break;
19928 0 : }
19929 0 : case 2: {
19930 0 : break;
19931 0 : }
19932 0 : case 3: {
19933 0 : break;
19934 0 : }
19935 0 : case 4: {
19936 0 : break;
19937 0 : }
19938 0 : case 5: {
19939 0 : break;
19940 0 : }
19941 0 : case 6: {
19942 0 : break;
19943 0 : }
19944 0 : case 7: {
19945 0 : break;
19946 0 : }
19947 0 : case 8: {
19948 0 : fd_txn_instr_error_new( &self->instruction_error );
19949 0 : break;
19950 0 : }
19951 0 : case 9: {
19952 0 : break;
19953 0 : }
19954 0 : case 10: {
19955 0 : break;
19956 0 : }
19957 0 : case 11: {
19958 0 : break;
19959 0 : }
19960 0 : case 12: {
19961 0 : break;
19962 0 : }
19963 0 : case 13: {
19964 0 : break;
19965 0 : }
19966 0 : case 14: {
19967 0 : break;
19968 0 : }
19969 0 : case 15: {
19970 0 : break;
19971 0 : }
19972 0 : case 16: {
19973 0 : break;
19974 0 : }
19975 0 : case 17: {
19976 0 : break;
19977 0 : }
19978 0 : case 18: {
19979 0 : break;
19980 0 : }
19981 0 : case 19: {
19982 0 : break;
19983 0 : }
19984 0 : case 20: {
19985 0 : break;
19986 0 : }
19987 0 : case 21: {
19988 0 : break;
19989 0 : }
19990 0 : case 22: {
19991 0 : break;
19992 0 : }
19993 0 : case 23: {
19994 0 : break;
19995 0 : }
19996 0 : case 24: {
19997 0 : break;
19998 0 : }
19999 0 : case 25: {
20000 0 : break;
20001 0 : }
20002 0 : case 26: {
20003 0 : break;
20004 0 : }
20005 0 : case 27: {
20006 0 : break;
20007 0 : }
20008 0 : case 28: {
20009 0 : break;
20010 0 : }
20011 0 : case 29: {
20012 0 : break;
20013 0 : }
20014 0 : case 30: {
20015 0 : break;
20016 0 : }
20017 0 : case 31: {
20018 0 : break;
20019 0 : }
20020 0 : case 32: {
20021 0 : break;
20022 0 : }
20023 0 : case 33: {
20024 0 : break;
20025 0 : }
20026 0 : case 34: {
20027 0 : break;
20028 0 : }
20029 0 : case 35: {
20030 0 : break;
20031 0 : }
20032 0 : case 36: {
20033 0 : break;
20034 0 : }
20035 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
20036 0 : }
20037 0 : }
20038 0 : void fd_txn_error_enum_new_disc( fd_txn_error_enum_t * self, uint discriminant ) {
20039 0 : self->discriminant = discriminant;
20040 0 : fd_txn_error_enum_inner_new( &self->inner, self->discriminant );
20041 0 : }
20042 0 : void fd_txn_error_enum_new( fd_txn_error_enum_t * self ) {
20043 0 : fd_memset( self, 0, sizeof(fd_txn_error_enum_t) );
20044 0 : fd_txn_error_enum_new_disc( self, UINT_MAX );
20045 0 : }
20046 :
20047 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, uint varint ) {
20048 0 : (void) varint;
20049 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_txn_error_enum", level++, 0);
20050 0 : switch( self->discriminant ) {
20051 0 : case 0: {
20052 0 : fun( w, self, "account_in_use", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
20053 0 : break;
20054 0 : }
20055 0 : case 1: {
20056 0 : fun( w, self, "account_loaded_twice", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
20057 0 : break;
20058 0 : }
20059 0 : case 2: {
20060 0 : fun( w, self, "account_not_found", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
20061 0 : break;
20062 0 : }
20063 0 : case 3: {
20064 0 : fun( w, self, "program_account_not_found", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
20065 0 : break;
20066 0 : }
20067 0 : case 4: {
20068 0 : fun( w, self, "insufficient_funds_for_fee", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
20069 0 : break;
20070 0 : }
20071 0 : case 5: {
20072 0 : fun( w, self, "invalid_account_for_fee", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
20073 0 : break;
20074 0 : }
20075 0 : case 6: {
20076 0 : fun( w, self, "already_processed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
20077 0 : break;
20078 0 : }
20079 0 : case 7: {
20080 0 : fun( w, self, "blockhash_not_found", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
20081 0 : break;
20082 0 : }
20083 0 : case 8: {
20084 0 : fun( w, self, "instruction_error", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
20085 0 : fd_txn_instr_error_walk( w, &self->inner.instruction_error, fun, "instruction_error", level, 0 );
20086 0 : break;
20087 0 : }
20088 0 : case 9: {
20089 0 : fun( w, self, "call_chain_too_deep", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
20090 0 : break;
20091 0 : }
20092 0 : case 10: {
20093 0 : fun( w, self, "missing_signature_for_fee", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
20094 0 : break;
20095 0 : }
20096 0 : case 11: {
20097 0 : fun( w, self, "invalid_account_index", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
20098 0 : break;
20099 0 : }
20100 0 : case 12: {
20101 0 : fun( w, self, "signature_failure", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
20102 0 : break;
20103 0 : }
20104 0 : case 13: {
20105 0 : fun( w, self, "invalid_program_for_execution", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
20106 0 : break;
20107 0 : }
20108 0 : case 14: {
20109 0 : fun( w, self, "sanitize_failure", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
20110 0 : break;
20111 0 : }
20112 0 : case 15: {
20113 0 : fun( w, self, "cluster_maintenance", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
20114 0 : break;
20115 0 : }
20116 0 : case 16: {
20117 0 : fun( w, self, "account_borrow_outstanding", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
20118 0 : break;
20119 0 : }
20120 0 : case 17: {
20121 0 : fun( w, self, "would_exceed_max_block_cost_limit", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
20122 0 : break;
20123 0 : }
20124 0 : case 18: {
20125 0 : fun( w, self, "unsupported_version", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
20126 0 : break;
20127 0 : }
20128 0 : case 19: {
20129 0 : fun( w, self, "invalid_writable_account", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
20130 0 : break;
20131 0 : }
20132 0 : case 20: {
20133 0 : fun( w, self, "would_exceed_max_account_cost_limit", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
20134 0 : break;
20135 0 : }
20136 0 : case 21: {
20137 0 : fun( w, self, "would_exceed_account_data_block_limit", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
20138 0 : break;
20139 0 : }
20140 0 : case 22: {
20141 0 : fun( w, self, "too_many_account_locks", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
20142 0 : break;
20143 0 : }
20144 0 : case 23: {
20145 0 : fun( w, self, "address_lookup_table_not_found", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
20146 0 : break;
20147 0 : }
20148 0 : case 24: {
20149 0 : fun( w, self, "invalid_address_lookup_table_owner", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
20150 0 : break;
20151 0 : }
20152 0 : case 25: {
20153 0 : fun( w, self, "invalid_address_lookup_table_data", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
20154 0 : break;
20155 0 : }
20156 0 : case 26: {
20157 0 : fun( w, self, "invalid_address_lookup_table_index", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
20158 0 : break;
20159 0 : }
20160 0 : case 27: {
20161 0 : fun( w, self, "invalid_rent_paying_account", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
20162 0 : break;
20163 0 : }
20164 0 : case 28: {
20165 0 : fun( w, self, "would_exceed_max_vote_cost_limit", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
20166 0 : break;
20167 0 : }
20168 0 : case 29: {
20169 0 : fun( w, self, "would_exceed_account_data_total_limit", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
20170 0 : break;
20171 0 : }
20172 0 : case 30: {
20173 0 : fun( w, self, "duplicate_instruction", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
20174 0 : fun( w, &self->inner.duplicate_instruction, "duplicate_instruction", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
20175 0 : break;
20176 0 : }
20177 0 : case 31: {
20178 0 : fun( w, self, "insufficient_funds_for_rent", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
20179 0 : fun( w, &self->inner.insufficient_funds_for_rent, "insufficient_funds_for_rent", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
20180 0 : break;
20181 0 : }
20182 0 : case 32: {
20183 0 : fun( w, self, "max_loaded_accounts_data_size_exceeded", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
20184 0 : break;
20185 0 : }
20186 0 : case 33: {
20187 0 : fun( w, self, "invalid_loaded_accounts_data_size_limit", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
20188 0 : break;
20189 0 : }
20190 0 : case 34: {
20191 0 : fun( w, self, "resanitization_needed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
20192 0 : break;
20193 0 : }
20194 0 : case 35: {
20195 0 : fun( w, self, "program_execution_temporarily_restricted", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
20196 0 : fun( w, &self->inner.program_execution_temporarily_restricted, "program_execution_temporarily_restricted", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
20197 0 : break;
20198 0 : }
20199 0 : case 36: {
20200 0 : fun( w, self, "unbalanced_transaction", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
20201 0 : break;
20202 0 : }
20203 0 : }
20204 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_txn_error_enum", level--, 0 );
20205 0 : }
20206 0 : ulong fd_txn_error_enum_size( fd_txn_error_enum_t const * self ) {
20207 0 : ulong size = 0;
20208 0 : size += sizeof(uint);
20209 0 : switch (self->discriminant) {
20210 0 : case 8: {
20211 0 : size += fd_txn_instr_error_size( &self->inner.instruction_error );
20212 0 : break;
20213 0 : }
20214 0 : case 30: {
20215 0 : size += sizeof(char);
20216 0 : break;
20217 0 : }
20218 0 : case 31: {
20219 0 : size += sizeof(char);
20220 0 : break;
20221 0 : }
20222 0 : case 35: {
20223 0 : size += sizeof(char);
20224 0 : break;
20225 0 : }
20226 0 : }
20227 0 : return size;
20228 0 : }
20229 :
20230 0 : int fd_txn_error_enum_inner_encode( fd_txn_error_enum_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
20231 0 : int err;
20232 0 : switch (discriminant) {
20233 0 : case 8: {
20234 0 : err = fd_txn_instr_error_encode( &self->instruction_error, ctx );
20235 0 : if( FD_UNLIKELY( err ) ) return err;
20236 0 : break;
20237 0 : }
20238 0 : case 30: {
20239 0 : err = fd_bincode_uint8_encode( (uchar)(self->duplicate_instruction), ctx );
20240 0 : if( FD_UNLIKELY( err ) ) return err;
20241 0 : break;
20242 0 : }
20243 0 : case 31: {
20244 0 : err = fd_bincode_uint8_encode( (uchar)(self->insufficient_funds_for_rent), ctx );
20245 0 : if( FD_UNLIKELY( err ) ) return err;
20246 0 : break;
20247 0 : }
20248 0 : case 35: {
20249 0 : err = fd_bincode_uint8_encode( (uchar)(self->program_execution_temporarily_restricted), ctx );
20250 0 : if( FD_UNLIKELY( err ) ) return err;
20251 0 : break;
20252 0 : }
20253 0 : }
20254 0 : return FD_BINCODE_SUCCESS;
20255 0 : }
20256 0 : int fd_txn_error_enum_encode( fd_txn_error_enum_t const * self, fd_bincode_encode_ctx_t * ctx ) {
20257 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
20258 0 : if( FD_UNLIKELY( err ) ) return err;
20259 0 : return fd_txn_error_enum_inner_encode( &self->inner, self->discriminant, ctx );
20260 0 : }
20261 :
20262 0 : FD_FN_PURE uchar fd_txn_result_is_ok(fd_txn_result_t const * self) {
20263 0 : return self->discriminant == 0;
20264 0 : }
20265 0 : FD_FN_PURE uchar fd_txn_result_is_error(fd_txn_result_t const * self) {
20266 0 : return self->discriminant == 1;
20267 0 : }
20268 : void fd_txn_result_inner_new( fd_txn_result_inner_t * self, uint discriminant );
20269 0 : int fd_txn_result_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
20270 0 : int err;
20271 0 : switch (discriminant) {
20272 0 : case 0: {
20273 0 : return FD_BINCODE_SUCCESS;
20274 0 : }
20275 0 : case 1: {
20276 0 : err = fd_txn_error_enum_decode_footprint_inner( ctx, total_sz );
20277 0 : if( FD_UNLIKELY( err ) ) return err;
20278 0 : return FD_BINCODE_SUCCESS;
20279 0 : }
20280 0 : default: return FD_BINCODE_ERR_ENCODING;
20281 0 : }
20282 0 : }
20283 0 : static int fd_txn_result_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
20284 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
20285 0 : uint discriminant = 0;
20286 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
20287 0 : if( FD_UNLIKELY( err ) ) return err;
20288 0 : return fd_txn_result_inner_decode_footprint( discriminant, ctx, total_sz );
20289 0 : }
20290 0 : int fd_txn_result_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
20291 0 : *total_sz += sizeof(fd_txn_result_t);
20292 0 : void const * start_data = ctx->data;
20293 0 : int err = fd_txn_result_decode_footprint_inner( ctx, total_sz );
20294 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
20295 0 : ctx->data = start_data;
20296 0 : return err;
20297 0 : }
20298 0 : static void fd_txn_result_inner_decode_inner( fd_txn_result_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
20299 0 : switch (discriminant) {
20300 0 : case 0: {
20301 0 : break;
20302 0 : }
20303 0 : case 1: {
20304 0 : fd_txn_error_enum_decode_inner( &self->error, alloc_mem, ctx );
20305 0 : break;
20306 0 : }
20307 0 : }
20308 0 : }
20309 0 : static void fd_txn_result_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
20310 0 : fd_txn_result_t * self = (fd_txn_result_t *)struct_mem;
20311 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
20312 0 : fd_txn_result_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
20313 0 : }
20314 0 : void * fd_txn_result_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
20315 0 : fd_txn_result_t * self = (fd_txn_result_t *)mem;
20316 0 : fd_txn_result_new( self );
20317 0 : void * alloc_region = (uchar *)mem + sizeof(fd_txn_result_t);
20318 0 : void * * alloc_mem = &alloc_region;
20319 0 : fd_txn_result_decode_inner( mem, alloc_mem, ctx );
20320 0 : return self;
20321 0 : }
20322 0 : void fd_txn_result_inner_new( fd_txn_result_inner_t * self, uint discriminant ) {
20323 0 : switch( discriminant ) {
20324 0 : case 0: {
20325 0 : break;
20326 0 : }
20327 0 : case 1: {
20328 0 : fd_txn_error_enum_new( &self->error );
20329 0 : break;
20330 0 : }
20331 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
20332 0 : }
20333 0 : }
20334 0 : void fd_txn_result_new_disc( fd_txn_result_t * self, uint discriminant ) {
20335 0 : self->discriminant = discriminant;
20336 0 : fd_txn_result_inner_new( &self->inner, self->discriminant );
20337 0 : }
20338 0 : void fd_txn_result_new( fd_txn_result_t * self ) {
20339 0 : fd_memset( self, 0, sizeof(fd_txn_result_t) );
20340 0 : fd_txn_result_new_disc( self, UINT_MAX );
20341 0 : }
20342 :
20343 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, uint varint ) {
20344 0 : (void) varint;
20345 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_txn_result", level++, 0);
20346 0 : switch( self->discriminant ) {
20347 0 : case 0: {
20348 0 : fun( w, self, "ok", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
20349 0 : break;
20350 0 : }
20351 0 : case 1: {
20352 0 : fun( w, self, "error", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
20353 0 : fd_txn_error_enum_walk( w, &self->inner.error, fun, "error", level, 0 );
20354 0 : break;
20355 0 : }
20356 0 : }
20357 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_txn_result", level--, 0 );
20358 0 : }
20359 0 : ulong fd_txn_result_size( fd_txn_result_t const * self ) {
20360 0 : ulong size = 0;
20361 0 : size += sizeof(uint);
20362 0 : switch (self->discriminant) {
20363 0 : case 1: {
20364 0 : size += fd_txn_error_enum_size( &self->inner.error );
20365 0 : break;
20366 0 : }
20367 0 : }
20368 0 : return size;
20369 0 : }
20370 :
20371 0 : int fd_txn_result_inner_encode( fd_txn_result_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
20372 0 : int err;
20373 0 : switch (discriminant) {
20374 0 : case 1: {
20375 0 : err = fd_txn_error_enum_encode( &self->error, ctx );
20376 0 : if( FD_UNLIKELY( err ) ) return err;
20377 0 : break;
20378 0 : }
20379 0 : }
20380 0 : return FD_BINCODE_SUCCESS;
20381 0 : }
20382 0 : int fd_txn_result_encode( fd_txn_result_t const * self, fd_bincode_encode_ctx_t * ctx ) {
20383 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
20384 0 : if( FD_UNLIKELY( err ) ) return err;
20385 0 : return fd_txn_result_inner_encode( &self->inner, self->discriminant, ctx );
20386 0 : }
20387 :
20388 0 : int fd_cache_status_encode( fd_cache_status_t const * self, fd_bincode_encode_ctx_t * ctx ) {
20389 0 : int err;
20390 0 : err = fd_bincode_bytes_encode( self->key_slice, 20, ctx );
20391 0 : if( FD_UNLIKELY( err ) ) return err;
20392 0 : err = fd_txn_result_encode( &self->result, ctx );
20393 0 : if( FD_UNLIKELY( err ) ) return err;
20394 0 : return FD_BINCODE_SUCCESS;
20395 0 : }
20396 0 : static int fd_cache_status_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
20397 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
20398 0 : int err = 0;
20399 0 : err = fd_bincode_bytes_decode_footprint( 20, ctx );
20400 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
20401 0 : err = fd_txn_result_decode_footprint_inner( ctx, total_sz );
20402 0 : if( FD_UNLIKELY( err ) ) return err;
20403 0 : return 0;
20404 0 : }
20405 0 : int fd_cache_status_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
20406 0 : *total_sz += sizeof(fd_cache_status_t);
20407 0 : void const * start_data = ctx->data;
20408 0 : int err = fd_cache_status_decode_footprint_inner( ctx, total_sz );
20409 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
20410 0 : ctx->data = start_data;
20411 0 : return err;
20412 0 : }
20413 0 : static void fd_cache_status_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
20414 0 : fd_cache_status_t * self = (fd_cache_status_t *)struct_mem;
20415 0 : fd_bincode_bytes_decode_unsafe( self->key_slice, 20, ctx );
20416 0 : fd_txn_result_decode_inner( &self->result, alloc_mem, ctx );
20417 0 : }
20418 0 : void * fd_cache_status_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
20419 0 : fd_cache_status_t * self = (fd_cache_status_t *)mem;
20420 0 : fd_cache_status_new( self );
20421 0 : void * alloc_region = (uchar *)mem + sizeof(fd_cache_status_t);
20422 0 : void * * alloc_mem = &alloc_region;
20423 0 : fd_cache_status_decode_inner( mem, alloc_mem, ctx );
20424 0 : return self;
20425 0 : }
20426 0 : void fd_cache_status_new(fd_cache_status_t * self) {
20427 0 : fd_memset( self, 0, sizeof(fd_cache_status_t) );
20428 0 : fd_txn_result_new( &self->result );
20429 0 : }
20430 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, uint varint ) {
20431 0 : (void) varint;
20432 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_cache_status", level++, 0 );
20433 0 : fun(w, self->key_slice, "key_slice", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
20434 0 : fd_txn_result_walk( w, &self->result, fun, "result", level, 0 );
20435 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_cache_status", level--, 0 );
20436 0 : }
20437 0 : ulong fd_cache_status_size( fd_cache_status_t const * self ) {
20438 0 : ulong size = 0;
20439 0 : size += 20;
20440 0 : size += fd_txn_result_size( &self->result );
20441 0 : return size;
20442 0 : }
20443 :
20444 0 : int fd_status_value_encode( fd_status_value_t const * self, fd_bincode_encode_ctx_t * ctx ) {
20445 0 : int err;
20446 0 : err = fd_bincode_uint64_encode( self->txn_idx, ctx );
20447 0 : if( FD_UNLIKELY( err ) ) return err;
20448 0 : err = fd_bincode_uint64_encode( self->statuses_len, ctx );
20449 0 : if( FD_UNLIKELY(err) ) return err;
20450 0 : if( self->statuses_len ) {
20451 0 : for( ulong i=0; i < self->statuses_len; i++ ) {
20452 0 : err = fd_cache_status_encode( self->statuses + i, ctx );
20453 0 : if( FD_UNLIKELY( err ) ) return err;
20454 0 : }
20455 0 : }
20456 0 : return FD_BINCODE_SUCCESS;
20457 0 : }
20458 0 : static int fd_status_value_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
20459 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
20460 0 : int err = 0;
20461 0 : err = fd_bincode_uint64_decode_footprint( ctx );
20462 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
20463 0 : ulong statuses_len;
20464 0 : err = fd_bincode_uint64_decode( &statuses_len, ctx );
20465 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
20466 0 : if( statuses_len ) {
20467 0 : *total_sz += FD_CACHE_STATUS_ALIGN + sizeof(fd_cache_status_t)*statuses_len;
20468 0 : for( ulong i=0; i < statuses_len; i++ ) {
20469 0 : err = fd_cache_status_decode_footprint_inner( ctx, total_sz );
20470 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
20471 0 : }
20472 0 : }
20473 0 : return 0;
20474 0 : }
20475 0 : int fd_status_value_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
20476 0 : *total_sz += sizeof(fd_status_value_t);
20477 0 : void const * start_data = ctx->data;
20478 0 : int err = fd_status_value_decode_footprint_inner( ctx, total_sz );
20479 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
20480 0 : ctx->data = start_data;
20481 0 : return err;
20482 0 : }
20483 0 : static void fd_status_value_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
20484 0 : fd_status_value_t * self = (fd_status_value_t *)struct_mem;
20485 0 : fd_bincode_uint64_decode_unsafe( &self->txn_idx, ctx );
20486 0 : fd_bincode_uint64_decode_unsafe( &self->statuses_len, ctx );
20487 0 : if( self->statuses_len ) {
20488 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_CACHE_STATUS_ALIGN );
20489 0 : self->statuses = *alloc_mem;
20490 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_cache_status_t)*self->statuses_len;
20491 0 : for( ulong i=0; i < self->statuses_len; i++ ) {
20492 0 : fd_cache_status_new( self->statuses + i );
20493 0 : fd_cache_status_decode_inner( self->statuses + i, alloc_mem, ctx );
20494 0 : }
20495 0 : } else
20496 0 : self->statuses = NULL;
20497 0 : }
20498 0 : void * fd_status_value_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
20499 0 : fd_status_value_t * self = (fd_status_value_t *)mem;
20500 0 : fd_status_value_new( self );
20501 0 : void * alloc_region = (uchar *)mem + sizeof(fd_status_value_t);
20502 0 : void * * alloc_mem = &alloc_region;
20503 0 : fd_status_value_decode_inner( mem, alloc_mem, ctx );
20504 0 : return self;
20505 0 : }
20506 0 : void fd_status_value_new(fd_status_value_t * self) {
20507 0 : fd_memset( self, 0, sizeof(fd_status_value_t) );
20508 0 : }
20509 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, uint varint ) {
20510 0 : (void) varint;
20511 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_status_value", level++, 0 );
20512 0 : fun( w, &self->txn_idx, "txn_idx", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
20513 0 : if( self->statuses_len ) {
20514 0 : fun( w, NULL, "statuses", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
20515 0 : for( ulong i=0; i < self->statuses_len; i++ )
20516 0 : fd_cache_status_walk(w, self->statuses + i, fun, "cache_status", level, 0 );
20517 0 : fun( w, NULL, "statuses", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
20518 0 : }
20519 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_status_value", level--, 0 );
20520 0 : }
20521 0 : ulong fd_status_value_size( fd_status_value_t const * self ) {
20522 0 : ulong size = 0;
20523 0 : size += sizeof(ulong);
20524 0 : do {
20525 0 : size += sizeof(ulong);
20526 0 : for( ulong i=0; i < self->statuses_len; i++ )
20527 0 : size += fd_cache_status_size( self->statuses + i );
20528 0 : } while(0);
20529 0 : return size;
20530 0 : }
20531 :
20532 0 : int fd_status_pair_encode( fd_status_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
20533 0 : int err;
20534 0 : err = fd_hash_encode( &self->hash, ctx );
20535 0 : if( FD_UNLIKELY( err ) ) return err;
20536 0 : err = fd_status_value_encode( &self->value, ctx );
20537 0 : if( FD_UNLIKELY( err ) ) return err;
20538 0 : return FD_BINCODE_SUCCESS;
20539 0 : }
20540 0 : static int fd_status_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
20541 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
20542 0 : int err = 0;
20543 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
20544 0 : if( FD_UNLIKELY( err ) ) return err;
20545 0 : err = fd_status_value_decode_footprint_inner( ctx, total_sz );
20546 0 : if( FD_UNLIKELY( err ) ) return err;
20547 0 : return 0;
20548 0 : }
20549 0 : int fd_status_pair_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
20550 0 : *total_sz += sizeof(fd_status_pair_t);
20551 0 : void const * start_data = ctx->data;
20552 0 : int err = fd_status_pair_decode_footprint_inner( ctx, total_sz );
20553 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
20554 0 : ctx->data = start_data;
20555 0 : return err;
20556 0 : }
20557 0 : static void fd_status_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
20558 0 : fd_status_pair_t * self = (fd_status_pair_t *)struct_mem;
20559 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
20560 0 : fd_status_value_decode_inner( &self->value, alloc_mem, ctx );
20561 0 : }
20562 0 : void * fd_status_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
20563 0 : fd_status_pair_t * self = (fd_status_pair_t *)mem;
20564 0 : fd_status_pair_new( self );
20565 0 : void * alloc_region = (uchar *)mem + sizeof(fd_status_pair_t);
20566 0 : void * * alloc_mem = &alloc_region;
20567 0 : fd_status_pair_decode_inner( mem, alloc_mem, ctx );
20568 0 : return self;
20569 0 : }
20570 0 : void fd_status_pair_new(fd_status_pair_t * self) {
20571 0 : fd_memset( self, 0, sizeof(fd_status_pair_t) );
20572 0 : fd_hash_new( &self->hash );
20573 0 : fd_status_value_new( &self->value );
20574 0 : }
20575 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, uint varint ) {
20576 0 : (void) varint;
20577 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_status_pair", level++, 0 );
20578 0 : fd_hash_walk( w, &self->hash, fun, "hash", level, 0 );
20579 0 : fd_status_value_walk( w, &self->value, fun, "value", level, 0 );
20580 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_status_pair", level--, 0 );
20581 0 : }
20582 0 : ulong fd_status_pair_size( fd_status_pair_t const * self ) {
20583 0 : ulong size = 0;
20584 0 : size += fd_hash_size( &self->hash );
20585 0 : size += fd_status_value_size( &self->value );
20586 0 : return size;
20587 0 : }
20588 :
20589 0 : int fd_slot_delta_encode( fd_slot_delta_t const * self, fd_bincode_encode_ctx_t * ctx ) {
20590 0 : int err;
20591 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
20592 0 : if( FD_UNLIKELY( err ) ) return err;
20593 0 : err = fd_bincode_bool_encode( (uchar)(self->is_root), ctx );
20594 0 : if( FD_UNLIKELY( err ) ) return err;
20595 0 : err = fd_bincode_uint64_encode( self->slot_delta_vec_len, ctx );
20596 0 : if( FD_UNLIKELY(err) ) return err;
20597 0 : if( self->slot_delta_vec_len ) {
20598 0 : for( ulong i=0; i < self->slot_delta_vec_len; i++ ) {
20599 0 : err = fd_status_pair_encode( self->slot_delta_vec + i, ctx );
20600 0 : if( FD_UNLIKELY( err ) ) return err;
20601 0 : }
20602 0 : }
20603 0 : return FD_BINCODE_SUCCESS;
20604 0 : }
20605 0 : static int fd_slot_delta_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
20606 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
20607 0 : int err = 0;
20608 0 : err = fd_bincode_uint64_decode_footprint( ctx );
20609 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
20610 0 : err = fd_bincode_bool_decode_footprint( ctx );
20611 0 : if( FD_UNLIKELY( err ) ) return err;
20612 0 : ulong slot_delta_vec_len;
20613 0 : err = fd_bincode_uint64_decode( &slot_delta_vec_len, ctx );
20614 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
20615 0 : if( slot_delta_vec_len ) {
20616 0 : *total_sz += FD_STATUS_PAIR_ALIGN + sizeof(fd_status_pair_t)*slot_delta_vec_len;
20617 0 : for( ulong i=0; i < slot_delta_vec_len; i++ ) {
20618 0 : err = fd_status_pair_decode_footprint_inner( ctx, total_sz );
20619 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
20620 0 : }
20621 0 : }
20622 0 : return 0;
20623 0 : }
20624 0 : int fd_slot_delta_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
20625 0 : *total_sz += sizeof(fd_slot_delta_t);
20626 0 : void const * start_data = ctx->data;
20627 0 : int err = fd_slot_delta_decode_footprint_inner( ctx, total_sz );
20628 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
20629 0 : ctx->data = start_data;
20630 0 : return err;
20631 0 : }
20632 0 : static void fd_slot_delta_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
20633 0 : fd_slot_delta_t * self = (fd_slot_delta_t *)struct_mem;
20634 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
20635 0 : fd_bincode_bool_decode_unsafe( &self->is_root, ctx );
20636 0 : fd_bincode_uint64_decode_unsafe( &self->slot_delta_vec_len, ctx );
20637 0 : if( self->slot_delta_vec_len ) {
20638 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_STATUS_PAIR_ALIGN );
20639 0 : self->slot_delta_vec = *alloc_mem;
20640 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_status_pair_t)*self->slot_delta_vec_len;
20641 0 : for( ulong i=0; i < self->slot_delta_vec_len; i++ ) {
20642 0 : fd_status_pair_new( self->slot_delta_vec + i );
20643 0 : fd_status_pair_decode_inner( self->slot_delta_vec + i, alloc_mem, ctx );
20644 0 : }
20645 0 : } else
20646 0 : self->slot_delta_vec = NULL;
20647 0 : }
20648 0 : void * fd_slot_delta_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
20649 0 : fd_slot_delta_t * self = (fd_slot_delta_t *)mem;
20650 0 : fd_slot_delta_new( self );
20651 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_delta_t);
20652 0 : void * * alloc_mem = &alloc_region;
20653 0 : fd_slot_delta_decode_inner( mem, alloc_mem, ctx );
20654 0 : return self;
20655 0 : }
20656 0 : void fd_slot_delta_new(fd_slot_delta_t * self) {
20657 0 : fd_memset( self, 0, sizeof(fd_slot_delta_t) );
20658 0 : }
20659 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, uint varint ) {
20660 0 : (void) varint;
20661 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_slot_delta", level++, 0 );
20662 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
20663 0 : fun( w, &self->is_root, "is_root", FD_FLAMENCO_TYPE_BOOL, "bool", level, 0 );
20664 0 : if( self->slot_delta_vec_len ) {
20665 0 : fun( w, NULL, "slot_delta_vec", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
20666 0 : for( ulong i=0; i < self->slot_delta_vec_len; i++ )
20667 0 : fd_status_pair_walk(w, self->slot_delta_vec + i, fun, "status_pair", level, 0 );
20668 0 : fun( w, NULL, "slot_delta_vec", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
20669 0 : }
20670 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_slot_delta", level--, 0 );
20671 0 : }
20672 0 : ulong fd_slot_delta_size( fd_slot_delta_t const * self ) {
20673 0 : ulong size = 0;
20674 0 : size += sizeof(ulong);
20675 0 : size += sizeof(char);
20676 0 : do {
20677 0 : size += sizeof(ulong);
20678 0 : for( ulong i=0; i < self->slot_delta_vec_len; i++ )
20679 0 : size += fd_status_pair_size( self->slot_delta_vec + i );
20680 0 : } while(0);
20681 0 : return size;
20682 0 : }
20683 :
20684 0 : int fd_bank_slot_deltas_encode( fd_bank_slot_deltas_t const * self, fd_bincode_encode_ctx_t * ctx ) {
20685 0 : int err;
20686 0 : err = fd_bincode_uint64_encode( self->slot_deltas_len, ctx );
20687 0 : if( FD_UNLIKELY(err) ) return err;
20688 0 : if( self->slot_deltas_len ) {
20689 0 : for( ulong i=0; i < self->slot_deltas_len; i++ ) {
20690 0 : err = fd_slot_delta_encode( self->slot_deltas + i, ctx );
20691 0 : if( FD_UNLIKELY( err ) ) return err;
20692 0 : }
20693 0 : }
20694 0 : return FD_BINCODE_SUCCESS;
20695 0 : }
20696 0 : static int fd_bank_slot_deltas_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
20697 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
20698 0 : int err = 0;
20699 0 : ulong slot_deltas_len;
20700 0 : err = fd_bincode_uint64_decode( &slot_deltas_len, ctx );
20701 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
20702 0 : if( slot_deltas_len ) {
20703 0 : *total_sz += FD_SLOT_DELTA_ALIGN + sizeof(fd_slot_delta_t)*slot_deltas_len;
20704 0 : for( ulong i=0; i < slot_deltas_len; i++ ) {
20705 0 : err = fd_slot_delta_decode_footprint_inner( ctx, total_sz );
20706 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
20707 0 : }
20708 0 : }
20709 0 : return 0;
20710 0 : }
20711 0 : int fd_bank_slot_deltas_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
20712 0 : *total_sz += sizeof(fd_bank_slot_deltas_t);
20713 0 : void const * start_data = ctx->data;
20714 0 : int err = fd_bank_slot_deltas_decode_footprint_inner( ctx, total_sz );
20715 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
20716 0 : ctx->data = start_data;
20717 0 : return err;
20718 0 : }
20719 0 : static void fd_bank_slot_deltas_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
20720 0 : fd_bank_slot_deltas_t * self = (fd_bank_slot_deltas_t *)struct_mem;
20721 0 : fd_bincode_uint64_decode_unsafe( &self->slot_deltas_len, ctx );
20722 0 : if( self->slot_deltas_len ) {
20723 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_SLOT_DELTA_ALIGN );
20724 0 : self->slot_deltas = *alloc_mem;
20725 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_slot_delta_t)*self->slot_deltas_len;
20726 0 : for( ulong i=0; i < self->slot_deltas_len; i++ ) {
20727 0 : fd_slot_delta_new( self->slot_deltas + i );
20728 0 : fd_slot_delta_decode_inner( self->slot_deltas + i, alloc_mem, ctx );
20729 0 : }
20730 0 : } else
20731 0 : self->slot_deltas = NULL;
20732 0 : }
20733 0 : void * fd_bank_slot_deltas_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
20734 0 : fd_bank_slot_deltas_t * self = (fd_bank_slot_deltas_t *)mem;
20735 0 : fd_bank_slot_deltas_new( self );
20736 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bank_slot_deltas_t);
20737 0 : void * * alloc_mem = &alloc_region;
20738 0 : fd_bank_slot_deltas_decode_inner( mem, alloc_mem, ctx );
20739 0 : return self;
20740 0 : }
20741 0 : void fd_bank_slot_deltas_new(fd_bank_slot_deltas_t * self) {
20742 0 : fd_memset( self, 0, sizeof(fd_bank_slot_deltas_t) );
20743 0 : }
20744 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, uint varint ) {
20745 0 : (void) varint;
20746 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_bank_slot_deltas", level++, 0 );
20747 0 : if( self->slot_deltas_len ) {
20748 0 : fun( w, NULL, "slot_deltas", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
20749 0 : for( ulong i=0; i < self->slot_deltas_len; i++ )
20750 0 : fd_slot_delta_walk(w, self->slot_deltas + i, fun, "slot_delta", level, 0 );
20751 0 : fun( w, NULL, "slot_deltas", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
20752 0 : }
20753 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_bank_slot_deltas", level--, 0 );
20754 0 : }
20755 0 : ulong fd_bank_slot_deltas_size( fd_bank_slot_deltas_t const * self ) {
20756 0 : ulong size = 0;
20757 0 : do {
20758 0 : size += sizeof(ulong);
20759 0 : for( ulong i=0; i < self->slot_deltas_len; i++ )
20760 0 : size += fd_slot_delta_size( self->slot_deltas + i );
20761 0 : } while(0);
20762 0 : return size;
20763 0 : }
20764 :
20765 0 : int fd_pubkey_rewardinfo_pair_encode( fd_pubkey_rewardinfo_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
20766 0 : int err;
20767 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
20768 0 : if( FD_UNLIKELY( err ) ) return err;
20769 0 : err = fd_reward_info_encode( &self->reward_info, ctx );
20770 0 : if( FD_UNLIKELY( err ) ) return err;
20771 0 : return FD_BINCODE_SUCCESS;
20772 0 : }
20773 0 : static int fd_pubkey_rewardinfo_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
20774 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
20775 0 : int err = 0;
20776 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
20777 0 : if( FD_UNLIKELY( err ) ) return err;
20778 0 : err = fd_reward_info_decode_footprint_inner( ctx, total_sz );
20779 0 : if( FD_UNLIKELY( err ) ) return err;
20780 0 : return 0;
20781 0 : }
20782 0 : int fd_pubkey_rewardinfo_pair_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
20783 0 : *total_sz += sizeof(fd_pubkey_rewardinfo_pair_t);
20784 0 : void const * start_data = ctx->data;
20785 0 : int err = fd_pubkey_rewardinfo_pair_decode_footprint_inner( ctx, total_sz );
20786 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
20787 0 : ctx->data = start_data;
20788 0 : return err;
20789 0 : }
20790 0 : static void fd_pubkey_rewardinfo_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
20791 0 : fd_pubkey_rewardinfo_pair_t * self = (fd_pubkey_rewardinfo_pair_t *)struct_mem;
20792 0 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
20793 0 : fd_reward_info_decode_inner( &self->reward_info, alloc_mem, ctx );
20794 0 : }
20795 0 : void * fd_pubkey_rewardinfo_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
20796 0 : fd_pubkey_rewardinfo_pair_t * self = (fd_pubkey_rewardinfo_pair_t *)mem;
20797 0 : fd_pubkey_rewardinfo_pair_new( self );
20798 0 : void * alloc_region = (uchar *)mem + sizeof(fd_pubkey_rewardinfo_pair_t);
20799 0 : void * * alloc_mem = &alloc_region;
20800 0 : fd_pubkey_rewardinfo_pair_decode_inner( mem, alloc_mem, ctx );
20801 0 : return self;
20802 0 : }
20803 0 : void fd_pubkey_rewardinfo_pair_new(fd_pubkey_rewardinfo_pair_t * self) {
20804 0 : fd_memset( self, 0, sizeof(fd_pubkey_rewardinfo_pair_t) );
20805 0 : fd_pubkey_new( &self->pubkey );
20806 0 : fd_reward_info_new( &self->reward_info );
20807 0 : }
20808 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, uint varint ) {
20809 0 : (void) varint;
20810 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_pubkey_rewardinfo_pair", level++, 0 );
20811 0 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level, 0 );
20812 0 : fd_reward_info_walk( w, &self->reward_info, fun, "reward_info", level, 0 );
20813 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_pubkey_rewardinfo_pair", level--, 0 );
20814 0 : }
20815 0 : int fd_calculated_stake_points_encode( fd_calculated_stake_points_t const * self, fd_bincode_encode_ctx_t * ctx ) {
20816 0 : int err;
20817 0 : err = fd_bincode_uint128_encode( self->points, ctx );
20818 0 : if( FD_UNLIKELY( err ) ) return err;
20819 0 : err = fd_bincode_uint64_encode( self->new_credits_observed, ctx );
20820 0 : if( FD_UNLIKELY( err ) ) return err;
20821 0 : err = fd_bincode_uint8_encode( (uchar)(self->force_credits_update_with_skipped_reward), ctx );
20822 0 : if( FD_UNLIKELY( err ) ) return err;
20823 0 : return FD_BINCODE_SUCCESS;
20824 0 : }
20825 0 : static inline int fd_calculated_stake_points_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
20826 0 : if( (ulong)ctx->data + 25UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
20827 0 : ctx->data = (void *)( (ulong)ctx->data + 25UL );
20828 0 : return 0;
20829 0 : }
20830 0 : static void fd_calculated_stake_points_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
20831 0 : fd_calculated_stake_points_t * self = (fd_calculated_stake_points_t *)struct_mem;
20832 0 : fd_bincode_uint128_decode_unsafe( &self->points, ctx );
20833 0 : fd_bincode_uint64_decode_unsafe( &self->new_credits_observed, ctx );
20834 0 : fd_bincode_uint8_decode_unsafe( &self->force_credits_update_with_skipped_reward, ctx );
20835 0 : }
20836 0 : void * fd_calculated_stake_points_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
20837 0 : fd_calculated_stake_points_t * self = (fd_calculated_stake_points_t *)mem;
20838 0 : fd_calculated_stake_points_new( self );
20839 0 : void * alloc_region = (uchar *)mem + sizeof(fd_calculated_stake_points_t);
20840 0 : void * * alloc_mem = &alloc_region;
20841 0 : fd_calculated_stake_points_decode_inner( mem, alloc_mem, ctx );
20842 0 : return self;
20843 0 : }
20844 0 : void fd_calculated_stake_points_walk( void * w, fd_calculated_stake_points_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
20845 0 : (void) varint;
20846 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_calculated_stake_points", level++, 0 );
20847 0 : fun( w, &self->points, "points", FD_FLAMENCO_TYPE_UINT128, "uint128", level, 0 );
20848 0 : fun( w, &self->new_credits_observed, "new_credits_observed", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
20849 0 : fun( w, &self->force_credits_update_with_skipped_reward, "force_credits_update_with_skipped_reward", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
20850 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_calculated_stake_points", level--, 0 );
20851 0 : }
20852 0 : int fd_calculated_stake_rewards_encode( fd_calculated_stake_rewards_t const * self, fd_bincode_encode_ctx_t * ctx ) {
20853 0 : int err;
20854 0 : err = fd_bincode_uint64_encode( self->staker_rewards, ctx );
20855 0 : if( FD_UNLIKELY( err ) ) return err;
20856 0 : err = fd_bincode_uint64_encode( self->voter_rewards, ctx );
20857 0 : if( FD_UNLIKELY( err ) ) return err;
20858 0 : err = fd_bincode_uint64_encode( self->new_credits_observed, ctx );
20859 0 : if( FD_UNLIKELY( err ) ) return err;
20860 0 : return FD_BINCODE_SUCCESS;
20861 0 : }
20862 0 : static inline int fd_calculated_stake_rewards_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
20863 0 : if( (ulong)ctx->data + 24UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
20864 0 : ctx->data = (void *)( (ulong)ctx->data + 24UL );
20865 0 : return 0;
20866 0 : }
20867 0 : static void fd_calculated_stake_rewards_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
20868 0 : fd_calculated_stake_rewards_t * self = (fd_calculated_stake_rewards_t *)struct_mem;
20869 0 : fd_bincode_uint64_decode_unsafe( &self->staker_rewards, ctx );
20870 0 : fd_bincode_uint64_decode_unsafe( &self->voter_rewards, ctx );
20871 0 : fd_bincode_uint64_decode_unsafe( &self->new_credits_observed, ctx );
20872 0 : }
20873 0 : void * fd_calculated_stake_rewards_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
20874 0 : fd_calculated_stake_rewards_t * self = (fd_calculated_stake_rewards_t *)mem;
20875 0 : fd_calculated_stake_rewards_new( self );
20876 0 : void * alloc_region = (uchar *)mem + sizeof(fd_calculated_stake_rewards_t);
20877 0 : void * * alloc_mem = &alloc_region;
20878 0 : fd_calculated_stake_rewards_decode_inner( mem, alloc_mem, ctx );
20879 0 : return self;
20880 0 : }
20881 0 : void fd_calculated_stake_rewards_walk( void * w, fd_calculated_stake_rewards_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
20882 0 : (void) varint;
20883 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_calculated_stake_rewards", level++, 0 );
20884 0 : fun( w, &self->staker_rewards, "staker_rewards", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
20885 0 : fun( w, &self->voter_rewards, "voter_rewards", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
20886 0 : fun( w, &self->new_credits_observed, "new_credits_observed", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
20887 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_calculated_stake_rewards", level--, 0 );
20888 0 : }
20889 0 : int fd_duplicate_slot_proof_encode( fd_duplicate_slot_proof_t const * self, fd_bincode_encode_ctx_t * ctx ) {
20890 0 : int err;
20891 0 : err = fd_bincode_uint64_encode( self->shred1_len, ctx );
20892 0 : if( FD_UNLIKELY(err) ) return err;
20893 0 : if( self->shred1_len ) {
20894 0 : err = fd_bincode_bytes_encode( self->shred1, self->shred1_len, ctx );
20895 0 : if( FD_UNLIKELY( err ) ) return err;
20896 0 : }
20897 0 : err = fd_bincode_uint64_encode( self->shred2_len, ctx );
20898 0 : if( FD_UNLIKELY(err) ) return err;
20899 0 : if( self->shred2_len ) {
20900 0 : err = fd_bincode_bytes_encode( self->shred2, self->shred2_len, ctx );
20901 0 : if( FD_UNLIKELY( err ) ) return err;
20902 0 : }
20903 0 : return FD_BINCODE_SUCCESS;
20904 0 : }
20905 0 : static int fd_duplicate_slot_proof_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 : ulong shred1_len;
20909 0 : err = fd_bincode_uint64_decode( &shred1_len, ctx );
20910 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
20911 0 : if( shred1_len ) {
20912 0 : *total_sz += 8UL + shred1_len;
20913 0 : err = fd_bincode_bytes_decode_footprint( shred1_len, ctx );
20914 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
20915 0 : }
20916 0 : ulong shred2_len;
20917 0 : err = fd_bincode_uint64_decode( &shred2_len, ctx );
20918 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
20919 0 : if( shred2_len ) {
20920 0 : *total_sz += 8UL + shred2_len;
20921 0 : err = fd_bincode_bytes_decode_footprint( shred2_len, ctx );
20922 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
20923 0 : }
20924 0 : return 0;
20925 0 : }
20926 0 : int fd_duplicate_slot_proof_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
20927 0 : *total_sz += sizeof(fd_duplicate_slot_proof_t);
20928 0 : void const * start_data = ctx->data;
20929 0 : int err = fd_duplicate_slot_proof_decode_footprint_inner( ctx, total_sz );
20930 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
20931 0 : ctx->data = start_data;
20932 0 : return err;
20933 0 : }
20934 0 : static void fd_duplicate_slot_proof_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
20935 0 : fd_duplicate_slot_proof_t * self = (fd_duplicate_slot_proof_t *)struct_mem;
20936 0 : fd_bincode_uint64_decode_unsafe( &self->shred1_len, ctx );
20937 0 : if( self->shred1_len ) {
20938 0 : self->shred1 = *alloc_mem;
20939 0 : fd_bincode_bytes_decode_unsafe( self->shred1, self->shred1_len, ctx );
20940 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->shred1_len;
20941 0 : } else
20942 0 : self->shred1 = NULL;
20943 0 : fd_bincode_uint64_decode_unsafe( &self->shred2_len, ctx );
20944 0 : if( self->shred2_len ) {
20945 0 : self->shred2 = *alloc_mem;
20946 0 : fd_bincode_bytes_decode_unsafe( self->shred2, self->shred2_len, ctx );
20947 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->shred2_len;
20948 0 : } else
20949 0 : self->shred2 = NULL;
20950 0 : }
20951 0 : void * fd_duplicate_slot_proof_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
20952 0 : fd_duplicate_slot_proof_t * self = (fd_duplicate_slot_proof_t *)mem;
20953 0 : fd_duplicate_slot_proof_new( self );
20954 0 : void * alloc_region = (uchar *)mem + sizeof(fd_duplicate_slot_proof_t);
20955 0 : void * * alloc_mem = &alloc_region;
20956 0 : fd_duplicate_slot_proof_decode_inner( mem, alloc_mem, ctx );
20957 0 : return self;
20958 0 : }
20959 0 : void fd_duplicate_slot_proof_new(fd_duplicate_slot_proof_t * self) {
20960 0 : fd_memset( self, 0, sizeof(fd_duplicate_slot_proof_t) );
20961 0 : }
20962 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, uint varint ) {
20963 0 : (void) varint;
20964 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_duplicate_slot_proof", level++, 0 );
20965 0 : if( self->shred1_len ) {
20966 0 : fun( w, NULL, "shred1", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
20967 0 : for( ulong i=0; i < self->shred1_len; i++ )
20968 0 : fun( w, self->shred1 + i, "shred1", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
20969 0 : fun( w, NULL, "shred1", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
20970 0 : }
20971 0 : if( self->shred2_len ) {
20972 0 : fun( w, NULL, "shred2", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
20973 0 : for( ulong i=0; i < self->shred2_len; i++ )
20974 0 : fun( w, self->shred2 + i, "shred2", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
20975 0 : fun( w, NULL, "shred2", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
20976 0 : }
20977 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_duplicate_slot_proof", level--, 0 );
20978 0 : }
20979 0 : ulong fd_duplicate_slot_proof_size( fd_duplicate_slot_proof_t const * self ) {
20980 0 : ulong size = 0;
20981 0 : do {
20982 0 : size += sizeof(ulong);
20983 0 : size += self->shred1_len;
20984 0 : } while(0);
20985 0 : do {
20986 0 : size += sizeof(ulong);
20987 0 : size += self->shred2_len;
20988 0 : } while(0);
20989 0 : return size;
20990 0 : }
20991 :
20992 0 : int fd_epoch_info_pair_encode( fd_epoch_info_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
20993 0 : int err;
20994 0 : err = fd_pubkey_encode( &self->account, ctx );
20995 0 : if( FD_UNLIKELY( err ) ) return err;
20996 0 : err = fd_stake_encode( &self->stake, ctx );
20997 0 : if( FD_UNLIKELY( err ) ) return err;
20998 0 : return FD_BINCODE_SUCCESS;
20999 0 : }
21000 0 : static inline int fd_epoch_info_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
21001 0 : if( (ulong)ctx->data + 104UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
21002 0 : ctx->data = (void *)( (ulong)ctx->data + 104UL );
21003 0 : return 0;
21004 0 : }
21005 0 : static void fd_epoch_info_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
21006 0 : fd_epoch_info_pair_t * self = (fd_epoch_info_pair_t *)struct_mem;
21007 0 : fd_pubkey_decode_inner( &self->account, alloc_mem, ctx );
21008 0 : fd_stake_decode_inner( &self->stake, alloc_mem, ctx );
21009 0 : }
21010 0 : void * fd_epoch_info_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
21011 0 : fd_epoch_info_pair_t * self = (fd_epoch_info_pair_t *)mem;
21012 0 : fd_epoch_info_pair_new( self );
21013 0 : void * alloc_region = (uchar *)mem + sizeof(fd_epoch_info_pair_t);
21014 0 : void * * alloc_mem = &alloc_region;
21015 0 : fd_epoch_info_pair_decode_inner( mem, alloc_mem, ctx );
21016 0 : return self;
21017 0 : }
21018 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, uint varint ) {
21019 0 : (void) varint;
21020 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_epoch_info_pair", level++, 0 );
21021 0 : fd_pubkey_walk( w, &self->account, fun, "account", level, 0 );
21022 0 : fd_stake_walk( w, &self->stake, fun, "stake", level, 0 );
21023 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_epoch_info_pair", level--, 0 );
21024 0 : }
21025 0 : int fd_usage_cost_details_encode( fd_usage_cost_details_t const * self, fd_bincode_encode_ctx_t * ctx ) {
21026 0 : int err;
21027 0 : err = fd_bincode_uint64_encode( self->signature_cost, ctx );
21028 0 : if( FD_UNLIKELY( err ) ) return err;
21029 0 : err = fd_bincode_uint64_encode( self->write_lock_cost, ctx );
21030 0 : if( FD_UNLIKELY( err ) ) return err;
21031 0 : err = fd_bincode_uint64_encode( self->data_bytes_cost, ctx );
21032 0 : if( FD_UNLIKELY( err ) ) return err;
21033 0 : err = fd_bincode_uint64_encode( self->programs_execution_cost, ctx );
21034 0 : if( FD_UNLIKELY( err ) ) return err;
21035 0 : err = fd_bincode_uint64_encode( self->loaded_accounts_data_size_cost, ctx );
21036 0 : if( FD_UNLIKELY( err ) ) return err;
21037 0 : err = fd_bincode_uint64_encode( self->allocated_accounts_data_size, ctx );
21038 0 : if( FD_UNLIKELY( err ) ) return err;
21039 0 : return FD_BINCODE_SUCCESS;
21040 0 : }
21041 0 : static inline int fd_usage_cost_details_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
21042 0 : if( (ulong)ctx->data + 48UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
21043 0 : ctx->data = (void *)( (ulong)ctx->data + 48UL );
21044 0 : return 0;
21045 0 : }
21046 0 : static void fd_usage_cost_details_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
21047 0 : fd_usage_cost_details_t * self = (fd_usage_cost_details_t *)struct_mem;
21048 0 : fd_bincode_uint64_decode_unsafe( &self->signature_cost, ctx );
21049 0 : fd_bincode_uint64_decode_unsafe( &self->write_lock_cost, ctx );
21050 0 : fd_bincode_uint64_decode_unsafe( &self->data_bytes_cost, ctx );
21051 0 : fd_bincode_uint64_decode_unsafe( &self->programs_execution_cost, ctx );
21052 0 : fd_bincode_uint64_decode_unsafe( &self->loaded_accounts_data_size_cost, ctx );
21053 0 : fd_bincode_uint64_decode_unsafe( &self->allocated_accounts_data_size, ctx );
21054 0 : }
21055 0 : void * fd_usage_cost_details_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
21056 0 : fd_usage_cost_details_t * self = (fd_usage_cost_details_t *)mem;
21057 0 : fd_usage_cost_details_new( self );
21058 0 : void * alloc_region = (uchar *)mem + sizeof(fd_usage_cost_details_t);
21059 0 : void * * alloc_mem = &alloc_region;
21060 0 : fd_usage_cost_details_decode_inner( mem, alloc_mem, ctx );
21061 0 : return self;
21062 0 : }
21063 0 : void fd_usage_cost_details_walk( void * w, fd_usage_cost_details_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
21064 0 : (void) varint;
21065 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_usage_cost_details", level++, 0 );
21066 0 : fun( w, &self->signature_cost, "signature_cost", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
21067 0 : fun( w, &self->write_lock_cost, "write_lock_cost", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
21068 0 : fun( w, &self->data_bytes_cost, "data_bytes_cost", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
21069 0 : fun( w, &self->programs_execution_cost, "programs_execution_cost", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
21070 0 : fun( w, &self->loaded_accounts_data_size_cost, "loaded_accounts_data_size_cost", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
21071 0 : fun( w, &self->allocated_accounts_data_size, "allocated_accounts_data_size", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
21072 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_usage_cost_details", level--, 0 );
21073 0 : }
21074 0 : FD_FN_PURE uchar fd_transaction_cost_is_simple_vote(fd_transaction_cost_t const * self) {
21075 0 : return self->discriminant == 0;
21076 0 : }
21077 0 : FD_FN_PURE uchar fd_transaction_cost_is_transaction(fd_transaction_cost_t const * self) {
21078 0 : return self->discriminant == 1;
21079 0 : }
21080 : void fd_transaction_cost_inner_new( fd_transaction_cost_inner_t * self, uint discriminant );
21081 0 : int fd_transaction_cost_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
21082 0 : int err;
21083 0 : switch (discriminant) {
21084 0 : case 0: {
21085 0 : return FD_BINCODE_SUCCESS;
21086 0 : }
21087 0 : case 1: {
21088 0 : err = fd_usage_cost_details_decode_footprint_inner( ctx, total_sz );
21089 0 : if( FD_UNLIKELY( err ) ) return err;
21090 0 : return FD_BINCODE_SUCCESS;
21091 0 : }
21092 0 : default: return FD_BINCODE_ERR_ENCODING;
21093 0 : }
21094 0 : }
21095 0 : static int fd_transaction_cost_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
21096 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
21097 0 : uint discriminant = 0;
21098 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
21099 0 : if( FD_UNLIKELY( err ) ) return err;
21100 0 : return fd_transaction_cost_inner_decode_footprint( discriminant, ctx, total_sz );
21101 0 : }
21102 0 : int fd_transaction_cost_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
21103 0 : *total_sz += sizeof(fd_transaction_cost_t);
21104 0 : void const * start_data = ctx->data;
21105 0 : int err = fd_transaction_cost_decode_footprint_inner( ctx, total_sz );
21106 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
21107 0 : ctx->data = start_data;
21108 0 : return err;
21109 0 : }
21110 0 : static void fd_transaction_cost_inner_decode_inner( fd_transaction_cost_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
21111 0 : switch (discriminant) {
21112 0 : case 0: {
21113 0 : break;
21114 0 : }
21115 0 : case 1: {
21116 0 : fd_usage_cost_details_decode_inner( &self->transaction, alloc_mem, ctx );
21117 0 : break;
21118 0 : }
21119 0 : }
21120 0 : }
21121 0 : static void fd_transaction_cost_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
21122 0 : fd_transaction_cost_t * self = (fd_transaction_cost_t *)struct_mem;
21123 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
21124 0 : fd_transaction_cost_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
21125 0 : }
21126 0 : void * fd_transaction_cost_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
21127 0 : fd_transaction_cost_t * self = (fd_transaction_cost_t *)mem;
21128 0 : fd_transaction_cost_new( self );
21129 0 : void * alloc_region = (uchar *)mem + sizeof(fd_transaction_cost_t);
21130 0 : void * * alloc_mem = &alloc_region;
21131 0 : fd_transaction_cost_decode_inner( mem, alloc_mem, ctx );
21132 0 : return self;
21133 0 : }
21134 0 : void fd_transaction_cost_inner_new( fd_transaction_cost_inner_t * self, uint discriminant ) {
21135 0 : switch( discriminant ) {
21136 0 : case 0: {
21137 0 : break;
21138 0 : }
21139 0 : case 1: {
21140 0 : fd_usage_cost_details_new( &self->transaction );
21141 0 : break;
21142 0 : }
21143 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
21144 0 : }
21145 0 : }
21146 0 : void fd_transaction_cost_new_disc( fd_transaction_cost_t * self, uint discriminant ) {
21147 0 : self->discriminant = discriminant;
21148 0 : fd_transaction_cost_inner_new( &self->inner, self->discriminant );
21149 0 : }
21150 0 : void fd_transaction_cost_new( fd_transaction_cost_t * self ) {
21151 0 : fd_memset( self, 0, sizeof(fd_transaction_cost_t) );
21152 0 : fd_transaction_cost_new_disc( self, UINT_MAX );
21153 0 : }
21154 :
21155 0 : void fd_transaction_cost_walk( void * w, fd_transaction_cost_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
21156 0 : (void) varint;
21157 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_transaction_cost", level++, 0);
21158 0 : switch( self->discriminant ) {
21159 0 : case 0: {
21160 0 : fun( w, self, "simple_vote", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
21161 0 : break;
21162 0 : }
21163 0 : case 1: {
21164 0 : fun( w, self, "transaction", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
21165 0 : fd_usage_cost_details_walk( w, &self->inner.transaction, fun, "transaction", level, 0 );
21166 0 : break;
21167 0 : }
21168 0 : }
21169 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_transaction_cost", level--, 0 );
21170 0 : }
21171 0 : ulong fd_transaction_cost_size( fd_transaction_cost_t const * self ) {
21172 0 : ulong size = 0;
21173 0 : size += sizeof(uint);
21174 0 : switch (self->discriminant) {
21175 0 : case 1: {
21176 0 : size += fd_usage_cost_details_size( &self->inner.transaction );
21177 0 : break;
21178 0 : }
21179 0 : }
21180 0 : return size;
21181 0 : }
21182 :
21183 0 : int fd_transaction_cost_inner_encode( fd_transaction_cost_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
21184 0 : int err;
21185 0 : switch (discriminant) {
21186 0 : case 1: {
21187 0 : err = fd_usage_cost_details_encode( &self->transaction, ctx );
21188 0 : if( FD_UNLIKELY( err ) ) return err;
21189 0 : break;
21190 0 : }
21191 0 : }
21192 0 : return FD_BINCODE_SUCCESS;
21193 0 : }
21194 0 : int fd_transaction_cost_encode( fd_transaction_cost_t const * self, fd_bincode_encode_ctx_t * ctx ) {
21195 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
21196 0 : if( FD_UNLIKELY( err ) ) return err;
21197 0 : return fd_transaction_cost_inner_encode( &self->inner, self->discriminant, ctx );
21198 0 : }
21199 :
21200 0 : int fd_rent_paying_encode( fd_rent_paying_t const * self, fd_bincode_encode_ctx_t * ctx ) {
21201 0 : int err;
21202 0 : err = fd_bincode_uint64_encode( self->lamports, ctx );
21203 0 : if( FD_UNLIKELY( err ) ) return err;
21204 0 : err = fd_bincode_uint64_encode( self->data_size, ctx );
21205 0 : if( FD_UNLIKELY( err ) ) return err;
21206 0 : return FD_BINCODE_SUCCESS;
21207 0 : }
21208 0 : static inline int fd_rent_paying_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
21209 0 : if( (ulong)ctx->data + 16UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
21210 0 : ctx->data = (void *)( (ulong)ctx->data + 16UL );
21211 0 : return 0;
21212 0 : }
21213 0 : static void fd_rent_paying_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
21214 0 : fd_rent_paying_t * self = (fd_rent_paying_t *)struct_mem;
21215 0 : fd_bincode_uint64_decode_unsafe( &self->lamports, ctx );
21216 0 : fd_bincode_uint64_decode_unsafe( &self->data_size, ctx );
21217 0 : }
21218 0 : void * fd_rent_paying_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
21219 0 : fd_rent_paying_t * self = (fd_rent_paying_t *)mem;
21220 0 : fd_rent_paying_new( self );
21221 0 : void * alloc_region = (uchar *)mem + sizeof(fd_rent_paying_t);
21222 0 : void * * alloc_mem = &alloc_region;
21223 0 : fd_rent_paying_decode_inner( mem, alloc_mem, ctx );
21224 0 : return self;
21225 0 : }
21226 0 : void fd_rent_paying_walk( void * w, fd_rent_paying_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
21227 0 : (void) varint;
21228 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_rent_paying", level++, 0 );
21229 0 : fun( w, &self->lamports, "lamports", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
21230 0 : fun( w, &self->data_size, "data_size", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
21231 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_rent_paying", level--, 0 );
21232 0 : }
21233 0 : FD_FN_PURE uchar fd_rent_state_is_uninitialized(fd_rent_state_t const * self) {
21234 0 : return self->discriminant == 0;
21235 0 : }
21236 0 : FD_FN_PURE uchar fd_rent_state_is_rent_paying(fd_rent_state_t const * self) {
21237 0 : return self->discriminant == 1;
21238 0 : }
21239 0 : FD_FN_PURE uchar fd_rent_state_is_rent_exempt(fd_rent_state_t const * self) {
21240 0 : return self->discriminant == 2;
21241 0 : }
21242 : void fd_rent_state_inner_new( fd_rent_state_inner_t * self, uint discriminant );
21243 0 : int fd_rent_state_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
21244 0 : int err;
21245 0 : switch (discriminant) {
21246 0 : case 0: {
21247 0 : return FD_BINCODE_SUCCESS;
21248 0 : }
21249 0 : case 1: {
21250 0 : err = fd_rent_paying_decode_footprint_inner( ctx, total_sz );
21251 0 : if( FD_UNLIKELY( err ) ) return err;
21252 0 : return FD_BINCODE_SUCCESS;
21253 0 : }
21254 0 : case 2: {
21255 0 : return FD_BINCODE_SUCCESS;
21256 0 : }
21257 0 : default: return FD_BINCODE_ERR_ENCODING;
21258 0 : }
21259 0 : }
21260 0 : static int fd_rent_state_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
21261 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
21262 0 : uint discriminant = 0;
21263 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
21264 0 : if( FD_UNLIKELY( err ) ) return err;
21265 0 : return fd_rent_state_inner_decode_footprint( discriminant, ctx, total_sz );
21266 0 : }
21267 0 : int fd_rent_state_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
21268 0 : *total_sz += sizeof(fd_rent_state_t);
21269 0 : void const * start_data = ctx->data;
21270 0 : int err = fd_rent_state_decode_footprint_inner( ctx, total_sz );
21271 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
21272 0 : ctx->data = start_data;
21273 0 : return err;
21274 0 : }
21275 0 : static void fd_rent_state_inner_decode_inner( fd_rent_state_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
21276 0 : switch (discriminant) {
21277 0 : case 0: {
21278 0 : break;
21279 0 : }
21280 0 : case 1: {
21281 0 : fd_rent_paying_decode_inner( &self->rent_paying, alloc_mem, ctx );
21282 0 : break;
21283 0 : }
21284 0 : case 2: {
21285 0 : break;
21286 0 : }
21287 0 : }
21288 0 : }
21289 0 : static void fd_rent_state_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
21290 0 : fd_rent_state_t * self = (fd_rent_state_t *)struct_mem;
21291 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
21292 0 : fd_rent_state_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
21293 0 : }
21294 0 : void * fd_rent_state_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
21295 0 : fd_rent_state_t * self = (fd_rent_state_t *)mem;
21296 0 : fd_rent_state_new( self );
21297 0 : void * alloc_region = (uchar *)mem + sizeof(fd_rent_state_t);
21298 0 : void * * alloc_mem = &alloc_region;
21299 0 : fd_rent_state_decode_inner( mem, alloc_mem, ctx );
21300 0 : return self;
21301 0 : }
21302 0 : void fd_rent_state_inner_new( fd_rent_state_inner_t * self, uint discriminant ) {
21303 0 : switch( discriminant ) {
21304 0 : case 0: {
21305 0 : break;
21306 0 : }
21307 0 : case 1: {
21308 0 : fd_rent_paying_new( &self->rent_paying );
21309 0 : break;
21310 0 : }
21311 0 : case 2: {
21312 0 : break;
21313 0 : }
21314 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
21315 0 : }
21316 0 : }
21317 0 : void fd_rent_state_new_disc( fd_rent_state_t * self, uint discriminant ) {
21318 0 : self->discriminant = discriminant;
21319 0 : fd_rent_state_inner_new( &self->inner, self->discriminant );
21320 0 : }
21321 0 : void fd_rent_state_new( fd_rent_state_t * self ) {
21322 0 : fd_memset( self, 0, sizeof(fd_rent_state_t) );
21323 0 : fd_rent_state_new_disc( self, UINT_MAX );
21324 0 : }
21325 :
21326 0 : void fd_rent_state_walk( void * w, fd_rent_state_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
21327 0 : (void) varint;
21328 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_rent_state", level++, 0);
21329 0 : switch( self->discriminant ) {
21330 0 : case 0: {
21331 0 : fun( w, self, "uninitialized", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
21332 0 : break;
21333 0 : }
21334 0 : case 1: {
21335 0 : fun( w, self, "rent_paying", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
21336 0 : fd_rent_paying_walk( w, &self->inner.rent_paying, fun, "rent_paying", level, 0 );
21337 0 : break;
21338 0 : }
21339 0 : case 2: {
21340 0 : fun( w, self, "rent_exempt", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
21341 0 : break;
21342 0 : }
21343 0 : }
21344 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_rent_state", level--, 0 );
21345 0 : }
21346 0 : ulong fd_rent_state_size( fd_rent_state_t const * self ) {
21347 0 : ulong size = 0;
21348 0 : size += sizeof(uint);
21349 0 : switch (self->discriminant) {
21350 0 : case 1: {
21351 0 : size += fd_rent_paying_size( &self->inner.rent_paying );
21352 0 : break;
21353 0 : }
21354 0 : }
21355 0 : return size;
21356 0 : }
21357 :
21358 0 : int fd_rent_state_inner_encode( fd_rent_state_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
21359 0 : int err;
21360 0 : switch (discriminant) {
21361 0 : case 1: {
21362 0 : err = fd_rent_paying_encode( &self->rent_paying, ctx );
21363 0 : if( FD_UNLIKELY( err ) ) return err;
21364 0 : break;
21365 0 : }
21366 0 : }
21367 0 : return FD_BINCODE_SUCCESS;
21368 0 : }
21369 0 : int fd_rent_state_encode( fd_rent_state_t const * self, fd_bincode_encode_ctx_t * ctx ) {
21370 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
21371 0 : if( FD_UNLIKELY( err ) ) return err;
21372 0 : return fd_rent_state_inner_encode( &self->inner, self->discriminant, ctx );
21373 0 : }
21374 :
21375 0 : #define REDBLK_T fd_clock_timestamp_vote_t_mapnode_t
21376 : #define REDBLK_NAME fd_clock_timestamp_vote_t_map
21377 : #define REDBLK_IMPL_STYLE 2
21378 : #include "../../util/tmpl/fd_redblack.c"
21379 0 : long fd_clock_timestamp_vote_t_map_compare( fd_clock_timestamp_vote_t_mapnode_t * left, fd_clock_timestamp_vote_t_mapnode_t * right ) {
21380 0 : return memcmp( left->elem.pubkey.uc, right->elem.pubkey.uc, sizeof(right->elem.pubkey) );
21381 0 : }
21382 0 : #define REDBLK_T fd_vote_reward_t_mapnode_t
21383 : #define REDBLK_NAME fd_vote_reward_t_map
21384 : #define REDBLK_IMPL_STYLE 2
21385 : #include "../../util/tmpl/fd_redblack.c"
21386 0 : long fd_vote_reward_t_map_compare( fd_vote_reward_t_mapnode_t * left, fd_vote_reward_t_mapnode_t * right ) {
21387 0 : return memcmp( left->elem.pubkey.uc, right->elem.pubkey.uc, sizeof(right->elem.pubkey) );
21388 0 : }
21389 : #include "fd_types_custom.c"
|