Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/flamenco/runtime/program/Local.mk
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,8 @@ $(call add-objs,fd_zk_elgamal_proof_program,fd_flamenco)

$(call add-hdrs,fd_native_cpi.h)
$(call add-objs,fd_native_cpi,fd_flamenco)

### Unit tests

$(call make-unit-test,test_bpf_loader_serialization,test_bpf_loader_serialization,fd_flamenco fd_funk fd_ballet fd_util)
$(call run-unit-test,test_bpf_loader_serialization)
12 changes: 5 additions & 7 deletions src/flamenco/runtime/program/fd_bpf_loader_program.c
Original file line number Diff line number Diff line change
Expand Up @@ -402,19 +402,17 @@ fd_bpf_execute( fd_exec_instr_ctx_t * instr_ctx,
int provide_instruction_data_offset_in_vm_r2 = FD_FEATURE_ACTIVE_BANK( instr_ctx->bank, provide_instruction_data_offset_in_vm_r2 );

ulong instruction_data_offset = 0UL;
uchar * input = NULL;
err = fd_bpf_loader_input_serialize_parameters( instr_ctx, &input_sz, pre_lens,
/* 16-byte aligned buffer:
https://github.com/anza-xyz/agave/blob/v3.0.0/program-runtime/src/serialization.rs#L60 */
uchar * input = instr_ctx->runtime->bpf_loader_serialization.serialization_mem[ instr_ctx->runtime->instr.stack_sz-1UL ];
err = fd_bpf_loader_input_serialize_parameters( instr_ctx, pre_lens,
input_mem_regions, &input_mem_regions_cnt,
acc_region_metas, stricter_abi_and_runtime_constraints, direct_mapping, is_deprecated,
&instruction_data_offset, &input );
&instruction_data_offset, &input_sz, input );
if( FD_UNLIKELY( err ) ) {
return err;
}

if( FD_UNLIKELY( input==NULL ) ) {
return FD_EXECUTOR_INSTR_ERR_MISSING_ACC;
}

fd_sha256_t _sha[1];
Comment on lines 412 to 416
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fd_exec_instr_ctx_get_index_of_instr_account_in_transaction throws FD_EXECUTOR_INSTR_ERR_MISSING_ACC if the account is missing, so propagating the error is the correct thing to do here and doesn't change the behaviour.

fd_sha256_t * sha = fd_sha256_join( fd_sha256_new( _sha ) );

Expand Down
136 changes: 77 additions & 59 deletions src/flamenco/runtime/program/fd_bpf_loader_serialization.c

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/flamenco/runtime/program/fd_bpf_loader_serialization.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ FD_PROTOTYPES_BEGIN

int
fd_bpf_loader_input_serialize_parameters( fd_exec_instr_ctx_t * instr_ctx,
ulong * sz,
ulong * pre_lens,
fd_vm_input_region_t * input_mem_regions,
uint * input_mem_regions_cnt,
Expand All @@ -19,7 +18,8 @@ fd_bpf_loader_input_serialize_parameters( fd_exec_instr_ctx_t * instr_ctx,
int direct_mapping,
uchar is_deprecated,
ulong * instr_data_offset,
uchar ** out /* output */ );
ulong * out_sz,
uchar * out );

int
fd_bpf_loader_input_deserialize_parameters( fd_exec_instr_ctx_t * ctx,
Expand Down
Loading
Loading