Padding in set target (#200)

* feat: handle padding in set_target

* remove enable from MerkleClaimAndProof

* Update src/backends/plonky2/circuits/mainpod.rs

Co-authored-by: Ahmad Afuni <root@ahmadafuni.com>

---------

Co-authored-by: Ahmad Afuni <root@ahmadafuni.com>
This commit is contained in:
Eduard S. 2025-04-21 17:27:29 +02:00 committed by GitHub
parent 17e6c2a092
commit 26a6b2d143
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 87 additions and 143 deletions

View file

@ -134,13 +134,8 @@ impl SignedPodVerifyTarget {
let (v, proof) = pod.dict.prove(k)?;
self.mt_proofs[i].set_targets(
pw,
&MerkleClaimAndProof::new(
self.params.max_depth_mt_gadget,
pod.dict.commitment(),
k.raw(),
Some(v.raw()),
&proof,
)?,
true,
&MerkleClaimAndProof::new(pod.dict.commitment(), k.raw(), Some(v.raw()), proof),
)?;
Ok(v)
})
@ -160,13 +155,8 @@ impl SignedPodVerifyTarget {
self.mt_proofs[curr].set_targets(
pw,
&MerkleClaimAndProof::new(
self.params.max_depth_mt_gadget,
pod.dict.commitment(),
k.raw(),
Some(v.raw()),
&proof,
)?,
true,
&MerkleClaimAndProof::new(pod.dict.commitment(), k.raw(), Some(v.raw()), proof),
)?;
curr += 1;
}
@ -174,10 +164,10 @@ impl SignedPodVerifyTarget {
assert!(curr <= self.params.max_signed_pod_values);
// add the proofs of empty leaves (if needed), till the max_signed_pod_values
let mut mp = MerkleClaimAndProof::empty(self.params.max_depth_mt_gadget);
let mut mp = MerkleClaimAndProof::empty();
mp.root = pod.dict.commitment();
for i in curr..self.params.max_signed_pod_values {
self.mt_proofs[i].set_targets(pw, &mp)?;
self.mt_proofs[i].set_targets(pw, false, &mp)?;
}
// get the signer pk