Documentation ¶
Index ¶
- type CoeffTable
- type R1CS
- func (engine *R1CS) Add(a, b *constraint.Coeff)
- func (cs *R1CS) AddConstraint(r1c constraint.R1C, debugInfo ...constraint.DebugInfo) int
- func (cs *R1CS) CurveID() ecc.ID
- func (engine *R1CS) FromInterface(i interface{}) constraint.Coeff
- func (cs *R1CS) GetConstraints() ([]constraint.R1C, constraint.Resolver)
- func (cs *R1CS) GetNbCoefficients() int
- func (engine *R1CS) Inverse(a *constraint.Coeff)
- func (engine *R1CS) IsOne(a *constraint.Coeff) bool
- func (cs *R1CS) IsSolved(witness witness.Witness, opts ...backend.ProverOption) error
- func (engine *R1CS) Mul(a, b *constraint.Coeff)
- func (engine *R1CS) Neg(a *constraint.Coeff)
- func (engine *R1CS) One() constraint.Coeff
- func (cs *R1CS) ReadFrom(r io.Reader) (int64, error)
- func (cs *R1CS) Solve(witness, a, b, c fr.Vector, opt backend.ProverConfig) (fr.Vector, error)
- func (engine *R1CS) String(a *constraint.Coeff) string
- func (engine *R1CS) Sub(a, b *constraint.Coeff)
- func (engine *R1CS) ToBigInt(c *constraint.Coeff) *big.Int
- func (cs *R1CS) WriteTo(w io.Writer) (int64, error)
- type SparseR1CS
- func (engine *SparseR1CS) Add(a, b *constraint.Coeff)
- func (cs *SparseR1CS) AddConstraint(c constraint.SparseR1C, debugInfo ...constraint.DebugInfo) int
- func (cs *SparseR1CS) CurveID() ecc.ID
- func (engine *SparseR1CS) FromInterface(i interface{}) constraint.Coeff
- func (cs *SparseR1CS) GetConstraints() ([]constraint.SparseR1C, constraint.Resolver)
- func (cs *SparseR1CS) GetNbCoefficients() int
- func (engine *SparseR1CS) Inverse(a *constraint.Coeff)
- func (engine *SparseR1CS) IsOne(a *constraint.Coeff) bool
- func (cs *SparseR1CS) IsSolved(witness witness.Witness, opts ...backend.ProverOption) error
- func (engine *SparseR1CS) Mul(a, b *constraint.Coeff)
- func (engine *SparseR1CS) Neg(a *constraint.Coeff)
- func (engine *SparseR1CS) One() constraint.Coeff
- func (cs *SparseR1CS) ReadFrom(r io.Reader) (int64, error)
- func (cs *SparseR1CS) Solve(witness fr.Vector, opt backend.ProverConfig) (fr.Vector, error)
- func (engine *SparseR1CS) String(a *constraint.Coeff) string
- func (engine *SparseR1CS) Sub(a, b *constraint.Coeff)
- func (engine *SparseR1CS) ToBigInt(c *constraint.Coeff) *big.Int
- func (cs *SparseR1CS) WriteTo(w io.Writer) (int64, error)
- type UnsatisfiedConstraintError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CoeffTable ¶
CoeffTable ensure we store unique coefficients in the constraint system
func (*CoeffTable) CoeffToString ¶
func (ct *CoeffTable) CoeffToString(cID int) string
CoeffToString implements constraint.Resolver
func (*CoeffTable) MakeTerm ¶
func (ct *CoeffTable) MakeTerm(coeff *constraint.Coeff, variableID int) constraint.Term
type R1CS ¶
type R1CS struct { constraint.R1CSCore CoeffTable // contains filtered or unexported fields }
R1CS describes a set of R1CS constraint
func NewR1CS ¶
NewR1CS returns a new R1CS and sets cs.Coefficient (fr.Element) from provided big.Int values
capacity pre-allocates memory for capacity nbConstraints
func (*R1CS) Add ¶
func (engine *R1CS) Add(a, b *constraint.Coeff)
func (*R1CS) AddConstraint ¶
func (cs *R1CS) AddConstraint(r1c constraint.R1C, debugInfo ...constraint.DebugInfo) int
func (*R1CS) FromInterface ¶
func (engine *R1CS) FromInterface(i interface{}) constraint.Coeff
func (*R1CS) GetConstraints ¶
func (cs *R1CS) GetConstraints() ([]constraint.R1C, constraint.Resolver)
GetConstraints return the list of R1C and a coefficient resolver
func (*R1CS) GetNbCoefficients ¶
GetNbCoefficients return the number of unique coefficients needed in the R1CS
func (*R1CS) Inverse ¶
func (engine *R1CS) Inverse(a *constraint.Coeff)
func (*R1CS) IsOne ¶
func (engine *R1CS) IsOne(a *constraint.Coeff) bool
func (*R1CS) IsSolved ¶
IsSolved returns nil if given witness solves the R1CS and error otherwise this method wraps cs.Solve() and allocates cs.Solve() inputs
func (*R1CS) Mul ¶
func (engine *R1CS) Mul(a, b *constraint.Coeff)
func (*R1CS) Neg ¶
func (engine *R1CS) Neg(a *constraint.Coeff)
func (*R1CS) One ¶
func (engine *R1CS) One() constraint.Coeff
func (*R1CS) Solve ¶
Solve sets all the wires and returns the a, b, c vectors. the cs system should have been compiled before. The entries in a, b, c are in Montgomery form. a, b, c vectors: ab-c = hz witness = [publicWires | secretWires] (without the ONE_WIRE !) returns [publicWires | secretWires | internalWires ]
func (*R1CS) String ¶
func (engine *R1CS) String(a *constraint.Coeff) string
func (*R1CS) Sub ¶
func (engine *R1CS) Sub(a, b *constraint.Coeff)
type SparseR1CS ¶
type SparseR1CS struct { constraint.SparseR1CSCore CoeffTable // contains filtered or unexported fields }
SparseR1CS represents a Plonk like circuit
func NewSparseR1CS ¶
func NewSparseR1CS(capacity int) *SparseR1CS
NewSparseR1CS returns a new SparseR1CS and sets r1cs.Coefficient (fr.Element) from provided big.Int values
func (*SparseR1CS) Add ¶
func (engine *SparseR1CS) Add(a, b *constraint.Coeff)
func (*SparseR1CS) AddConstraint ¶
func (cs *SparseR1CS) AddConstraint(c constraint.SparseR1C, debugInfo ...constraint.DebugInfo) int
func (*SparseR1CS) CurveID ¶
func (cs *SparseR1CS) CurveID() ecc.ID
CurveID returns curve ID as defined in gnark-crypto (ecc.BW6-633)
func (*SparseR1CS) FromInterface ¶
func (engine *SparseR1CS) FromInterface(i interface{}) constraint.Coeff
func (*SparseR1CS) GetConstraints ¶
func (cs *SparseR1CS) GetConstraints() ([]constraint.SparseR1C, constraint.Resolver)
GetConstraints return the list of SparseR1C and a coefficient resolver
func (*SparseR1CS) GetNbCoefficients ¶
func (cs *SparseR1CS) GetNbCoefficients() int
GetNbCoefficients return the number of unique coefficients needed in the R1CS
func (*SparseR1CS) Inverse ¶
func (engine *SparseR1CS) Inverse(a *constraint.Coeff)
func (*SparseR1CS) IsOne ¶
func (engine *SparseR1CS) IsOne(a *constraint.Coeff) bool
func (*SparseR1CS) IsSolved ¶
func (cs *SparseR1CS) IsSolved(witness witness.Witness, opts ...backend.ProverOption) error
IsSolved returns nil if given witness solves the SparseR1CS and error otherwise this method wraps cs.Solve() and allocates cs.Solve() inputs
func (*SparseR1CS) Mul ¶
func (engine *SparseR1CS) Mul(a, b *constraint.Coeff)
func (*SparseR1CS) Neg ¶
func (engine *SparseR1CS) Neg(a *constraint.Coeff)
func (*SparseR1CS) One ¶
func (engine *SparseR1CS) One() constraint.Coeff
func (*SparseR1CS) ReadFrom ¶
func (cs *SparseR1CS) ReadFrom(r io.Reader) (int64, error)
ReadFrom attempts to decode SparseR1CS from io.Reader using cbor
func (*SparseR1CS) Solve ¶
func (cs *SparseR1CS) Solve(witness fr.Vector, opt backend.ProverConfig) (fr.Vector, error)
Solve sets all the wires. solution.values = [publicInputs | secretInputs | internalVariables ] witness: contains the input variables it returns the full slice of wires
func (*SparseR1CS) String ¶
func (engine *SparseR1CS) String(a *constraint.Coeff) string
func (*SparseR1CS) Sub ¶
func (engine *SparseR1CS) Sub(a, b *constraint.Coeff)
type UnsatisfiedConstraintError ¶
type UnsatisfiedConstraintError struct { Err error CID int // constraint ID DebugInfo *string // optional debug info }
UnsatisfiedConstraintError wraps an error with useful metadata on the unsatisfied constraint
func (*UnsatisfiedConstraintError) Error ¶
func (r *UnsatisfiedConstraintError) Error() string