remove NonePod and use dummy signed pods (#272)

* remove NonePod and use dummy signed pods

* apply suggestion by @arnaucube
This commit is contained in:
Eduard S. 2025-06-13 10:14:15 +02:00 committed by GitHub
parent 03485d6fd3
commit 3b4edab1f5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 54 additions and 49 deletions

View file

@ -18,7 +18,7 @@ use crate::{
deserialize_proof,
emptypod::EmptyPod,
error::{Error, Result},
mock::emptypod::MockEmptyPod,
mock::{emptypod::MockEmptyPod, signedpod::MockSignedPod},
primitives::merkletree::MerkleClaimAndProof,
recursion::{RecursiveCircuit, RecursiveParams},
serialize_proof,
@ -27,8 +27,8 @@ use crate::{
},
middleware::{
self, resolve_wildcard_values, AnchoredKey, CustomPredicateBatch, DynError, Hash,
MainPodInputs, NativeOperation, NonePod, OperationType, Params, Pod, PodId, PodProver,
PodType, RecursivePod, StatementArg, ToFields, VDSet, F, KEY_TYPE, SELF,
MainPodInputs, NativeOperation, OperationType, Params, Pod, PodId, PodProver, PodType,
RecursivePod, StatementArg, ToFields, VDSet, F, KEY_TYPE, SELF,
},
};
@ -257,13 +257,16 @@ pub(crate) fn layout_statements(
statements.push(middleware::Statement::None.into());
// Input signed pods region
// TODO: Replace this with a dumb signed pod
// https://github.com/0xPARC/pod2/issues/246
let none_sig_pod_box: Box<dyn Pod> = Box::new(NonePod {});
let none_sig_pod = none_sig_pod_box.as_ref();
let dummy_signed_pod_box: Box<dyn Pod> =
if mock || inputs.signed_pods.len() == params.max_input_signed_pods {
Box::new(MockSignedPod::dummy())
} else {
Box::new(SignedPod::dummy())
};
let dummy_signed_pod = dummy_signed_pod_box.as_ref();
assert!(inputs.signed_pods.len() <= params.max_input_signed_pods);
for i in 0..params.max_input_signed_pods {
let pod = inputs.signed_pods.get(i).unwrap_or(&none_sig_pod);
let pod = inputs.signed_pods.get(i).unwrap_or(&dummy_signed_pod);
let sts = pod.pub_statements();
assert!(sts.len() <= params.max_signed_pod_values);
for j in 0..params.max_signed_pod_values {