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

Commit 8c85c6d

Browse files
committed
remove unnecessary block of code
1 parent 7285da5 commit 8c85c6d

File tree

1 file changed

+0
-312
lines changed

1 file changed

+0
-312
lines changed

token/program-2022-test/tests/confidential_transfer.rs

Lines changed: 0 additions & 312 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,137 +1066,6 @@ async fn confidential_transfer_withdraw_with_option(option: ConfidentialTransfer
10661066
.await;
10671067
}
10681068

1069-
// #[cfg(feature = "zk-ops")]
1070-
// #[tokio::test]
1071-
// async fn confidential_transfer_withdraw_with_record_account() {
1072-
// let authority = Keypair::new();
1073-
// let auto_approve_new_accounts = true;
1074-
// let auditor_elgamal_keypair = ElGamalKeypair::new_rand();
1075-
// let auditor_elgamal_pubkey = (*auditor_elgamal_keypair.pubkey()).into();
1076-
//
1077-
// let mut context = TestContext::new().await;
1078-
// context
1079-
// .init_token_with_mint(vec![
1080-
// ExtensionInitializationParams::ConfidentialTransferMint {
1081-
// authority: Some(authority.pubkey()),
1082-
// auto_approve_new_accounts,
1083-
// auditor_elgamal_pubkey: Some(auditor_elgamal_pubkey),
1084-
// },
1085-
// ])
1086-
// .await
1087-
// .unwrap();
1088-
//
1089-
// let TokenContext {
1090-
// token,
1091-
// alice,
1092-
// mint_authority,
1093-
// decimals,
1094-
// ..
1095-
// } = context.token_context.unwrap();
1096-
// let alice_meta = ConfidentialTokenAccountMeta::new_with_tokens(
1097-
// &token,
1098-
// &alice,
1099-
// None,
1100-
// false,
1101-
// false,
1102-
// &mint_authority,
1103-
// 42,
1104-
// decimals,
1105-
// )
1106-
// .await;
1107-
//
1108-
// let state = token
1109-
// .get_account_info(&alice_meta.token_account)
1110-
// .await
1111-
// .unwrap();
1112-
// assert_eq!(state.base.amount, 0);
1113-
// alice_meta
1114-
// .check_balances(
1115-
// &token,
1116-
// ConfidentialTokenAccountBalances {
1117-
// pending_balance_lo: 0,
1118-
// pending_balance_hi: 0,
1119-
// available_balance: 42,
1120-
// decryptable_available_balance: 42,
1121-
// },
1122-
// )
1123-
// .await;
1124-
//
1125-
// let state = token
1126-
// .get_account_info(&alice_meta.token_account)
1127-
// .await
1128-
// .unwrap();
1129-
// let extension = state
1130-
// .get_extension::<ConfidentialTransferAccount>()
1131-
// .unwrap();
1132-
// let account_info = WithdrawAccountInfo::new(extension);
1133-
//
1134-
// let withdraw_proof = account_info
1135-
// .generate_proof_data(42, &alice_meta.elgamal_keypair,
1136-
// &alice_meta.aes_key) .unwrap();
1137-
//
1138-
// let record_account = Keypair::new();
1139-
// let record_account_authority = Keypair::new();
1140-
//
1141-
// token
1142-
// .confidential_transfer_create_record_account(
1143-
// &record_account.pubkey(),
1144-
// &record_account_authority.pubkey(),
1145-
// &withdraw_proof,
1146-
// &record_account,
1147-
// &record_account_authority,
1148-
// )
1149-
// .await
1150-
// .unwrap();
1151-
//
1152-
// let proof_account = ProofAccount::RecordAccount(
1153-
// record_account.pubkey(),
1154-
// RecordData::WRITABLE_START_INDEX as u32,
1155-
// );
1156-
//
1157-
// token
1158-
// .confidential_transfer_withdraw(
1159-
// &alice_meta.token_account,
1160-
// &alice.pubkey(),
1161-
// Some(&proof_account),
1162-
// 42,
1163-
// decimals,
1164-
// None,
1165-
// &alice_meta.elgamal_keypair,
1166-
// &alice_meta.aes_key,
1167-
// &[&alice],
1168-
// )
1169-
// .await
1170-
// .unwrap();
1171-
//
1172-
// let state = token
1173-
// .get_account_info(&alice_meta.token_account)
1174-
// .await
1175-
// .unwrap();
1176-
// assert_eq!(state.base.amount, 42);
1177-
// alice_meta
1178-
// .check_balances(
1179-
// &token,
1180-
// ConfidentialTokenAccountBalances {
1181-
// pending_balance_lo: 0,
1182-
// pending_balance_hi: 0,
1183-
// available_balance: 0,
1184-
// decryptable_available_balance: 0,
1185-
// },
1186-
// )
1187-
// .await;
1188-
//
1189-
// token
1190-
// .confidential_transfer_close_record_account(
1191-
// &record_account.pubkey(),
1192-
// &record_account_authority.pubkey(),
1193-
// &alice.pubkey(),
1194-
// &record_account_authority,
1195-
// )
1196-
// .await
1197-
// .unwrap();
1198-
// }
1199-
12001069
#[derive(Clone, Copy)]
12011070
pub enum ConfidentialTransferOption {
12021071
InstructionData,
@@ -3067,184 +2936,3 @@ async fn confidential_transfer_empty_account_with_proof_context() {
30672936
)))
30682937
);
30692938
}
3070-
3071-
// #[tokio::test]
3072-
// async fn confidential_transfer_withdraw_with_proof_context() {
3073-
// let authority = Keypair::new();
3074-
// let auto_approve_new_accounts = true;
3075-
//
3076-
// let mut context = TestContext::new().await;
3077-
// context
3078-
// .init_token_with_mint(vec![
3079-
// ExtensionInitializationParams::ConfidentialTransferMint {
3080-
// authority: Some(authority.pubkey()),
3081-
// auto_approve_new_accounts,
3082-
// auditor_elgamal_pubkey: None,
3083-
// },
3084-
// ])
3085-
// .await
3086-
// .unwrap();
3087-
//
3088-
// let TokenContext {
3089-
// token,
3090-
// alice,
3091-
// bob,
3092-
// mint_authority,
3093-
// decimals,
3094-
// ..
3095-
// } = context.token_context.unwrap();
3096-
//
3097-
// let alice_meta = ConfidentialTokenAccountMeta::new_with_tokens(
3098-
// &token,
3099-
// &alice,
3100-
// None,
3101-
// false,
3102-
// false,
3103-
// &mint_authority,
3104-
// 42,
3105-
// decimals,
3106-
// )
3107-
// .await;
3108-
//
3109-
// let context_state_account = Keypair::new();
3110-
//
3111-
// // create context state
3112-
// {
3113-
// let context_state_authority = Keypair::new();
3114-
// let space = size_of::<ProofContextState<WithdrawProofContext>>();
3115-
//
3116-
// let instruction_type = ProofInstruction::VerifyWithdraw;
3117-
//
3118-
// let context_state_info = ContextStateInfo {
3119-
// context_state_account: &context_state_account.pubkey(),
3120-
// context_state_authority: &context_state_authority.pubkey(),
3121-
// };
3122-
//
3123-
// let state = token
3124-
// .get_account_info(&alice_meta.token_account)
3125-
// .await
3126-
// .unwrap();
3127-
// let extension = state
3128-
// .get_extension::<ConfidentialTransferAccount>()
3129-
// .unwrap();
3130-
// let current_ciphertext =
3131-
// extension.available_balance.try_into().unwrap();
3132-
//
3133-
// let proof_data =
3134-
// confidential_transfer::instruction::WithdrawData::new( 0,
3135-
// &alice_meta.elgamal_keypair,
3136-
// 42,
3137-
// &current_ciphertext,
3138-
// )
3139-
// .unwrap();
3140-
//
3141-
// let mut ctx = context.context.lock().await;
3142-
// let rent = ctx.banks_client.get_rent().await.unwrap();
3143-
//
3144-
// let instructions = vec![
3145-
// system_instruction::create_account(
3146-
// &ctx.payer.pubkey(),
3147-
// &context_state_account.pubkey(),
3148-
// rent.minimum_balance(space),
3149-
// space as u64,
3150-
// &zk_elgamal_proof_program::id(),
3151-
// ),
3152-
// instruction_type.encode_verify_proof(Some(context_state_info),
3153-
// &proof_data), ];
3154-
//
3155-
// let last_blockhash = ctx.get_new_latest_blockhash().await.unwrap();
3156-
// let tx = Transaction::new_signed_with_payer(
3157-
// &instructions,
3158-
// Some(&ctx.payer.pubkey()),
3159-
// &[&ctx.payer, &context_state_account],
3160-
// last_blockhash,
3161-
// );
3162-
// ctx.banks_client.process_transaction(tx).await.unwrap();
3163-
// }
3164-
//
3165-
// token
3166-
// .confidential_transfer_withdraw(
3167-
// &alice_meta.token_account,
3168-
// &alice.pubkey(),
3169-
// Some(&ProofAccount::ContextAccount(
3170-
// context_state_account.pubkey(),
3171-
// )),
3172-
// 0,
3173-
// decimals,
3174-
// None,
3175-
// &alice_meta.elgamal_keypair,
3176-
// &alice_meta.aes_key,
3177-
// &[&alice],
3178-
// )
3179-
// .await
3180-
// .unwrap();
3181-
//
3182-
// // attempt to create an account with a wrong proof type context state
3183-
// let bob_meta = ConfidentialTokenAccountMeta::new(&token, &bob, None,
3184-
// false, false).await; let context_state_account = Keypair::new();
3185-
//
3186-
// {
3187-
// let context_state_authority = Keypair::new();
3188-
// let space =
3189-
// size_of::<ProofContextState<PubkeyValidityProofContext>>();
3190-
//
3191-
// let instruction_type = ProofInstruction::VerifyPubkeyValidity;
3192-
//
3193-
// let context_state_info = ContextStateInfo {
3194-
// context_state_account: &context_state_account.pubkey(),
3195-
// context_state_authority: &context_state_authority.pubkey(),
3196-
// };
3197-
//
3198-
// let proof_data =
3199-
//
3200-
// confidential_transfer::instruction::PubkeyValidityData::new(&bob_meta.
3201-
// elgamal_keypair) .unwrap();
3202-
//
3203-
// let mut ctx = context.context.lock().await;
3204-
// let rent = ctx.banks_client.get_rent().await.unwrap();
3205-
//
3206-
// let instructions = vec![
3207-
// system_instruction::create_account(
3208-
// &ctx.payer.pubkey(),
3209-
// &context_state_account.pubkey(),
3210-
// rent.minimum_balance(space),
3211-
// space as u64,
3212-
// &zk_elgamal_proof_program::id(),
3213-
// ),
3214-
// instruction_type.encode_verify_proof(Some(context_state_info),
3215-
// &proof_data), ];
3216-
//
3217-
// let last_blockhash = ctx.get_new_latest_blockhash().await.unwrap();
3218-
// let tx = Transaction::new_signed_with_payer(
3219-
// &instructions,
3220-
// Some(&ctx.payer.pubkey()),
3221-
// &[&ctx.payer, &context_state_account],
3222-
// last_blockhash,
3223-
// );
3224-
// ctx.banks_client.process_transaction(tx).await.unwrap();
3225-
// }
3226-
//
3227-
// let err = token
3228-
// .confidential_transfer_withdraw(
3229-
// &bob_meta.token_account,
3230-
// &bob.pubkey(),
3231-
// Some(&ProofAccount::ContextAccount(
3232-
// context_state_account.pubkey(),
3233-
// )),
3234-
// 0,
3235-
// decimals,
3236-
// None,
3237-
// &bob_meta.elgamal_keypair,
3238-
// &bob_meta.aes_key,
3239-
// &[&bob],
3240-
// )
3241-
// .await
3242-
// .unwrap_err();
3243-
//
3244-
// assert_eq!(
3245-
// err,
3246-
// TokenClientError::Client(Box::new(TransportError::TransactionError(
3247-
// TransactionError::InstructionError(0,
3248-
// InstructionError::InvalidArgument,) )))
3249-
// );
3250-
// }

0 commit comments

Comments
 (0)