make Pod derive from Any (#205)

This commit is contained in:
Daniel Gulotta 2025-04-22 06:06:23 -06:00 committed by GitHub
parent bf6d8aee8b
commit 58d3c6a236
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 29 additions and 56 deletions

View file

@ -1,4 +1,4 @@
use std::{any::Any, collections::HashMap};
use std::collections::HashMap;
use anyhow::{anyhow, Result};
use itertools::Itertools;
@ -118,13 +118,6 @@ impl Pod for MockSignedPod {
.collect()
}
fn into_any(self: Box<Self>) -> Box<dyn Any> {
self
}
fn as_any(&self) -> &dyn Any {
self
}
fn serialized_proof(&self) -> String {
self.signature.to_string()
}
@ -132,7 +125,7 @@ impl Pod for MockSignedPod {
#[cfg(test)]
pub mod tests {
use std::iter;
use std::{any::Any, iter};
use plonky2::field::types::Field;
@ -152,7 +145,9 @@ pub mod tests {
let mut signer = MockSigner { pk: "Molly".into() };
let pod = pod.sign(&mut signer).unwrap();
let pod = pod.pod.into_any().downcast::<MockSignedPod>().unwrap();
let pod = (pod.pod as Box<dyn Any>)
.downcast::<MockSignedPod>()
.unwrap();
pod.verify()?;
println!("id: {}", pod.id());