@@ -3067,184 +3067,3 @@ async fn confidential_transfer_empty_account_with_proof_context() {
3067
3067
) ) )
3068
3068
) ;
3069
3069
}
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
- // ¤t_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