diff --git a/zk-token-sdk/src/zk_token_elgamal/convert.rs b/zk-token-sdk/src/zk_token_elgamal/convert.rs index 9dd08dd07..777b15171 100644 --- a/zk-token-sdk/src/zk_token_elgamal/convert.rs +++ b/zk-token-sdk/src/zk_token_elgamal/convert.rs @@ -21,7 +21,7 @@ mod target_arch { range_proof::RangeProof, }, curve25519_dalek::{ristretto::CompressedRistretto, scalar::Scalar}, - std::{convert::TryFrom, fmt}, + std::convert::TryFrom, }; impl From for pod::Scalar { @@ -50,12 +50,6 @@ mod target_arch { } } - impl fmt::Debug for pod::ElGamalCiphertext { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "{:?}", self.0) - } - } - impl From for pod::ElGamalPubkey { fn from(pk: ElGamalPubkey) -> Self { Self(pk.to_bytes()) @@ -70,12 +64,6 @@ mod target_arch { } } - impl fmt::Debug for pod::ElGamalPubkey { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "{:?}", self.0) - } - } - impl From for pod::CompressedRistretto { fn from(cr: CompressedRistretto) -> Self { Self(cr.to_bytes()) @@ -111,13 +99,6 @@ mod target_arch { } } - #[cfg(not(target_arch = "bpf"))] - impl fmt::Debug for pod::PedersenCommitment { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "{:?}", self.0) - } - } - #[cfg(not(target_arch = "bpf"))] impl From for pod::PedersenDecryptHandle { fn from(handle: PedersenDecryptHandle) -> Self { @@ -142,13 +123,6 @@ mod target_arch { } } - #[cfg(not(target_arch = "bpf"))] - impl fmt::Debug for pod::PedersenDecryptHandle { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "{:?}", self.0) - } - } - impl TryFrom for pod::RangeProof64 { type Error = ProofError; diff --git a/zk-token-sdk/src/zk_token_elgamal/pod.rs b/zk-token-sdk/src/zk_token_elgamal/pod.rs index 9b1ff138c..31ede5684 100644 --- a/zk-token-sdk/src/zk_token_elgamal/pod.rs +++ b/zk-token-sdk/src/zk_token_elgamal/pod.rs @@ -1,4 +1,6 @@ -use bytemuck::{Pod, Zeroable}; +use std::fmt; + +pub use bytemuck::{Pod, Zeroable}; #[derive(Clone, Copy, Pod, Zeroable, PartialEq)] #[repr(transparent)] @@ -12,18 +14,42 @@ pub struct CompressedRistretto(pub [u8; 32]); #[repr(transparent)] pub struct ElGamalCiphertext(pub [u8; 64]); +impl fmt::Debug for ElGamalCiphertext { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "{:?}", self.0) + } +} + #[derive(Clone, Copy, Pod, Zeroable, PartialEq)] #[repr(transparent)] pub struct ElGamalPubkey(pub [u8; 32]); +impl fmt::Debug for ElGamalPubkey { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "{:?}", self.0) + } +} + #[derive(Clone, Copy, Pod, Zeroable, PartialEq)] #[repr(transparent)] pub struct PedersenCommitment(pub [u8; 32]); +impl fmt::Debug for PedersenCommitment { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "{:?}", self.0) + } +} + #[derive(Clone, Copy, Pod, Zeroable, PartialEq)] #[repr(transparent)] pub struct PedersenDecryptHandle(pub [u8; 32]); +impl fmt::Debug for PedersenDecryptHandle { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "{:?}", self.0) + } +} + /// Serialization of range proofs for 64-bit numbers (for `Withdraw` instruction) #[derive(Clone, Copy)] #[repr(transparent)]