Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: organize std packages hints registrations #1043

Merged
merged 10 commits into from
Feb 8, 2024
Prev Previous commit
Next Next commit
fix: register package hints
  • Loading branch information
ivokub committed Feb 8, 2024
commit eed6aa07316fab9137a355a5725a40df0f3b1b04
20 changes: 16 additions & 4 deletions std/hints.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ import (
"sync"

"github.com/consensys/gnark/constraint/solver"
"github.com/consensys/gnark/std/algebra/emulated/fields_bls12381"
"github.com/consensys/gnark/std/algebra/emulated/fields_bn254"
"github.com/consensys/gnark/std/algebra/emulated/fields_bw6761"
"github.com/consensys/gnark/std/algebra/emulated/sw_emulated"
"github.com/consensys/gnark/std/algebra/native/fields_bls12377"
"github.com/consensys/gnark/std/algebra/native/fields_bls24315"
"github.com/consensys/gnark/std/algebra/native/sw_bls12377"
"github.com/consensys/gnark/std/algebra/native/sw_bls24315"
"github.com/consensys/gnark/std/evmprecompiles"
Expand All @@ -29,10 +34,6 @@ func RegisterHints() {

func registerHints() {
// note that importing these packages may already trigger a call to solver.RegisterHint(...)
solver.RegisterHint(sw_bls24315.DecomposeScalarG1)
solver.RegisterHint(sw_bls12377.DecomposeScalarG1)
solver.RegisterHint(sw_bls24315.DecomposeScalarG2)
solver.RegisterHint(sw_bls12377.DecomposeScalarG2)
solver.RegisterHint(bits.GetHints()...)
solver.RegisterHint(cmp.GetHints()...)
solver.RegisterHint(selector.GetHints()...)
Expand All @@ -41,5 +42,16 @@ func registerHints() {
solver.RegisterHint(evmprecompiles.GetHints()...)
solver.RegisterHint(logderivarg.GetHints()...)
solver.RegisterHint(bitslice.GetHints()...)
// emulated fields
solver.RegisterHint(fields_bls12381.GetHints()...)
solver.RegisterHint(fields_bn254.GetHints()...)
solver.RegisterHint(fields_bw6761.GetHints()...)
// native fields
solver.RegisterHint(fields_bls12377.GetHints()...)
solver.RegisterHint(fields_bls24315.GetHints()...)
// emulated curves
solver.RegisterHint(sw_emulated.GetHints()...)
// native curves
solver.RegisterHint(sw_bls12377.GetHints()...)
solver.RegisterHint(sw_bls24315.GetHints()...)
}