Skip to content

Commit

Permalink
Merge branch 'main' into legacy-gas-price-change
Browse files Browse the repository at this point in the history
  • Loading branch information
Filter94 authored Sep 13, 2024
2 parents 2bfbdb8 + 3a0572a commit c79b60d
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/reuse-run-e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets._GITHUB_TOKEN_RELEASE_ACCESS }}
outputs:
tests_outcome: ${{ steps.run_e2e_tests.outcome }}
runs-on: ubuntu-22.04-16core
runs-on: ubuntu-22.04
steps:
- name: Setup upterm session
if: ${{ inputs.e2e-tests-with-ssh }}
Expand Down
48 changes: 30 additions & 18 deletions prover/circuits/pi-interconnection/circuit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ package pi_interconnection_test
import (
"errors"
"fmt"
"github.com/consensys/zkevm-monorepo/prover/config"
"github.com/leanovate/gopter"
"github.com/leanovate/gopter/gen"
"github.com/leanovate/gopter/prop"
"testing"

"github.com/consensys/gnark-crypto/ecc"
Expand All @@ -14,9 +18,7 @@ import (
"github.com/consensys/zkevm-monorepo/prover/circuits/internal"
pi_interconnection "github.com/consensys/zkevm-monorepo/prover/circuits/pi-interconnection"
"github.com/consensys/zkevm-monorepo/prover/circuits/pi-interconnection/keccak"
"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/stretchr/testify/assert"
"golang.org/x/crypto/sha3"
)
Expand Down Expand Up @@ -103,22 +105,32 @@ func (c *testMerkleCircuit) Define(api frontend.API) error {
}

func TestMaxNbCircuitsSum(t *testing.T) {
cfg := config.PublicInput{
MaxNbDecompression: test_utils.RandIntN(10),
MaxNbExecution: test_utils.RandIntN(10),
MaxNbCircuits: 20,
MaxNbKeccakF: 200,
ExecutionMaxNbMsg: 2,
L2MsgMerkleDepth: 5,
L2MsgMaxNbMerkle: 2,
MockKeccakWizard: true,
}

c, err := pi_interconnection.Compile(cfg)
assert.NoError(t, err)
parameters := gopter.DefaultTestParameters()
parameters.MinSuccessfulTests = 5
parameters.Rng.Seed(0x123456789abcdef0)

properties := gopter.NewProperties(parameters)

properties.Property("provides the correct number of public inputs", prop.ForAll(
func(maxNbDecompression, maxNbExecution int) bool {
cfg := config.PublicInput{
MaxNbDecompression: maxNbDecompression,
MaxNbExecution: maxNbExecution,
MaxNbCircuits: 20,
MaxNbKeccakF: 200,
ExecutionMaxNbMsg: 2,
L2MsgMerkleDepth: 5,
L2MsgMaxNbMerkle: 2,
MockKeccakWizard: true,
}

cs, err := frontend.Compile(ecc.BLS12_377.ScalarField(), scs.NewBuilder, c.Circuit)
assert.NoError(t, err)
c, err := pi_interconnection.Compile(cfg)
assert.NoError(t, err)
cs, err := frontend.Compile(ecc.BLS12_377.ScalarField(), scs.NewBuilder, c.Circuit)
assert.NoError(t, err)
return cfg.MaxNbDecompression+cfg.MaxNbExecution == pi_interconnection.GetMaxNbCircuitsSum(cs)
}, gen.IntRange(1, 10), gen.IntRange(1, 10),
))

assert.Equal(t, cfg.MaxNbDecompression+cfg.MaxNbExecution, pi_interconnection.GetMaxNbCircuitsSum(cs))
properties.TestingRun(t)
}

0 comments on commit c79b60d

Please sign in to comment.