feat: custom predicates in frontend statement and operation types (#97)

* Modify frontend statement type

* Modify frontend operation type

* Add exception to typos.toml
This commit is contained in:
Ahmad Afuni 2025-02-28 22:03:44 +10:00 committed by GitHub
parent bcfad307e7
commit 7373b959f6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 168 additions and 125 deletions

View file

@ -7,7 +7,7 @@ use std::fmt;
use crate::middleware::{
self, hash_str, AnchoredKey, Hash, MainPodInputs, NativeOperation, NativePredicate, NonePod,
Params, Pod, PodId, PodProver, StatementArg, ToFields, KEY_TYPE, SELF,
OperationType, Params, Pod, PodId, PodProver, StatementArg, ToFields, KEY_TYPE, SELF,
};
mod operation;
@ -261,7 +261,11 @@ impl MockMainPod {
.map(|mid_arg| Self::find_op_arg(statements, mid_arg))
.collect::<Result<Vec<_>>>()?;
Self::pad_operation_args(params, &mut args);
operations.push(Operation(op.code(), args));
let op_code = match op.code() {
OperationType::Native(code) => code,
_ => unimplemented!(),
};
operations.push(Operation(op_code, args));
}
Ok(operations)
}

View file

@ -2,7 +2,7 @@ use anyhow::Result;
use std::fmt;
use super::Statement;
use crate::middleware::{self, NativeOperation};
use crate::middleware::{self, NativeOperation, OperationType};
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum OperationArg {
@ -29,7 +29,7 @@ impl Operation {
OperationArg::Index(i) => Some(statements[*i].clone().try_into()),
})
.collect::<Result<Vec<crate::middleware::Statement>>>()?;
middleware::Operation::op(self.0, &deref_args)
middleware::Operation::op(OperationType::Native(self.0), &deref_args)
}
}