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:
parent
0637f52573
commit
4a94b34792
7 changed files with 357 additions and 182 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue