diff --git a/prover/circuits/aggregation/circuit_test.go b/prover/circuits/aggregation/circuit_test.go index 0f9accf5..b68a3389 100644 --- a/prover/circuits/aggregation/circuit_test.go +++ b/prover/circuits/aggregation/circuit_test.go @@ -96,7 +96,7 @@ func testAggregation(t *testing.T, nCircuits int, ncs ...int) { } // This collects the verifying keys from the public parameters - var vkeys []plonk.VerifyingKey + vkeys := make([]plonk.VerifyingKey, 0, len(innerSetups)) for _, setup := range innerSetups { vkeys = append(vkeys, setup.VerifyingKey) } diff --git a/prover/example/test_cases/fibonacci_test.go b/prover/example/test_cases/fibonacci_test.go index 4b244e6e..a6a431a7 100644 --- a/prover/example/test_cases/fibonacci_test.go +++ b/prover/example/test_cases/fibonacci_test.go @@ -7,8 +7,9 @@ import ( "github.com/consensys/linea-monorepo/prover/maths/common/smartvectors" "github.com/consensys/linea-monorepo/prover/protocol/column" - "github.com/consensys/linea-monorepo/prover/protocol/ifaces" + "github.com/consensys/linea-monorepo/prover/protocol/compiler/globalcs" "github.com/consensys/linea-monorepo/prover/protocol/wizard" + sym "github.com/consensys/linea-monorepo/prover/symbolic" ) func defineFibo(build *wizard.Builder) { @@ -18,9 +19,11 @@ func defineFibo(build *wizard.Builder) { p1 := build.RegisterCommit(P1, n) // overshadows P // P(X) = P(X/w) + P(X/w^2) - expr := ifaces.ColumnAsVariable(column.Shift(p1, -1)). - Add(ifaces.ColumnAsVariable(column.Shift(p1, -2))). - Sub(ifaces.ColumnAsVariable(p1)) + expr := sym.Sub( + p1, + column.Shift(p1, -1), + column.Shift(p1, -2), + ) _ = build.GlobalConstraint(GLOBAL1, expr) } @@ -31,5 +34,5 @@ func proveFibo(run *wizard.ProverRuntime) { } func TestFibo(t *testing.T) { - checkSolved(t, defineFibo, proveFibo, ALL_BUT_ILC, true) + checkSolved(t, defineFibo, proveFibo, join(compilationSuite{globalcs.Compile}, DUMMY), true) } diff --git a/prover/example/test_cases/framework_test.go b/prover/example/test_cases/framework_test.go index 1386fa71..a5f4e82f 100644 --- a/prover/example/test_cases/framework_test.go +++ b/prover/example/test_cases/framework_test.go @@ -5,9 +5,7 @@ package test_cases_test import ( "testing" - "github.com/consensys/gnark-crypto/ecc" "github.com/consensys/gnark/frontend" - "github.com/consensys/gnark/frontend/cs/scs" "github.com/consensys/linea-monorepo/prover/protocol/coin" "github.com/consensys/linea-monorepo/prover/protocol/compiler/dummy" "github.com/consensys/linea-monorepo/prover/protocol/compiler/globalcs" @@ -22,7 +20,6 @@ import ( "github.com/consensys/linea-monorepo/prover/protocol/ifaces" "github.com/consensys/linea-monorepo/prover/protocol/wizard" "github.com/sirupsen/logrus" - "github.com/stretchr/testify/require" ) /* @@ -147,48 +144,6 @@ func checkSolved( // expected a failure return } - t.Fatalf(err.Error()) - } - - /* - Allocate the circuit - */ - circ := SimpleTestGnarkCircuit{} - { - c, err := wizard.AllocateWizardCircuit(compiled) - if err != nil { - // The only error case acknowledged here is that the returned circuit - // is empty. In that case, there is simply no point to run the verification. - return - } - - circ.C = *c - } - - scs, err := frontend.Compile( - ecc.BLS12_377.ScalarField(), - scs.NewBuilder, - &circ, - frontend.IgnoreUnconstrainedInputs(), - ) - - if err != nil { - // When the error string is too large `require.NoError` does not print - // the error. - t.Logf("circuit construction failed : %v\n", err) - t.FailNow() - } - - assignment := GetAssignment(compiled, proof) - witness, err := frontend.NewWitness(assignment, ecc.BLS12_377.ScalarField()) - require.NoError(t, err) - - err = scs.IsSolved(witness) - - if err != nil { - // When the error string is too large `require.NoError` does not print - // the error. - t.Logf("circuit solving failed : %v\n", err) - t.FailNow() + t.Fatal(err.Error()) } } diff --git a/prover/integration/circuit-testing/aggregation/main.go b/prover/integration/circuit-testing/aggregation/main.go index 6a06b8dd..f71e6c07 100644 --- a/prover/integration/circuit-testing/aggregation/main.go +++ b/prover/integration/circuit-testing/aggregation/main.go @@ -40,20 +40,20 @@ func main() { } // This collects the verifying keys from the public parameters - var vkeys []plonk.VerifyingKey + vkeys := make([]plonk.VerifyingKey, 0, len(innerSetups)) for _, setup := range innerSetups { vkeys = append(vkeys, setup.VerifyingKey) } + ncs := []int{1, 5, 10, 20} + // At this step, we will collect several proofs for the BW6 circuit and // several verification keys. var ( - bw6Vkeys []plonk.VerifyingKey - bw6Proofs []plonk.Proof + bw6Vkeys = make([]plonk.VerifyingKey, 0, len(ncs)) + bw6Proofs = make([]plonk.Proof, 0, len(ncs)) ) - ncs := []int{1, 5, 10, 20} - aggregationPIBytes := []byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32} var aggregationPI frBw6.Element aggregationPI.SetBytes(aggregationPIBytes) diff --git a/prover/zkevm/prover/hash/keccak/keccak_zkevm.go b/prover/zkevm/prover/hash/keccak/keccak_zkevm.go index 547ca751..8b9b073c 100644 --- a/prover/zkevm/prover/hash/keccak/keccak_zkevm.go +++ b/prover/zkevm/prover/hash/keccak/keccak_zkevm.go @@ -36,8 +36,8 @@ func newKeccakZkEvm(comp *wizard.CompiledIOP, settings Settings, providers []gen // create the list of [generic.GenDataModule] and [generic.GenInfoModule] var ( - gdm []generic.GenDataModule - gim []generic.GenInfoModule + gdm = make([]generic.GenDataModule, 0, len(providers)) + gim = make([]generic.GenInfoModule, 0, len(providers)) ) for i := range providers { diff --git a/prover/zkevm/prover/hash/keccak/keccakf/lookups_test.go b/prover/zkevm/prover/hash/keccak/keccakf/lookups_test.go index 7ddb2f37..677bc5d5 100644 --- a/prover/zkevm/prover/hash/keccak/keccakf/lookups_test.go +++ b/prover/zkevm/prover/hash/keccak/keccakf/lookups_test.go @@ -17,7 +17,7 @@ func TestLookupsBaseAToBaseB(t *testing.T) { for i := 0; i < BaseAPow4; i++ { // baseADirty is equal to i dirtyA := baseADirty.Get(i) - assert.Equal(t, i, dirtyA.Uint64(), baseADirty, "base A dirty") + assert.Equal(t, uint64(i), dirtyA.Uint64(), "base A dirty") // cleanB is consistent with the declaration that dirty cleanB := baseBClean.Get(i) @@ -36,7 +36,7 @@ func TestLookupsBaseBToBaseA(t *testing.T) { for i := 0; i < BaseBPow4; i++ { // baseBDirty is equal to i dirtyB := baseBDirty.Get(i) - assert.Equal(t, i, dirtyB.Uint64(), "base B dirty") + assert.Equal(t, uint64(i), dirtyB.Uint64(), "base B dirty") // cleanA is consistent with the declaration that dirty cleanA := baseAClean.Get(i)