From 176e21b015b99d7698cfb6106a284c07adde410d Mon Sep 17 00:00:00 2001 From: Sean Bowe Date: Wed, 19 Oct 2022 13:15:44 -0600 Subject: [PATCH 1/2] Update zcash_primitives to orchard 0.3; release zcash_primitives and zcash_proofs 0.8. --- Cargo.toml | 1 - zcash_client_backend/CHANGELOG.md | 2 +- zcash_client_backend/Cargo.toml | 6 +++--- zcash_client_sqlite/CHANGELOG.md | 2 +- zcash_client_sqlite/Cargo.toml | 6 +++--- zcash_extensions/Cargo.toml | 4 ++-- zcash_primitives/CHANGELOG.md | 3 +++ zcash_primitives/Cargo.toml | 6 +++--- zcash_proofs/CHANGELOG.md | 4 ++++ zcash_proofs/Cargo.toml | 4 ++-- 10 files changed, 22 insertions(+), 16 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index cc0491b3f..45a673e2b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,6 +21,5 @@ codegen-units = 1 [patch.crates-io] zcash_encoding = { path = "components/zcash_encoding" } zcash_note_encryption = { path = "components/zcash_note_encryption" } -orchard = { git = "https://github.com/zcash/orchard.git", rev = "4035a97d178f99bb889f4d7ed26c59378fa88961" } schemer = { git = "https://github.com/aschampion/schemer.git", rev = "6726b60f43f72c6e24a18d31be0ec7d42829e5e1" } schemer-rusqlite = { git = "https://github.com/aschampion/schemer.git", rev = "6726b60f43f72c6e24a18d31be0ec7d42829e5e1" } diff --git a/zcash_client_backend/CHANGELOG.md b/zcash_client_backend/CHANGELOG.md index fc4806396..1e6372c69 100644 --- a/zcash_client_backend/CHANGELOG.md +++ b/zcash_client_backend/CHANGELOG.md @@ -64,7 +64,7 @@ and this library adheres to Rust's notion of ### Changed - MSRV is now 1.56.1. - Bumped dependencies to `ff 0.12`, `group 0.12`, `bls12_381 0.7`, `jubjub 0.9`, - `zcash_primitives 0.7`. + `zcash_primitives 0.8`, `orchard 0.3`. - `zcash_client_backend::proto`: - `compact_formats::CompactSpend` has been renamed to `CompactSaplingSpend`, and its `epk` field (and associated `set_epk` method) has been renamed to diff --git a/zcash_client_backend/Cargo.toml b/zcash_client_backend/Cargo.toml index 5bdd1f376..28a4b9ca4 100644 --- a/zcash_client_backend/Cargo.toml +++ b/zcash_client_backend/Cargo.toml @@ -29,7 +29,7 @@ hdwallet = { version = "0.3.1", optional = true } jubjub = "0.9" memuse = "0.2" nom = "7" -orchard = "0.2" +orchard = "0.3" percent-encoding = "2.1.0" proptest = { version = "1.0.0", optional = true } protobuf = "~2.27.1" # MSRV 1.52.1 @@ -45,7 +45,7 @@ tracing = "0.1" zcash_address = { version = "0.1", path = "../components/zcash_address" } zcash_encoding = { version = "0.1", path = "../components/zcash_encoding" } zcash_note_encryption = { version = "0.2", path = "../components/zcash_note_encryption" } -zcash_primitives = { version = "0.7", path = "../zcash_primitives" } +zcash_primitives = { version = "0.8", path = "../zcash_primitives" } [build-dependencies] protobuf-codegen-pure = "~2.27.1" # MSRV 1.52.1 @@ -55,7 +55,7 @@ gumdrop = "0.8" proptest = "1.0.0" rand_xorshift = "0.3" tempfile = "3.1.0" -zcash_proofs = { version = "0.7", path = "../zcash_proofs" } +zcash_proofs = { version = "0.8", path = "../zcash_proofs" } zcash_address = { version = "0.1", path = "../components/zcash_address", features = ["test-dependencies"] } [features] diff --git a/zcash_client_sqlite/CHANGELOG.md b/zcash_client_sqlite/CHANGELOG.md index 8a72b9ea8..f8f71bbc1 100644 --- a/zcash_client_sqlite/CHANGELOG.md +++ b/zcash_client_sqlite/CHANGELOG.md @@ -62,7 +62,7 @@ and this library adheres to Rust's notion of (and in the future, outputs to other pools). Values for this column should be assigned by inference from the address type in the stored data. - MSRV is now 1.56.1. -- Bumped dependencies to `ff 0.12`, `group 0.12`, `jubjub 0.9`. +- Bumped dependencies to `ff 0.12`, `group 0.12`, `jubjub 0.9`, `zcash_primitives 0.8`. - Renamed the following to use lower-case abbreviations (matching Rust naming conventions): - `zcash_client_sqlite::BlockDB` to `BlockDb` diff --git a/zcash_client_sqlite/Cargo.toml b/zcash_client_sqlite/Cargo.toml index f6ad8b4db..a8e55cfb5 100644 --- a/zcash_client_sqlite/Cargo.toml +++ b/zcash_client_sqlite/Cargo.toml @@ -28,14 +28,14 @@ secrecy = "0.8" time = "0.2" uuid = "1.1" zcash_client_backend = { version = "0.5", path = "../zcash_client_backend" } -zcash_primitives = { version = "0.7", path = "../zcash_primitives" } +zcash_primitives = { version = "0.8", path = "../zcash_primitives" } [dev-dependencies] proptest = "1.0.0" regex = "1.4" tempfile = "3" -zcash_proofs = { version = "0.7", path = "../zcash_proofs" } -zcash_primitives = { version = "0.7", path = "../zcash_primitives", features = ["test-dependencies"] } +zcash_proofs = { version = "0.8", path = "../zcash_proofs" } +zcash_primitives = { version = "0.8", path = "../zcash_primitives", features = ["test-dependencies"] } zcash_address = { version = "0.1", path = "../components/zcash_address", features = ["test-dependencies"] } [features] diff --git a/zcash_extensions/Cargo.toml b/zcash_extensions/Cargo.toml index c92dd9e17..440d17fbb 100644 --- a/zcash_extensions/Cargo.toml +++ b/zcash_extensions/Cargo.toml @@ -11,14 +11,14 @@ rust-version = "1.56.1" [dependencies] blake2b_simd = "1" -zcash_primitives = { version = "0.7", path = "../zcash_primitives", features = ["zfuture" ] } +zcash_primitives = { version = "0.8", path = "../zcash_primitives", features = ["zfuture" ] } [dev-dependencies] ff = "0.12" jubjub = "0.9" rand_core = "0.6" zcash_address = { version = "0.1", path = "../components/zcash_address" } -zcash_proofs = { version = "0.7", path = "../zcash_proofs" } +zcash_proofs = { version = "0.8", path = "../zcash_proofs" } [features] transparent-inputs = [] diff --git a/zcash_primitives/CHANGELOG.md b/zcash_primitives/CHANGELOG.md index 900ecbe45..89cc61cd1 100644 --- a/zcash_primitives/CHANGELOG.md +++ b/zcash_primitives/CHANGELOG.md @@ -6,6 +6,8 @@ and this library adheres to Rust's notion of [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] + +## [0.8.0] - 2022-10-19 ### Added - `zcash_primitives::legacy`: - `impl {Copy, Eq, Ord} for TransparentAddress` @@ -57,6 +59,7 @@ and this library adheres to Rust's notion of ### Changed - Migrated to `group 0.13`. +- Migrated to `orchard 0.3`. - `zcash_primitives::sapling::ViewingKey` now stores `nk` as a `NullifierDerivingKey` instead of as a bare `jubjub::SubgroupPoint`. - The signature of `zcash_primitives::sapling::Note::nf` has changed to diff --git a/zcash_primitives/Cargo.toml b/zcash_primitives/Cargo.toml index 91d6e7db1..8248e880b 100644 --- a/zcash_primitives/Cargo.toml +++ b/zcash_primitives/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "zcash_primitives" description = "Rust implementations of the Zcash primitives" -version = "0.7.0" +version = "0.8.0" authors = [ "Jack Grigg ", "Kris Nuttycombe " @@ -38,7 +38,7 @@ jubjub = "0.9" lazy_static = "1" memuse = "0.2.1" nonempty = "0.7" -orchard = "0.2" +orchard = "0.3" proptest = { version = "1.0.0", optional = true } rand = "0.8" rand_core = "0.6" @@ -58,7 +58,7 @@ features = ["pre-zip-212"] criterion = "0.3" proptest = "1.0.0" rand_xorshift = "0.3" -orchard = { version = "0.2", features = ["test-dependencies"] } +orchard = { version = "0.3", features = ["test-dependencies"] } [target.'cfg(unix)'.dev-dependencies] pprof = { version = "0.9", features = ["criterion", "flamegraph"] } # MSRV 1.56 diff --git a/zcash_proofs/CHANGELOG.md b/zcash_proofs/CHANGELOG.md index 81f5a00af..2a33ac28a 100644 --- a/zcash_proofs/CHANGELOG.md +++ b/zcash_proofs/CHANGELOG.md @@ -7,6 +7,10 @@ and this library adheres to Rust's notion of ## [Unreleased] +## [0.8.0] - 2022-10-19 +### Changed +- Bumped dependencies to `zcash_primitives 0.8`. + ## [0.7.1] - 2022-07-05 ### Added - `zcash_proofs::sapling::BatchValidator` diff --git a/zcash_proofs/Cargo.toml b/zcash_proofs/Cargo.toml index 86d0ad73c..5302cabbf 100644 --- a/zcash_proofs/Cargo.toml +++ b/zcash_proofs/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "zcash_proofs" description = "Zcash zk-SNARK circuits and proving APIs" -version = "0.7.1" +version = "0.8.0" authors = [ "Jack Grigg ", ] @@ -30,7 +30,7 @@ rand_core = "0.6" redjubjub = "0.5" tracing = "0.1" wagyu-zcash-parameters = { version = "0.2", optional = true } -zcash_primitives = { version = "0.7", path = "../zcash_primitives" } +zcash_primitives = { version = "0.8", path = "../zcash_primitives" } [dev-dependencies] criterion = "0.3" From 5bf36989e20d0b9745fa906d918966f74106933c Mon Sep 17 00:00:00 2001 From: Kris Nuttycombe Date: Wed, 19 Oct 2022 13:35:37 -0600 Subject: [PATCH 2/2] Fix beta clippy complaints. --- zcash_client_backend/build.rs | 4 ++-- zcash_client_backend/src/keys.rs | 2 +- zcash_client_sqlite/src/prepared.rs | 2 +- zcash_client_sqlite/src/wallet/init.rs | 2 +- zcash_primitives/src/legacy.rs | 4 ++-- .../src/transaction/components/transparent/builder.rs | 4 ++-- zcash_primitives/src/transaction/util/sha256d.rs | 2 +- zcash_proofs/src/lib.rs | 4 ++-- zcash_proofs/src/sprout.rs | 4 ++-- 9 files changed, 14 insertions(+), 14 deletions(-) diff --git a/zcash_client_backend/build.rs b/zcash_client_backend/build.rs index 6d0c8c926..65b9417eb 100644 --- a/zcash_client_backend/build.rs +++ b/zcash_client_backend/build.rs @@ -1,8 +1,8 @@ fn main() { protobuf_codegen_pure::Codegen::new() .out_dir("src/proto") - .inputs(&["proto/compact_formats.proto"]) - .includes(&["proto"]) + .inputs(["proto/compact_formats.proto"]) + .includes(["proto"]) .run() .expect("Protobuf codegen failed"); } diff --git a/zcash_client_backend/src/keys.rs b/zcash_client_backend/src/keys.rs index 18e8b73fe..7051bd029 100644 --- a/zcash_client_backend/src/keys.rs +++ b/zcash_client_backend/src/keys.rs @@ -612,7 +612,7 @@ mod tests { #[cfg(feature = "transparent-inputs")] fn seed() -> Vec { let seed_hex = "6ef5f84def6f4b9d38f466586a8380a38593bd47c8cda77f091856176da47f26b5bd1c8d097486e5635df5a66e820d28e1d73346f499801c86228d43f390304f"; - hex::decode(&seed_hex).unwrap() + hex::decode(seed_hex).unwrap() } #[test] diff --git a/zcash_client_sqlite/src/prepared.rs b/zcash_client_sqlite/src/prepared.rs index 272394c81..3db3aff48 100644 --- a/zcash_client_sqlite/src/prepared.rs +++ b/zcash_client_sqlite/src/prepared.rs @@ -352,7 +352,7 @@ impl<'a, P> DataConnStmtCache<'a, P> { /// Finds the database row for the given `txid`, if the transaction is in the wallet. pub(crate) fn stmt_select_tx_ref(&mut self, txid: &TxId) -> Result { self.stmt_select_tx_ref - .query_row(&[&txid.as_ref()[..]], |row| row.get(0)) + .query_row([&txid.as_ref()[..]], |row| row.get(0)) .map_err(SqliteClientError::from) } diff --git a/zcash_client_sqlite/src/wallet/init.rs b/zcash_client_sqlite/src/wallet/init.rs index ce71d50fa..f1167cd3f 100644 --- a/zcash_client_sqlite/src/wallet/init.rs +++ b/zcash_client_sqlite/src/wallet/init.rs @@ -842,7 +842,7 @@ mod tests { tx.write(&mut tx_bytes).unwrap(); wdb.conn.execute( "INSERT INTO transactions (block, id_tx, txid, raw) VALUES (0, 0, '', ?)", - &[&tx_bytes[..]], + [&tx_bytes[..]], )?; wdb.conn.execute( "INSERT INTO sent_notes (tx, output_index, from_account, address, value) diff --git a/zcash_primitives/src/legacy.rs b/zcash_primitives/src/legacy.rs index 912c6ffe3..e1d12a766 100644 --- a/zcash_primitives/src/legacy.rs +++ b/zcash_primitives/src/legacy.rs @@ -84,10 +84,10 @@ impl Shl<&[u8]> for Script { self.0.push(data.len() as u8); } else if data.len() <= 0xffff { self.0.push(OpCode::PushData2 as u8); - self.0.extend(&(data.len() as u16).to_le_bytes()); + self.0.extend((data.len() as u16).to_le_bytes()); } else { self.0.push(OpCode::PushData4 as u8); - self.0.extend(&(data.len() as u32).to_le_bytes()); + self.0.extend((data.len() as u32).to_le_bytes()); } self.0.extend(data); self diff --git a/zcash_primitives/src/transaction/components/transparent/builder.rs b/zcash_primitives/src/transaction/components/transparent/builder.rs index a2ac99aa8..63371ddcd 100644 --- a/zcash_primitives/src/transaction/components/transparent/builder.rs +++ b/zcash_primitives/src/transaction/components/transparent/builder.rs @@ -100,7 +100,7 @@ impl TransparentBuilder { use ripemd::Ripemd160; use sha2::{Digest, Sha256}; - if hash[..] != Ripemd160::digest(&Sha256::digest(&pubkey))[..] { + if hash[..] != Ripemd160::digest(Sha256::digest(&pubkey))[..] { return Err(Error::InvalidAddress); } } @@ -245,7 +245,7 @@ impl Bundle { // Signature has to have "SIGHASH_ALL" appended to it let mut sig_bytes: Vec = sig.serialize_der()[..].to_vec(); - sig_bytes.extend(&[SIGHASH_ALL as u8]); + sig_bytes.extend([SIGHASH_ALL as u8]); // P2PKH scriptSig Script::default() << &sig_bytes[..] << &info.pubkey[..] diff --git a/zcash_primitives/src/transaction/util/sha256d.rs b/zcash_primitives/src/transaction/util/sha256d.rs index 0852b3d6c..889b2ba73 100644 --- a/zcash_primitives/src/transaction/util/sha256d.rs +++ b/zcash_primitives/src/transaction/util/sha256d.rs @@ -60,7 +60,7 @@ impl HashWriter { impl Write for HashWriter { fn write(&mut self, buf: &[u8]) -> io::Result { - self.hasher.update(&buf); + self.hasher.update(buf); Ok(buf.len()) } diff --git a/zcash_proofs/src/lib.rs b/zcash_proofs/src/lib.rs index 906996943..5ee22508e 100644 --- a/zcash_proofs/src/lib.rs +++ b/zcash_proofs/src/lib.rs @@ -232,7 +232,7 @@ fn stream_params_downloads_to_disk( use std::io::{BufWriter, Read}; // Fail early if the directory isn't writeable. - let new_params_file = File::create(¶ms_path)?; + let new_params_file = File::create(params_path)?; let new_params_file = BufWriter::with_capacity(1024 * 1024, new_params_file); // Set up the download requests. @@ -441,7 +441,7 @@ fn verify_file_size( name: &str, params_source: &str, ) -> Result<(), io::Error> { - let file_size = std::fs::metadata(¶ms_path)?.len(); + let file_size = std::fs::metadata(params_path)?.len(); if file_size != expected_bytes { return Err(io::Error::new( diff --git a/zcash_proofs/src/sprout.rs b/zcash_proofs/src/sprout.rs index 832be3873..53f35be44 100644 --- a/zcash_proofs/src/sprout.rs +++ b/zcash_proofs/src/sprout.rs @@ -159,8 +159,8 @@ pub fn verify_proof( public_input.extend(mac2); public_input.extend(cm1); public_input.extend(cm2); - public_input.extend(&vpub_old.to_le_bytes()); - public_input.extend(&vpub_new.to_le_bytes()); + public_input.extend(vpub_old.to_le_bytes()); + public_input.extend(vpub_new.to_le_bytes()); let public_input = multipack::bytes_to_bits(&public_input); let public_input = multipack::compute_multipacking(&public_input);