Skip to content

Commit

Permalink
bls12377: test mul 01 by 01
Browse files Browse the repository at this point in the history
  • Loading branch information
shramee committed Mar 8, 2024
1 parent 718671d commit 10215c6
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions std/algebra/native/fields_bls12377/e6_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,48 @@ func TestMulFp6(t *testing.T) {
assert.CheckCircuit(&circuit, test.WithValidAssignment(&witness), test.WithCurves(ecc.BW6_761))
}

type e6Mul01By01 struct {
A0, A1 E2
B0, B1 E2
C E6 `gnark:",public"`
}

func (circuit *e6Mul01By01) Define(api frontend.API) error {
expected := E6{}

expected = *Mul01By01(api, circuit.A0, circuit.A1, circuit.B0, circuit.B1)
expected.AssertIsEqual(api, circuit.C)

return nil
}

func TestMul01By01(t *testing.T) {

var circuit, witness e6Mul01By01
// witness values
var a, c bls12377.E6
var A0, A1, B0, B1 bls12377.E2
_, _ = A0.SetRandom()
_, _ = A1.SetRandom()
_, _ = B0.SetRandom()
_, _ = B1.SetRandom()
a.B0 = A0
a.B1 = A1
a.B2.SetZero()
c.Set(&a)
c.MulBy01(&B0, &B1)

witness.A0.Assign(&A0)
witness.A1.Assign(&A1)
witness.B0.Assign(&B0)
witness.B1.Assign(&B1)
witness.C.Assign(&c)

assert := test.NewAssert(t)
assert.CheckCircuit(&circuit, test.WithValidAssignment(&witness), test.WithCurves(ecc.BW6_761))

}

type fp6MulByNonResidue struct {
A E6
C E6 `gnark:",public"`
Expand Down

0 comments on commit 10215c6

Please sign in to comment.