r1cs

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 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.CurveObject
	IsSolved(solution map[string]interface{}) error
	GetNbConstraints() int
	GetNbWires() int
	GetNbCoefficients() int
}

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

func Read

func Read(path string) (R1CS, error)

Read file at path and attempt to decode it into a R1CS object note that until v1.X.X serialization (schema-less, disk, network, ..) may change

type UntypedR1CS

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

	// Constraints
	NbConstraints   int // total number of constraints
	NbCOConstraints int // 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 R1CS is Untyped and have big.Int coefficients

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() int

GetNbConstraints returns the number of constraints

func (*UntypedR1CS) GetNbWires

func (r1cs *UntypedR1CS) GetNbWires() int

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) 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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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