Skip to content

Commit

Permalink
zk-sdk: add missing feature gates
Browse files Browse the repository at this point in the history
  • Loading branch information
0x0ece committed Jan 8, 2025
1 parent bf77a1d commit b53aa56
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/flamenco/runtime/program/fd_zk_elgamal_proof_program.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@

int
fd_executor_zk_elgamal_proof_program_execute( fd_exec_instr_ctx_t * ctx ) {
/* Feature-gate program activation */
if( FD_UNLIKELY( !FD_FEATURE_ACTIVE( ctx->slot_ctx, zk_elgamal_proof_program_enabled ) ) ) {
return FD_EXECUTOR_INSTR_ERR_UNSUPPORTED_PROGRAM_ID;
}

uchar const * instr_data = ctx->instr->data;
ulong instr_data_sz = ctx->instr->data_sz;

Expand Down
5 changes: 5 additions & 0 deletions src/flamenco/runtime/program/zksdk/fd_zksdk.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,11 @@ fd_zksdk_process_verify_proof( fd_exec_instr_ctx_t * ctx ) {
if( ctx->instr->data_sz == 5UL ) {
/* Case 1. Proof data from account data. */

/* https://github.com/anza-xyz/agave/blob/v2.1.7/programs/zk-token-proof/src/lib.rs#L54-L59 */
if( FD_UNLIKELY( !FD_FEATURE_ACTIVE( ctx->slot_ctx, enable_zk_proof_from_account ) ) ) {
return FD_EXECUTOR_INSTR_ERR_INVALID_INSTR_DATA;
}

/* https://github.com/anza-xyz/agave/blob/v2.0.1/programs/zk-elgamal-proof/src/lib.rs#L46-L47 */
FD_BORROWED_ACCOUNT_DECL( proof_data_acc );
FD_BORROWED_ACCOUNT_TRY_BORROW_IDX( ctx, 0UL, proof_data_acc ) {
Expand Down

0 comments on commit b53aa56

Please sign in to comment.