Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

op-e2e: Retrieve AllocType from System instead of env #12221

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 3 additions & 16 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -908,9 +908,6 @@ jobs:

go-e2e-test:
parameters:
variant:
type: string
default: ''
module:
description: Go Module Name
type: string
Expand All @@ -935,13 +932,6 @@ jobs:
parallelism: <<parameters.parallelism>>
steps:
- checkout
- when:
condition:
equal: ['-mt-cannon', <<parameters.variant>>]
steps:
- run:
name: Set OP_E2E_ALLOC_TYPE = mt-cannon
command: echo 'export OP_E2E_ALLOC_TYPE=mt-cannon' >> $BASH_ENV
- check-changed:
patterns: op-(.+),cannon,contracts-bedrock
- run:
Expand Down Expand Up @@ -979,7 +969,7 @@ jobs:
# want it to.
export OP_E2E_CANNON_ENABLED="false"
# Note: We don't use circle CI test splits because we need to split by test name, not by package. There is an additional
# constraint that gotestsum does not currently (nor likely will) accept files from different pacakges when building.
# constraint that gotestsum does not currently (nor likely will) accept files from different packages when building.
JUNIT_FILE=/tmp/test-results/<<parameters.module>>_<<parameters.target>>.xml JSON_LOG_FILE=/testlogs/test.log make <<parameters.target>>
working_directory: <<parameters.module>>
- store_artifacts:
Expand Down Expand Up @@ -1685,13 +1675,10 @@ workflows:
context:
- slack
- go-e2e-test:
name: op-e2e-cannon-tests<< matrix.variant >>
matrix:
parameters:
variant: ["", "-mt-cannon"]
name: op-e2e-cannon-tests
module: op-e2e
target: test-cannon
parallelism: 4
parallelism: 8
notify: true
mentions: "@proofs-squad"
requires:
Expand Down
12 changes: 0 additions & 12 deletions op-e2e/config/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,15 +212,3 @@ func initAllocType(root string, allocType AllocType) {
dc.SetDeployments(l1Deployments)
deployConfigsByType[allocType] = dc
}

func AllocTypeFromEnv() AllocType {
allocType := os.Getenv("OP_E2E_ALLOC_TYPE")
if allocType == "" {
return DefaultAllocType
}
out := AllocType(allocType)
if err := out.Check(); err != nil {
panic(err)
}
return out
}
14 changes: 9 additions & 5 deletions op-e2e/e2eutils/challenger/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"time"

e2econfig "github.com/ethereum-optimism/optimism/op-e2e/config"

"github.com/ethereum-optimism/optimism/op-service/crypto"

"github.com/ethereum/go-ethereum/ethclient"
Expand All @@ -39,6 +38,11 @@ type EndpointProvider interface {
L1BeaconEndpoint() endpoint.RestHTTP
}

