pub struct FeatureFlags {
pub range_check0: bool,
pub range_check1: bool,
pub foreign_field_add: bool,
pub foreign_field_mul: bool,
pub xor: bool,
pub rot: bool,
pub lookup_features: LookupFeatures,
}Expand description
Flags indicating which optional gates are used in a circuit.
Kimchi circuits can use a variety of optional gates and lookup patterns. Rather than always including constraints for every possible gate type, these flags track which gates are actually present. This allows the prover and verifier to only compute and check relevant constraints.
Flags are typically computed automatically via Self::from_gates, which
scans the circuit gates and enables the corresponding flags.
When a flag is disabled, the following optimizations apply:
- The gate’s selector polynomial is not computed
- The gate’s constraints are excluded from linearization
- Associated lookup tables are not included
Fields§
§range_check0: boolEnables GateType::RangeCheck0, which partially constrains one
88-bit value. Can also perform a standalone 64-bit range check by
constraining columns 1-2 to zero (removing the two highest 12-bit
limbs: 88 - 24 = 64 bits).
See crate::circuits::polynomials::range_check for details.
range_check1: boolEnables GateType::RangeCheck1, which fully constrains the third
value in the multi-range-check gadget and triggers deferred lookups.
See crate::circuits::polynomials::range_check for details.
foreign_field_add: boolEnables GateType::ForeignFieldAdd for addition over non-native fields.
foreign_field_mul: boolEnables GateType::ForeignFieldMul for multiplication over non-native fields.
xor: boolEnables GateType::Xor16 for 16-bit XOR operations.
rot: boolEnables GateType::Rot64 for 64-bit rotation operations.
lookup_features: LookupFeaturesLookup feature configuration.
See LookupFeatures for details.
Implementations§
Source§impl FeatureFlags
impl FeatureFlags
Sourcepub fn from_gates_and_lookup_features<F: PrimeField>(
gates: &[CircuitGate<F>],
lookup_features: LookupFeatures,
) -> FeatureFlags
pub fn from_gates_and_lookup_features<F: PrimeField>( gates: &[CircuitGate<F>], lookup_features: LookupFeatures, ) -> FeatureFlags
Creates feature flags by scanning gates, using pre-computed lookup features.
Sourcepub fn from_gates<F: PrimeField>(
gates: &[CircuitGate<F>],
uses_runtime_tables: bool,
) -> FeatureFlags
pub fn from_gates<F: PrimeField>( gates: &[CircuitGate<F>], uses_runtime_tables: bool, ) -> FeatureFlags
Creates feature flags by scanning gates for optional gate types.
This is the primary constructor. It detects both gate-level features and lookup features from the circuit gates.
Trait Implementations§
Source§impl Clone for FeatureFlags
impl Clone for FeatureFlags
Source§fn clone(&self) -> FeatureFlags
fn clone(&self) -> FeatureFlags
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FeatureFlags
impl Debug for FeatureFlags
Source§impl Default for FeatureFlags
impl Default for FeatureFlags
Source§fn default() -> FeatureFlags
fn default() -> FeatureFlags
Returns an instance with all features disabled.
Source§impl<'de> Deserialize<'de> for FeatureFlags
impl<'de> Deserialize<'de> for FeatureFlags
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl From<FeatureFlags> for JsValue
impl From<FeatureFlags> for JsValue
Source§fn from(value: FeatureFlags) -> Self
fn from(value: FeatureFlags) -> Self
Source§impl<'from_value_lifetime> FromValue<'from_value_lifetime> for FeatureFlags
impl<'from_value_lifetime> FromValue<'from_value_lifetime> for FeatureFlags
Source§fn from_value(value: Value) -> Self
fn from_value(value: Value) -> Self
Source§impl FromWasmAbi for FeatureFlags
impl FromWasmAbi for FeatureFlags
Source§impl IntoValue for FeatureFlags
impl IntoValue for FeatureFlags
Source§fn into_value(self, gc: &Runtime) -> Value
fn into_value(self, gc: &Runtime) -> Value
Source§impl IntoWasmAbi for FeatureFlags
impl IntoWasmAbi for FeatureFlags
Source§impl LongRefFromWasmAbi for FeatureFlags
impl LongRefFromWasmAbi for FeatureFlags
Source§impl OCamlBinding for FeatureFlags
impl OCamlBinding for FeatureFlags
Source§impl OCamlDesc for FeatureFlags
impl OCamlDesc for FeatureFlags
Source§fn ocaml_desc(env: &Env, generics: &[&str]) -> String
fn ocaml_desc(env: &Env, generics: &[&str]) -> String
Source§impl OptionFromWasmAbi for FeatureFlags
impl OptionFromWasmAbi for FeatureFlags
Source§impl OptionIntoWasmAbi for FeatureFlags
impl OptionIntoWasmAbi for FeatureFlags
Source§impl RefFromWasmAbi for FeatureFlags
impl RefFromWasmAbi for FeatureFlags
Source§type Anchor = Ref<'static, FeatureFlags>
type Anchor = Ref<'static, FeatureFlags>
Self for the duration of the
invocation of the function that has an &Self parameter. This is
required to ensure that the lifetimes don’t persist beyond one function
call, and so that they remain anonymous.Source§impl RefMutFromWasmAbi for FeatureFlags
impl RefMutFromWasmAbi for FeatureFlags
Source§impl Serialize for FeatureFlags
impl Serialize for FeatureFlags
Source§impl TryFromJsValue for FeatureFlags
impl TryFromJsValue for FeatureFlags
Source§impl VectorFromWasmAbi for FeatureFlags
impl VectorFromWasmAbi for FeatureFlags
type Abi = <Box<[JsValue]> as FromWasmAbi>::Abi
unsafe fn vector_from_abi(js: Self::Abi) -> Box<[FeatureFlags]>
Source§impl VectorIntoWasmAbi for FeatureFlags
impl VectorIntoWasmAbi for FeatureFlags
type Abi = <Box<[JsValue]> as IntoWasmAbi>::Abi
fn vector_into_abi(vector: Box<[FeatureFlags]>) -> Self::Abi
Source§impl WasmDescribe for FeatureFlags
impl WasmDescribe for FeatureFlags
Source§impl WasmDescribeVector for FeatureFlags
impl WasmDescribeVector for FeatureFlags
impl Copy for FeatureFlags
Auto Trait Implementations§
impl Freeze for FeatureFlags
impl RefUnwindSafe for FeatureFlags
impl Send for FeatureFlags
impl Sync for FeatureFlags
impl Unpin for FeatureFlags
impl UnwindSafe for FeatureFlags
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
Source§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
IntoWasmAbi::AbiSource§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
IntoWasmAbi::into_abi, except that it may throw and never
return in the case of Err.