limit the number of StatementTmpl in CustomPredicate: (#101)
* limit the number of StatementTmpl in CustomPredicate: - add constructor method for CustomPredicate - make size checks at the CustomPredicate creation, so that once instantiated we can assume that contains valid data This resolves #79 * Update tests to use new interface --------- Co-authored-by: Ahmad <root@ahmadafuni.com>
This commit is contained in:
parent
c9f7427967
commit
c92839d897
6 changed files with 119 additions and 79 deletions
|
|
@ -92,6 +92,22 @@ pub struct Params {
|
|||
pub max_custom_batch_size: usize,
|
||||
}
|
||||
|
||||
impl Default for Params {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
max_input_signed_pods: 3,
|
||||
max_input_main_pods: 3,
|
||||
max_statements: 20,
|
||||
max_signed_pod_values: 8,
|
||||
max_public_statements: 10,
|
||||
max_statement_args: 5,
|
||||
max_operation_args: 5,
|
||||
max_custom_predicate_arity: 5,
|
||||
max_custom_batch_size: 5,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Params {
|
||||
pub fn max_priv_statements(&self) -> usize {
|
||||
self.max_statements - self.max_public_statements
|
||||
|
|
@ -134,22 +150,6 @@ impl Params {
|
|||
}
|
||||
}
|
||||
|
||||
impl Default for Params {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
max_input_signed_pods: 3,
|
||||
max_input_main_pods: 3,
|
||||
max_statements: 20,
|
||||
max_signed_pod_values: 8,
|
||||
max_public_statements: 10,
|
||||
max_statement_args: 5,
|
||||
max_operation_args: 5,
|
||||
max_custom_predicate_arity: 5,
|
||||
max_custom_batch_size: 5,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub trait Pod: fmt::Debug + DynClone {
|
||||
fn verify(&self) -> bool;
|
||||
fn id(&self) -> PodId;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue