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

Exposed SaplingVerificationContextInner for mocking purposes. #72

Merged
merged 2 commits into from
Feb 27, 2024
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
2 changes: 1 addition & 1 deletion masp_proofs/src/circuit/ecc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion masp_proofs/src/sapling/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<jubjub::ExtendedPoint> {
Expand Down
12 changes: 6 additions & 6 deletions masp_proofs/src/sapling/verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
}
Expand All @@ -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<C>(
pub fn check_spend<C>(
&mut self,
cv: jubjub::ExtendedPoint,
anchor: bls12_381::Scalar,
Expand Down Expand Up @@ -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<C>(
pub fn check_convert<C>(
&mut self,
cv: jubjub::ExtendedPoint,
anchor: bls12_381::Scalar,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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],
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "1.70.0"
channel = "1.76.0"
components = [ "clippy", "rustfmt" ]
Loading