Skip to content

Commit

Permalink
chore: make staticcheck happy
Browse files Browse the repository at this point in the history
  • Loading branch information
Tabaie committed Jun 27, 2023
1 parent 3fad3c8 commit 1243f3c
Show file tree
Hide file tree
Showing 20 changed files with 81 additions and 56 deletions.
10 changes: 5 additions & 5 deletions constraint/bls12-377/gkr.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions constraint/bls12-381/gkr.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions constraint/bls24-315/gkr.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions constraint/bls24-317/gkr.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions constraint/blueprint.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package constraint

type BlueprintID uint32

// Blueprint enable representing heterogenous constraints or instructions in a constraint system
// Blueprint enable representing heterogeneous constraints or instructions in a constraint system
// in a memory efficient way. Blueprints essentially help the frontend/ to "compress"
// constraints or instructions, and specify for the solving (or zksnark setup) part how to
// "decompress" and optionally "solve" the associated wires.
Expand Down Expand Up @@ -66,8 +66,8 @@ type BlueprintHint interface {
DecompressHint(h *HintMapping, instruction Instruction)
}

// Compressable represent an object that knows how to encode itself as a []uint32.
type Compressable interface {
// Compressible represent an object that knows how to encode itself as a []uint32.
type Compressible interface {
// Compress interprets the objects as a LinearExpression and encodes it as a []uint32.
Compress(to *[]uint32)
}
10 changes: 5 additions & 5 deletions constraint/bn254/gkr.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions constraint/bn254/system.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions constraint/bw6-633/gkr.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions constraint/bw6-761/gkr.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions constraint/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ type System struct {
lbOutputs []uint32 `cbor:"-"` // wire outputs for current constraint.

CommitmentInfo Commitments
GkrInfo GkrInfo

genericHint BlueprintID
}
Expand Down Expand Up @@ -457,3 +458,12 @@ func putBuffer(buf *[]uint32) {
}
bufPool.Put(buf)
}

func (system *System) AddGkr(gkr GkrInfo) error {
if system.GkrInfo.Is() {
return fmt.Errorf("currently only one GKR sub-circuit per SNARK is supported")
}

system.GkrInfo = gkr
return nil
}
3 changes: 2 additions & 1 deletion constraint/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type ConstraintSystem interface {
// Deprecated: use _, err := Solve(...) instead
IsSolved(witness witness.Witness, opts ...solver.Option) error

// Solve attempts to solves the constraint system using provided witness.
// Solve attempts to solve the constraint system using provided witness.
// Returns an error if the witness does not allow all the constraints to be satisfied.
// Returns a typed solution (R1CSSolution or SparseR1CSSolution) and nil otherwise.
Solve(witness witness.Witness, opts ...solver.Option) (any, error)
Expand Down Expand Up @@ -52,6 +52,7 @@ type ConstraintSystem interface {

AddCommitment(c Commitment) error
GetCommitments() Commitments
AddGkr(gkr GkrInfo) error

AddLog(l LogEntry)

Expand Down
2 changes: 1 addition & 1 deletion constraint/term.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func (t Term) String(r Resolver) string {
return sbb.String()
}

// implements constraint.Compressable
// implements constraint.Compressible

// Compress compresses the term into a slice of uint32 words.
// For compatibility with test engine and LinearExpression, the term is encoded as:
Expand Down
4 changes: 3 additions & 1 deletion frontend/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ type Compiler interface {
// ToCanonicalVariable converts a frontend.Variable to a constraint system specific Variable
// ! Experimental: use in conjunction with constraint.CustomizableSystem
ToCanonicalVariable(Variable) CanonicalVariable

SetGkrInfo(constraint.GkrInfo) error
}

// Builder represents a constraint system builder
Expand Down Expand Up @@ -104,5 +106,5 @@ type Rangechecker interface {
// a PLONK builder --> constraint.Term
// and the test/Engine --> ~*big.Int.
type CanonicalVariable interface {
constraint.Compressable
constraint.Compressible
}
4 changes: 4 additions & 0 deletions frontend/cs/r1cs/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -815,3 +815,7 @@ func (builder *builder) wireIDsToVars(wireIDs ...[]int) []frontend.Variable {
}
return res
}

func (builder *builder) SetGkrInfo(info constraint.GkrInfo) error {
return builder.cs.AddGkr(info)
}
4 changes: 4 additions & 0 deletions frontend/cs/scs/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -619,3 +619,7 @@ func filterConstants(v []frontend.Variable) []frontend.Variable {
func (*builder) FrontendType() frontendtype.Type {
return frontendtype.SCS
}

func (builder *builder) SetGkrInfo(info constraint.GkrInfo) error {
return builder.cs.AddGkr(info)
}
Loading

0 comments on commit 1243f3c

Please sign in to comment.