Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

[token-2022] Update to check_zk_elgamal_proof_program_account #7163

Merged
Merged
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
8 changes: 5 additions & 3 deletions token/program-2022/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,12 @@ pub fn check_spl_token_program_account(spl_token_program_id: &Pubkey) -> Program
Ok(())
}

/// Checks that the supplied program ID is correct for the ZK Token proof
/// Checks that the supplied program ID is correct for the ZK ElGamal proof
/// program
pub fn check_zk_token_proof_program_account(zk_token_proof_program_id: &Pubkey) -> ProgramResult {
if zk_token_proof_program_id != &solana_zk_sdk::zk_elgamal_proof_program::id() {
pub fn check_zk_elgamal_proof_program_account(
zk_elgamal_proof_program_id: &Pubkey,
) -> ProgramResult {
if zk_elgamal_proof_program_id != &solana_zk_sdk::zk_elgamal_proof_program::id() {
return Err(ProgramError::IncorrectProgramId);
}
Ok(())
Expand Down
4 changes: 2 additions & 2 deletions token/program-2022/src/proof.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Helper for processing instruction data from ZK Token proof program

use {
crate::check_zk_token_proof_program_account,
crate::check_zk_elgamal_proof_program_account,
bytemuck::Pod,
solana_program::{
account_info::{next_account_info, AccountInfo},
Expand Down Expand Up @@ -107,7 +107,7 @@ pub fn verify_and_extract_context<'a, T: Pod + ZkProofData<U>, U: Pod>(
if proof_instruction_offset == 0 {
// interpret `account_info` as a context state account
let context_state_account_info = next_account_info(account_info_iter)?;
check_zk_token_proof_program_account(context_state_account_info.owner)?;
check_zk_elgamal_proof_program_account(context_state_account_info.owner)?;
let context_state_account_data = context_state_account_info.data.borrow();
let context_state = pod_from_bytes::<ProofContextState<U>>(&context_state_account_data)?;

Expand Down
Loading