Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump borsh to v1.0.0-alpha.4 #213

Merged
merged 1 commit into from
Sep 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
(
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![])

Check warning on line 231 in taiga_halo2/src/transaction.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

use of `unwrap_or` to construct default value

warning: use of `unwrap_or` to construct default value --> taiga_halo2/src/transaction.rs:231:18 | 231 | .unwrap_or(vec![]) | ^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_or_default = note: `-W clippy::unwrap-or-default` implied by `-W clippy::all`

Check warning on line 231 in taiga_halo2/src/transaction.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

use of `unwrap_or` to construct default value

warning: use of `unwrap_or` to construct default value --> taiga_halo2/src/transaction.rs:231:18 | 231 | .unwrap_or(vec![]) | ^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_or_default = note: `-W clippy::unwrap-or-default` implied by `-W clippy::all`
.encode(env),
self.signature.try_to_vec().unwrap_or(vec![]).encode(env),
borsh::to_vec(&self.signature).unwrap_or(vec![]).encode(env),

Check warning on line 233 in taiga_halo2/src/transaction.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

use of `unwrap_or` to construct default value

warning: use of `unwrap_or` to construct default value --> taiga_halo2/src/transaction.rs:233:44 | 233 | borsh::to_vec(&self.signature).unwrap_or(vec![]).encode(env), | ^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_or_default

Check warning on line 233 in taiga_halo2/src/transaction.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

use of `unwrap_or` to construct default value

warning: use of `unwrap_or` to construct default value --> taiga_halo2/src/transaction.rs:233:44 | 233 | borsh::to_vec(&self.signature).unwrap_or(vec![]).encode(env), | ^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_or_default
)
.encode(env)
}
Expand Down Expand Up @@ -421,7 +420,7 @@

#[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
Loading