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

Commit 2d0cb06

Browse files
[token-2022] Update docs to use zk_elgamal_proof program (#7162)
1 parent 83e8c68 commit 2d0cb06

File tree

3 files changed

+41
-37
lines changed

3 files changed

+41
-37
lines changed

token/program-2022/src/extension/confidential_transfer/instruction.rs

Lines changed: 38 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use {
1313
instruction::{encode_instruction, TokenInstruction},
1414
proof::{ProofData, ProofLocation},
1515
},
16-
bytemuck::Zeroable, // `Pod` comes from zk_token_proof_instruction
16+
bytemuck::Zeroable,
1717
num_enum::{IntoPrimitive, TryFromPrimitive},
1818
solana_program::{
1919
instruction::{AccountMeta, Instruction},
@@ -75,18 +75,18 @@ pub enum ConfidentialTransferInstruction {
7575
/// `DisableNonConfidentialCredits` instructions to disable.
7676
///
7777
/// In order for this instruction to be successfully processed, it must be
78-
/// accompanied by the `VerifyPubkeyValidityProof` instruction of the
79-
/// `zk_token_proof` program in the same transaction or the address of a
78+
/// accompanied by the `VerifyPubkeyValidity` instruction of the
79+
/// `zk_elgamal_proof` program in the same transaction or the address of a
8080
/// context state account for the proof must be provided.
8181
///
8282
/// Accounts expected by this instruction:
8383
///
8484
/// * Single owner/delegate
8585
/// 0. `[writeable]` The SPL Token account.
8686
/// 1. `[]` The corresponding SPL Token mint.
87-
/// 2. `[]` Instructions sysvar if `VerifyPubkeyValidityProof` is included
88-
/// in the same transaction or context state account if
89-
/// `VerifyPubkeyValidityProof` is pre-verified into a context state
87+
/// 2. `[]` Instructions sysvar if `VerifyPubkeyValidity` is included in
88+
/// the same transaction or context state account if
89+
/// `VerifyPubkeyValidity` is pre-verified into a context state
9090
/// account.
9191
/// 3. `[]` (Optional) Record account if the accompanying proof is to be
9292
/// read from a record account.
@@ -95,9 +95,9 @@ pub enum ConfidentialTransferInstruction {
9595
/// * Multisignature owner/delegate
9696
/// 0. `[writeable]` The SPL Token account.
9797
/// 1. `[]` The corresponding SPL Token mint.
98-
/// 2. `[]` Instructions sysvar if `VerifyPubkeyValidityProof` is included
99-
/// in the same transaction or context state account if
100-
/// `VerifyPubkeyValidityProof` is pre-verified into a context state
98+
/// 2. `[]` Instructions sysvar if `VerifyPubkeyValidity` is included in
99+
/// the same transaction or context state account if
100+
/// `VerifyPubkeyValidity` is pre-verified into a context state
101101
/// account.
102102
/// 3. `[]` (Optional) Record account if the accompanying proof is to be
103103
/// read from a record account.
@@ -143,25 +143,25 @@ pub enum ConfidentialTransferInstruction {
143143
/// token account.
144144
///
145145
/// In order for this instruction to be successfully processed, it must be
146-
/// accompanied by the `VerifyZeroBalanceProof` instruction of the
147-
/// `zk_token_proof` program in the same transaction or the address of a
146+
/// accompanied by the `VerifyZeroCiphertext` instruction of the
147+
/// `zk_elgamal_proof` program in the same transaction or the address of a
148148
/// context state account for the proof must be provided.
149149
///
150150
/// * Single owner/delegate
151151
/// 0. `[writable]` The SPL Token account.
152-
/// 1. `[]` Instructions sysvar if `VerifyZeroBalanceProof` is included in
152+
/// 1. `[]` Instructions sysvar if `VerifyZeroCiphertext` is included in
153153
/// the same transaction or context state account if
154-
/// `VerifyZeroBalanceProof` is pre-verified into a context state
154+
/// `VerifyZeroCiphertext` is pre-verified into a context state
155155
/// account.
156156
/// 2. `[]` (Optional) Record account if the accompanying proof is to be
157157
/// read from a record account.
158158
/// 3. `[signer]` The single account owner.
159159
///
160160
/// * Multisignature owner/delegate
161161
/// 0. `[writable]` The SPL Token account.
162-
/// 1. `[]` Instructions sysvar if `VerifyZeroBalanceProof` is included in
162+
/// 1. `[]` Instructions sysvar if `VerifyZeroCiphertext` is included in
163163
/// the same transaction or context state account if
164-
/// `VerifyZeroBalanceProof` is pre-verified into a context state
164+
/// `VerifyZeroCiphertext` is pre-verified into a context state
165165
/// account.
166166
/// 2. `[]` (Optional) Record account if the accompanying proof is to be
167167
/// read from a record account.
@@ -251,10 +251,10 @@ pub enum ConfidentialTransferInstruction {
251251
/// Transfer tokens confidentially.
252252
///
253253
/// In order for this instruction to be successfully processed, it must be
254-
/// accompanied by the following list of `zk_token_proof` program
254+
/// accompanied by the following list of `zk_elgamal_proof` program
255255
/// instructions:
256-
/// - `VerifyCiphertextCommitmentEqualityProof`
257-
/// - `VerifyBatchedGroupedCiphertext3HandlesValidityProof`
256+
/// - `VerifyCiphertextCommitmentEquality`
257+
/// - `VerifyBatchedGroupedCiphertext3HandlesValidity`
258258
/// - `VerifyBatchedRangeProofU128`
259259
/// These instructions can be accompanied in the same transaction or can be
260260
/// pre-verified into a context state account, in which case, only their
@@ -267,7 +267,8 @@ pub enum ConfidentialTransferInstruction {
267267
/// 2. `[]` The token mint.
268268
/// 3. `[writable]` The destination SPL Token account.
269269
/// 4. `[]` (Optional) Instructions sysvar if at least one of the
270-
/// `zk_token_proof` instructions are included in the same transaction.
270+
/// `zk_elgamal_proof` instructions are included in the same
271+
/// transaction.
271272
/// 5. `[]` (Optional) Equality proof record account or context state
272273
/// account.
273274
/// 6. `[]` (Optional) Ciphertext validity proof record account or context
@@ -281,7 +282,8 @@ pub enum ConfidentialTransferInstruction {
281282
/// 2. `[]` The token mint.
282283
/// 3. `[writable]` The destination SPL Token account.
283284
/// 4. `[]` (Optional) Instructions sysvar if at least one of the
284-
/// `zk_token_proof` instructions are included in the same transaction.
285+
/// `zk_elgamal_proof` instructions are included in the same
286+
/// transaction.
285287
/// 5. `[]` (Optional) Equality proof record account or context state
286288
/// account.
287289
/// 6. `[]` (Optional) Ciphertext validity proof record account or context
@@ -412,13 +414,13 @@ pub enum ConfidentialTransferInstruction {
412414
/// Transfer tokens confidentially with fee.
413415
///
414416
/// In order for this instruction to be successfully processed, it must be
415-
/// accompanied by the following list of `zk_token_proof` program
417+
/// accompanied by the following list of `zk_elgamal_proof` program
416418
/// instructions:
417-
/// - `VerifyCiphertextCommitmentEqualityProof`
418-
/// - `VerifyBatchedGroupedCiphertext3HandlesValidityProof` (transfer amount
419+
/// - `VerifyCiphertextCommitmentEquality`
420+
/// - `VerifyBatchedGroupedCiphertext3HandlesValidity` (transfer amount
419421
/// ciphertext)
420-
/// - `FeeSigmaProof`
421-
/// - `VerifyBatchedGroupedCiphertext2HandlesValidityProof` (fee ciphertext)
422+
/// - `VerifyPercentageWithFee`
423+
/// - `VerifyBatchedGroupedCiphertext2HandlesValidity` (fee ciphertext)
422424
/// - `VerifyBatchedRangeProofU256`
423425
/// These instructions can be accompanied in the same transaction or can be
424426
/// pre-verified into a context state account, in which case, only their
@@ -433,7 +435,8 @@ pub enum ConfidentialTransferInstruction {
433435
/// 2. `[]` The token mint.
434436
/// 3. `[writable]` The destination SPL Token account.
435437
/// 4. `[]` (Optional) Instructions sysvar if at least one of the
436-
/// `zk_token_proof` instructions are included in the same transaction.
438+
/// `zk_elgamal_proof` instructions are included in the same
439+
/// transaction.
437440
/// 5. `[]` (Optional) Equality proof record account or context state
438441
/// account.
439442
/// 6. `[]` (Optional) Transfer amount ciphertext validity proof record
@@ -451,7 +454,8 @@ pub enum ConfidentialTransferInstruction {
451454
/// 2. `[]` The token mint.
452455
/// 3. `[writable]` The destination SPL Token account.
453456
/// 4. `[]` (Optional) Instructions sysvar if at least one of the
454-
/// `zk_token_proof` instructions are included in the same transaction.
457+
/// `zk_elgamal_proof` instructions are included in the same
458+
/// transaction.
455459
/// 5. `[]` (Optional) Equality proof record account or context state
456460
/// account.
457461
/// 6. `[]` (Optional) Transfer amount ciphertext validity proof record
@@ -511,7 +515,7 @@ pub struct ConfigureAccountInstructionData {
511515
/// The maximum number of despots and transfers that an account can receiver
512516
/// before the `ApplyPendingBalance` is executed
513517
pub maximum_pending_balance_credit_counter: PodU64,
514-
/// Relative location of the `ProofInstruction::ZeroBalanceProof`
518+
/// Relative location of the `ProofInstruction::ZeroCiphertextProof`
515519
/// instruction to the `ConfigureAccount` instruction in the
516520
/// transaction. If the offset is `0`, then use a context state account
517521
/// for the proof.
@@ -576,12 +580,12 @@ pub struct TransferInstructionData {
576580
#[cfg_attr(feature = "serde-traits", serde(with = "aeciphertext_fromstr"))]
577581
pub new_source_decryptable_available_balance: DecryptableBalance,
578582
/// Relative location of the
579-
/// `ProofInstruction::VerifyCiphertextCommitmentEqualityProof` instruction
583+
/// `ProofInstruction::VerifyCiphertextCommitmentEquality` instruction
580584
/// to the `Transfer` instruction in the transaction. If the offset is
581585
/// `0`, then use a context state account for the proof.
582586
pub equality_proof_instruction_offset: i8,
583587
/// Relative location of the
584-
/// `ProofInstruction::VerifyBatchedGroupedCiphertext3HandlesValidityProof`
588+
/// `ProofInstruction::VerifyBatchedGroupedCiphertext3HandlesValidity`
585589
/// instruction to the `Transfer` instruction in the transaction. If the
586590
/// offset is `0`, then use a context state account for the proof.
587591
pub ciphertext_validity_proof_instruction_offset: i8,
@@ -615,23 +619,23 @@ pub struct TransferWithFeeInstructionData {
615619
#[cfg_attr(feature = "serde-traits", serde(with = "aeciphertext_fromstr"))]
616620
pub new_source_decryptable_available_balance: DecryptableBalance,
617621
/// Relative location of the
618-
/// `ProofInstruction::VerifyCiphertextCommitmentEqualityProof` instruction
622+
/// `ProofInstruction::VerifyCiphertextCommitmentEquality` instruction
619623
/// to the `TransferWithFee` instruction in the transaction. If the offset
620624
/// is `0`, then use a context state account for the proof.
621625
pub equality_proof_instruction_offset: i8,
622626
/// Relative location of the
623-
/// `ProofInstruction::VerifyBatchedGroupedCiphertext3HandlesValidityProof`
627+
/// `ProofInstruction::VerifyBatchedGroupedCiphertext3HandlesValidity`
624628
/// instruction to the `TransferWithFee` instruction in the transaction.
625629
/// If the offset is `0`, then use a context state account for the
626630
/// proof.
627631
pub transfer_amount_ciphertext_validity_proof_instruction_offset: i8,
628-
/// Relative location of the `ProofInstruction::VerifyFeeSigmaProof`
632+
/// Relative location of the `ProofInstruction::VerifyPercentageWithFee`
629633
/// instruction to the `TransferWithFee` instruction in the transaction.
630634
/// If the offset is `0`, then use a context state account for the
631635
/// proof.
632636
pub fee_sigma_proof_instruction_offset: i8,
633637
/// Relative location of the
634-
/// `ProofInstruction::VerifyBatchedGroupedCiphertext2HandlesValidityProof`
638+
/// `ProofInstruction::VerifyBatchedGroupedCiphertext2HandlesValidity`
635639
/// instruction to the `TransferWithFee` instruction in the transaction.
636640
/// If the offset is `0`, then use a context state account for the
637641
/// proof.

token/program-2022/src/extension/confidential_transfer_fee/instruction.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ pub enum ConfidentialTransferFeeInstruction {
6161
///
6262
/// In order for this instruction to be successfully processed, it must be
6363
/// accompanied by the `VerifyCiphertextCiphertextEquality` instruction
64-
/// of the `zk_token_proof` program in the same transaction or the
64+
/// of the `zk_elgamal_proof` program in the same transaction or the
6565
/// address of a context state account for the proof must be provided.
6666
///
6767
/// Accounts expected by this instruction:
@@ -126,7 +126,7 @@ pub enum ConfidentialTransferFeeInstruction {
126126
///
127127
/// In order for this instruction to be successfully processed, it must be
128128
/// accompanied by the `VerifyWithdrawWithheldTokens` instruction of the
129-
/// `zk_token_proof` program in the same transaction or the address of a
129+
/// `zk_elgamal_proof` program in the same transaction or the address of a
130130
/// context state account for the proof must be provided.
131131
///
132132
/// Accounts expected by this instruction:

token/program-2022/src/proof.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! Helper for processing instruction data from ZK Token proof program
1+
//! Helper for processing instruction data from ZK ElGamal proof program
22
33
use {
44
crate::check_zk_token_proof_program_account,

0 commit comments

Comments
 (0)