type System interface {
RollupCfg() *rollup.Config
L2Genesis() *core.Genesis
AllocType() e2econfig.AllocType
}
type Helper struct {
log log.Logger
t *testing.T
Expand Down Expand Up @@ -142,17 +146,17 @@ func applyCannonConfig(c *config.Config, t *testing.T, rollupCfg *rollup.Config,
c.Cannon.RollupConfigPath = rollupFile
}

func WithCannon(t *testing.T, rollupCfg *rollup.Config, l2Genesis *core.Genesis, allocType e2econfig.AllocType) Option {
func WithCannon(t *testing.T, system System) Option {
return func(c *config.Config) {
c.TraceTypes = append(c.TraceTypes, types.TraceTypeCannon)
applyCannonConfig(c, t, rollupCfg, l2Genesis, allocType)
applyCannonConfig(c, t, system.RollupCfg(), system.L2Genesis(), system.AllocType())
}
}

func WithPermissioned(t *testing.T, rollupCfg *rollup.Config, l2Genesis *core.Genesis, allocType e2econfig.AllocType) Option {
func WithPermissioned(t *testing.T, system System) Option {
return func(c *config.Config) {
c.TraceTypes = append(c.TraceTypes, types.TraceTypePermissioned)
applyCannonConfig(c, t, rollupCfg, l2Genesis, allocType)
applyCannonConfig(c, t, system.RollupCfg(), system.L2Genesis(), system.AllocType())
}
}

Expand Down
3 changes: 2 additions & 1 deletion op-e2e/e2eutils/disputegame/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ type DisputeSystem interface {
L1Deployments() *genesis.L1Deployments
RollupCfg() *rollup.Config
L2Genesis() *core.Genesis
AllocType() config.AllocType

AdvanceTime(time.Duration)
}
Expand Down Expand Up @@ -117,7 +118,7 @@ func NewFactoryHelper(t *testing.T, ctx context.Context, system DisputeSystem, o
chainID, err := client.ChainID(ctx)
require.NoError(err)

allocType := config.AllocTypeFromEnv()
allocType := system.AllocType()
require.True(allocType.UsesProofs(), "AllocType %v does not support proofs", allocType)

factoryCfg := &FactoryCfg{PrivKey: TestKey}
Expand Down
4 changes: 2 additions & 2 deletions op-e2e/e2eutils/disputegame/output_cannon_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ type OutputCannonGameHelper struct {

func (g *OutputCannonGameHelper) StartChallenger(ctx context.Context, name string, options ...challenger.Option) *challenger.Helper {
opts := []challenger.Option{
challenger.WithCannon(g.T, g.System.RollupCfg(), g.System.L2Genesis(), g.AllocType),
challenger.WithCannon(g.T, g.System),
challenger.WithFactoryAddress(g.FactoryAddr),
challenger.WithGameAddress(g.Addr),
}
Expand Down Expand Up @@ -331,7 +331,7 @@ func (g *OutputCannonGameHelper) createCannonTraceProvider(ctx context.Context,

func (g *OutputCannonGameHelper) defaultChallengerOptions() []challenger.Option {
return []challenger.Option{
challenger.WithCannon(g.T, g.System.RollupCfg(), g.System.L2Genesis(), g.AllocType),
challenger.WithCannon(g.T, g.System),
challenger.WithFactoryAddress(g.FactoryAddr),
challenger.WithGameAddress(g.Addr),
}
Expand Down
2 changes: 0 additions & 2 deletions op-e2e/e2eutils/disputegame/output_game_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ type OutputGameHelper struct {
Addr common.Address
CorrectOutputProvider *outputs.OutputTraceProvider
System DisputeSystem
AllocType config.AllocType
}

func NewOutputGameHelper(t *testing.T, require *require.Assertions, client *ethclient.Client, opts *bind.TransactOpts, privKey *ecdsa.PrivateKey,
Expand All @@ -58,7 +57,6 @@ func NewOutputGameHelper(t *testing.T, require *require.Assertions, client *ethc
Addr: addr,
CorrectOutputProvider: correctOutputProvider,
System: system,
AllocType: allocType,
}
}

Expand Down
12 changes: 10 additions & 2 deletions op-e2e/faultproofs/cannon_benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,20 @@ import (
"github.com/ethereum-optimism/optimism/op-service/testlog"
)

func TestBenchmarkCannon_FPP(t *testing.T) {
func TestBenchmarkCannonFPP_Standard(t *testing.T) {
testBenchmarkCannonFPP(t, config.AllocTypeStandard)
}

func TestBenchmarkCannonFPP_Multithreaded(t *testing.T) {
testBenchmarkCannonFPP(t, config.AllocTypeMTCannon)
}

func testBenchmarkCannonFPP(t *testing.T, allocType config.AllocType) {
t.Skip("TODO(client-pod#906): Compare total witness size for assertions against pages allocated by the VM")

op_e2e.InitParallel(t, op_e2e.UsesCannon)
ctx := context.Background()
cfg := e2esys.DefaultSystemConfig(t, e2esys.WithAllocType(config.AllocTypeFromEnv()))
cfg := e2esys.DefaultSystemConfig(t, e2esys.WithAllocType(allocType))
// We don't need a verifier - just the sequencer is enough
delete(cfg.Nodes, "verifier")
// Use a small sequencer window size to avoid test timeout while waiting for empty blocks
Expand Down
4 changes: 1 addition & 3 deletions op-e2e/faultproofs/multi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import (
"context"
"testing"

"github.com/ethereum-optimism/optimism/op-e2e/config"

op_e2e "github.com/ethereum-optimism/optimism/op-e2e"

"github.com/ethereum-optimism/optimism/op-e2e/e2eutils/challenger"
Expand All @@ -29,7 +27,7 @@ func TestMultipleGameTypes(t *testing.T) {

// Start a challenger with both cannon and alphabet support
gameFactory.StartChallenger(ctx, "TowerDefense",
challenger.WithCannon(t, sys.RollupConfig, sys.L2GenesisCfg, config.AllocTypeFromEnv()),
challenger.WithCannon(t, sys),
challenger.WithAlphabet(),
challenger.WithPrivKey(sys.Cfg.Secrets.Alice),
)
Expand Down
Loading