Documentation
¶
Index ¶
- type ACIR
- func (a *ACIR[T, E]) Compile() (constraint.ConstraintSystemGeneric[E], error)
- func (acir *ACIR[T, E]) GetWitness(fileName string, field *big.Int) (witness.Witness, error)
- func (a *ACIR[T, E]) PublicWitnesses() []PublicWitness
- func (a *ACIR[T, E]) String() string
- func (a *ACIR[T, E]) UnmarshalJSON(data []byte) error
- type Circuit
- type CircuitResolver
- type DummyCircuit
- type Program
- type PublicWitness
- type StackItem
- type WitnessStack
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ACIR ¶
type ACIR[T shr.ACIRField, E constraint.Element] struct { NoirVersion string `json:"noir_version"` Hash uint64 `json:"hash"` ABI hdr.ACIRABI `json:"abi"` Program Program[T, E] `json:"program"` DebugSymbols string `json:"debug_symbols"` FileMap map[string]hdr.ACIRFileData `json:"file_map"` }
Struct representation of an ACIR programme
func (*ACIR[T, E]) Compile ¶
func (a *ACIR[T, E]) Compile() (constraint.ConstraintSystemGeneric[E], error)
func (*ACIR[T, E]) GetWitness ¶
Constructs a gnark witness for the constraint system we generate when we call acir.compile() The trick here is that Gnark wants the public variables to be at the beginning of the witness vector, whereas the noir witness stack doesn't care about which variables are public
func (*ACIR[T, E]) PublicWitnesses ¶
func (a *ACIR[T, E]) PublicWitnesses() []PublicWitness
PublicWitnesses returns the main circuit's public witness slots in the order gnark expects.
func (*ACIR[T, E]) UnmarshalJSON ¶
Construct an ACIR instance from json data
type Circuit ¶
type Circuit[T shr.ACIRField, E constraint.Element] struct { CircuitName string CurrentWitnessIndex uint32 Opcodes []ops.Opcode[E] `json:"opcodes"` // Opcodes in the circuit PrivateParameters btree.BTree `json:"private_parameters"` // Witnesses PublicParameters btree.BTree `json:"public_parameters"` // Witnesses ReturnValues btree.BTree `json:"return_values"` // Witnesses MemoryBlocks map[uint32]*logderivlookup.Table }
func (*Circuit[T, E]) Define ¶
func (c *Circuit[T, E]) Define(api frontend.Builder[E], witnesses map[shr.Witness]frontend.Variable, resolve CircuitResolver[T, E], index *uint32) ([]frontend.Variable, []frontend.Variable, error)
Define the constraints for a circuit This returns the input and output variables of the circuit, so that circuits that call the circuit can check that the values they called the circuit with are consistent with the true value.
func (*Circuit[T, E]) UnmarshalReader ¶
func (c *Circuit[T, E]) UnmarshalReader(r *msgpackutil.Reader) error
type CircuitResolver ¶
The Circuit resolver is a function type that takes a circuit id and returns a reference to the circuit at that index and an error if no suh circuit exists
type DummyCircuit ¶
type DummyCircuit struct{}
We need the dummy circuit to feed in our custom builder This makes sure that `callDeferred` is actually called on our custom builder See desired behaviour [here](https://github.com/Consensys/gnark/blob/master/frontend/compile.go#L159) and notice how it is not called by custom constraint system builders [here](https://github.com/Consensys/gnark/blob/55b0e54d2ae15e886ad37300a8d2b00ad00a8023/frontend/cs/r1cs/builder.go#L278)
type Program ¶
type Program[T shr.ACIRField, E constraint.Element] struct { Functions []Circuit[T, E] `json:"functions"` }
Program struct represents the circuits in an ACIR programme
func (*Program[T, E]) Define ¶
func (p *Program[T, E]) Define( api frontend.Builder[E], witnesses map[shr.Witness]frontend.Variable, ) error
Define adds constraints to the ACIR programme
func (*Program[T, E]) UnmarshalReader ¶
func (p *Program[T, E]) UnmarshalReader(r *msgpackutil.Reader) error
func (*Program[T, E]) WitnessLayout ¶
WitnessLayout walks the call tree to determine the dense slot count and the global slot at which the main circuit's local witnesses begin. The witness space is laid out in postorder: each circuit reserves CurrentWitnessIndex+1 contiguous slots, with all transitively-called subcircuits placed before the caller.
type PublicWitness ¶
PublicWitness names a witness slot of the main circuit that must be allocated as a public gnark variable.
type WitnessStack ¶
WitnessStack stores witnesses from `nargo execute` in postorder based on circuit calls. For each execution, witnesses of called subcircuits are stored before their caller, so the main circuit’s witnesses appear last.
func LoadWitnessStackFromFile ¶
func LoadWitnessStackFromFile[T shr.ACIRField](filePath string, modulus *big.Int) (WitnessStack[T], error)
LoadWitnessStackFromFile reads and decodes a witness stack file emitted by `nargo execute`. The wire envelope mirrors the bytecode side: gzip → format byte → msgpack-tagged payload. The payload is a `WitnessStack` struct containing a single tagged field 0 = Vec<StackItem>, where each StackItem has 0 = index (u32) and 1 = witness (WitnessMap, a fixmap of witness → FieldElement).
Directories
¶
| Path | Synopsis |
|---|---|
|
Package msgpackutil implements just enough of MessagePack to decode values emitted by any of noir's three ACIR serialization formats: `Msgpack` (string-keyed fixmap), `MsgpackCompact` (positional fixarray), and `MsgpackTagged` (int-keyed fixmap or positional fixarray per-type).
|
Package msgpackutil implements just enough of MessagePack to decode values emitted by any of noir's three ACIR serialization formats: `Msgpack` (string-keyed fixmap), `MsgpackCompact` (positional fixarray), and `MsgpackTagged` (int-keyed fixmap or positional fixarray per-type). |