From de22a068f6051472a982d605013602b84a1dcf79 Mon Sep 17 00:00:00 2001 From: SW van Heerden Date: Thu, 30 Nov 2023 14:34:30 +0200 Subject: [PATCH] upgrade borsh --- Cargo.toml | 6 +++--- src/commitment.rs | 6 +++--- src/ristretto/ristretto_keys.rs | 16 ++++++++-------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 3a0ccd7c..16332c20 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,13 +7,13 @@ categories = ["cryptography"] homepage = "https://tari.com" readme = "README.md" license = "BSD-3-Clause" -version = "0.19.0" +version = "0.19.1" edition = "2018" [dependencies] -tari_utilities = { version = "0.6", default-features = false, features = ["zero"] } +tari_utilities = { version = "0.6.2", default-features = false, features = ["zero"] } blake2 = { version = "0.10", default-features = false } -borsh = { version = "0.10" , optional = true , default-features = false} +borsh = { version = "1.2" , optional = true , default-features = false, features = ["derive"]} bulletproofs_plus = { package = "tari_bulletproofs_plus", version = "0.3", optional = true } curve25519-dalek = { package = "tari-curve25519-dalek", version = "4.0.3", default-features = false, features = [ "alloc", "rand_core", "precomputed-tables", "zeroize"] } digest = { version = "0.10", default-features = false } diff --git a/src/commitment.rs b/src/commitment.rs index 9abfa208..6f2ce73f 100644 --- a/src/commitment.rs +++ b/src/commitment.rs @@ -38,15 +38,15 @@ pub struct HomomorphicCommitment

(pub(crate) P); #[cfg(feature = "borsh")] impl borsh::BorshDeserialize for HomomorphicCommitment

{ - fn deserialize_reader(reader: &mut R) -> Result - where R: borsh::maybestd::io::Read { + fn deserialize_reader(reader: &mut R) -> Result + where R: borsh::io::Read { Ok(Self(P::deserialize_reader(reader)?)) } } #[cfg(feature = "borsh")] impl borsh::BorshSerialize for HomomorphicCommitment

{ - fn serialize(&self, writer: &mut W) -> borsh::maybestd::io::Result<()> { + fn serialize(&self, writer: &mut W) -> borsh::io::Result<()> { self.0.serialize(writer) } } diff --git a/src/ristretto/ristretto_keys.rs b/src/ristretto/ristretto_keys.rs index ee9bf0cf..fc5d1efc 100644 --- a/src/ristretto/ristretto_keys.rs +++ b/src/ristretto/ristretto_keys.rs @@ -56,18 +56,18 @@ pub struct RistrettoSecretKey(pub(crate) Scalar); #[cfg(feature = "borsh")] impl borsh::BorshSerialize for RistrettoSecretKey { - fn serialize(&self, writer: &mut W) -> borsh::maybestd::io::Result<()> { + fn serialize(&self, writer: &mut W) -> borsh::io::Result<()> { borsh::BorshSerialize::serialize(&self.as_bytes(), writer) } } #[cfg(feature = "borsh")] impl borsh::BorshDeserialize for RistrettoSecretKey { - fn deserialize_reader(reader: &mut R) -> Result - where R: borsh::maybestd::io::Read { + fn deserialize_reader(reader: &mut R) -> Result + where R: borsh::io::Read { let bytes: Zeroizing> = Zeroizing::new(borsh::BorshDeserialize::deserialize_reader(reader)?); Self::from_canonical_bytes(bytes.as_slice()) - .map_err(|e| borsh::maybestd::io::Error::new(borsh::maybestd::io::ErrorKind::InvalidInput, e.to_string())) + .map_err(|e| borsh::io::Error::new(borsh::io::ErrorKind::InvalidInput, e.to_string())) } } @@ -277,18 +277,18 @@ pub struct RistrettoPublicKey { #[cfg(feature = "borsh")] impl borsh::BorshSerialize for RistrettoPublicKey { - fn serialize(&self, writer: &mut W) -> borsh::maybestd::io::Result<()> { + fn serialize(&self, writer: &mut W) -> borsh::io::Result<()> { borsh::BorshSerialize::serialize(&self.as_bytes(), writer) } } #[cfg(feature = "borsh")] impl borsh::BorshDeserialize for RistrettoPublicKey { - fn deserialize_reader(reader: &mut R) -> Result - where R: borsh::maybestd::io::Read { + fn deserialize_reader(reader: &mut R) -> Result + where R: borsh::io::Read { let bytes: Vec = borsh::BorshDeserialize::deserialize_reader(reader)?; Self::from_canonical_bytes(bytes.as_slice()) - .map_err(|e| borsh::maybestd::io::Error::new(borsh::maybestd::io::ErrorKind::InvalidInput, e.to_string())) + .map_err(|e| borsh::io::Error::new(borsh::io::ErrorKind::InvalidInput, e.to_string())) } }