From 157c9ead5c2e0c49adc90c0227fb7d400350c6b1 Mon Sep 17 00:00:00 2001 From: Arya Tabaie <15056835+Tabaie@users.noreply.github.com> Date: Mon, 16 Dec 2024 22:03:57 -0600 Subject: [PATCH] fix another shifted case --- backend/groth16/bn254/mpcsetup/unit_test.go | 8 ++++++++ backend/groth16/bn254/mpcsetup/utils.go | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/backend/groth16/bn254/mpcsetup/unit_test.go b/backend/groth16/bn254/mpcsetup/unit_test.go index 93b28fcc3..e22dcfbad 100644 --- a/backend/groth16/bn254/mpcsetup/unit_test.go +++ b/backend/groth16/bn254/mpcsetup/unit_test.go @@ -313,6 +313,14 @@ func TestLinearCombinationsG1(t *testing.T) { acc.Add(&acc, &g1) } + testLinearCombinationsG1( + []int{3}, + frs(1, 1, 1), + frs(1, 1, 0), + frs(0, 1, 1), + infty, g1, infty, + ) + testLinearCombinationsG1( []int{3}, frs(1, 1, 1), diff --git a/backend/groth16/bn254/mpcsetup/utils.go b/backend/groth16/bn254/mpcsetup/utils.go index f45481f53..19549f324 100644 --- a/backend/groth16/bn254/mpcsetup/utils.go +++ b/backend/groth16/bn254/mpcsetup/utils.go @@ -156,7 +156,7 @@ func linearCombinationsG1(A []curve.G1Affine, powers []fr.Element, ends []int) ( A[2*i+1] = A[ends[i]-1] } powers[2*len(ends)].Neg(&rInvNeg) // r⁻¹: coefficient for truncated - A[2*len(ends)] = A[prevEnd] + A[2*len(ends)] = truncated // TODO @Tabaie O(1) MSM worth it? if _, err := shifted.MultiExp(A[:2*len(ends)+1], powers[:2*len(ends)+1], msmCfg); err != nil {