From 8c0176fca548c612f4e928880bea734911d573e9 Mon Sep 17 00:00:00 2001 From: teor Date: Tue, 7 Feb 2023 01:23:13 +1000 Subject: [PATCH] change(deps): Upgrade to the zcash_primitives 0.10 API (#6087) * bump zcash_primitives and proofs to 0.10.0 * Update to latest Sapling API * Update Cargo.lock --- Cargo.lock | 12 ++++++------ zebra-chain/Cargo.toml | 2 +- .../src/primitives/zcash_note_encryption.rs | 4 ++-- zebra-chain/src/primitives/zcash_primitives.rs | 16 +++++++++++++--- zebra-consensus/Cargo.toml | 2 +- 5 files changed, 23 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6b8887fe0..e16485fa9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5359,9 +5359,9 @@ dependencies = [ [[package]] name = "zcash_primitives" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f9a45953c4ddd81d68f45920955707f45c8926800671f354dd13b97507edf28" +checksum = "b6879bd4026d9269a41ca91858f453b523f30824288248148211e1cab23b3e0d" dependencies = [ "aes", "bip0039", @@ -5395,9 +5395,9 @@ dependencies = [ [[package]] name = "zcash_proofs" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77381adc72286874e563ee36ba99953946abcbd195ada45440a2754ca823d407" +checksum = "28ca180a8138ae6e2de2b88573ed19dd57798f42a79a00d992b4d727132c7081" dependencies = [ "bellman", "blake2b_simd", @@ -5410,7 +5410,7 @@ dependencies = [ "rand_core 0.6.4", "redjubjub", "tracing", - "zcash_primitives 0.9.1", + "zcash_primitives 0.10.0", ] [[package]] @@ -5492,7 +5492,7 @@ dependencies = [ "zcash_encoding", "zcash_history", "zcash_note_encryption", - "zcash_primitives 0.9.1", + "zcash_primitives 0.10.0", "zebra-test", ] diff --git a/zebra-chain/Cargo.toml b/zebra-chain/Cargo.toml index a21d067e2..3914e057f 100644 --- a/zebra-chain/Cargo.toml +++ b/zebra-chain/Cargo.toml @@ -63,7 +63,7 @@ orchard = "0.3.0" zcash_encoding = "0.2.0" zcash_history = "0.3.0" zcash_note_encryption = "0.2.0" -zcash_primitives = { version = "0.9.1", features = ["transparent-inputs"] } +zcash_primitives = { version = "0.10.0", features = ["transparent-inputs"] } # Time chrono = { version = "0.4.23", default-features = false, features = ["clock", "std", "serde"] } diff --git a/zebra-chain/src/primitives/zcash_note_encryption.rs b/zebra-chain/src/primitives/zcash_note_encryption.rs index ed4be9de2..6f46af82d 100644 --- a/zebra-chain/src/primitives/zcash_note_encryption.rs +++ b/zebra-chain/src/primitives/zcash_note_encryption.rs @@ -1,6 +1,6 @@ //! Contains code that interfaces with the zcash_note_encryption crate from //! librustzcash. -//! + use crate::{ block::Height, parameters::{Network, NetworkUpgrade}, @@ -24,7 +24,7 @@ pub fn decrypts_successfully(transaction: &Transaction, network: Network, height let null_sapling_ovk = zcash_primitives::keys::OutgoingViewingKey([0u8; 32]); if let Some(bundle) = alt_tx.sapling_bundle() { - for output in bundle.shielded_outputs.iter() { + for output in bundle.shielded_outputs().iter() { let recovery = match network { Network::Mainnet => { zcash_primitives::sapling::note_encryption::try_sapling_output_recovery( diff --git a/zebra-chain/src/primitives/zcash_primitives.rs b/zebra-chain/src/primitives/zcash_primitives.rs index 7ee6bd245..dcb051773 100644 --- a/zebra-chain/src/primitives/zcash_primitives.rs +++ b/zebra-chain/src/primitives/zcash_primitives.rs @@ -13,6 +13,8 @@ use crate::{ transparent::{self, Script}, }; +// TODO: move copied and modified code to a separate module. +// // Used by boilerplate code below. #[derive(Clone, Debug)] @@ -87,10 +89,18 @@ impl zp_tx::components::sapling::Authorized, > for IdentityMap { - fn map_proof( + fn map_spend_proof( &self, - p: ::Proof, - ) -> ::Proof + p: ::SpendProof, + ) -> ::SpendProof + { + p + } + + fn map_output_proof( + &self, + p: ::OutputProof, + ) -> ::OutputProof { p } diff --git a/zebra-consensus/Cargo.toml b/zebra-consensus/Cargo.toml index 11280fd08..3eeb94982 100644 --- a/zebra-consensus/Cargo.toml +++ b/zebra-consensus/Cargo.toml @@ -47,7 +47,7 @@ tracing-futures = "0.2.5" orchard = "0.3.0" -zcash_proofs = { version = "0.9.0", features = ["local-prover", "multicore", "download-params"] } +zcash_proofs = { version = "0.10.0", features = ["local-prover", "multicore", "download-params"] } tower-fallback = { path = "../tower-fallback/" } tower-batch = { path = "../tower-batch/" }