Skip to main content

FeatureFlags

FeatureFlags: {
allMaybe: {
foreignFieldAdd: undefined;
foreignFieldMul: undefined;
lookup: undefined;
rangeCheck0: undefined;
rangeCheck1: undefined;
rot: undefined;
runtimeTables: undefined;
xor: undefined;
};
allNone: {
foreignFieldAdd: boolean;
foreignFieldMul: boolean;
lookup: boolean;
rangeCheck0: boolean;
rangeCheck1: boolean;
rot: boolean;
runtimeTables: boolean;
xor: boolean;
};
fromGates: (gates: Gate[], runtimeTables: boolean) => FeatureFlags;
fromZkProgram: (program: AnalysableProgram, withRuntimeTables: boolean) => Promise<FeatureFlags>;
fromZkProgramList: (programs: AnalysableProgram[], withRuntimeTables: boolean) => Promise<FeatureFlags>;
};

Defined in: lib/proof-system/feature-flags.ts:17

Feature flags indicate what custom gates are used in a proof of circuit. Side loading, for example, requires a set of feature flags in advance (at compile time) in order to verify and side load proofs. If the side loaded proofs and verification keys do not match the specified feature flag configurations, the verification will fail. Flags specified as undefined are considered as maybe by Pickles. This means, proofs can be sided loaded that can, but don't have to, use a specific custom gate. Note: Maybe feature flags incur a proving overhead.

Type declaration

allMaybe

allMaybe: {
foreignFieldAdd: undefined;
foreignFieldMul: undefined;
lookup: undefined;
rangeCheck0: undefined;
rangeCheck1: undefined;
rot: undefined;
runtimeTables: undefined;
xor: undefined;
};

Returns a feature flag configuration where all flags are optional.

allMaybe.foreignFieldAdd

foreignFieldAdd: undefined = undefined;

allMaybe.foreignFieldMul

foreignFieldMul: undefined = undefined;

allMaybe.lookup

lookup: undefined = undefined;

allMaybe.rangeCheck0

rangeCheck0: undefined = undefined;

allMaybe.rangeCheck1

rangeCheck1: undefined = undefined;

allMaybe.rot

rot: undefined = undefined;

allMaybe.runtimeTables

runtimeTables: undefined = undefined;

allMaybe.xor

xor: undefined = undefined;

allNone

allNone: {
foreignFieldAdd: boolean;
foreignFieldMul: boolean;
lookup: boolean;
rangeCheck0: boolean;
rangeCheck1: boolean;
rot: boolean;
runtimeTables: boolean;
xor: boolean;
};

Returns a feature flag configuration where all flags are set to false.

allNone.foreignFieldAdd

foreignFieldAdd: boolean = false;

allNone.foreignFieldMul

foreignFieldMul: boolean = false;

allNone.lookup

lookup: boolean = false;

allNone.rangeCheck0

rangeCheck0: boolean = false;

allNone.rangeCheck1

rangeCheck1: boolean = false;

allNone.rot

rot: boolean = false;

allNone.runtimeTables

runtimeTables: boolean = false;

allNone.xor

xor: boolean = false;

fromGates()

fromGates: (gates: Gate[], runtimeTables: boolean) => FeatureFlags = featureFlagsFromGates;

Given a list of gates, returns the feature flag configuration that the gates use.

Parameters

gates

Gate[]

runtimeTables

boolean = false

Returns

FeatureFlags

fromZkProgram()

fromZkProgram: (program: AnalysableProgram, withRuntimeTables: boolean) => Promise<FeatureFlags>;

Given a ZkProgram, return the feature flag configuration that fits the given program. This function considers all methods of the specified ZkProgram and finds a configuration that fits all. Optionally, it accepts a flag indicating whether runtime tables are used in the program (default is false)

Parameters

program

AnalysableProgram

withRuntimeTables

boolean = false

Returns

Promise<FeatureFlags>

fromZkProgramList()

fromZkProgramList: (programs: AnalysableProgram[], withRuntimeTables: boolean) => Promise<FeatureFlags>;

Given a list of ZkPrograms, return the feature flag configuration that fits the given set of programs. This function considers all methods of all specified ZkPrograms and finds a configuration that fits all.

Parameters

programs

AnalysableProgram[]

withRuntimeTables

boolean = false

Returns

Promise<FeatureFlags>