From be66f69eb58e66a85ea78eb0f8b4f3a5c60f6dd9 Mon Sep 17 00:00:00 2001 From: Ava Howell Date: Thu, 22 Feb 2024 17:45:30 -0800 Subject: [PATCH] fix arb_valid_dummy_spend_statement: derive nullifier using real state commitment proof with invalid anchor --- .../component/shielded-pool/src/spend/proof.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/crates/core/component/shielded-pool/src/spend/proof.rs b/crates/core/component/shielded-pool/src/spend/proof.rs index 8b24a8fc45..9ad99765f9 100644 --- a/crates/core/component/shielded-pool/src/spend/proof.rs +++ b/crates/core/component/shielded-pool/src/spend/proof.rs @@ -863,19 +863,19 @@ mod tests { let ak: VerificationKey = sk_sender.spend_auth_key().into(); let mut sct = tct::Tree::new(); - // We shouldn't need a valid Merkle proof here, so let's generate a dummy one. - let rseed = Rseed([0u8; 32]); - let dummy_note_commitment = Note::from_parts(sender, value_to_send, rseed).expect("can create note").commit(); - sct.insert(tct::Witness::Keep, dummy_note_commitment).expect("should be able to insert note commitments into the SCT"); + sct.insert(tct::Witness::Keep, note_commitment).expect("should be able to insert note commitments into the SCT"); - let anchor = sct.root(); - let state_commitment_proof = sct.witness(dummy_note_commitment).expect("can witness note commitment"); + let state_commitment_proof = sct.witness(note_commitment).expect("can witness note commitment"); let balance_commitment = value_to_send.commit(v_blinding); let rk: VerificationKey = rsk.into(); let nullifier = Nullifier::derive(&nk, state_commitment_proof.position(), ¬e_commitment); + // use an invalid anchor to verify that the circuit skips inclusion checks for dummy + // spends + let invalid_anchor = tct::Tree::new().root(); + let public = SpendProofPublic { - anchor, + anchor: invalid_anchor, balance_commitment, nullifier, rk,