Skip to content

Commit

Permalink
Bump borsh to v1.0.0-alpha.4 (#213)
Browse files Browse the repository at this point in the history
bump borsh to v1.0.0-alpha.4
  • Loading branch information
bazzilic authored Sep 5, 2023
1 parent 5da156f commit dbfd3d3
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
2 changes: 1 addition & 1 deletion taiga_halo2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
10 changes: 5 additions & 5 deletions taiga_halo2/src/note.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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();
Expand All @@ -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();
Expand Down
7 changes: 3 additions & 4 deletions taiga_halo2/src/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit dbfd3d3

Please sign in to comment.