From 30492323d98b0531fd18b6285cd94afcaa4066d2 Mon Sep 17 00:00:00 2001 From: Murisi Tarusenga Date: Thu, 22 Feb 2024 12:29:22 +0200 Subject: [PATCH 1/2] Exposed SaplingVerificationContextInner for mocking purposes. --- masp_proofs/src/sapling/mod.rs | 4 +++- masp_proofs/src/sapling/verifier.rs | 12 ++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/masp_proofs/src/sapling/mod.rs b/masp_proofs/src/sapling/mod.rs index 16d90e6e..b6fbf0dc 100644 --- a/masp_proofs/src/sapling/mod.rs +++ b/masp_proofs/src/sapling/mod.rs @@ -6,7 +6,9 @@ mod prover; mod verifier; pub use self::prover::SaplingProvingContext; -pub use self::verifier::{BatchValidator, SaplingVerificationContext}; +pub use self::verifier::{ + BatchValidator, SaplingVerificationContext, SaplingVerificationContextInner, +}; // This function computes `value` in the exponent of the value commitment base fn masp_compute_value_balance(asset_type: AssetType, value: i128) -> Option { diff --git a/masp_proofs/src/sapling/verifier.rs b/masp_proofs/src/sapling/verifier.rs index c9c297dd..1a8b27f2 100644 --- a/masp_proofs/src/sapling/verifier.rs +++ b/masp_proofs/src/sapling/verifier.rs @@ -17,14 +17,14 @@ mod batch; pub use batch::BatchValidator; /// A context object for verifying the Sapling components of a Zcash transaction. -struct SaplingVerificationContextInner { +pub struct SaplingVerificationContextInner { // (sum of the Spend value commitments) - (sum of the Output value commitments) cv_sum: jubjub::ExtendedPoint, } impl SaplingVerificationContextInner { /// Construct a new context to be used with a single transaction. - fn new() -> Self { + pub fn new() -> Self { SaplingVerificationContextInner { cv_sum: jubjub::ExtendedPoint::identity(), } @@ -33,7 +33,7 @@ impl SaplingVerificationContextInner { /// Perform consensus checks on a Sapling SpendDescription, while /// accumulating its value commitment inside the context for later use. #[allow(clippy::too_many_arguments)] - fn check_spend( + pub fn check_spend( &mut self, cv: jubjub::ExtendedPoint, anchor: bls12_381::Scalar, @@ -101,7 +101,7 @@ impl SaplingVerificationContextInner { /// Perform consensus checks on a Convert SpendDescription, while /// accumulating its value commitment inside the context for later use. #[allow(clippy::too_many_arguments)] - fn check_convert( + pub fn check_convert( &mut self, cv: jubjub::ExtendedPoint, anchor: bls12_381::Scalar, @@ -132,7 +132,7 @@ impl SaplingVerificationContextInner { /// Perform consensus checks on a Sapling OutputDescription, while /// accumulating its value commitment inside the context for later use. - fn check_output( + pub fn check_output( &mut self, cv: jubjub::ExtendedPoint, cmu: bls12_381::Scalar, @@ -170,7 +170,7 @@ impl SaplingVerificationContextInner { /// Perform consensus checks on the valueBalance and bindingSig parts of a /// Sapling transaction. All SpendDescriptions and OutputDescriptions must /// have been checked before calling this function. - fn final_check( + pub fn final_check( &self, value_balance: I128Sum, sighash_value: &[u8; 32], From 91c43b8a11a14f920a32d153cfc3b5483183105a Mon Sep 17 00:00:00 2001 From: Murisi Tarusenga Date: Tue, 27 Feb 2024 08:58:51 +0200 Subject: [PATCH 2/2] Upgraded the toolchain to 1.76.0. --- masp_proofs/src/circuit/ecc.rs | 2 +- rust-toolchain.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/masp_proofs/src/circuit/ecc.rs b/masp_proofs/src/circuit/ecc.rs index 48d093f7..ed532fa9 100644 --- a/masp_proofs/src/circuit/ecc.rs +++ b/masp_proofs/src/circuit/ecc.rs @@ -37,7 +37,7 @@ where for (i, (chunk, window)) in by.chunks(3).zip(base.iter()).enumerate() { let chunk_a = chunk - .get(0) + .first() .cloned() .unwrap_or_else(|| Boolean::constant(false)); let chunk_b = chunk diff --git a/rust-toolchain.toml b/rust-toolchain.toml index cad9254a..1eb46057 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "1.70.0" +channel = "1.76.0" components = [ "clippy", "rustfmt" ]