mirror of
https://github.com/logos-co/nomos-pocs.git
synced 2025-01-10 17:36:01 +00:00
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)]
|
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||||
pub struct PtxPrivate {
|
pub struct PtxPrivate {
|
||||||
pub ptx: PartialTxWitness,
|
pub ptx: PartialTxWitness,
|
||||||
pub input_cm_paths: Vec<MMRProof>,
|
pub input_cm_proofs: Vec<MMRProof>,
|
||||||
pub cm_mmr: MMR,
|
pub cm_mmr: MMR,
|
||||||
}
|
}
|
||||||
|
@ -1,20 +1,18 @@
|
|||||||
/// Input Proof
|
/// Input Proof
|
||||||
use cl::cl::merkle;
|
|
||||||
use ledger_proof_statements::ptx::{PtxPrivate, PtxPublic};
|
use ledger_proof_statements::ptx::{PtxPrivate, PtxPublic};
|
||||||
use risc0_zkvm::guest::env;
|
use risc0_zkvm::guest::env;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let PtxPrivate {
|
let PtxPrivate {
|
||||||
ptx,
|
ptx,
|
||||||
input_cm_paths,
|
input_cm_proofs,
|
||||||
cm_roots,
|
cm_mmr,
|
||||||
} = env::read();
|
} = env::read();
|
||||||
|
|
||||||
assert_eq!(ptx.inputs.len(), input_cm_paths.len());
|
assert_eq!(ptx.inputs.len(), input_cm_proofs.len());
|
||||||
for ((input, cm_path), cm_root) in ptx.inputs.iter().zip(input_cm_paths).zip(&cm_roots) {
|
for (input, cm_mmr_proof) in ptx.inputs.iter().zip(input_cm_proofs) {
|
||||||
let note_cm = input.note_commitment();
|
let note_cm = input.note_commitment();
|
||||||
let cm_leaf = merkle::leaf(note_cm.as_bytes());
|
assert!(cm_mmr.verify_proof(¬e_cm.0, &cm_mmr_proof));
|
||||||
assert_eq!(*cm_root, merkle::path_root(cm_leaf, &cm_path));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for output in ptx.outputs.iter() {
|
for output in ptx.outputs.iter() {
|
||||||
@ -23,6 +21,6 @@ fn main() {
|
|||||||
|
|
||||||
env::commit(&PtxPublic {
|
env::commit(&PtxPublic {
|
||||||
ptx: ptx.commit(),
|
ptx: ptx.commit(),
|
||||||
cm_roots,
|
cm_mmr,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user