Skip to content

Commit

Permalink
bench some benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
Tabaie committed Sep 26, 2024
1 parent 9c23552 commit 6765b24
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 0 deletions.
Binary file not shown.
53 changes: 53 additions & 0 deletions prover/circuits/bench/constraints/aggregation/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package main

import (
"context"

"github.com/consensys/gnark-crypto/ecc"
"github.com/consensys/gnark/backend/plonk"
"github.com/consensys/gnark/frontend"
"github.com/consensys/gnark/frontend/cs/scs"
"github.com/consensys/gnark/profile"
"github.com/consensys/zkevm-monorepo/prover/circuits"
"github.com/consensys/zkevm-monorepo/prover/circuits/aggregation"
"github.com/consensys/zkevm-monorepo/prover/circuits/dummy"
pi_interconnection "github.com/consensys/zkevm-monorepo/prover/circuits/pi-interconnection"
"github.com/consensys/zkevm-monorepo/prover/utils/test_utils"
"github.com/stretchr/testify/assert"
)

func main() {

const nbCircuits = 400

piCircuit := pi_interconnection.DummyCircuit{
ExecutionPublicInput: make([]frontend.Variable, nbCircuits),
DecompressionPublicInput: make([]frontend.Variable, nbCircuits),
DecompressionFPI: make([]frontend.Variable, nbCircuits),
ExecutionFPI: make([]frontend.Variable, nbCircuits),
}

var t test_utils.FakeTestingT

innerField := ecc.BLS12_377.ScalarField()
piCs, err := frontend.Compile(innerField, scs.NewBuilder, &piCircuit)
assert.NoError(t, err)

srsProvider := circuits.NewUnsafeSRSProvider()

piSetup, err := circuits.MakeSetup(context.TODO(), "public-input-interconnection", piCs, srsProvider, nil)
assert.NoError(t, err)

// Having more than 2 types of inner circuit to reflect various versions
innerVks := make([]plonk.VerifyingKey, 10)
for i := range innerVks {
setup, err := dummy.MakeUnsafeSetup(srsProvider, 0, innerField)
assert.NoError(t, err)
innerVks[i] = setup.VerifyingKey
}

p := profile.Start(profile.WithPath("aggregation.pprof"))
defer p.Stop()
_, err = aggregation.MakeCS(nbCircuits, piSetup, innerVks)
assert.NoError(t, err)
}
Binary file not shown.
Binary file added prover/circuits/bench/constraints/execution.pdf
Binary file not shown.
32 changes: 32 additions & 0 deletions prover/circuits/bench/constraints/execution/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package main

Check failure on line 1 in prover/circuits/bench/constraints/execution/main.go

View workflow job for this annotation

GitHub Actions / testing / prover / Prover static check

: # github.com/consensys/zkevm-monorepo/prover/circuits/bench/constraints/execution

import (
"path/filepath"

"github.com/consensys/zkevm-monorepo/prover/circuits/execution"
"github.com/consensys/zkevm-monorepo/prover/config"
"github.com/consensys/zkevm-monorepo/prover/utils"
"github.com/consensys/zkevm-monorepo/prover/utils/test_utils"
"github.com/consensys/zkevm-monorepo/prover/zkevm"
"github.com/spf13/viper"
"github.com/stretchr/testify/assert"
)

func main() {
var t test_utils.FakeTestingT
root, err := utils.GetRepoRootPath()
assert.NoError(t, err)
root = filepath.Join(root, "prover")

viper.Set("assets_dir", filepath.Join(root, "prover-assets"))
// TODO Make sure this is the correct config file
cfg, err := config.NewConfigFromFile(filepath.Join(root, "config", "config-integration-full.toml"))
assert.NoError(t, err)

//extraFlags["cfg_checksum"] = limits.Checksum()
// The builder itself will create a profile called "profiling-execution.pprof"
_, err = execution.NewBuilder(
zkevm.FullZkEvm(&cfg.TracesLimits), // or TracesLimitsLarge?
).Compile()
assert.NoError(t, err)
}

0 comments on commit 6765b24

Please sign in to comment.