6
6
program_test:: { TestContext , TokenContext } ,
7
7
solana_program_test:: tokio,
8
8
solana_sdk:: {
9
- epoch_info :: EpochInfo , instruction:: InstructionError , pubkey:: Pubkey , signature:: Signer ,
10
- signer :: keypair :: Keypair , transaction:: TransactionError , transport:: TransportError ,
9
+ instruction:: InstructionError , pubkey:: Pubkey , signature:: Signer , signer :: keypair :: Keypair ,
10
+ transaction:: TransactionError , transport:: TransportError ,
11
11
} ,
12
12
spl_token_2022:: {
13
13
error:: TokenError ,
19
19
} ,
20
20
solana_zk_token_sdk:: {
21
21
encryption:: { auth_encryption:: * , elgamal:: * } ,
22
- zk_token_elgamal:: { self , pod:: Zeroable } ,
22
+ zk_token_elgamal:: pod:: Zeroable ,
23
23
} ,
24
24
} ,
25
25
spl_token_client:: {
@@ -29,10 +29,16 @@ use {
29
29
std:: convert:: TryInto ,
30
30
} ;
31
31
32
+ #[ cfg( feature = "zk-ops" ) ]
33
+ use { solana_sdk:: epoch_info:: EpochInfo , spl_token_2022:: solana_zk_token_sdk:: zk_token_elgamal} ;
34
+
35
+ #[ cfg( feature = "zk-ops" ) ]
32
36
const TEST_MAXIMUM_FEE : u64 = 100 ;
37
+ #[ cfg( feature = "zk-ops" ) ]
33
38
const TEST_FEE_BASIS_POINTS : u16 = 250 ;
34
39
const TEST_MAXIMUM_PENDING_BALANCE_CREDIT_COUNTER : u64 = 2 ;
35
40
41
+ #[ cfg( feature = "zk-ops" ) ]
36
42
fn test_epoch_info ( ) -> EpochInfo {
37
43
EpochInfo {
38
44
epoch : 0 ,
@@ -49,6 +55,7 @@ struct ConfidentialTransferMintWithKeypairs {
49
55
ct_mint_authority : Keypair ,
50
56
#[ allow( dead_code) ]
51
57
ct_mint_transfer_auditor_encryption_keypair : ElGamalKeypair ,
58
+ #[ allow( dead_code) ]
52
59
ct_mint_withdraw_withheld_authority_encryption_keypair : ElGamalKeypair ,
53
60
}
54
61
@@ -123,6 +130,7 @@ impl ConfidentialTokenAccountMeta {
123
130
}
124
131
}
125
132
133
+ #[ cfg( feature = "zk-ops" ) ]
126
134
async fn new_with_required_memo_transfers < T > ( token : & Token < T > , owner : & Keypair ) -> Self
127
135
where
128
136
T : SendTransaction ,
@@ -165,6 +173,7 @@ impl ConfidentialTokenAccountMeta {
165
173
}
166
174
}
167
175
176
+ #[ cfg( feature = "zk-ops" ) ]
168
177
async fn with_tokens < T > (
169
178
token : & Token < T > ,
170
179
owner : & Keypair ,
@@ -199,6 +208,7 @@ impl ConfidentialTokenAccountMeta {
199
208
meta
200
209
}
201
210
211
+ #[ cfg( feature = "zk-ops" ) ]
202
212
async fn check_balances < T > ( & self , token : & Token < T > , expected : ConfidentialTokenAccountBalances )
203
213
where
204
214
T : SendTransaction ,
@@ -238,13 +248,15 @@ impl ConfidentialTokenAccountMeta {
238
248
}
239
249
}
240
250
251
+ #[ cfg( feature = "zk-ops" ) ]
241
252
struct ConfidentialTokenAccountBalances {
242
253
pending_balance_lo : u64 ,
243
254
pending_balance_hi : u64 ,
244
255
available_balance : u64 ,
245
256
decryptable_available_balance : u64 ,
246
257
}
247
258
259
+ #[ cfg( feature = "zk-ops" ) ]
248
260
async fn check_withheld_amount_in_mint < T > (
249
261
token : & Token < T > ,
250
262
withdraw_withheld_authority_encryption_keypair : & ElGamalKeypair ,
@@ -468,6 +480,7 @@ async fn ct_new_account_is_empty() {
468
480
. unwrap ( ) ;
469
481
}
470
482
483
+ #[ cfg( feature = "zk-ops" ) ]
471
484
#[ tokio:: test]
472
485
async fn ct_deposit ( ) {
473
486
let ConfidentialTransferMintWithKeypairs { ct_mint, .. } =
@@ -591,6 +604,7 @@ async fn ct_deposit() {
591
604
assert_eq ! ( extension. actual_pending_balance_credit_counter, 2 . into( ) ) ;
592
605
}
593
606
607
+ #[ cfg( feature = "zk-ops" ) ]
594
608
#[ tokio:: test]
595
609
async fn ct_withdraw ( ) {
596
610
let ConfidentialTransferMintWithKeypairs { ct_mint, .. } =
@@ -693,6 +707,7 @@ async fn ct_withdraw() {
693
707
. unwrap ( ) ;
694
708
}
695
709
710
+ #[ cfg( feature = "zk-ops" ) ]
696
711
#[ tokio:: test]
697
712
async fn ct_transfer ( ) {
698
713
let ConfidentialTransferMintWithKeypairs { ct_mint, .. } =
@@ -920,6 +935,7 @@ async fn ct_transfer() {
920
935
. await ;
921
936
}
922
937
938
+ #[ cfg( feature = "zk-ops" ) ]
923
939
#[ tokio:: test]
924
940
async fn ct_transfer_with_fee ( ) {
925
941
let ConfidentialTransferMintWithKeypairs { ct_mint, .. } =
@@ -1123,6 +1139,7 @@ async fn ct_transfer_with_fee() {
1123
1139
. await ;
1124
1140
}
1125
1141
1142
+ #[ cfg( feature = "zk-ops" ) ]
1126
1143
#[ tokio:: test]
1127
1144
async fn ct_withdraw_withheld_tokens_from_mint ( ) {
1128
1145
let ConfidentialTransferMintWithKeypairs {
@@ -1277,6 +1294,7 @@ async fn ct_withdraw_withheld_tokens_from_mint() {
1277
1294
. await ;
1278
1295
}
1279
1296
1297
+ #[ cfg( feature = "zk-ops" ) ]
1280
1298
#[ tokio:: test]
1281
1299
async fn ct_withdraw_withheld_tokens_from_accounts ( ) {
1282
1300
let ConfidentialTransferMintWithKeypairs {
@@ -1396,6 +1414,7 @@ async fn ct_withdraw_withheld_tokens_from_accounts() {
1396
1414
. await ;
1397
1415
}
1398
1416
1417
+ #[ cfg( feature = "zk-ops" ) ]
1399
1418
#[ tokio:: test]
1400
1419
async fn ct_transfer_memo ( ) {
1401
1420
let ConfidentialTransferMintWithKeypairs { ct_mint, .. } =
@@ -1496,6 +1515,7 @@ async fn ct_transfer_memo() {
1496
1515
. await ;
1497
1516
}
1498
1517
1518
+ #[ cfg( feature = "zk-ops" ) ]
1499
1519
#[ tokio:: test]
1500
1520
async fn ct_transfer_with_fee_memo ( ) {
1501
1521
let ConfidentialTransferMintWithKeypairs { ct_mint, .. } =
0 commit comments