Add SignedPod verification circuit (SignedPodVerifyGadget) (#170)

* add boolean selector to the MerkleProofGadget, to allow skipping proof verifications when all the slots are not used (eg. in the SignedPod circuit)

* move existing signedpod's circuits draft to its own file

* implement SignedPodVerify circuit
This commit is contained in:
arnaucube 2025-04-01 18:20:28 +02:00 committed by GitHub
parent 0637f52573
commit 4a94b34792
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 357 additions and 182 deletions

View file

@ -56,17 +56,7 @@ impl MockSignedPod {
impl Pod for MockSignedPod {
fn verify(&self) -> Result<()> {
// 1. Verify type
let value_at_type = self.dict.get(&hash_str(KEY_TYPE).into())?;
if Value::from(PodType::MockSigned) != value_at_type {
return Err(anyhow!(
"type does not match, expected MockSigned ({}), found {}",
PodType::MockSigned,
value_at_type
));
}
// 2. Verify id
// 1. Verify id
let mt = MerkleTree::new(
MAX_DEPTH,
&self
@ -84,6 +74,16 @@ impl Pod for MockSignedPod {
));
}
// 2. Verify type
let value_at_type = self.dict.get(&hash_str(KEY_TYPE).into())?;
if Value::from(PodType::MockSigned) != value_at_type {
return Err(anyhow!(
"type does not match, expected MockSigned ({}), found {}",
PodType::MockSigned,
value_at_type
));
}
// 3. Verify signature
let pk_hash = self.dict.get(&hash_str(KEY_SIGNER).into())?;
let signature = format!("{}_signed_by_{}", id, pk_hash);