how to implement msm for element exceeding MODULUS in ecc.BN254.ScalarField() #1186
Closed
xiangjianmeng
started this conversation in
General
Replies: 1 comment 11 replies
-
Instead of using So instead of: type yourCircuit struct {
X frontend.Variable
}
func (c *yourCircuit) Define(api frontend.API) error {
xnna, err := ToElement(c.X)
// xnna is type emulated.Element[emulated.BN254Fp]
// ...
} you could instead have type nnaCircuit struct {
X emulated.Element[emulated.BN254Fp]
}
func (c *nnaCircuit) Define(api frontend.API) error {
// use c.X as emulated.Element[emulated.BN254Fp] directly
// ...
} This approach works similarly for providing the point directly as witness element, see for example https://github.com/Consensys/gnark/blob/master/std/algebra/emulated/sw_emulated/point_test.go#L622-L661 |
Beta Was this translation helpful? Give feedback.
11 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The full example is the Unit test
TestMsmSolve
in https://github.com/xiangjianmeng/gnark-halo2-verify/tree/fix-compileBeta Was this translation helpful? Give feedback.
All reactions