diff --git a/Cargo.lock b/Cargo.lock index bc2de37d2..72c516709 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -104,7 +104,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0944d18a9a37691b87733b39c9360c9950af9aa5f97e2455bc108d8eb64fc1c1" dependencies = [ "bitvec", - "blake2s_simd", + "blake2s_simd 0.5.11", "byteorder", "crossbeam-channel", "ff", @@ -171,6 +171,17 @@ dependencies = [ "constant_time_eq", ] +[[package]] +name = "blake2b_simd" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72936ee4afc7f8f736d1c38383b56480b5497b4617b4a77bdbf1d2ababc76127" +dependencies = [ + "arrayref", + "arrayvec 0.7.2", + "constant_time_eq", +] + [[package]] name = "blake2s_simd" version = "0.5.11" @@ -182,6 +193,17 @@ dependencies = [ "constant_time_eq", ] +[[package]] +name = "blake2s_simd" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db539cc2b5f6003621f1cd9ef92d7ded8ea5232c7de0f9faa2de251cd98730d4" +dependencies = [ + "arrayref", + "arrayvec 0.7.2", + "constant_time_eq", +] + [[package]] name = "block-buffer" version = "0.9.0" @@ -444,18 +466,18 @@ checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d" [[package]] name = "equihash" version = "0.1.0" -source = "git+https://github.com/zcash/librustzcash.git?rev=53d0a51d33a421cb76d3e3124d1e4c1c9036068e#53d0a51d33a421cb76d3e3124d1e4c1c9036068e" +source = "git+https://github.com/zcash/librustzcash.git?rev=5622b060b1f57de7afc3d0b4e425b9b4b22482a0#5622b060b1f57de7afc3d0b4e425b9b4b22482a0" dependencies = [ - "blake2b_simd", + "blake2b_simd 1.0.0", "byteorder", ] [[package]] name = "f4jumble" version = "0.0.0" -source = "git+https://github.com/zcash/librustzcash.git?rev=53d0a51d33a421cb76d3e3124d1e4c1c9036068e#53d0a51d33a421cb76d3e3124d1e4c1c9036068e" +source = "git+https://github.com/zcash/librustzcash.git?rev=5622b060b1f57de7afc3d0b4e425b9b4b22482a0#5622b060b1f57de7afc3d0b4e425b9b4b22482a0" dependencies = [ - "blake2b_simd", + "blake2b_simd 1.0.0", ] [[package]] @@ -579,7 +601,7 @@ version = "0.1.0-beta.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0f186b85ed81082fb1cf59d52b0111f02915e89a4ac61d292b38d075e570f3a9" dependencies = [ - "blake2b_simd", + "blake2b_simd 0.5.11", "ff", "group", "pasta_curves", @@ -680,8 +702,9 @@ dependencies = [ [[package]] name = "incrementalmerkletree" -version = "0.1.0" -source = "git+https://github.com/zcash/incrementalmerkletree?rev=b7bd6246122a6e9ace8edb51553fbf5228906cbb#b7bd6246122a6e9ace8edb51553fbf5228906cbb" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "186fd3ab92aeac865d4b80b410de9a7b341d31ba8281373caed0b6d17b2b5e96" dependencies = [ "serde", ] @@ -763,8 +786,8 @@ name = "librustzcash" version = "0.2.0" dependencies = [ "bellman", - "blake2b_simd", - "blake2s_simd", + "blake2b_simd 1.0.0", + "blake2s_simd 1.0.0", "bls12_381", "byteorder", "ed25519-zebra", @@ -1018,14 +1041,15 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "orchard" -version = "0.0.0" -source = "git+https://github.com/zcash/orchard.git?rev=2c8241f25b943aa05203eacf9905db117c69bd29#2c8241f25b943aa05203eacf9905db117c69bd29" +version = "0.1.0-beta.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e31f03b6d0aee6d993cac35388b818e04f076ded0ab284979e4d7cd5a8b3c2be" dependencies = [ "aes", "arrayvec 0.7.2", "bigint", "bitvec", - "blake2b_simd", + "blake2b_simd 1.0.0", "ff", "fpe", "group", @@ -1102,7 +1126,7 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d647d91972bad78120fd61e06b225fcda117805c9bbf17676b51bd03a251278b" dependencies = [ - "blake2b_simd", + "blake2b_simd 0.5.11", "ff", "group", "lazy_static", @@ -1311,10 +1335,11 @@ dependencies = [ [[package]] name = "reddsa" -version = "0.0.0" -source = "git+https://github.com/str4d/redjubjub.git?rev=416a6a8ebf8bd42c114c938883016c04f338de72#416a6a8ebf8bd42c114c938883016c04f338de72" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a90e2c94bca3445cae0d55dff7370e29c24885d2403a1665ce19c106c79455e6" dependencies = [ - "blake2b_simd", + "blake2b_simd 0.5.11", "byteorder", "digest", "group", @@ -1790,10 +1815,10 @@ dependencies = [ [[package]] name = "zcash_address" version = "0.0.0" -source = "git+https://github.com/zcash/librustzcash.git?rev=53d0a51d33a421cb76d3e3124d1e4c1c9036068e#53d0a51d33a421cb76d3e3124d1e4c1c9036068e" +source = "git+https://github.com/zcash/librustzcash.git?rev=5622b060b1f57de7afc3d0b4e425b9b4b22482a0#5622b060b1f57de7afc3d0b4e425b9b4b22482a0" dependencies = [ "bech32", - "blake2b_simd", + "blake2b_simd 1.0.0", "bs58", "f4jumble", "zcash_encoding", @@ -1802,7 +1827,7 @@ dependencies = [ [[package]] name = "zcash_encoding" version = "0.0.0" -source = "git+https://github.com/zcash/librustzcash.git?rev=53d0a51d33a421cb76d3e3124d1e4c1c9036068e#53d0a51d33a421cb76d3e3124d1e4c1c9036068e" +source = "git+https://github.com/zcash/librustzcash.git?rev=5622b060b1f57de7afc3d0b4e425b9b4b22482a0#5622b060b1f57de7afc3d0b4e425b9b4b22482a0" dependencies = [ "byteorder", "nonempty", @@ -1811,24 +1836,20 @@ dependencies = [ [[package]] name = "zcash_history" version = "0.2.0" -source = "git+https://github.com/zcash/librustzcash.git?rev=53d0a51d33a421cb76d3e3124d1e4c1c9036068e#53d0a51d33a421cb76d3e3124d1e4c1c9036068e" +source = "git+https://github.com/zcash/librustzcash.git?rev=5622b060b1f57de7afc3d0b4e425b9b4b22482a0#5622b060b1f57de7afc3d0b4e425b9b4b22482a0" dependencies = [ "bigint", - "blake2b_simd", + "blake2b_simd 1.0.0", "byteorder", ] [[package]] name = "zcash_note_encryption" -version = "0.0.0" -source = "git+https://github.com/zcash/librustzcash.git?rev=53d0a51d33a421cb76d3e3124d1e4c1c9036068e#53d0a51d33a421cb76d3e3124d1e4c1c9036068e" +version = "0.1.0" +source = "git+https://github.com/zcash/librustzcash.git?rev=5622b060b1f57de7afc3d0b4e425b9b4b22482a0#5622b060b1f57de7afc3d0b4e425b9b4b22482a0" dependencies = [ - "blake2b_simd", - "byteorder", "chacha20", "chacha20poly1305", - "ff", - "group", "rand_core 0.6.3", "subtle", ] @@ -1836,13 +1857,13 @@ dependencies = [ [[package]] name = "zcash_primitives" version = "0.5.0" -source = "git+https://github.com/zcash/librustzcash.git?rev=53d0a51d33a421cb76d3e3124d1e4c1c9036068e#53d0a51d33a421cb76d3e3124d1e4c1c9036068e" +source = "git+https://github.com/zcash/librustzcash.git?rev=5622b060b1f57de7afc3d0b4e425b9b4b22482a0#5622b060b1f57de7afc3d0b4e425b9b4b22482a0" dependencies = [ "aes", "bip0039", "bitvec", - "blake2b_simd", - "blake2s_simd", + "blake2b_simd 1.0.0", + "blake2s_simd 1.0.0", "bls12_381", "byteorder", "chacha20poly1305", @@ -1870,10 +1891,10 @@ dependencies = [ [[package]] name = "zcash_proofs" version = "0.5.0" -source = "git+https://github.com/zcash/librustzcash.git?rev=53d0a51d33a421cb76d3e3124d1e4c1c9036068e#53d0a51d33a421cb76d3e3124d1e4c1c9036068e" +source = "git+https://github.com/zcash/librustzcash.git?rev=5622b060b1f57de7afc3d0b4e425b9b4b22482a0#5622b060b1f57de7afc3d0b4e425b9b4b22482a0" dependencies = [ "bellman", - "blake2b_simd", + "blake2b_simd 1.0.0", "bls12_381", "byteorder", "directories", diff --git a/Cargo.toml b/Cargo.toml index c23a77465..6d9428b95 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,17 +27,17 @@ crate-type = ["staticlib"] [dependencies] bellman = "0.11" -blake2b_simd = "0.5" -blake2s_simd = "0.5" +blake2b_simd = "1" +blake2s_simd = "1" bls12_381 = "0.6" byteorder = "1" group = "0.11" -incrementalmerkletree = "0.1" +incrementalmerkletree = "0.2" libc = "0.2" jubjub = "0.8" memuse = "0.2" nonempty = "0.7" -orchard = "0.0" +orchard = "=0.1.0-beta.1" subtle = "2.2" rand_core = "0.6" tracing = "0.1" @@ -45,7 +45,7 @@ tracing-core = "0.1" tracing-appender = "0.2" zcash_address = "0.0" zcash_history = "0.2" -zcash_note_encryption = "0.0" +zcash_note_encryption = "0.1" zcash_primitives = "0.5" zcash_proofs = "0.5" ed25519-zebra = "3" @@ -69,10 +69,8 @@ panic = 'abort' codegen-units = 1 [patch.crates-io] -incrementalmerkletree = { git = "https://github.com/zcash/incrementalmerkletree", rev = "b7bd6246122a6e9ace8edb51553fbf5228906cbb" } -orchard = { git = "https://github.com/zcash/orchard.git", rev = "2c8241f25b943aa05203eacf9905db117c69bd29" } -zcash_address = { git = "https://github.com/zcash/librustzcash.git", rev = "53d0a51d33a421cb76d3e3124d1e4c1c9036068e" } -zcash_history = { git = "https://github.com/zcash/librustzcash.git", rev = "53d0a51d33a421cb76d3e3124d1e4c1c9036068e" } -zcash_note_encryption = { git = "https://github.com/zcash/librustzcash.git", rev = "53d0a51d33a421cb76d3e3124d1e4c1c9036068e" } -zcash_primitives = { git = "https://github.com/zcash/librustzcash.git", rev = "53d0a51d33a421cb76d3e3124d1e4c1c9036068e" } -zcash_proofs = { git = "https://github.com/zcash/librustzcash.git", rev = "53d0a51d33a421cb76d3e3124d1e4c1c9036068e" } +zcash_address = { git = "https://github.com/zcash/librustzcash.git", rev = "5622b060b1f57de7afc3d0b4e425b9b4b22482a0" } +zcash_history = { git = "https://github.com/zcash/librustzcash.git", rev = "5622b060b1f57de7afc3d0b4e425b9b4b22482a0" } +zcash_note_encryption = { git = "https://github.com/zcash/librustzcash.git", rev = "5622b060b1f57de7afc3d0b4e425b9b4b22482a0" } +zcash_primitives = { git = "https://github.com/zcash/librustzcash.git", rev = "5622b060b1f57de7afc3d0b4e425b9b4b22482a0" } +zcash_proofs = { git = "https://github.com/zcash/librustzcash.git", rev = "5622b060b1f57de7afc3d0b4e425b9b4b22482a0" } diff --git a/doc/release-notes.md b/doc/release-notes.md index 49091187c..a94a7919a 100644 --- a/doc/release-notes.md +++ b/doc/release-notes.md @@ -4,6 +4,23 @@ release-notes at release time) Notable changes =============== +Wallet +------ + +From this release, newly-created wallets will save the chain name ("Zcash") and +network identifier (e.g. "main") to the `wallet.dat` file. This will enable the +`zcashd` node to check on subsequent starts that the `wallet.dat` file matches +the node's configuration. Existing wallets will start saving this information in +a later release. + +`libzcash_script` +----------------- + +Two new APIs have been added to this library (`zcash_script_legacy_sigop_count` +and `zcash_script_legacy_sigop_count_precomputed`), for counting the number of +signature operations in the transparent inputs and outputs of a transaction. +The presence of these APIs is indicated by a library API version of 2. + Updated RPCs ------------ diff --git a/src/rust/src/address_ffi.rs b/src/rust/src/address_ffi.rs index cf2e54bcc..e47827636 100644 --- a/src/rust/src/address_ffi.rs +++ b/src/rust/src/address_ffi.rs @@ -5,7 +5,10 @@ use std::{ }; use libc::{c_char, c_void}; -use zcash_address::{unified, FromAddress, Network, ToAddress, ZcashAddress}; +use zcash_address::{ + unified::{self, Container, Encoding}, + FromAddress, Network, ToAddress, ZcashAddress, +}; use zcash_primitives::sapling; pub type UnifiedAddressObj = NonNull; @@ -69,8 +72,8 @@ impl UnifiedAddressHelper { } self.ua - .receivers() - .into_iter() + .items_as_parsed() + .iter() .map(|receiver| match receiver { unified::Receiver::Orchard(data) => { // ZIP 316: Senders MUST reject Unified Addresses in which any @@ -92,7 +95,7 @@ impl UnifiedAddressHelper { // ZIP 316: Senders MUST reject Unified Addresses in which any // constituent address does not meet the validation requirements of // its Receiver Encoding. - if sapling::PaymentAddress::from_bytes(&data).is_none() { + if sapling::PaymentAddress::from_bytes(data).is_none() { tracing::error!("Unified Address contains invalid Sapling receiver"); false } else { @@ -106,7 +109,7 @@ impl UnifiedAddressHelper { (p2pkh_cb.unwrap())(ua_obj, data.as_ptr()) }, unified::Receiver::Unknown { typecode, data } => unsafe { - (unknown_cb.unwrap())(ua_obj, typecode, data.as_ptr(), data.len()) + (unknown_cb.unwrap())(ua_obj, *typecode, data.as_ptr(), data.len()) }, }) .all(|b| b) @@ -209,7 +212,7 @@ pub extern "C" fn zcash_address_serialize_unified( } }; - let ua: unified::Address = match receivers.try_into() { + let ua = match unified::Address::try_from_items_preserving_order(receivers) { Ok(ua) => ua, Err(e) => { tracing::error!("{}", e); diff --git a/src/rust/src/rustzcash.rs b/src/rust/src/rustzcash.rs index 399e806d5..9e9d9bd90 100644 --- a/src/rust/src/rustzcash.rs +++ b/src/rust/src/rustzcash.rs @@ -1089,9 +1089,9 @@ pub extern "C" fn librustzcash_zip32_xfvk_address( .expect("valid ExtendedFullViewingKey"); let j = zip32::DiversifierIndex(unsafe { *j }); - let addr = match xfvk.address(j) { - Ok(addr) => addr, - Err(_) => return false, + let addr = match xfvk.find_address(j) { + Some(addr) => addr, + None => return false, }; let j_ret = unsafe { &mut *j_ret };