Line data Source code
1 : #undef FD_SPAD_USE_HANDHOLDING
2 : #define FD_SPAD_USE_HANDHOLDING 1
3 :
4 : #include "fd_solfuzz_private.h"
5 : #include "fd_instr_harness.h"
6 : #include "../fd_executor.h"
7 : #include "../context/fd_exec_txn_ctx.h"
8 : #include "../program/fd_bpf_loader_program.h"
9 : #include "../sysvar/fd_sysvar.h"
10 : #include "../sysvar/fd_sysvar_clock.h"
11 : #include "../sysvar/fd_sysvar_epoch_schedule.h"
12 : #include "../sysvar/fd_sysvar_recent_hashes.h"
13 : #include "../sysvar/fd_sysvar_rent.h"
14 : #include "../sysvar/fd_sysvar_last_restart_slot.h"
15 : #include "../fd_system_ids.h"
16 : #include <assert.h>
17 :
18 : int
19 : fd_runtime_fuzz_instr_ctx_create( fd_solfuzz_runner_t * runner,
20 : fd_exec_instr_ctx_t * ctx,
21 : fd_exec_test_instr_context_t const * test_ctx,
22 0 : bool is_syscall ) {
23 :
24 0 : memset( ctx, 0, sizeof(fd_exec_instr_ctx_t) );
25 :
26 0 : fd_funk_t * funk = runner->funk;
27 :
28 : /* Generate unique ID for funk txn */
29 :
30 0 : fd_funk_txn_xid_t xid[1] = {0};
31 0 : xid[0] = fd_funk_generate_xid();
32 :
33 : /* Create temporary funk transaction and txn / slot / epoch contexts */
34 :
35 0 : fd_funk_txn_xid_t parent_xid; fd_funk_txn_xid_set_root( &parent_xid );
36 0 : fd_funk_txn_prepare( funk, &parent_xid, xid );
37 :
38 : /* Allocate contexts */
39 0 : uchar * txn_ctx_mem = fd_spad_alloc( runner->spad,FD_EXEC_TXN_CTX_ALIGN, FD_EXEC_TXN_CTX_FOOTPRINT );
40 0 : fd_exec_txn_ctx_t * txn_ctx = fd_exec_txn_ctx_join ( fd_exec_txn_ctx_new ( txn_ctx_mem ), runner->spad, fd_wksp_containing( runner->spad ) );
41 :
42 0 : ctx->txn_ctx = txn_ctx;
43 :
44 : /* Bank manager */
45 0 : fd_banks_clear_bank( runner->banks, runner->bank );
46 :
47 0 : fd_features_t * features = fd_bank_features_modify( runner->bank );
48 0 : fd_exec_test_feature_set_t const * feature_set = &test_ctx->epoch_context.features;
49 0 : if( !fd_runtime_fuzz_restore_features( features, feature_set ) ) {
50 0 : return 0;
51 0 : }
52 :
53 : /* Setup vote states accounts */
54 0 : fd_vote_states_t * vote_states = fd_vote_states_join( fd_vote_states_new( fd_bank_vote_states_locking_modify( runner->bank ), FD_RUNTIME_MAX_VOTE_ACCOUNTS, 999UL ) );
55 0 : if( FD_UNLIKELY( !vote_states ) ) FD_LOG_ERR(( "fd_vote_states_new failed" ));
56 0 : fd_bank_vote_states_end_locking_modify( runner->bank );
57 :
58 0 : fd_vote_states_t * vote_states_prev = fd_vote_states_join( fd_vote_states_new( fd_bank_vote_states_prev_locking_modify( runner->bank ), FD_RUNTIME_MAX_VOTE_ACCOUNTS, 999UL ) );
59 0 : if( FD_UNLIKELY( !vote_states_prev ) ) FD_LOG_ERR(( "fd_vote_states_new for prev failed" ));
60 0 : fd_bank_vote_states_prev_end_locking_modify( runner->bank );
61 :
62 0 : fd_vote_states_t * vote_states_prev_prev = fd_vote_states_join( fd_vote_states_new( fd_bank_vote_states_prev_prev_locking_modify( runner->bank ), FD_RUNTIME_MAX_VOTE_ACCOUNTS, 999UL ) );
63 0 : if( FD_UNLIKELY( !vote_states_prev_prev ) ) FD_LOG_ERR(( "fd_vote_staets_new for prev2 failed" ));
64 0 : fd_bank_vote_states_prev_prev_end_locking_modify( runner->bank );
65 :
66 : /* Blockhash queue init */
67 :
68 0 : ulong blockhash_seed; FD_TEST( fd_rng_secure( &blockhash_seed, sizeof(ulong) ) );
69 0 : fd_blockhashes_t * blockhashes = fd_blockhashes_init( fd_bank_block_hash_queue_modify( runner->bank ), blockhash_seed );
70 0 : fd_memset( fd_blockhash_deq_push_tail_nocopy( blockhashes->d.deque ), 0, sizeof(fd_hash_t) );
71 :
72 : /* Set up mock txn descriptor */
73 0 : fd_txn_p_t * txn = fd_spad_alloc( runner->spad, fd_txn_align(), fd_txn_footprint( 1UL, 0UL ) );
74 0 : fd_txn_t * txn_descriptor = TXN( txn );
75 0 : txn_descriptor->transaction_version = FD_TXN_V0;
76 0 : txn_descriptor->acct_addr_cnt = (ushort)test_ctx->accounts_count;
77 :
78 0 : fd_exec_txn_ctx_setup( runner->bank,
79 0 : runner->funk,
80 0 : xid,
81 0 : NULL,
82 0 : txn_ctx,
83 0 : NULL );
84 0 : fd_exec_txn_ctx_setup_basic( txn_ctx );
85 :
86 0 : txn_ctx->txn = *txn;
87 0 : txn_ctx->compute_budget_details.compute_unit_limit = test_ctx->cu_avail;
88 0 : txn_ctx->compute_budget_details.compute_meter = test_ctx->cu_avail;
89 0 : txn_ctx->spad = runner->spad;
90 0 : txn_ctx->instr_info_cnt = 1UL;
91 0 : txn_ctx->fuzz_config.enable_vm_tracing = runner->enable_vm_tracing;
92 :
93 : /* Set up instruction context */
94 :
95 0 : fd_instr_info_t * info = fd_spad_alloc( runner->spad, 8UL, sizeof(fd_instr_info_t) );
96 0 : assert( info );
97 0 : memset( info, 0, sizeof(fd_instr_info_t) );
98 :
99 0 : if( test_ctx->data ) {
100 0 : info->data_sz = (ushort)test_ctx->data->size;
101 0 : info->data = test_ctx->data->bytes;
102 0 : }
103 :
104 0 : txn_ctx->instr_infos[ 0UL ] = *info;
105 :
106 : /* Prepare borrowed account table (correctly handles aliasing) */
107 :
108 0 : if( FD_UNLIKELY( test_ctx->accounts_count > MAX_TX_ACCOUNT_LOCKS ) ) {
109 0 : FD_LOG_NOTICE(( "too many accounts" ));
110 0 : return 0;
111 0 : }
112 :
113 : /* Load accounts into database */
114 :
115 0 : fd_txn_account_t * accts = txn_ctx->accounts;
116 0 : fd_memset( accts, 0, test_ctx->accounts_count * sizeof(fd_txn_account_t) );
117 0 : txn_ctx->accounts_cnt = test_ctx->accounts_count;
118 :
119 0 : int has_program_id = 0;
120 :
121 0 : for( ulong j=0UL; j < test_ctx->accounts_count; j++ ) {
122 0 : fd_pubkey_t * acc_key = (fd_pubkey_t *)test_ctx->accounts[j].address;
123 :
124 0 : memcpy( &(txn_ctx->account_keys[j]), test_ctx->accounts[j].address, sizeof(fd_pubkey_t) );
125 0 : if( !fd_runtime_fuzz_load_account( &accts[j], funk, xid, &test_ctx->accounts[j], 0 ) ) {
126 0 : return 0;
127 0 : }
128 :
129 0 : fd_txn_account_t * acc = &accts[j];
130 0 : if( fd_txn_account_get_meta( acc ) ) {
131 0 : uchar * data = fd_spad_alloc( txn_ctx->spad, FD_ACCOUNT_REC_ALIGN, FD_ACC_TOT_SZ_MAX );
132 0 : ulong dlen = fd_txn_account_get_data_len( acc );
133 0 : fd_account_meta_t * meta = (fd_account_meta_t *)data;
134 0 : fd_memcpy( data, fd_txn_account_get_meta( acc ), sizeof(fd_account_meta_t)+dlen );
135 0 : if( FD_UNLIKELY( !fd_txn_account_join( fd_txn_account_new( acc, acc_key, meta, 0 ), txn_ctx->spad_wksp ) ) ) {
136 0 : FD_LOG_CRIT(( "Failed to join and new a txn account" ));
137 0 : }
138 0 : }
139 :
140 0 : if( !memcmp( accts[j].pubkey, test_ctx->program_id, sizeof(fd_pubkey_t) ) ) {
141 0 : has_program_id = 1;
142 0 : info->program_id = (uchar)txn_ctx->accounts_cnt;
143 0 : }
144 :
145 : /* Since the instructions sysvar is set as mutable at the txn level, we need to make it mutable here as well. */
146 0 : if( !memcmp( accts[j].pubkey, &fd_sysvar_instructions_id, sizeof(fd_pubkey_t) ) ) {
147 0 : fd_txn_account_set_mutable( acc );
148 0 : }
149 0 : }
150 :
151 : /* If the program id is not in the set of accounts it must be added to the set of accounts. */
152 0 : if( FD_UNLIKELY( !has_program_id ) ) {
153 0 : fd_txn_account_t * program_acc = &accts[ test_ctx->accounts_count ];
154 0 : fd_pubkey_t * program_key = &txn_ctx->account_keys[ txn_ctx->accounts_cnt ];
155 0 : memcpy( program_key, test_ctx->program_id, sizeof(fd_pubkey_t) );
156 :
157 0 : fd_account_meta_t * meta = fd_spad_alloc( txn_ctx->spad, alignof(fd_account_meta_t), sizeof(fd_account_meta_t) );
158 0 : fd_account_meta_init( meta );
159 :
160 0 : if( FD_UNLIKELY( !fd_txn_account_join( fd_txn_account_new(
161 0 : program_acc,
162 0 : program_key,
163 0 : meta,
164 0 : 1 ), txn_ctx->spad_wksp ) ) ) {
165 0 : FD_LOG_CRIT(( "Failed to join and new a txn account" ));
166 0 : }
167 :
168 0 : info->program_id = (uchar)txn_ctx->accounts_cnt;
169 0 : txn_ctx->accounts_cnt++;
170 0 : }
171 :
172 : /* Load in executable accounts */
173 0 : for( ulong i = 0; i < txn_ctx->accounts_cnt; i++ ) {
174 0 : fd_pubkey_t * acc_key = (fd_pubkey_t *)test_ctx->accounts[i].address;
175 :
176 0 : fd_txn_account_t * acc = &accts[i];
177 0 : if ( !fd_executor_pubkey_is_bpf_loader( fd_txn_account_get_owner( acc ) ) ) {
178 0 : continue;
179 0 : }
180 :
181 0 : fd_account_meta_t const * meta = fd_txn_account_get_meta( acc );
182 0 : if( meta == NULL ) {
183 0 : uchar * mem = fd_spad_alloc( txn_ctx->spad, FD_TXN_ACCOUNT_ALIGN, sizeof(fd_account_meta_t) );
184 0 : fd_account_meta_t * meta = (fd_account_meta_t *)mem;
185 0 : memset( meta, 0, sizeof(fd_account_meta_t) );
186 0 : if( FD_UNLIKELY( !fd_txn_account_join( fd_txn_account_new( acc, acc_key, meta, 0 ), txn_ctx->spad_wksp ) ) ) {
187 0 : FD_LOG_CRIT(( "Failed to join and new a txn account" ));
188 0 : }
189 0 : continue;
190 0 : }
191 :
192 0 : if( FD_UNLIKELY( !memcmp(meta->owner, fd_solana_bpf_loader_upgradeable_program_id.key, sizeof(fd_pubkey_t)) ) ) {
193 0 : fd_bpf_upgradeable_loader_state_t * program_loader_state = fd_bpf_loader_program_get_state( acc,
194 0 : txn_ctx->spad,
195 0 : NULL );
196 :
197 0 : if( FD_UNLIKELY( !program_loader_state ) ) {
198 0 : continue;
199 0 : }
200 :
201 0 : if( !fd_bpf_upgradeable_loader_state_is_program( program_loader_state ) ) {
202 0 : continue;
203 0 : }
204 :
205 0 : fd_pubkey_t * programdata_acc = &program_loader_state->inner.program.programdata_address;
206 0 : if( FD_UNLIKELY( fd_txn_account_init_from_funk_readonly( &txn_ctx->executable_accounts[txn_ctx->executable_cnt],
207 0 : programdata_acc,
208 0 : txn_ctx->funk,
209 0 : txn_ctx->xid ) ) ) {
210 0 : continue;
211 0 : }
212 0 : txn_ctx->executable_cnt++;
213 0 : }
214 0 : }
215 :
216 : /* Set slot bank variables and ensure all relevant sysvars are present */
217 0 : fd_sol_sysvar_last_restart_slot_t last_restart_slot_[1];
218 0 : FD_TEST( fd_sysvar_last_restart_slot_read( funk, xid, last_restart_slot_ ) );
219 :
220 0 : fd_sol_sysvar_clock_t clock_[1];
221 0 : fd_sol_sysvar_clock_t * clock = fd_sysvar_clock_read( funk, xid, clock_ );
222 0 : FD_TEST( clock );
223 0 : fd_bank_slot_set( runner->bank, clock->slot );
224 :
225 0 : fd_epoch_schedule_t epoch_schedule_[1];
226 0 : fd_epoch_schedule_t * epoch_schedule = fd_sysvar_epoch_schedule_read( funk, xid, epoch_schedule_ );
227 0 : FD_TEST( epoch_schedule );
228 0 : fd_bank_epoch_schedule_set( runner->bank, *epoch_schedule );
229 :
230 : /* Override epoch bank rent setting */
231 0 : fd_rent_t const * rent = fd_sysvar_rent_read( funk, xid, runner->spad );
232 0 : FD_TEST( rent );
233 0 : fd_bank_rent_set( runner->bank, *rent );
234 :
235 : /* Override most recent blockhash if given */
236 0 : fd_recent_block_hashes_t const * rbh = fd_sysvar_recent_hashes_read( funk, xid, runner->spad );
237 0 : FD_TEST( rbh );
238 0 : if( !deq_fd_block_block_hash_entry_t_empty( rbh->hashes ) ) {
239 0 : fd_block_block_hash_entry_t const * last = deq_fd_block_block_hash_entry_t_peek_tail_const( rbh->hashes );
240 0 : if( last ) {
241 0 : fd_blockhashes_t * blockhashes = fd_bank_block_hash_queue_modify( runner->bank );
242 0 : fd_blockhashes_pop_new( blockhashes );
243 0 : fd_blockhash_info_t * info = fd_blockhashes_push_new( blockhashes, &last->blockhash );
244 0 : info->fee_calculator = last->fee_calculator;
245 :
246 0 : fd_bank_lamports_per_signature_set( runner->bank, last->fee_calculator.lamports_per_signature );
247 :
248 0 : fd_bank_prev_lamports_per_signature_set( runner->bank, last->fee_calculator.lamports_per_signature );
249 0 : }
250 0 : }
251 :
252 : /* Refresh the program cache */
253 0 : fd_runtime_fuzz_refresh_program_cache( runner->bank, funk, xid, test_ctx->accounts, test_ctx->accounts_count, runner->spad );
254 :
255 : /* Load instruction accounts */
256 :
257 0 : if( FD_UNLIKELY( test_ctx->instr_accounts_count > MAX_TX_ACCOUNT_LOCKS ) ) {
258 0 : FD_LOG_NOTICE(( "too many instruction accounts" ));
259 0 : return 0;
260 0 : }
261 :
262 : /* Restore sysvar cache */
263 0 : fd_sysvar_cache_restore_fuzz( runner->bank, runner->funk, xid );
264 0 : ctx->sysvar_cache = fd_bank_sysvar_cache_modify( runner->bank );
265 :
266 0 : uchar acc_idx_seen[ FD_INSTR_ACCT_MAX ] = {0};
267 0 : for( ulong j=0UL; j < test_ctx->instr_accounts_count; j++ ) {
268 0 : uint index = test_ctx->instr_accounts[j].index;
269 0 : if( index >= test_ctx->accounts_count ) {
270 0 : FD_LOG_NOTICE( ( "instruction account index out of range (%u > %u)", index, test_ctx->instr_accounts_count ) );
271 0 : return 0;
272 0 : }
273 :
274 0 : fd_txn_account_t * acc = &accts[ index ];
275 :
276 : /* Setup instruction accounts */
277 0 : fd_instr_info_setup_instr_account( info,
278 0 : acc_idx_seen,
279 0 : (ushort)index,
280 0 : (ushort)j,
281 0 : (ushort)j,
282 0 : test_ctx->instr_accounts[j].is_writable,
283 0 : test_ctx->instr_accounts[j].is_signer );
284 :
285 0 : if( test_ctx->instr_accounts[j].is_writable ) {
286 0 : fd_txn_account_set_mutable( acc );
287 0 : }
288 0 : }
289 0 : info->acct_cnt = (uchar)test_ctx->instr_accounts_count;
290 :
291 : /* The remaining checks enforce that the program is in the accounts list. */
292 0 : bool found_program_id = false;
293 0 : for( uint i = 0; i < test_ctx->accounts_count; i++ ) {
294 0 : if( 0 == memcmp( test_ctx->accounts[i].address, test_ctx->program_id, sizeof(fd_pubkey_t) ) ) {
295 0 : info->program_id = (uchar) i;
296 0 : found_program_id = true;
297 0 : break;
298 0 : }
299 0 : }
300 :
301 : /* Early returning only happens in instruction execution. */
302 0 : if( !is_syscall && !found_program_id ) {
303 0 : FD_LOG_NOTICE(( " Unable to find program_id in accounts" ));
304 0 : return 0;
305 0 : }
306 :
307 0 : ctx->instr = info;
308 :
309 : /* Refresh the setup from the updated slot and epoch ctx. */
310 0 : fd_exec_txn_ctx_setup( runner->bank,
311 0 : runner->funk,
312 0 : xid,
313 0 : NULL,
314 0 : txn_ctx,
315 0 : NULL );
316 :
317 0 : fd_log_collector_init( &ctx->txn_ctx->log_collector, 1 );
318 0 : fd_base58_encode_32( txn_ctx->account_keys[ ctx->instr->program_id ].uc, NULL, ctx->program_id_base58 );
319 :
320 0 : return 1;
321 0 : }
322 :
323 :
324 :
325 : void
326 : fd_runtime_fuzz_instr_ctx_destroy( fd_solfuzz_runner_t * runner,
327 0 : fd_exec_instr_ctx_t * ctx ) {
328 0 : if( !ctx ) return;
329 0 : fd_funk_txn_cancel_all( runner->funk );
330 0 : }
331 :
332 :
333 : ulong
334 : fd_solfuzz_instr_run( fd_solfuzz_runner_t * runner,
335 : void const * input_,
336 : void ** output_,
337 : void * output_buf,
338 0 : ulong output_bufsz ) {
339 0 : fd_exec_test_instr_context_t const * input = fd_type_pun_const( input_ );
340 0 : fd_exec_test_instr_effects_t ** output = fd_type_pun( output_ );
341 :
342 : /* Convert the Protobuf inputs to a fd_exec context */
343 0 : fd_exec_instr_ctx_t ctx[1];
344 0 : if( !fd_runtime_fuzz_instr_ctx_create( runner, ctx, input, false ) ) {
345 0 : fd_runtime_fuzz_instr_ctx_destroy( runner, ctx );
346 0 : return 0UL;
347 0 : }
348 :
349 0 : fd_instr_info_t * instr = (fd_instr_info_t *) ctx->instr;
350 :
351 : /* Execute the test */
352 0 : int exec_result = fd_execute_instr(ctx->txn_ctx, instr);
353 :
354 : /* Allocate space to capture outputs */
355 :
356 0 : ulong output_end = (ulong)output_buf + output_bufsz;
357 0 : FD_SCRATCH_ALLOC_INIT( l, output_buf );
358 :
359 0 : fd_exec_test_instr_effects_t * effects =
360 0 : FD_SCRATCH_ALLOC_APPEND( l, alignof(fd_exec_test_instr_effects_t),
361 0 : sizeof (fd_exec_test_instr_effects_t) );
362 0 : if( FD_UNLIKELY( _l > output_end ) ) {
363 0 : fd_runtime_fuzz_instr_ctx_destroy( runner, ctx );
364 0 : return 0UL;
365 0 : }
366 0 : fd_memset( effects, 0, sizeof(fd_exec_test_instr_effects_t) );
367 :
368 : /* Capture error code */
369 :
370 0 : effects->result = -exec_result;
371 0 : effects->cu_avail = ctx->txn_ctx->compute_budget_details.compute_meter;
372 :
373 : /* Don't capture custom error codes if the program is a precompile */
374 0 : if( FD_LIKELY( effects->result ) ) {
375 0 : int program_id_idx = ctx->instr[ 0UL ].program_id;
376 0 : if( exec_result==FD_EXECUTOR_INSTR_ERR_CUSTOM_ERR &&
377 0 : fd_executor_lookup_native_precompile_program( &ctx->txn_ctx->accounts[ program_id_idx ] )==NULL ) {
378 0 : effects->custom_err = ctx->txn_ctx->custom_err;
379 0 : }
380 0 : }
381 :
382 : /* Allocate space for captured accounts */
383 0 : ulong modified_acct_cnt = ctx->txn_ctx->accounts_cnt;
384 :
385 0 : fd_exec_test_acct_state_t * modified_accts =
386 0 : FD_SCRATCH_ALLOC_APPEND( l, alignof(fd_exec_test_acct_state_t),
387 0 : sizeof (fd_exec_test_acct_state_t) * modified_acct_cnt );
388 0 : if( FD_UNLIKELY( _l > output_end ) ) {
389 0 : fd_runtime_fuzz_instr_ctx_destroy( runner, ctx );
390 0 : return 0;
391 0 : }
392 0 : effects->modified_accounts = modified_accts;
393 0 : effects->modified_accounts_count = 0UL;
394 :
395 : /* Capture borrowed accounts */
396 :
397 0 : for( ulong j=0UL; j < ctx->txn_ctx->accounts_cnt; j++ ) {
398 0 : fd_txn_account_t * acc = &ctx->txn_ctx->accounts[j];
399 0 : if( !fd_txn_account_get_meta( acc ) ) {
400 0 : continue;
401 0 : }
402 :
403 0 : ulong modified_idx = effects->modified_accounts_count;
404 0 : assert( modified_idx < modified_acct_cnt );
405 :
406 0 : fd_exec_test_acct_state_t * out_acct = &effects->modified_accounts[ modified_idx ];
407 0 : memset( out_acct, 0, sizeof(fd_exec_test_acct_state_t) );
408 : /* Copy over account content */
409 :
410 0 : memcpy( out_acct->address, acc->pubkey, sizeof(fd_pubkey_t) );
411 0 : out_acct->lamports = fd_txn_account_get_lamports( acc );
412 0 : if( fd_txn_account_get_data_len( acc )>0UL ) {
413 0 : out_acct->data =
414 0 : FD_SCRATCH_ALLOC_APPEND( l, alignof(pb_bytes_array_t),
415 0 : PB_BYTES_ARRAY_T_ALLOCSIZE( fd_txn_account_get_data_len( acc ) ) );
416 0 : if( FD_UNLIKELY( _l > output_end ) ) {
417 0 : fd_runtime_fuzz_instr_ctx_destroy( runner, ctx );
418 0 : return 0UL;
419 0 : }
420 0 : out_acct->data->size = (pb_size_t)fd_txn_account_get_data_len( acc );
421 0 : fd_memcpy( out_acct->data->bytes, fd_txn_account_get_data( acc ), fd_txn_account_get_data_len( acc ) );
422 0 : }
423 :
424 0 : out_acct->executable = fd_txn_account_is_executable( acc );
425 0 : memcpy( out_acct->owner, fd_txn_account_get_owner( acc ), sizeof(fd_pubkey_t) );
426 :
427 0 : effects->modified_accounts_count++;
428 0 : }
429 :
430 : /* Capture return data */
431 0 : fd_txn_return_data_t * return_data = &ctx->txn_ctx->return_data;
432 0 : if( return_data->len>0UL ) {
433 0 : effects->return_data = FD_SCRATCH_ALLOC_APPEND(l, alignof(pb_bytes_array_t),
434 0 : PB_BYTES_ARRAY_T_ALLOCSIZE( return_data->len ) );
435 0 : if( FD_UNLIKELY( _l > output_end ) ) {
436 0 : fd_runtime_fuzz_instr_ctx_destroy( runner, ctx );
437 0 : return 0UL;
438 0 : }
439 0 : effects->return_data->size = (pb_size_t)return_data->len;
440 0 : fd_memcpy( effects->return_data->bytes, return_data->data, return_data->len );
441 0 : }
442 :
443 0 : ulong actual_end = FD_SCRATCH_ALLOC_FINI( l, 1UL );
444 0 : fd_runtime_fuzz_instr_ctx_destroy( runner, ctx );
445 :
446 0 : *output = effects;
447 0 : return actual_end - (ulong)output_buf;
448 :
449 0 : }
|