diff --git a/goas/cl/cl/src/input.rs b/goas/cl/cl/src/input.rs index 246952d..8a9ff2f 100644 --- a/goas/cl/cl/src/input.rs +++ b/goas/cl/cl/src/input.rs @@ -21,7 +21,6 @@ pub struct Input { #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] pub struct InputWitness { pub note: NoteWitness, - pub utxo_balance_blinding: BalanceWitness, pub balance_blinding: BalanceWitness, pub nf_sk: NullifierSecret, pub nonce: NullifierNonce, @@ -36,7 +35,6 @@ impl InputWitness { assert_eq!(nf_sk.commit(), output.nf_pk); Self { note: output.note, - utxo_balance_blinding: output.balance_blinding, balance_blinding: BalanceWitness::random(&mut rng), nf_sk, nonce: output.nonce, @@ -55,13 +53,8 @@ impl InputWitness { } } - pub fn to_output(&self) -> crate::OutputWitness { - crate::OutputWitness { - note: self.note, - balance_blinding: self.utxo_balance_blinding, - nf_pk: self.nf_sk.commit(), - nonce: self.nonce, - } + pub fn note_commitment(&self) -> crate::NoteCommitment { + self.note.commit(self.nf_sk.commit(), self.nonce) } } diff --git a/goas/cl/ledger/src/input.rs b/goas/cl/ledger/src/input.rs index 704b1d1..0c934b5 100644 --- a/goas/cl/ledger/src/input.rs +++ b/goas/cl/ledger/src/input.rs @@ -11,7 +11,7 @@ pub struct ProvedInput { impl ProvedInput { pub fn prove(input: &cl::InputWitness, note_commitments: &[cl::NoteCommitment]) -> Self { - let output_cm = input.to_output().commit_note(); + let output_cm = input.note_commitment(); let cm_leaves = note_commitment_leaves(note_commitments); let cm_idx = note_commitments @@ -95,13 +95,12 @@ mod test { let input = cl::InputWitness { note: cl::NoteWitness::basic(32, "NMO"), - utxo_balance_blinding: cl::BalanceWitness::random(&mut rng), balance_blinding: cl::BalanceWitness::random(&mut rng), nf_sk: cl::NullifierSecret::random(&mut rng), nonce: cl::NullifierNonce::random(&mut rng), }; - let notes = vec![input.to_output().commit_note()]; + let notes = vec![input.note_commitment()]; let mut proved_input = ProvedInput::prove(&input, ¬es); diff --git a/goas/cl/proof_statements/src/ptx.rs b/goas/cl/proof_statements/src/ptx.rs index 6cbc2a0..9701646 100644 --- a/goas/cl/proof_statements/src/ptx.rs +++ b/goas/cl/proof_statements/src/ptx.rs @@ -16,7 +16,7 @@ impl PartialTxInputPrivate { } pub fn cm_root(&self) -> [u8; 32] { - let leaf = merkle::leaf(self.input.to_output().commit_note().as_bytes()); + let leaf = merkle::leaf(self.input.note_commitment().as_bytes()); merkle::path_root(leaf, &self.cm_path) } } diff --git a/goas/cl/risc0_proofs/input/src/main.rs b/goas/cl/risc0_proofs/input/src/main.rs index fa63ab3..baa0737 100644 --- a/goas/cl/risc0_proofs/input/src/main.rs +++ b/goas/cl/risc0_proofs/input/src/main.rs @@ -6,7 +6,7 @@ use risc0_zkvm::guest::env; fn main() { let secret: InputPrivate = env::read(); - let out_cm = secret.input.to_output().commit_note(); + let out_cm = secret.input.note_commitment(); let cm_leaf = merkle::leaf(out_cm.as_bytes()); let cm_root = merkle::path_root(cm_leaf, &secret.cm_path); diff --git a/goas/zone/risc0_proofs/spend_zone_funds/src/main.rs b/goas/zone/risc0_proofs/spend_zone_funds/src/main.rs index 97beecd..7510e03 100644 --- a/goas/zone/risc0_proofs/spend_zone_funds/src/main.rs +++ b/goas/zone/risc0_proofs/spend_zone_funds/src/main.rs @@ -18,7 +18,6 @@ fn main() { spend_event_state_path, } = env::read(); - let cm_root = in_zone_funds.cm_root(); let ptx_root = in_zone_funds.ptx_root(); let nf = Nullifier::new(in_zone_funds.input.nf_sk, in_zone_funds.input.nonce); // check the zone funds note is the one in the spend event @@ -78,7 +77,6 @@ fn main() { assert_eq!(spent_note.output.nf_pk, spend_event.to); env::commit(&DeathConstraintPublic { - cm_root, ptx_root, nf, });