From 6749c45c63e50dc04cc0460d1ec741811cc233c5 Mon Sep 17 00:00:00 2001 From: Sam Kim Date: Thu, 14 Oct 2021 15:44:33 -0400 Subject: [PATCH] merge --- zk-token-sdk/src/zk_token_elgamal/convert.rs | 26 +------------------- zk-token-sdk/src/zk_token_elgamal/pod.rs | 14 ----------- 2 files changed, 1 insertion(+), 39 deletions(-) diff --git a/zk-token-sdk/src/zk_token_elgamal/convert.rs b/zk-token-sdk/src/zk_token_elgamal/convert.rs index 840b9c02fc..e773c72af5 100644 --- a/zk-token-sdk/src/zk_token_elgamal/convert.rs +++ b/zk-token-sdk/src/zk_token_elgamal/convert.rs @@ -22,7 +22,7 @@ mod target_arch { range_proof::RangeProof, }, curve25519_dalek::{ristretto::CompressedRistretto, scalar::Scalar}, - std::convert::{TryFrom, TryInto}, + std::convert::TryFrom, }; impl From for pod::Scalar { @@ -136,30 +136,6 @@ mod target_arch { } } - impl From> for pod::OptionAESCiphertext { - fn from(ct: Option) -> Self { - let mut buf = [0_u8; 17]; - match ct { - Some(ct) => { - buf[0] = 1_u8; - buf[1..].copy_from_slice(&ct.0); - Self(buf) - }, - None => Self(buf), - } - } - } - - impl From for Option { - fn from(ct: pod::OptionAESCiphertext) -> Self { - if ct.0[0] == 0 { - None - } else { - Some(AESCiphertext(ct.0[1..17].try_into().unwrap())) - } - } - } - 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 780a17dd69..148342b6bd 100644 --- a/zk-token-sdk/src/zk_token_elgamal/pod.rs +++ b/zk-token-sdk/src/zk_token_elgamal/pod.rs @@ -81,17 +81,3 @@ impl fmt::Debug for AESCiphertext { } } -/// Temporary serialization of Option -#[derive(Clone, Copy, Pod, Zeroable, PartialEq)] -#[repr(transparent)] -pub struct OptionAESCiphertext(pub [u8; 17]); - -impl fmt::Debug for OptionAESCiphertext { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - if self.0[0] == 1_u8 { - write!(f, "Some({:?})", &self.0[1..17]) - } else { - write!(f, "None") - } - } -}