Line data Source code
1 : /* Automatically generated by fd_pb_gen.py. Do not edit. */
2 :
3 : #include "instr.pb.h"
4 :
5 : static int
6 : fd_exec_test_instr_acct_encode( fd_pb_encoder_t * enc,
7 0 : void const * msg_ ) {
8 0 : fd_exec_test_instr_acct_t const * msg = msg_;
9 0 : if( msg->index && FD_UNLIKELY( !fd_pb_push_uint32( enc, 1U, msg->index ) ) ) return 0;
10 0 : if( msg->is_writable && FD_UNLIKELY( !fd_pb_push_bool( enc, 2U, msg->is_writable ) ) ) return 0;
11 0 : if( msg->is_signer && FD_UNLIKELY( !fd_pb_push_bool( enc, 3U, msg->is_signer ) ) ) return 0;
12 0 : return 1;
13 0 : }
14 :
15 : static int
16 : fd_exec_test_instr_acct_decode( fd_pb_inbuf_t * in,
17 : void * msg_,
18 0 : fd_spad_t * spad FD_PARAM_UNUSED ) {
19 0 : fd_exec_test_instr_acct_t * msg = msg_;
20 0 : while( fd_pb_inbuf_sz( in ) ) {
21 0 : fd_pb_tlv_t tlv[1];
22 0 : if( FD_UNLIKELY( !fd_pb_dec_tlv( in, tlv ) ) ) return 0;
23 0 : switch( tlv->field_id ) {
24 0 : case 1:
25 0 : if( FD_UNLIKELY( !fd_pb_dec_uint32( tlv, &msg->index ) ) ) return 0;
26 0 : break;
27 0 : case 2:
28 0 : if( FD_UNLIKELY( !fd_pb_dec_bool( tlv, &msg->is_writable ) ) ) return 0;
29 0 : break;
30 0 : case 3:
31 0 : if( FD_UNLIKELY( !fd_pb_dec_bool( tlv, &msg->is_signer ) ) ) return 0;
32 0 : break;
33 0 : default:
34 0 : if( FD_UNLIKELY( !fd_pb_dec_skip( in, tlv ) ) ) return 0;
35 0 : break;
36 0 : }
37 0 : }
38 0 : return 1;
39 0 : }
40 :
41 : fd_pb_msgdesc_t const fd_exec_test_instr_acct_desc = {
42 : .encode = fd_exec_test_instr_acct_encode,
43 : .decode = fd_exec_test_instr_acct_decode
44 : };
45 :
46 : static int
47 : fd_exec_test_instr_context_encode( fd_pb_encoder_t * enc,
48 0 : void const * msg_ ) {
49 0 : fd_exec_test_instr_context_t const * msg = msg_;
50 0 : if( FD_UNLIKELY( !fd_pb_push_bytes( enc, 1U, msg->program_id, 32UL ) ) ) return 0;
51 0 : for( ulong i=0UL; i<msg->accounts_count; i++ ) {
52 0 : if( FD_UNLIKELY( !fd_pb_enc_submsg( enc, 3U, &fd_exec_test_acct_state_desc, &msg->accounts[ i ] ) ) ) return 0;
53 0 : }
54 0 : for( ulong i=0UL; i<msg->instr_accounts_count; i++ ) {
55 0 : if( FD_UNLIKELY( !fd_pb_enc_submsg( enc, 4U, &fd_exec_test_instr_acct_desc, &msg->instr_accounts[ i ] ) ) ) return 0;
56 0 : }
57 0 : if( msg->data && msg->data->size && FD_UNLIKELY( !fd_pb_push_bytes( enc, 5U, msg->data->bytes, msg->data->size ) ) ) return 0;
58 0 : if( msg->cu_avail && FD_UNLIKELY( !fd_pb_push_uint64( enc, 6U, msg->cu_avail ) ) ) return 0;
59 0 : if( msg->has_features && FD_UNLIKELY( !fd_pb_enc_submsg( enc, 10U, &fd_exec_test_feature_set_desc, &msg->features ) ) ) return 0;
60 0 : return 1;
61 0 : }
62 :
63 : static int
64 : fd_exec_test_instr_context_decode( fd_pb_inbuf_t * in,
65 : void * msg_,
66 0 : fd_spad_t * spad ) {
67 0 : fd_exec_test_instr_context_t * msg = msg_;
68 0 : while( fd_pb_inbuf_sz( in ) ) {
69 0 : fd_pb_tlv_t tlv[1];
70 0 : if( FD_UNLIKELY( !fd_pb_dec_tlv( in, tlv ) ) ) return 0;
71 0 : switch( tlv->field_id ) {
72 0 : case 1:
73 0 : if( FD_UNLIKELY( !fd_pb_dec_bytes_fixed( in, tlv, msg->program_id, 32UL ) ) ) return 0;
74 0 : break;
75 0 : case 3:
76 0 : {
77 0 : void * ele = fd_pb_dec_grow( spad, &msg->accounts, &msg->accounts_count, alignof(fd_exec_test_acct_state_t), sizeof(fd_exec_test_acct_state_t) );
78 0 : if( FD_UNLIKELY( !ele ) ) return 0;
79 0 : if( FD_UNLIKELY( !fd_pb_dec_submsg( in, tlv, spad, &fd_exec_test_acct_state_desc, ele ) ) ) return 0;
80 0 : }
81 0 : break;
82 0 : case 4:
83 0 : {
84 0 : void * ele = fd_pb_dec_grow( spad, &msg->instr_accounts, &msg->instr_accounts_count, alignof(fd_exec_test_instr_acct_t), sizeof(fd_exec_test_instr_acct_t) );
85 0 : if( FD_UNLIKELY( !ele ) ) return 0;
86 0 : if( FD_UNLIKELY( !fd_pb_dec_submsg( in, tlv, spad, &fd_exec_test_instr_acct_desc, ele ) ) ) return 0;
87 0 : }
88 0 : break;
89 0 : case 5:
90 0 : if( FD_UNLIKELY( !fd_pb_dec_bytes_ptr( in, tlv, spad, &msg->data ) ) ) return 0;
91 0 : break;
92 0 : case 6:
93 0 : if( FD_UNLIKELY( !fd_pb_dec_uint64( tlv, &msg->cu_avail ) ) ) return 0;
94 0 : break;
95 0 : case 10:
96 0 : if( FD_UNLIKELY( !fd_pb_dec_submsg( in, tlv, spad, &fd_exec_test_feature_set_desc, &msg->features ) ) ) return 0;
97 0 : msg->has_features = 1;
98 0 : break;
99 0 : default:
100 0 : if( FD_UNLIKELY( !fd_pb_dec_skip( in, tlv ) ) ) return 0;
101 0 : break;
102 0 : }
103 0 : }
104 0 : return 1;
105 0 : }
106 :
107 : fd_pb_msgdesc_t const fd_exec_test_instr_context_desc = {
108 : .encode = fd_exec_test_instr_context_encode,
109 : .decode = fd_exec_test_instr_context_decode
110 : };
111 :
112 : static int
113 : fd_exec_test_instr_effects_encode( fd_pb_encoder_t * enc,
114 0 : void const * msg_ ) {
115 0 : fd_exec_test_instr_effects_t const * msg = msg_;
116 0 : if( msg->result && FD_UNLIKELY( !fd_pb_push_int32( enc, 1U, msg->result ) ) ) return 0;
117 0 : if( msg->custom_err && FD_UNLIKELY( !fd_pb_push_uint32( enc, 2U, msg->custom_err ) ) ) return 0;
118 0 : for( ulong i=0UL; i<msg->modified_accounts_count; i++ ) {
119 0 : if( FD_UNLIKELY( !fd_pb_enc_submsg( enc, 3U, &fd_exec_test_acct_state_desc, &msg->modified_accounts[ i ] ) ) ) return 0;
120 0 : }
121 0 : if( msg->cu_avail && FD_UNLIKELY( !fd_pb_push_uint64( enc, 4U, msg->cu_avail ) ) ) return 0;
122 0 : if( msg->return_data_hash && FD_UNLIKELY( !fd_pb_push_fixed64( enc, 6U, msg->return_data_hash ) ) ) return 0;
123 0 : return 1;
124 0 : }
125 :
126 : static int
127 : fd_exec_test_instr_effects_decode( fd_pb_inbuf_t * in,
128 : void * msg_,
129 0 : fd_spad_t * spad ) {
130 0 : fd_exec_test_instr_effects_t * msg = msg_;
131 0 : while( fd_pb_inbuf_sz( in ) ) {
132 0 : fd_pb_tlv_t tlv[1];
133 0 : if( FD_UNLIKELY( !fd_pb_dec_tlv( in, tlv ) ) ) return 0;
134 0 : switch( tlv->field_id ) {
135 0 : case 1:
136 0 : if( FD_UNLIKELY( !fd_pb_dec_int32( tlv, &msg->result ) ) ) return 0;
137 0 : break;
138 0 : case 2:
139 0 : if( FD_UNLIKELY( !fd_pb_dec_uint32( tlv, &msg->custom_err ) ) ) return 0;
140 0 : break;
141 0 : case 3:
142 0 : {
143 0 : void * ele = fd_pb_dec_grow( spad, &msg->modified_accounts, &msg->modified_accounts_count, alignof(fd_exec_test_acct_state_t), sizeof(fd_exec_test_acct_state_t) );
144 0 : if( FD_UNLIKELY( !ele ) ) return 0;
145 0 : if( FD_UNLIKELY( !fd_pb_dec_submsg( in, tlv, spad, &fd_exec_test_acct_state_desc, ele ) ) ) return 0;
146 0 : }
147 0 : break;
148 0 : case 4:
149 0 : if( FD_UNLIKELY( !fd_pb_dec_uint64( tlv, &msg->cu_avail ) ) ) return 0;
150 0 : break;
151 0 : case 6:
152 0 : if( FD_UNLIKELY( !fd_pb_dec_fixed64( tlv, &msg->return_data_hash ) ) ) return 0;
153 0 : break;
154 0 : default:
155 0 : if( FD_UNLIKELY( !fd_pb_dec_skip( in, tlv ) ) ) return 0;
156 0 : break;
157 0 : }
158 0 : }
159 0 : return 1;
160 0 : }
161 :
162 : fd_pb_msgdesc_t const fd_exec_test_instr_effects_desc = {
163 : .encode = fd_exec_test_instr_effects_encode,
164 : .decode = fd_exec_test_instr_effects_decode
165 : };
166 :
167 : static int
168 : fd_exec_test_instr_fixture_encode( fd_pb_encoder_t * enc,
169 0 : void const * msg_ ) {
170 0 : fd_exec_test_instr_fixture_t const * msg = msg_;
171 0 : if( msg->has_metadata && FD_UNLIKELY( !fd_pb_enc_submsg( enc, 1U, &fd_exec_test_fixture_metadata_desc, &msg->metadata ) ) ) return 0;
172 0 : if( msg->has_input && FD_UNLIKELY( !fd_pb_enc_submsg( enc, 2U, &fd_exec_test_instr_context_desc, &msg->input ) ) ) return 0;
173 0 : if( msg->has_output && FD_UNLIKELY( !fd_pb_enc_submsg( enc, 3U, &fd_exec_test_instr_effects_desc, &msg->output ) ) ) return 0;
174 0 : return 1;
175 0 : }
176 :
177 : static int
178 : fd_exec_test_instr_fixture_decode( fd_pb_inbuf_t * in,
179 : void * msg_,
180 0 : fd_spad_t * spad ) {
181 0 : fd_exec_test_instr_fixture_t * msg = msg_;
182 0 : while( fd_pb_inbuf_sz( in ) ) {
183 0 : fd_pb_tlv_t tlv[1];
184 0 : if( FD_UNLIKELY( !fd_pb_dec_tlv( in, tlv ) ) ) return 0;
185 0 : switch( tlv->field_id ) {
186 0 : case 1:
187 0 : if( FD_UNLIKELY( !fd_pb_dec_submsg( in, tlv, spad, &fd_exec_test_fixture_metadata_desc, &msg->metadata ) ) ) return 0;
188 0 : msg->has_metadata = 1;
189 0 : break;
190 0 : case 2:
191 0 : if( FD_UNLIKELY( !fd_pb_dec_submsg( in, tlv, spad, &fd_exec_test_instr_context_desc, &msg->input ) ) ) return 0;
192 0 : msg->has_input = 1;
193 0 : break;
194 0 : case 3:
195 0 : if( FD_UNLIKELY( !fd_pb_dec_submsg( in, tlv, spad, &fd_exec_test_instr_effects_desc, &msg->output ) ) ) return 0;
196 0 : msg->has_output = 1;
197 0 : break;
198 0 : default:
199 0 : if( FD_UNLIKELY( !fd_pb_dec_skip( in, tlv ) ) ) return 0;
200 0 : break;
201 0 : }
202 0 : }
203 0 : return 1;
204 0 : }
205 :
206 : fd_pb_msgdesc_t const fd_exec_test_instr_fixture_desc = {
207 : .encode = fd_exec_test_instr_fixture_encode,
208 : .decode = fd_exec_test_instr_fixture_decode
209 : };
210 :
|