Skip to content

Commit

Permalink
flatten out function arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
samkim-crypto committed Apr 27, 2024
1 parent 0c71fbb commit 7be265f
Showing 1 changed file with 36 additions and 34 deletions.
70 changes: 36 additions & 34 deletions zk-sdk/src/sigma_proofs/percentage_with_cap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,17 +100,14 @@ impl PercentageWithCapProof {
/// * `max_fee` - The maximum fee bound
/// * `transcript` - The transcript that does the bookkeeping for the Fiat-Shamir heuristic
pub fn new(
(percentage_amount, percentage_commitment, percentage_opening): (
u64,
&PedersenCommitment,
&PedersenOpening,
),
(delta_percentage, delta_commitment, delta_opening): (
u64,
&PedersenCommitment,
&PedersenOpening,
),
(claimed_commitment, claimed_opening): (&PedersenCommitment, &PedersenOpening),
percentage_commitment: &PedersenCommitment,
percentage_opening: &PedersenOpening,
percentage_amount: u64,
delta_commitment: &PedersenCommitment,
delta_opening: &PedersenOpening,
delta_amount: u64,
claimed_commitment: &PedersenCommitment,
claimed_opening: &PedersenOpening,
max_value: u64,
transcript: &mut Transcript,
) -> Self {
Expand All @@ -127,7 +124,8 @@ impl PercentageWithCapProof {

let proof_below_max = Self::create_proof_percentage_below_max(
percentage_commitment,
(delta_percentage, delta_opening),
delta_opening,
delta_amount,
claimed_opening,
max_value,
&mut transcript_percentage_below_max,
Expand Down Expand Up @@ -243,7 +241,8 @@ impl PercentageWithCapProof {
/// * `transcript` - The transcript that does the bookkeeping for the Fiat-Shamir heuristic
fn create_proof_percentage_below_max(
percentage_commitment: &PedersenCommitment,
(delta_percentage, delta_opening): (u64, &PedersenOpening),
delta_opening: &PedersenOpening,
delta_amount: u64,
claimed_opening: &PedersenOpening,
max_value: u64,
transcript: &mut Transcript,
Expand Down Expand Up @@ -561,13 +560,14 @@ mod test {
let mut verifier_transcript = Transcript::new(b"test");

let proof = PercentageWithCapProof::new(
(
percentage_amount,
&percentage_commitment,
&percentage_opening,
),
(delta, &delta_commitment, &delta_opening),
(&claimed_commitment, &claimed_opening),
&percentage_commitment,
&percentage_opening,
percentage_amount,
&delta_commitment,
&delta_opening,
delta,
&claimed_commitment,
&claimed_opening,
max_value,
&mut prover_transcript,
);
Expand Down Expand Up @@ -612,13 +612,14 @@ mod test {
let mut verifier_transcript = Transcript::new(b"test");

let proof = PercentageWithCapProof::new(
(
percentage_amount,
&percentage_commitment,
&percentage_opening,
),
(delta, &delta_commitment, &delta_opening),
(&claimed_commitment, &claimed_opening),
&percentage_commitment,
&percentage_opening,
percentage_amount,
&delta_commitment,
&delta_opening,
delta,
&claimed_commitment,
&claimed_opening,
max_value,
&mut prover_transcript,
);
Expand Down Expand Up @@ -658,13 +659,14 @@ mod test {
let mut verifier_transcript = Transcript::new(b"test");

let proof = PercentageWithCapProof::new(
(
percentage_amount,
&percentage_commitment,
&percentage_opening,
),
(delta, &delta_commitment, &delta_opening),
(&claimed_commitment, &claimed_opening),
&percentage_commitment,
&percentage_opening,
percentage_amount,
&delta_commitment,
&delta_opening,
delta,
&claimed_commitment,
&claimed_opening,
max_value,
&mut prover_transcript,
);
Expand Down

0 comments on commit 7be265f

Please sign in to comment.