diff --git a/token/confidential-transfer/proof-generation/src/mint.rs b/token/confidential-transfer/proof-generation/src/mint.rs index 849dfc5de20..87752bc4c9e 100644 --- a/token/confidential-transfer/proof-generation/src/mint.rs +++ b/token/confidential-transfer/proof-generation/src/mint.rs @@ -96,6 +96,7 @@ pub fn mint_split_proof_data( let decryptable_supply_ciphertext = supply_elgamal_keypair .pubkey() .encrypt(current_decyptable_supply); + #[allow(clippy::arithmetic_side_effects)] let ct_decryptable_to_current_diff = decryptable_supply_ciphertext - current_supply_ciphertext; let decryptable_to_current_diff = supply_elgamal_keypair .secret() diff --git a/token/confidential-transfer/proof-tests/tests/proof_test.rs b/token/confidential-transfer/proof-tests/tests/proof_test.rs index f4c3a7f3a9e..3cb5d1ad5ae 100644 --- a/token/confidential-transfer/proof-tests/tests/proof_test.rs +++ b/token/confidential-transfer/proof-tests/tests/proof_test.rs @@ -223,6 +223,7 @@ fn test_mint_validity(mint_amount: u64, supply: u64) { equality_proof_data, ciphertext_validity_proof_data, range_proof_data, + new_decryptable_supply: _, } = mint_split_proof_data( &supply_ciphertext, &decryptable_supply, diff --git a/token/program-2022/src/serialization.rs b/token/program-2022/src/serialization.rs index 0cd75c044b9..9d72b2f9287 100644 --- a/token/program-2022/src/serialization.rs +++ b/token/program-2022/src/serialization.rs @@ -1,11 +1,6 @@ //! serialization module - contains helpers for serde types from other crates, //! deserialization visitors -use { - base64::{prelude::BASE64_STANDARD, Engine}, - serde::de::Error, -}; - /// helper function to ser/deser COption wrapped values pub mod coption_fromstr { use { @@ -135,24 +130,22 @@ pub mod elgamalciphertext_fromstr { de::{Error, Visitor}, Deserializer, Serializer, }, - solana_zk_token_sdk::zk_token_elgamal::pod::ElGamalCiphertext, - std::fmt, + solana_zk_sdk::encryption::pod::elgamal::PodElGamalCiphertext, + std::{fmt, str::FromStr}, }; - const AE_CIPHERTEXT_LEN: usize = 64; - /// serialize AeCiphertext values supporting Display trait - pub fn serialize(x: &ElGamalCiphertext, s: S) -> Result + pub fn serialie(x: &PodElGamalCiphertext, s: S) -> Result where S: Serializer, { s.serialize_str(&x.to_string()) } - struct AeCiphertextVisitor; + struct ElGamalCiphertextVisitor; - impl<'de> Visitor<'de> for AeCiphertextVisitor { - type Value = ElGamalCiphertext; + impl<'de> Visitor<'de> for ElGamalCiphertextVisitor { + type Value = PodElGamalCiphertext; fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { formatter.write_str("a FromStr type") @@ -162,17 +155,16 @@ pub mod elgamalciphertext_fromstr { where E: Error, { - let array = super::base64_to_bytes::(v)?; - Ok(ElGamalCiphertext(array)) + FromStr::from_str(v).map_err(Error::custom) } } /// deserialize AeCiphertext values from str - pub fn deserialize<'de, D>(d: D) -> Result + pub fn deserialize<'de, D>(d: D) -> Result where D: Deserializer<'de>, { - d.deserialize_str(AeCiphertextVisitor) + d.deserialize_str(ElGamalCiphertextVisitor) } } diff --git a/token/program-2022/tests/serialization.rs b/token/program-2022/tests/serialization.rs index 1d8d3b5021f..80e9fab1fc5 100644 --- a/token/program-2022/tests/serialization.rs +++ b/token/program-2022/tests/serialization.rs @@ -5,13 +5,7 @@ use { solana_program::program_option::COption, solana_sdk::pubkey::Pubkey, spl_pod::optional_keys::{OptionalNonZeroElGamalPubkey, OptionalNonZeroPubkey}, - spl_token_2022::{ - extension::confidential_transfer, - instruction, - solana_zk_sdk::encryption::pod::{ - auth_encryption::PodAeCiphertext, elgamal::PodElGamalPubkey, - }, - }, + spl_token_2022::{extension::confidential_transfer, instruction}, std::str::FromStr, };