From 24a6489d2f232e69adc2ab7406da74ae4a5c8edd Mon Sep 17 00:00:00 2001 From: bazzilic Date: Tue, 5 Sep 2023 17:02:19 +0800 Subject: [PATCH] bump borsh to v1.0.0-alpha.4 --- Cargo.toml | 1 + taiga_halo2/Cargo.toml | 2 +- taiga_halo2/src/note.rs | 10 +++++----- taiga_halo2/src/transaction.rs | 7 +++---- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 1fee9d33..893e792b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,6 +3,7 @@ members = [ "taiga_halo2", # "taiga_zk_garage", ] +resolver = "2" [patch.crates-io] # ark-serialize = { git="https://github.com/simonmasson/algebra", rev="e2ea75c" } diff --git a/taiga_halo2/Cargo.toml b/taiga_halo2/Cargo.toml index 434f12a2..59503543 100644 --- a/taiga_halo2/Cargo.toml +++ b/taiga_halo2/Cargo.toml @@ -23,7 +23,7 @@ num-bigint = "0.4" rustler = { version = "0.29.1", optional = true } serde = { version = "1.0", features = ["derive"], optional = true } -borsh = { version = "= 1.0.0-alpha.3", features = ["derive"], optional = true } +borsh = { version = "= 1.0.0-alpha.4", features = ["derive"], optional = true } [dev-dependencies] criterion = "0.5" diff --git a/taiga_halo2/src/note.rs b/taiga_halo2/src/note.rs index 2f6e1d2c..0f39c53e 100644 --- a/taiga_halo2/src/note.rs +++ b/taiga_halo2/src/note.rs @@ -648,7 +648,7 @@ pub mod tests { #[cfg(feature = "borsh")] #[test] fn note_borsh_serialization_test() { - use borsh::{BorshDeserialize, BorshSerialize}; + use borsh::BorshDeserialize; use rand::rngs::OsRng; use crate::note::NoteCommitment; @@ -657,7 +657,7 @@ pub mod tests { let input_note = random_input_note(&mut rng); { // BorshSerialize - let borsh = input_note.try_to_vec().unwrap(); + let borsh = borsh::to_vec(&input_note).unwrap(); // BorshDeserialize let de_note: Note = BorshDeserialize::deserialize(&mut borsh.as_ref()).unwrap(); assert_eq!(input_note, de_note); @@ -666,7 +666,7 @@ pub mod tests { let output_note = random_output_note(&mut rng, input_note.rho); { // BorshSerialize - let borsh = output_note.try_to_vec().unwrap(); + let borsh = borsh::to_vec(&output_note).unwrap(); // BorshDeserialize let de_note: Note = BorshDeserialize::deserialize(&mut borsh.as_ref()).unwrap(); assert_eq!(output_note, de_note); @@ -675,7 +675,7 @@ pub mod tests { let icm = input_note.commitment(); { // BorshSerialize - let borsh = icm.try_to_vec().unwrap(); + let borsh = borsh::to_vec(&icm).unwrap(); // BorshDeserialize let de_icm: NoteCommitment = BorshDeserialize::deserialize(&mut borsh.as_ref()).unwrap(); @@ -685,7 +685,7 @@ pub mod tests { let ocm = output_note.commitment(); { // BorshSerialize - let borsh = ocm.try_to_vec().unwrap(); + let borsh = borsh::to_vec(&ocm).unwrap(); // BorshDeserialize let de_ocm: NoteCommitment = BorshDeserialize::deserialize(&mut borsh.as_ref()).unwrap(); diff --git a/taiga_halo2/src/transaction.rs b/taiga_halo2/src/transaction.rs index e24058fd..e60e8757 100644 --- a/taiga_halo2/src/transaction.rs +++ b/taiga_halo2/src/transaction.rs @@ -227,11 +227,10 @@ impl rustler::Encoder for Transaction { ( transaction().encode(env), self.shielded_ptx_bundle.encode(env), - self.transparent_ptx_bundle - .try_to_vec() + borsh::to_vec(&self.transparent_ptx_bundle) .unwrap_or(vec![]) .encode(env), - self.signature.try_to_vec().unwrap_or(vec![]).encode(env), + borsh::to_vec(&self.signature).unwrap_or(vec![]).encode(env), ) .encode(env) } @@ -421,7 +420,7 @@ pub mod testing { #[cfg(feature = "borsh")] { - let borsh = tx.try_to_vec().unwrap(); + let borsh = borsh::to_vec(&tx).unwrap(); let de_tx: Transaction = BorshDeserialize::deserialize(&mut borsh.as_ref()).unwrap(); let (de_shielded_ret, _) = de_tx.execute().unwrap(); assert_eq!(_shielded_ret, de_shielded_ret);