update ptx proof to use MMR's
This commit is contained in:
parent
84cb37240b
commit
f8a62fe7c9
|
@ -13,6 +13,6 @@ pub struct PtxPublic {
|
|||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct PtxPrivate {
|
||||
pub ptx: PartialTxWitness,
|
||||
pub input_cm_paths: Vec<MMRProof>,
|
||||
pub input_cm_proofs: Vec<MMRProof>,
|
||||
pub cm_mmr: MMR,
|
||||
}
|
||||
|
|
|
@ -1,20 +1,18 @@
|
|||
/// Input Proof
|
||||
use cl::cl::merkle;
|
||||
use ledger_proof_statements::ptx::{PtxPrivate, PtxPublic};
|
||||
use risc0_zkvm::guest::env;
|
||||
|
||||
fn main() {
|
||||
let PtxPrivate {
|
||||
ptx,
|
||||
input_cm_paths,
|
||||
cm_roots,
|
||||
input_cm_proofs,
|
||||
cm_mmr,
|
||||
} = env::read();
|
||||
|
||||
assert_eq!(ptx.inputs.len(), input_cm_paths.len());
|
||||
for ((input, cm_path), cm_root) in ptx.inputs.iter().zip(input_cm_paths).zip(&cm_roots) {
|
||||
assert_eq!(ptx.inputs.len(), input_cm_proofs.len());
|
||||
for (input, cm_mmr_proof) in ptx.inputs.iter().zip(input_cm_proofs) {
|
||||
let note_cm = input.note_commitment();
|
||||
let cm_leaf = merkle::leaf(note_cm.as_bytes());
|
||||
assert_eq!(*cm_root, merkle::path_root(cm_leaf, &cm_path));
|
||||
assert!(cm_mmr.verify_proof(¬e_cm.0, &cm_mmr_proof));
|
||||
}
|
||||
|
||||
for output in ptx.outputs.iter() {
|
||||
|
@ -23,6 +21,6 @@ fn main() {
|
|||
|
||||
env::commit(&PtxPublic {
|
||||
ptx: ptx.commit(),
|
||||
cm_roots,
|
||||
cm_mmr,
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue