mirror of
https://github.com/logos-storage/gnark-plonky2-verifier.git
synced 2026-01-06 23:23:08 +00:00
* gl * stage 1 optimizations * working optimized poseidon * Fix posedion tests * in progress gate type refactor * working gates * working e2e * hm' * hm2 * debug saga continues * more debugging cry * more debug * it finally works * optimizations * more optimizations * new changes * more optimizations * more cleanup * some refactoring * new files * flattening of packages * working commit * more refactor * more flattening * more flattening * more more refactor * more optimizations * more optimizations * more optimizations * plonk benchmark * plonk * fix r1cs * resolve kevin's comments * Update goldilocks/base.go Co-authored-by: Kevin Jue <kjue235@gmail.com> * Update goldilocks/base.go Co-authored-by: Kevin Jue <kjue235@gmail.com> * Update goldilocks/base.go Co-authored-by: Kevin Jue <kjue235@gmail.com> * Update goldilocks/quadratic_extension.go Co-authored-by: Kevin Jue <kjue235@gmail.com> * fix: resolve kevin's confusion --------- Co-authored-by: Kevin Jue <kjue235@gmail.com>
52 lines
1.1 KiB
Go
52 lines
1.1 KiB
Go
package gates
|
|
|
|
import (
|
|
"regexp"
|
|
|
|
"github.com/consensys/gnark/frontend"
|
|
gl "github.com/succinctlabs/gnark-plonky2-verifier/goldilocks"
|
|
)
|
|
|
|
var publicInputGateRegex = regexp.MustCompile("PublicInputGate")
|
|
|
|
func deserializePublicInputGate(parameters map[string]string) Gate {
|
|
// Has the format "PublicInputGate"
|
|
return NewPublicInputGate()
|
|
}
|
|
|
|
type PublicInputGate struct {
|
|
}
|
|
|
|
func NewPublicInputGate() *PublicInputGate {
|
|
return &PublicInputGate{}
|
|
}
|
|
|
|
func (g *PublicInputGate) Id() string {
|
|
return "PublicInputGate"
|
|
}
|
|
|
|
func (g *PublicInputGate) WiresPublicInputsHash() []uint64 {
|
|
return []uint64{0, 1, 2, 3}
|
|
}
|
|
|
|
func (g *PublicInputGate) EvalUnfiltered(
|
|
api frontend.API,
|
|
glApi gl.Chip,
|
|
vars EvaluationVars,
|
|
) []gl.QuadraticExtensionVariable {
|
|
constraints := []gl.QuadraticExtensionVariable{}
|
|
|
|
wires := g.WiresPublicInputsHash()
|
|
hash_parts := vars.publicInputsHash
|
|
for i := 0; i < 4; i++ {
|
|
wire := wires[i]
|
|
hash_part := hash_parts[i]
|
|
|
|
tmp := gl.NewQuadraticExtensionVariable(hash_part, gl.Zero())
|
|
diff := glApi.SubExtension(vars.localWires[wire], tmp)
|
|
constraints = append(constraints, diff)
|
|
}
|
|
|
|
return constraints
|
|
}
|