r1cs

package
v0.3.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 23, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package r1cs expose the R1CS (rank-1 constraint system) interface

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type R1CS

type R1CS interface {
	io.WriterTo
	io.ReaderFrom
	IsSolved(solution map[string]interface{}) error
	GetNbConstraints() uint64
	GetNbWires() uint64
	GetNbCoefficients() int
	GetCurveID() gurvy.ID
}

R1CS represents a rank 1 constraint system it's underlying implementation is curve specific (i.e bn256/R1CS, ...)

func New added in v0.3.6

func New(curveID gurvy.ID) R1CS

New instantiate a concrete curved-typed R1CS and return a R1CS interface This method exists for (de)serialization purposes

type UntypedR1CS

type UntypedR1CS struct {
	// Wires
	NbWires       uint64
	NbPublicWires uint64 // includes ONE wire
	NbSecretWires uint64
	SecretWires   []string // private wire names
	PublicWires   []string // public wire names
	Logs          []backend.LogEntry
	DebugInfo     []backend.LogEntry

	// Constraints
	NbConstraints   uint64 // total number of constraints
	NbCOConstraints uint64 // number of constraints that need to be solved, the first of the Constraints slice
	Constraints     []r1c.R1C
	Coefficients    []big.Int
}

UntypedR1CS decsribes a set of UntypedR1CS constraint The coefficients from the rank-1 constraint it contains are big.Int and not tied to a curve base field

func (*UntypedR1CS) GetCurveID

func (r1cs *UntypedR1CS) GetCurveID() gurvy.ID

GetCurveID returns gurvy.UNKNOWN as this is a untyped R1CS using big.Int

func (*UntypedR1CS) GetNbCoefficients

func (r1cs *UntypedR1CS) GetNbCoefficients() int

GetNbCoefficients return the number of unique coefficients needed in the R1CS

func (*UntypedR1CS) GetNbConstraints

func (r1cs *UntypedR1CS) GetNbConstraints() uint64

GetNbConstraints returns the number of constraints

func (*UntypedR1CS) GetNbWires

func (r1cs *UntypedR1CS) GetNbWires() uint64

GetNbWires returns the number of wires

func (*UntypedR1CS) IsSolved

func (r1cs *UntypedR1CS) IsSolved(solution map[string]interface{}) error

IsSolved call will panic as we can't solve a UntypedR1CS

func (*UntypedR1CS) ReadFrom added in v0.3.6

func (r1cs *UntypedR1CS) ReadFrom(r io.Reader) (n int64, err error)

ReadFrom panics (can't deserialize untyped R1CS)

func (*UntypedR1CS) ToR1CS

func (r1cs *UntypedR1CS) ToR1CS(curveID gurvy.ID) R1CS

ToR1CS will convert the big.Int coefficients in the UntypedR1CS to field elements in the basefield of the provided curveID and return a R1CS

this should not be called in a normal circuit development workflow

func (*UntypedR1CS) WriteTo added in v0.3.6

func (r1cs *UntypedR1CS) WriteTo(w io.Writer) (n int64, err error)

WriteTo panics (can't serialize untyped R1CS)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL