Skip to content

Commit

Permalink
circuits: fix arguments and calls
Browse files Browse the repository at this point in the history
Co-authored-by: Eduardo Leegwater Simões <[email protected]>
  • Loading branch information
xevisalle and Eduardo Leegwater Simões committed Jun 6, 2024
1 parent 84f7c3b commit 66e661d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions circuits/src/recipient.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ impl Default for RecipientParameters {
pub(crate) fn gadget(
composer: &mut Composer,
rp: &RecipientParameters,
payload_hash: &Witness,
payload_hash: Witness,
) -> Result<(), Error> {
// VERIFY A SIGNATURE FOR EACH KEY 'A' AND 'B'
let pk_A = composer.append_point(rp.sender_pk.A());
Expand All @@ -77,8 +77,8 @@ pub(crate) fn gadget(
let sig_B_u = composer.append_witness(*rp.sig_vec[1].u());
let sig_B_R = composer.append_point(rp.sig_vec[1].R());

gadgets::verify_signature(composer, sig_A_u, sig_A_R, pk_A, *payload_hash)?;
gadgets::verify_signature(composer, sig_B_u, sig_B_R, pk_B, *payload_hash)?;
gadgets::verify_signature(composer, sig_A_u, sig_A_R, pk_A, payload_hash)?;
gadgets::verify_signature(composer, sig_B_u, sig_B_R, pk_B, payload_hash)?;

// ENCRYPT EACH KEY 'A' and 'B' USING EACH OUTPUT 'NPK'
let note_pk_1 = composer.append_public_point(rp.recipient_npk_vec[0]);
Expand Down
8 changes: 4 additions & 4 deletions circuits/src/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ impl<const H: usize> TxInputNote<H> {
note: &Note,
merkle_opening: poseidon_merkle::Opening<(), H>,
sk: &SecretKey,
payload_hash: &BlsScalar,
payload_hash: BlsScalar,
) -> Result<crate::transaction::TxInputNote<H>, PhoenixError> {
let note_sk = sk.gen_note_sk(note);
let note_pk_p =
Expand All @@ -74,7 +74,7 @@ impl<const H: usize> TxInputNote<H> {
&[note_pk_p.get_u(), note_pk_p.get_v(), (*note.pos()).into()],
)[0];

let signature = note_sk.sign_double(rng, *payload_hash);
let signature = note_sk.sign_double(rng, payload_hash);

Ok(crate::transaction::TxInputNote {
merkle_opening,
Expand Down Expand Up @@ -359,7 +359,7 @@ impl<const H: usize, const I: usize> Default for TxCircuit<H, I> {
&note,
merkle_opening,
&sk,
&payload_hash,
payload_hash,
)
.expect("Note created properly.");

Expand Down Expand Up @@ -443,7 +443,7 @@ impl<const H: usize, const I: usize> Circuit for TxCircuit<H, I> {
)?;

// Prove correctness of the sender keys encryption
recipient::gadget(composer, &self.rp, &payload_hash)?;
recipient::gadget(composer, &self.rp, payload_hash)?;

Ok(())
}
Expand Down
2 changes: 1 addition & 1 deletion circuits/tests/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ fn create_test_tx_input_notes<const I: usize>(
&notes[i],
merkle_opening,
&sk,
&payload_hash,
payload_hash,
)
.expect("Note created properly.");

Expand Down

0 comments on commit 66e661d

Please sign in to comment.