always replace SELF when copying statements (#345)
This commit is contained in:
parent
5cdf53576b
commit
89dfc4e214
5 changed files with 12 additions and 14 deletions
|
|
@ -2,17 +2,16 @@
|
|||
//! is enabled.
|
||||
//! See src/middleware/basetypes.rs for more details.
|
||||
|
||||
/// F is the native field we use everywhere. Currently it's Goldilocks from plonky2
|
||||
pub use plonky2::field::goldilocks_field::GoldilocksField as F;
|
||||
use plonky2::{
|
||||
field::{extension::quadratic::QuadraticExtension, goldilocks_field::GoldilocksField},
|
||||
field::extension::quadratic::QuadraticExtension,
|
||||
hash::{hash_types, poseidon::PoseidonHash},
|
||||
plonk::{circuit_builder, circuit_data, config::GenericConfig, proof},
|
||||
};
|
||||
use schemars::JsonSchema;
|
||||
use serde::{Deserialize, Deserializer, Serialize};
|
||||
|
||||
/// F is the native field we use everywhere. Currently it's Goldilocks from plonky2
|
||||
pub type F = GoldilocksField;
|
||||
|
||||
/// D defines the extension degree of the field used in the Plonky2 proofs (quadratic extension).
|
||||
pub const D: usize = 2;
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ use crate::{
|
|||
middleware::{
|
||||
AnchoredKey, CustomPredicate, CustomPredicateBatch, CustomPredicateRef, NativeOperation,
|
||||
NativePredicate, Params, PodType, PredicatePrefix, Statement, StatementArg, ToFields,
|
||||
Value, ValueRef, EMPTY_VALUE, F, HASH_SIZE, KEY_TYPE, SELF, VALUE_SIZE,
|
||||
Value, ValueRef, F, HASH_SIZE, KEY_TYPE, SELF, VALUE_SIZE,
|
||||
},
|
||||
};
|
||||
|
||||
|
|
@ -947,7 +947,6 @@ fn normalize_statement_circuit(
|
|||
statement: &StatementTarget,
|
||||
self_id: &ValueTarget,
|
||||
) -> StatementTarget {
|
||||
let zero_value = builder.constant_value(EMPTY_VALUE);
|
||||
let self_value = builder.constant_value(SELF.0.into());
|
||||
let args = statement
|
||||
.args
|
||||
|
|
@ -955,11 +954,8 @@ fn normalize_statement_circuit(
|
|||
.map(|arg| {
|
||||
let first = ValueTarget::from_slice(&arg.elements[..VALUE_SIZE]);
|
||||
let second = ValueTarget::from_slice(&arg.elements[VALUE_SIZE..]);
|
||||
let is_not_ak = builder.is_equal_flattenable(&zero_value, &second);
|
||||
let is_ak = builder.not(is_not_ak);
|
||||
let is_self = builder.is_equal_flattenable(&self_value, &first);
|
||||
let normalize = builder.and(is_ak, is_self);
|
||||
let first_normalized = builder.select_flattenable(params, normalize, self_id, &first);
|
||||
let first_normalized = builder.select_flattenable(params, is_self, self_id, &first);
|
||||
StatementArgTarget::new(first_normalized, second)
|
||||
})
|
||||
.collect_vec();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue