|
13 | 13 | crate::{
|
14 | 14 | encryption::pedersen::{PedersenCommitment, PedersenOpening},
|
15 | 15 | sigma_proofs::percentage_with_cap::PercentageWithCapProof,
|
16 |
| - zk_elgamal_proof_program::errors::{ProofGenerationError, ProofVerificationError}, |
| 16 | + zk_elgamal_proof_program::{ |
| 17 | + errors::{ProofGenerationError, ProofVerificationError}, |
| 18 | + proof_data::errors::ProofDataError, |
| 19 | + }, |
17 | 20 | },
|
18 | 21 | bytemuck::bytes_of,
|
19 | 22 | merlin::Transcript,
|
|
24 | 27 | encryption::pod::pedersen::PodPedersenCommitment,
|
25 | 28 | pod::PodU64,
|
26 | 29 | sigma_proofs::pod::PodPercentageWithCapProof,
|
27 |
| - zk_elgamal_proof_program::proof_data::{ProofType, ZkProofData}, |
| 30 | + zk_elgamal_proof_program::proof_data::{pod::impl_wasm_to_bytes, ProofType, ZkProofData}, |
28 | 31 | },
|
29 | 32 | bytemuck_derive::{Pod, Zeroable},
|
30 | 33 | };
|
@@ -110,13 +113,10 @@ impl PercentageWithCapProofData {
|
110 | 113 |
|
111 | 114 | Ok(Self { context, proof })
|
112 | 115 | }
|
113 |
| - |
114 |
| - #[cfg_attr(target_arch = "wasm32", wasm_bindgen(js_name = toBytes))] |
115 |
| - pub fn to_bytes(&self) -> Box<[u8]> { |
116 |
| - bytes_of(self).into() |
117 |
| - } |
118 | 116 | }
|
119 | 117 |
|
| 118 | +impl_wasm_to_bytes!(TYPE = PercentageWithCapProofData); |
| 119 | + |
120 | 120 | impl ZkProofData<PercentageWithCapProofContext> for PercentageWithCapProofData {
|
121 | 121 | const PROOF_TYPE: ProofType = ProofType::PercentageWithCap;
|
122 | 122 |
|
@@ -161,6 +161,8 @@ impl PercentageWithCapProofContext {
|
161 | 161 | }
|
162 | 162 | }
|
163 | 163 |
|
| 164 | +impl_wasm_to_bytes!(TYPE = PercentageWithCapProofContext); |
| 165 | + |
164 | 166 | #[cfg(test)]
|
165 | 167 | mod test {
|
166 | 168 | use {super::*, crate::encryption::pedersen::Pedersen, curve25519_dalek::scalar::Scalar};
|
|
0 commit comments