implement SignedPod (non-mock) using proof-based signatures (#160)

This commit is contained in:
arnaucube 2025-03-25 22:17:14 +01:00 committed by GitHub
parent 30f26a94ef
commit d6033b7090
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 259 additions and 60 deletions

View file

@ -66,6 +66,7 @@ impl ToFields for PodId {
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum PodType {
None = 0,
MockSigned = 1,
@ -73,6 +74,17 @@ pub enum PodType {
Signed = 3,
Main = 4,
}
impl fmt::Display for PodType {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
PodType::None => write!(f, "None"),
PodType::MockSigned => write!(f, "MockSigned"),
PodType::MockMain => write!(f, "MockMain"),
PodType::Signed => write!(f, "Signed"),
PodType::Main => write!(f, "Main"),
}
}
}
impl From<PodType> for Value {
fn from(v: PodType) -> Self {
@ -169,7 +181,7 @@ impl Params {
}
pub trait Pod: fmt::Debug + DynClone {
fn verify(&self) -> bool;
fn verify(&self) -> Result<()>;
fn id(&self) -> PodId;
fn pub_statements(&self) -> Vec<Statement>;
/// Extract key-values from ValueOf public statements
@ -208,8 +220,8 @@ pub trait PodSigner {
pub struct NonePod {}
impl Pod for NonePod {
fn verify(&self) -> bool {
true
fn verify(&self) -> Result<()> {
Ok(())
}
fn id(&self) -> PodId {
PodId(EMPTY_HASH)