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

Update zcash_primitives to orchard 0.3; release zcash_primitives and zcash_proofs 0.8. #681

Merged
merged 2 commits into from
Oct 19, 2022
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: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
2 changes: 1 addition & 1 deletion zcash_client_backend/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions zcash_client_backend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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]
Expand Down
4 changes: 2 additions & 2 deletions zcash_client_backend/build.rs
Original file line number Diff line number Diff line change
@@ -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");
}
2 changes: 1 addition & 1 deletion zcash_client_backend/src/keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ mod tests {
#[cfg(feature = "transparent-inputs")]
fn seed() -> Vec<u8> {
let seed_hex = "6ef5f84def6f4b9d38f466586a8380a38593bd47c8cda77f091856176da47f26b5bd1c8d097486e5635df5a66e820d28e1d73346f499801c86228d43f390304f";
hex::decode(&seed_hex).unwrap()
hex::decode(seed_hex).unwrap()
}

#[test]
Expand Down
2 changes: 1 addition & 1 deletion zcash_client_sqlite/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
6 changes: 3 additions & 3 deletions zcash_client_sqlite/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion zcash_client_sqlite/src/prepared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<i64, SqliteClientError> {
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)
}

Expand Down
2 changes: 1 addition & 1 deletion zcash_client_sqlite/src/wallet/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions zcash_extensions/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand Down
3 changes: 3 additions & 0 deletions zcash_primitives/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions zcash_primitives/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>",
"Kris Nuttycombe <[email protected]>"
Expand Down Expand Up @@ -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"
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions zcash_primitives/src/legacy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down Expand Up @@ -245,7 +245,7 @@ impl Bundle<Unauthorized> {

// Signature has to have "SIGHASH_ALL" appended to it
let mut sig_bytes: Vec<u8> = 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[..]
Expand Down
2 changes: 1 addition & 1 deletion zcash_primitives/src/transaction/util/sha256d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ impl HashWriter {

impl Write for HashWriter {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
self.hasher.update(&buf);
self.hasher.update(buf);

Ok(buf.len())
}
Expand Down
4 changes: 4 additions & 0 deletions zcash_proofs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
4 changes: 2 additions & 2 deletions zcash_proofs/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>",
]
Expand Down Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions zcash_proofs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(&params_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.
Expand Down Expand Up @@ -441,7 +441,7 @@ fn verify_file_size(
name: &str,
params_source: &str,
) -> Result<(), io::Error> {
let file_size = std::fs::metadata(&params_path)?.len();
let file_size = std::fs::metadata(params_path)?.len();

if file_size != expected_bytes {
return Err(io::Error::new(
Expand Down
4 changes: 2 additions & 2 deletions zcash_proofs/src/sprout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down