1
+ #[ cfg( not( target_arch = "wasm32" ) ) ]
2
+ use solana_zk_sdk:: encryption:: grouped_elgamal:: GroupedElGamal ;
3
+ #[ cfg( target_arch = "wasm32" ) ]
4
+ use solana_zk_sdk:: encryption:: grouped_elgamal:: {
5
+ GroupedElGamalCiphertext2Handles , GroupedElGamalCiphertext3Handles ,
6
+ } ;
1
7
use {
2
8
crate :: {
3
9
encryption:: { FeeCiphertext , TransferAmountCiphertext } ,
11
17
encryption:: {
12
18
auth_encryption:: { AeCiphertext , AeKey } ,
13
19
elgamal:: { ElGamalCiphertext , ElGamalKeypair , ElGamalPubkey } ,
14
- grouped_elgamal:: GroupedElGamal ,
15
20
pedersen:: { Pedersen , PedersenCommitment , PedersenOpening } ,
16
21
} ,
17
22
zk_elgamal_proof_program:: proof_data:: {
@@ -71,6 +76,16 @@ pub fn transfer_with_fee_split_proof_data(
71
76
destination_elgamal_pubkey,
72
77
auditor_elgamal_pubkey,
73
78
) ;
79
+ #[ cfg( not( target_arch = "wasm32" ) ) ]
80
+ let grouped_ciphertext_lo = transfer_amount_grouped_ciphertext_lo. 0 ;
81
+ #[ cfg( target_arch = "wasm32" ) ]
82
+ let grouped_ciphertext_lo = GroupedElGamalCiphertext3Handles :: encryption_with_u64 (
83
+ source_elgamal_keypair. pubkey ( ) ,
84
+ destination_elgamal_pubkey,
85
+ auditor_elgamal_pubkey,
86
+ transfer_amount_lo,
87
+ & transfer_amount_opening_lo,
88
+ ) ;
74
89
75
90
let ( transfer_amount_grouped_ciphertext_hi, transfer_amount_opening_hi) =
76
91
TransferAmountCiphertext :: new (
@@ -79,6 +94,16 @@ pub fn transfer_with_fee_split_proof_data(
79
94
destination_elgamal_pubkey,
80
95
auditor_elgamal_pubkey,
81
96
) ;
97
+ #[ cfg( not( target_arch = "wasm32" ) ) ]
98
+ let grouped_ciphertext_hi = transfer_amount_grouped_ciphertext_hi. 0 ;
99
+ #[ cfg( target_arch = "wasm32" ) ]
100
+ let grouped_ciphertext_hi = GroupedElGamalCiphertext3Handles :: encryption_with_u64 (
101
+ source_elgamal_keypair. pubkey ( ) ,
102
+ destination_elgamal_pubkey,
103
+ auditor_elgamal_pubkey,
104
+ transfer_amount_hi,
105
+ & transfer_amount_opening_hi,
106
+ ) ;
82
107
83
108
// Decrypt the current available balance at the source
84
109
let current_decrypted_available_balance = current_decryptable_available_balance
@@ -130,8 +155,8 @@ pub fn transfer_with_fee_split_proof_data(
130
155
source_elgamal_keypair. pubkey ( ) ,
131
156
destination_elgamal_pubkey,
132
157
auditor_elgamal_pubkey,
133
- & transfer_amount_grouped_ciphertext_lo . 0 ,
134
- & transfer_amount_grouped_ciphertext_hi . 0 ,
158
+ & grouped_ciphertext_lo ,
159
+ & grouped_ciphertext_hi ,
135
160
transfer_amount_lo,
136
161
transfer_amount_hi,
137
162
& transfer_amount_opening_lo,
@@ -233,6 +258,7 @@ pub fn transfer_with_fee_split_proof_data(
233
258
234
259
// encrypt the fee amount under the destination and withdraw withheld authority
235
260
// ElGamal public key
261
+ #[ cfg( not( target_arch = "wasm32" ) ) ]
236
262
let fee_destination_withdraw_withheld_authority_ciphertext_lo = GroupedElGamal :: encrypt_with (
237
263
[
238
264
destination_elgamal_pubkey,
@@ -241,6 +267,16 @@ pub fn transfer_with_fee_split_proof_data(
241
267
fee_amount_lo,
242
268
& fee_opening_lo,
243
269
) ;
270
+ #[ cfg( target_arch = "wasm32" ) ]
271
+ let fee_destination_withdraw_withheld_authority_ciphertext_lo =
272
+ GroupedElGamalCiphertext2Handles :: encryption_with_u64 (
273
+ destination_elgamal_pubkey,
274
+ withdraw_withheld_authority_elgamal_pubkey,
275
+ fee_amount_lo,
276
+ & fee_opening_lo,
277
+ ) ;
278
+
279
+ #[ cfg( not( target_arch = "wasm32" ) ) ]
244
280
let fee_destination_withdraw_withheld_authority_ciphertext_hi = GroupedElGamal :: encrypt_with (
245
281
[
246
282
destination_elgamal_pubkey,
@@ -249,6 +285,14 @@ pub fn transfer_with_fee_split_proof_data(
249
285
fee_amount_hi,
250
286
& fee_opening_hi,
251
287
) ;
288
+ #[ cfg( target_arch = "wasm32" ) ]
289
+ let fee_destination_withdraw_withheld_authority_ciphertext_hi =
290
+ GroupedElGamalCiphertext2Handles :: encryption_with_u64 (
291
+ destination_elgamal_pubkey,
292
+ withdraw_withheld_authority_elgamal_pubkey,
293
+ fee_amount_hi,
294
+ & fee_opening_hi,
295
+ ) ;
252
296
253
297
// generate fee ciphertext validity data
254
298
let fee_ciphertext_validity_proof_data =
0 commit comments