From 259f6781064b55fe336367276c190e5fba4be213 Mon Sep 17 00:00:00 2001 From: Anton Evangelatov Date: Wed, 18 Nov 2026 10:25:52 +0100 Subject: [PATCH 1/4] op-devstack, op-acceptance-tests: skip presets that start no kona-node in the kona acceptance job The supernode runtimes and the interop runtimes without a supernode start only op-node and op-supernode CLs, whatever DEVSTACK_L2CL_KIND says. Under kona-node their tests repeated the op-node acceptance job exactly: 158 of 289 top-level tests and about 10,200 of 15,400 test-seconds of the kona job on develop. Their sysgo constructors now skip the test under kona-node before starting anything. Tests that start both CLs explicitly still run in both jobs, and SkipOnKonaNode stays the list of real kona-node gaps. Co-Authored-By: Claude Opus 5.5 --- docs/ai/acceptance-tests.md | 11 ++- op-devstack/README.md | 2 +- op-devstack/sysgo/mixed_runtime.go | 12 +++ op-devstack/sysgo/mixed_runtime_test.go | 86 +++++++++++++++++++ .../sysgo/multichain_supernode_runtime.go | 2 + op-devstack/sysgo/singlechain_build.go | 4 +- op-devstack/sysgo/singlechain_interop.go | 3 + ...inglechain_supernode_synctester_variant.go | 1 + 8 files changed, 116 insertions(+), 5 deletions(-) diff --git a/docs/ai/acceptance-tests.md b/docs/ai/acceptance-tests.md index c80f1b66320..09bc47e2b49 100644 --- a/docs/ai/acceptance-tests.md +++ b/docs/ai/acceptance-tests.md @@ -50,9 +50,14 @@ CI runs two variants of the `op-acceptance-tests` job: `memory-all-opn-op-reth-< (op-node + op-reth) and `memory-all-kona-op-reth-` (kona-node + op-reth). A test that cannot run under kona-node skips itself in code with `sysgo.SkipOnKonaNode` rather -than being left out of a list. Skip only for a real client gap. A test that pins the CL kind of -every node itself runs the same way in both CL variants; let it run twice rather than skipping -one variant to save CI time. +than being left out of a list. Skip only for a real client gap. + +The supernode runtimes and the interop runtimes without a supernode start only op-node and +op-supernode CLs, whatever `DEVSTACK_L2CL_KIND` says, so under kona-node they would repeat the +op-node job. Their sysgo constructors skip the test under kona-node before starting anything +(`skipOpNodeOnlyRuntimeOnKonaNode`), so a new test on those presets needs no handling of its own. +A test that starts both CLs itself, through `sysgo.NewMixedSingleChainRuntime` with explicit CL +kinds, still runs in both jobs. ### Kona Prestate diff --git a/op-devstack/README.md b/op-devstack/README.md index 855d41befad..db3ac372b8e 100644 --- a/op-devstack/README.md +++ b/op-devstack/README.md @@ -112,7 +112,7 @@ and returns a typed output that the test then may use. - `DEVSTACK_MONOREPO_ROOT`: Absolute path to a monorepo checkout. Used by out-of-tree acceptance suites (which depend on this module by git rev) so contract-artifact resolution can find `packages/contracts-bedrock` outside the cwd-relative walk. In-tree runs don't need it. ### Rust stack env vars: -- `DEVSTACK_L2CL_KIND=kona-node` to select kona-node as default L2 CL node. Any value other than `op-node` or `kona-node` fails the test before a node starts. Some presets pin nodes to op-node whatever the variable says, such as the sequencer of a chain with interop at genesis, and the sequencer and deriving verifier of the two-verifiers preset. +- `DEVSTACK_L2CL_KIND=kona-node` to select kona-node as default L2 CL node. Any value other than `op-node` or `kona-node` fails the test before a node starts. Some presets pin nodes to op-node whatever the variable says, such as the sequencer of a chain with interop at genesis, and the sequencer and deriving verifier of the two-verifiers preset. The supernode and interop runtimes start only op-node and op-supernode CLs, so under kona-node they skip the test - `RUST_BINARY_PATH_KONA_NODE=/home/USERHERE/projects/kona/target/debug/kona-node` to select the kona-node executable to run (skips the build; the path must exist) - `RUST_BINARY_PATH_OP_RETH=/home/USERHERE/projects/reth/target/release/op-reth` to select the op-reth executable to run (skips the build; the path must exist) diff --git a/op-devstack/sysgo/mixed_runtime.go b/op-devstack/sysgo/mixed_runtime.go index 08bc3aba0d6..8c133eee67c 100644 --- a/op-devstack/sysgo/mixed_runtime.go +++ b/op-devstack/sysgo/mixed_runtime.go @@ -62,6 +62,18 @@ func FlakyOnKonaNode(t devtest.T, reason string) { } } +// skipOpNodeOnlyRuntimeOnKonaNode skips the test under DEVSTACK_L2CL_KIND=kona-node. Call it first +// in a runtime constructor that starts only op-node and op-supernode CLs whatever the variable +// says: under kona-node such a run repeats the op-node run exactly. It is separate from +// SkipOnKonaNode so that list names only real kona-node gaps. Remove the call once the runtime +// starts the CL kind the variable selects, as kona-node or lokahi support for supernode and +// interop topologies would. +func skipOpNodeOnlyRuntimeOnKonaNode(t devtest.T) { + if devstackL2CLKind() == MixedL2CLKona { + t.Skip("skipping on kona-node: this runtime starts only op-node and op-supernode CLs whatever DEVSTACK_L2CL_KIND says") + } +} + // devstackL2CLKind returns the L2 CL kind requested via the DEVSTACK_L2CL_KIND // environment variable. Returns the empty string when the variable is unset, // meaning "use the runtime's default". diff --git a/op-devstack/sysgo/mixed_runtime_test.go b/op-devstack/sysgo/mixed_runtime_test.go index 5c97f9ca742..421cf70f768 100644 --- a/op-devstack/sysgo/mixed_runtime_test.go +++ b/op-devstack/sysgo/mixed_runtime_test.go @@ -83,6 +83,84 @@ func TestResolveMixedL2CLKind(t *testing.T) { } } +// startupProbeT stops a runtime constructor at a skip or at its first side effect, the temp dir +// it writes the JWT secret to, whichever comes first, so a test can tell which came first +// without starting a system. +type startupProbeT struct { + devtest.T +} + +type startupProbeOutcome string + +const ( + probeSkipped startupProbeOutcome = "skipped" + probeStarted startupProbeOutcome = "started" +) + +func (*startupProbeT) Skip(...any) { panic(probeSkipped) } +func (*startupProbeT) Skipf(string, ...any) { panic(probeSkipped) } +func (*startupProbeT) SkipNow() { panic(probeSkipped) } +func (*startupProbeT) TempDir() string { panic(probeStarted) } +func (*startupProbeT) TempDirWithPrefix(string) string { panic(probeStarted) } + +func TestOpNodeOnlyRuntimesSkipOnKonaNodeBeforeStarting(t *testing.T) { + runtimes := []struct { + name string + newRuntime func(devtest.T) + }{ + {name: "TwoL2Supernode", newRuntime: func(t devtest.T) { NewTwoL2SupernodeRuntimeWithConfig(t, PresetConfig{}) }}, + {name: "TwoL2SupernodeInterop", newRuntime: func(t devtest.T) { + NewTwoL2SupernodeInteropRuntimeWithConfig(t, 0, PresetConfig{}) + }}, + {name: "TwoL2SupernodeLightSequencerInterop", newRuntime: func(t devtest.T) { + NewTwoL2SupernodeLightSequencerInteropRuntimeWithConfig(t, 0, PresetConfig{}) + }}, + {name: "TwoL2SupernodeFollowL2", newRuntime: func(t devtest.T) { + NewTwoL2SupernodeFollowL2RuntimeWithConfig(t, 0, PresetConfig{}) + }}, + {name: "TwoL2SupernodeProofs", newRuntime: func(t devtest.T) { + NewTwoL2SupernodeProofsRuntimeWithConfig(t, true, PresetConfig{}) + }}, + {name: "ThreeL2SupernodeProofs", newRuntime: func(t devtest.T) { + NewThreeL2SupernodeProofsRuntimeWithConfig(t, true, PresetConfig{}) + }}, + {name: "SingleChainSupernodeProofs", newRuntime: func(t devtest.T) { + NewSingleChainSupernodeProofsRuntimeWithConfig(t, true, PresetConfig{}) + }}, + {name: "SingleChainSuperRootAtGenesis", newRuntime: func(t devtest.T) { + NewSingleChainSuperRootAtGenesisRuntimeWithConfig(t, PresetConfig{}) + }}, + {name: "SingleSupernodeWithSyncTester", newRuntime: func(t devtest.T) { + NewSingleSupernodeWithSyncTesterRuntimeWithConfig(t, PresetConfig{}) + }}, + {name: "MinimalInteropNoSupernode", newRuntime: func(t devtest.T) { NewMinimalInteropNoSupernodeRuntime(t) }}, + {name: "SingleChainInteropNoSupernodeSuperRoot", newRuntime: func(t devtest.T) { + NewSingleChainInteropNoSupernodeSuperRootRuntimeWithConfig(t, PresetConfig{}) + }}, + {name: "SingleChainInteropNoSupernodeZKDispute", newRuntime: func(t devtest.T) { + NewSingleChainInteropNoSupernodeZKDisputeRuntimeWithConfig(t, PresetConfig{}) + }}, + } + for _, rt := range runtimes { + t.Run(rt.name, func(t *testing.T) { + for _, tc := range []struct { + name string + kind MixedL2CLKind + want startupProbeOutcome + }{ + {name: "empty", kind: "", want: probeStarted}, + {name: "op-node", kind: MixedL2CLOpNode, want: probeStarted}, + {name: "kona-node", kind: MixedL2CLKona, want: probeSkipped}, + } { + t.Run(tc.name, func(t *testing.T) { + t.Setenv("DEVSTACK_L2CL_KIND", string(tc.kind)) + require.PanicsWithValue(t, tc.want, func() { rt.newRuntime(&startupProbeT{T: devtest.SerialT(t)}) }) + }) + } + }) + } +} + // An unknown kind fails at resolution, before any preset starts a node of that kind. func TestResolveMixedL2CLKindRejectsUnknownKind(t *testing.T) { for _, kind := range []string{"kona", "Kona-Node", "op-geth"} { @@ -94,3 +172,11 @@ func TestResolveMixedL2CLKindRejectsUnknownKind(t *testing.T) { }) } } + +// A runtime that starts the CL kind DEVSTACK_L2CL_KIND selects must still run in the kona-node job. +func TestKonaCapableRuntimeStartsOnKonaNode(t *testing.T) { + t.Setenv("DEVSTACK_L2CL_KIND", string(MixedL2CLKona)) + require.PanicsWithValue(t, probeStarted, func() { + NewMinimalRuntimeWithConfig(&startupProbeT{T: devtest.SerialT(t)}, PresetConfig{}) + }) +} diff --git a/op-devstack/sysgo/multichain_supernode_runtime.go b/op-devstack/sysgo/multichain_supernode_runtime.go index bb54a37350b..853fe4b509a 100644 --- a/op-devstack/sysgo/multichain_supernode_runtime.go +++ b/op-devstack/sysgo/multichain_supernode_runtime.go @@ -121,6 +121,7 @@ func startSupernodeEL(t devtest.T, l2Net *L2Network, jwtPath string, jwtSecret [ } func newSingleChainSupernodeRuntimeWithConfig(t devtest.T, lagoonAtGenesis bool, cfg PresetConfig) *MultiChainRuntime { + skipOpNodeOnlyRuntimeOnKonaNode(t) require := t.Require() keys, err := devkeys.NewMnemonicDevKeys(devkeys.TestMnemonic) @@ -225,6 +226,7 @@ func newMultiL2SupernodeRuntimeWithConfigAndSequencerMode( supernodeSequencerEnabled bool, chainSpecs []runtimeChainSpec, ) (*MultiChainRuntime, uint64) { + skipOpNodeOnlyRuntimeOnKonaNode(t) require := t.Require() require.NotEmpty(chainSpecs, "multi-chain runtime needs at least one L2 chain") diff --git a/op-devstack/sysgo/singlechain_build.go b/op-devstack/sysgo/singlechain_build.go index 68ba9535293..85f7446cfad 100644 --- a/op-devstack/sysgo/singlechain_build.go +++ b/op-devstack/sysgo/singlechain_build.go @@ -91,7 +91,9 @@ func applyConfigPrefundedL2(t devtest.T, keys devkeys.Keys, l1ChainID, l2ChainID l1Config.WithPrefundedAccount(addrFor(devkeys.SystemConfigOwner), *millionEth) } -// startL2CLForKey starts an L2 CL node of the given kind for the given key. +// startL2CLForKey starts an L2 CL node of the given kind for the given key. A runtime that calls +// skipOpNodeOnlyRuntimeOnKonaNode must drop that call when it starts a CL through here, or the +// kona-node run keeps skipping its tests. func startL2CLForKey( t devtest.T, keys devkeys.Keys, diff --git a/op-devstack/sysgo/singlechain_interop.go b/op-devstack/sysgo/singlechain_interop.go index 80ba236837d..02251e1e8e7 100644 --- a/op-devstack/sysgo/singlechain_interop.go +++ b/op-devstack/sysgo/singlechain_interop.go @@ -54,6 +54,7 @@ func startSingleChainInteropPrimaryNoSupernode( // NewMinimalInteropNoSupernodeRuntime constructs the single-chain interop world // without supernode wiring. func NewMinimalInteropNoSupernodeRuntime(t devtest.T) *SingleChainRuntime { + skipOpNodeOnlyRuntimeOnKonaNode(t) return newSingleChainRuntimeWithConfig(t, PresetConfig{}, singleChainRuntimeSpec{ BuildWorld: newSingleChainInteropWorldNoSupernode, SequencerCLKind: MixedL2CLOpNode, @@ -70,6 +71,7 @@ func NewMinimalInteropNoSupernodeRuntime(t devtest.T) *SingleChainRuntime { // games sourcing super roots directly from the op-node's superroot_atTimestamp endpoint. // The primary op-node enables its safe DB (required by superroot_atTimestamp). func NewSingleChainInteropNoSupernodeSuperRootRuntimeWithConfig(t devtest.T, cfg PresetConfig) *SingleChainRuntime { + skipOpNodeOnlyRuntimeOnKonaNode(t) cfg = withSuperRootGamesAtGenesisDeployerFeatures(cfg) cfg.AddedGameTypes = append(cfg.AddedGameTypes, gameTypes.SuperCannonKonaGameType) return newSingleChainRuntimeWithConfig(t, cfg, singleChainRuntimeSpec{ @@ -88,6 +90,7 @@ func NewSingleChainInteropNoSupernodeSuperRootRuntimeWithConfig(t devtest.T, cfg // roots directly from the op-node's superroot_atTimestamp endpoint. The primary op-node enables // its safe DB (required by superroot_atTimestamp). func NewSingleChainInteropNoSupernodeZKDisputeRuntimeWithConfig(t devtest.T, cfg PresetConfig) *SingleChainRuntime { + skipOpNodeOnlyRuntimeOnKonaNode(t) cfg = withSuperRootGamesAtGenesisDeployerFeatures(cfg) // ZK games resolve only after the challenge/prove windows elapse, so time travel is required. cfg.EnableTimeTravel = true diff --git a/op-devstack/sysgo/singlechain_supernode_synctester_variant.go b/op-devstack/sysgo/singlechain_supernode_synctester_variant.go index 009e11fbc41..b13cf8a8bc5 100644 --- a/op-devstack/sysgo/singlechain_supernode_synctester_variant.go +++ b/op-devstack/sysgo/singlechain_supernode_synctester_variant.go @@ -21,6 +21,7 @@ func NewSingleSupernodeWithSyncTesterRuntime(t devtest.T) *MultiChainRuntime { } func NewSingleSupernodeWithSyncTesterRuntimeWithConfig(t devtest.T, cfg PresetConfig) *MultiChainRuntime { + skipOpNodeOnlyRuntimeOnKonaNode(t) require := t.Require() keys, err := devkeys.NewMnemonicDevKeys(devkeys.TestMnemonic) From 178a8b5de62e2c747ec37b1bcd43f2dc5992a5e0 Mon Sep 17 00:00:00 2001 From: Anton Evangelatov Date: Wed, 18 Nov 2026 10:25:56 +0100 Subject: [PATCH 2/4] ci: run the kona memory-all job on 2 nodes With the presets that start no kona-node skipped under kona-node, the kona job has about 5,100 test-seconds left, a third of before. Its wall time is bounded by its longest test, about 400 s, so 2 nodes running 16 tests at once finish no later than 4 did. The scheduled shipped-binaries copy of the job inherits the change. Co-Authored-By: Claude Opus 5.5 --- .circleci/continue/main.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.circleci/continue/main.yml b/.circleci/continue/main.yml index 3504e771de9..e86cb40568a 100644 --- a/.circleci/continue/main.yml +++ b/.circleci/continue/main.yml @@ -2901,6 +2901,9 @@ workflows: # for the gitignored superchain-configs.zip op-acceptance-tests //go:embeds - prep-superchain # IN-MEMORY - kona/op-reth + # 2 nodes, not 4: tests whose runtime starts no kona-node skip here (sysgo's + # skipOpNodeOnlyRuntimeOnKonaNode), leaving about a third of the test time. The longest + # test, TestExecuteStep_CannonKona at about 400 s, still bounds the wall time. - op-acceptance-tests: &memory_all_kona name: memory-all-kona-op-reth-<> image: <> @@ -2908,7 +2911,7 @@ workflows: parameters: l1_fork: *acceptance_l1_forks l2_cl_kind: kona-node - parallelism: 4 + parallelism: 2 acceptance_test_jobs: "16" no_output_timeout: 120m context: From da02c2c9204d5b0ccbcddb1e1ed1cea90a7f6049 Mon Sep 17 00:00:00 2001 From: Anton Evangelatov Date: Wed, 18 Nov 2026 16:56:55 +0100 Subject: [PATCH 3/4] op-devstack: skip op-node-only presets on kona-node in the presets Move the kona-node skip from six sysgo runtime constructors to the first line of the 14 preset constructors whose runtimes start only op-node and op-supernode CLs (NewSimpleInterop, NewTwoL2SupernodeInterop, NewSingleChainInteropNoSupernode and the rest). A reader of a preset now sees that its tests don't run in the kona-node job. Nothing outside op-devstack/presets calls those runtimes, so the same tests skip. The test lists both sides: the 14 presets must skip under kona-node, and the 11 presets that start the selected CL must not. A probe T stops each preset at its first temp dir, so neither case starts a system. Co-Authored-By: Claude Opus 5.5 --- .circleci/continue/main.yml | 4 +- docs/ai/acceptance-tests.md | 11 +- op-devstack/README.md | 2 +- op-devstack/presets/interop.go | 9 ++ op-devstack/presets/op_node_only.go | 17 +++ op-devstack/presets/op_node_only_test.go | 101 ++++++++++++++++++ .../singlechain_supernode_with_synctester.go | 1 + op-devstack/presets/twol2.go | 3 + op-devstack/presets/twol2_follow_l2.go | 1 + op-devstack/sysgo/mixed_runtime.go | 12 --- op-devstack/sysgo/mixed_runtime_test.go | 86 --------------- .../sysgo/multichain_supernode_runtime.go | 2 - op-devstack/sysgo/singlechain_build.go | 7 +- op-devstack/sysgo/singlechain_interop.go | 3 - ...inglechain_supernode_synctester_variant.go | 1 - 15 files changed, 145 insertions(+), 115 deletions(-) create mode 100644 op-devstack/presets/op_node_only.go create mode 100644 op-devstack/presets/op_node_only_test.go diff --git a/.circleci/continue/main.yml b/.circleci/continue/main.yml index e86cb40568a..40096ab4ba4 100644 --- a/.circleci/continue/main.yml +++ b/.circleci/continue/main.yml @@ -2901,8 +2901,8 @@ workflows: # for the gitignored superchain-configs.zip op-acceptance-tests //go:embeds - prep-superchain # IN-MEMORY - kona/op-reth - # 2 nodes, not 4: tests whose runtime starts no kona-node skip here (sysgo's - # skipOpNodeOnlyRuntimeOnKonaNode), leaving about a third of the test time. The longest + # 2 nodes, not 4: tests on presets that start no kona-node skip here (op-devstack presets' + # skipOpNodeOnlyPresetOnKonaNode), leaving about a third of the test time. The longest # test, TestExecuteStep_CannonKona at about 400 s, still bounds the wall time. - op-acceptance-tests: &memory_all_kona name: memory-all-kona-op-reth-<> diff --git a/docs/ai/acceptance-tests.md b/docs/ai/acceptance-tests.md index 09bc47e2b49..90c93f9c499 100644 --- a/docs/ai/acceptance-tests.md +++ b/docs/ai/acceptance-tests.md @@ -52,12 +52,13 @@ CI runs two variants of the `op-acceptance-tests` job: `memory-all-opn-op-reth-< A test that cannot run under kona-node skips itself in code with `sysgo.SkipOnKonaNode` rather than being left out of a list. Skip only for a real client gap. -The supernode runtimes and the interop runtimes without a supernode start only op-node and +The supernode presets (`NewSimpleInterop`, `NewTwoL2SupernodeInterop`, ...) and the interop +presets without a supernode (`NewSingleChainInteropNoSupernode`, ...) start only op-node and op-supernode CLs, whatever `DEVSTACK_L2CL_KIND` says, so under kona-node they would repeat the -op-node job. Their sysgo constructors skip the test under kona-node before starting anything -(`skipOpNodeOnlyRuntimeOnKonaNode`), so a new test on those presets needs no handling of its own. -A test that starts both CLs itself, through `sysgo.NewMixedSingleChainRuntime` with explicit CL -kinds, still runs in both jobs. +op-node job. Each of them calls `skipOpNodeOnlyPresetOnKonaNode` first, which skips the test +under kona-node before anything starts, so a new test on those presets needs no handling of its +own. A test that starts both CLs itself, through `sysgo.NewMixedSingleChainRuntime` with +explicit CL kinds, still runs in both jobs. ### Kona Prestate diff --git a/op-devstack/README.md b/op-devstack/README.md index db3ac372b8e..4813e0712c8 100644 --- a/op-devstack/README.md +++ b/op-devstack/README.md @@ -112,7 +112,7 @@ and returns a typed output that the test then may use. - `DEVSTACK_MONOREPO_ROOT`: Absolute path to a monorepo checkout. Used by out-of-tree acceptance suites (which depend on this module by git rev) so contract-artifact resolution can find `packages/contracts-bedrock` outside the cwd-relative walk. In-tree runs don't need it. ### Rust stack env vars: -- `DEVSTACK_L2CL_KIND=kona-node` to select kona-node as default L2 CL node. Any value other than `op-node` or `kona-node` fails the test before a node starts. Some presets pin nodes to op-node whatever the variable says, such as the sequencer of a chain with interop at genesis, and the sequencer and deriving verifier of the two-verifiers preset. The supernode and interop runtimes start only op-node and op-supernode CLs, so under kona-node they skip the test +- `DEVSTACK_L2CL_KIND=kona-node` to select kona-node as default L2 CL node. Any value other than `op-node` or `kona-node` fails the test before a node starts. Some presets pin nodes to op-node whatever the variable says, such as the sequencer of a chain with interop at genesis, and the sequencer and deriving verifier of the two-verifiers preset. The supernode and interop presets start only op-node and op-supernode CLs, so under kona-node they skip the test - `RUST_BINARY_PATH_KONA_NODE=/home/USERHERE/projects/kona/target/debug/kona-node` to select the kona-node executable to run (skips the build; the path must exist) - `RUST_BINARY_PATH_OP_RETH=/home/USERHERE/projects/reth/target/release/op-reth` to select the op-reth executable to run (skips the build; the path must exist) diff --git a/op-devstack/presets/interop.go b/op-devstack/presets/interop.go index 44b507ca514..59a876b8fc2 100644 --- a/op-devstack/presets/interop.go +++ b/op-devstack/presets/interop.go @@ -139,12 +139,14 @@ func (s *SingleChainInterop) StandardBridge(l2Chain *dsl.L2Network) *dsl.Standar // NewSimpleInterop creates a fresh SimpleInterop target for the current // test using the super-root proofs system backed by op-supernode. func NewSimpleInterop(t devtest.T, opts ...Option) *SimpleInterop { + skipOpNodeOnlyPresetOnKonaNode(t) presetCfg, _ := collectSupportedPresetConfig(t, "NewSimpleInterop", opts, twoL2SupernodeProofsPresetSupportedOptionKinds) return simpleInteropFromSupernodeProofsRuntime(t, sysgo.NewTwoL2SupernodeProofsRuntimeWithConfig(t, true, presetCfg)) } // NewThreeChainInterop creates a three-chain supernode proofs system. func NewThreeChainInterop(t devtest.T, opts ...Option) *ThreeChainInterop { + skipOpNodeOnlyPresetOnKonaNode(t) presetCfg, _ := collectSupportedPresetConfig(t, "NewThreeChainInterop", opts, twoL2SupernodeProofsPresetSupportedOptionKinds) return threeChainInteropFromSupernodeProofsRuntime(t, sysgo.NewThreeL2SupernodeProofsRuntimeWithConfig(t, true, presetCfg)) } @@ -152,6 +154,7 @@ func NewThreeChainInterop(t devtest.T, opts ...Option) *ThreeChainInterop { // NewSingleChainInterop creates a fresh SingleChainInterop target for the // current test using the single-chain super-root proofs system backed by op-supernode. func NewSingleChainInterop(t devtest.T, opts ...Option) *SingleChainInterop { + skipOpNodeOnlyPresetOnKonaNode(t) presetCfg, _ := collectSupportedPresetConfig(t, "NewSingleChainInterop", opts, supernodeProofsPresetSupportedOptionKinds) return singleChainInteropFromSupernodeProofsRuntime(t, sysgo.NewSingleChainSupernodeProofsRuntimeWithConfig(t, true, presetCfg)) } @@ -159,6 +162,7 @@ func NewSingleChainInterop(t devtest.T, opts ...Option) *SingleChainInterop { // NewSimpleInteropIsthmusSuper creates a fresh SimpleInterop target for the current test // using the Isthmus super-root system backed by op-supernode. func NewSimpleInteropIsthmusSuper(t devtest.T, opts ...Option) *SimpleInterop { + skipOpNodeOnlyPresetOnKonaNode(t) presetCfg, _ := collectSupportedPresetConfig(t, "NewSimpleInteropIsthmusSuper", opts, twoL2SupernodeProofsPresetSupportedOptionKinds) return simpleInteropFromSupernodeProofsRuntime(t, sysgo.NewTwoL2SupernodeProofsRuntimeWithConfig(t, false, presetCfg)) } @@ -166,6 +170,7 @@ func NewSimpleInteropIsthmusSuper(t devtest.T, opts ...Option) *SimpleInterop { // NewSingleChainInteropIsthmusSuper creates a fresh SingleChainInterop target for the // current test using the single-chain Isthmus super-root system backed by op-supernode. func NewSingleChainInteropIsthmusSuper(t devtest.T, opts ...Option) *SingleChainInterop { + skipOpNodeOnlyPresetOnKonaNode(t) presetCfg, _ := collectSupportedPresetConfig(t, "NewSingleChainInteropIsthmusSuper", opts, supernodeProofsPresetSupportedOptionKinds) return singleChainInteropFromSupernodeProofsRuntime(t, sysgo.NewSingleChainSupernodeProofsRuntimeWithConfig(t, false, presetCfg)) } @@ -175,6 +180,7 @@ func NewSingleChainInteropIsthmusSuper(t devtest.T, opts ...Option) *SingleChain // op-supernode). The op-challenger plays super-cannon-kona games against this op-node // source. This exercises the "op-node as super root RPC" path end-to-end. func NewSingleChainInteropNoSupernode(t devtest.T, opts ...Option) *SingleChainInterop { + skipOpNodeOnlyPresetOnKonaNode(t) presetCfg, _ := collectSupportedPresetConfig(t, "NewSingleChainInteropNoSupernode", opts, singleChainInteropNoSupernodePresetSupportedOptionKinds) return singleChainInteropNoSupernodeFromRuntime(t, sysgo.NewSingleChainInteropNoSupernodeSuperRootRuntimeWithConfig(t, presetCfg)) } @@ -184,6 +190,7 @@ func NewSingleChainInteropNoSupernode(t devtest.T, opts ...Option) *SingleChainI // running an op-challenger that plays ZK dispute games against that op-node source. This exercises // the "op-node as super root RPC" path for the ZK game end-to-end. func NewSingleChainInteropNoSupernodeZKDispute(t devtest.T, opts ...Option) *SingleChainInterop { + skipOpNodeOnlyPresetOnKonaNode(t) presetCfg, _ := collectSupportedPresetConfig(t, "NewSingleChainInteropNoSupernodeZKDispute", opts, 0) return singleChainInteropNoSupernodeFromRuntime(t, sysgo.NewSingleChainInteropNoSupernodeZKDisputeRuntimeWithConfig(t, presetCfg)) } @@ -194,6 +201,7 @@ func NewSingleChainInteropNoSupernodeZKDispute(t devtest.T, opts ...Option) *Sin // migration runs. This exercises the initial-deploy path for super-root // dispute games tracked by ethereum-optimism/optimism#18729. func NewSingleChainInteropSuperRootAtGenesis(t devtest.T, opts ...Option) *SingleChainInterop { + skipOpNodeOnlyPresetOnKonaNode(t) presetCfg, _ := collectSupportedPresetConfig(t, "NewSingleChainInteropSuperRootAtGenesis", opts, supernodeProofsPresetSupportedOptionKinds) return singleChainInteropFromSupernodeProofsRuntime(t, sysgo.NewSingleChainSuperRootAtGenesisRuntimeWithConfig(t, presetCfg)) } @@ -239,6 +247,7 @@ type MinimalInteropNoSupernode struct { // NewMinimalInteropNoSupernode creates a fresh MinimalInteropNoSupernode target for the // current test. func NewMinimalInteropNoSupernode(t devtest.T, opts ...Option) *MinimalInteropNoSupernode { + skipOpNodeOnlyPresetOnKonaNode(t) _, _ = collectSupportedPresetConfig(t, "NewMinimalInteropNoSupernode", opts, 0) return &MinimalInteropNoSupernode{ Minimal: *minimalFromRuntime(t, sysgo.NewMinimalInteropNoSupernodeRuntime(t)), diff --git a/op-devstack/presets/op_node_only.go b/op-devstack/presets/op_node_only.go new file mode 100644 index 00000000000..42c29157b90 --- /dev/null +++ b/op-devstack/presets/op_node_only.go @@ -0,0 +1,17 @@ +package presets + +import ( + "github.com/ethereum-optimism/optimism/op-devstack/devtest" + "github.com/ethereum-optimism/optimism/op-devstack/sysgo" +) + +// skipOpNodeOnlyPresetOnKonaNode skips the test under DEVSTACK_L2CL_KIND=kona-node. A preset calls +// it first when its runtime starts only op-node and op-supernode CLs whatever that variable says, +// as the supernode and interop presets do: under kona-node the test would repeat the op-node job. +// It is separate from sysgo.SkipOnKonaNode so that list names only real kona-node gaps. Remove +// the call from a preset once its runtime starts the CL kind the variable selects. +func skipOpNodeOnlyPresetOnKonaNode(t devtest.T) { + if sysgo.ResolveMixedL2CLKind(t) == sysgo.MixedL2CLKona { + t.Skip("skipping on kona-node: this preset starts only op-node and op-supernode CLs whatever DEVSTACK_L2CL_KIND says") + } +} diff --git a/op-devstack/presets/op_node_only_test.go b/op-devstack/presets/op_node_only_test.go new file mode 100644 index 00000000000..121481f50c2 --- /dev/null +++ b/op-devstack/presets/op_node_only_test.go @@ -0,0 +1,101 @@ +package presets + +import ( + "testing" + + "github.com/ethereum-optimism/optimism/op-devstack/devtest" + "github.com/ethereum-optimism/optimism/op-devstack/sysgo" + "github.com/stretchr/testify/require" +) + +type presetCase struct { + name string + newPreset func(devtest.T) +} + +// These presets start only op-node and op-supernode CLs, so under kona-node each must skip before +// it starts anything. +func TestOpNodeOnlyPresetsSkipOnKonaNode(t *testing.T) { + t.Setenv("DEVSTACK_L2CL_KIND", string(sysgo.MixedL2CLKona)) + for _, p := range []presetCase{ + {"NewSimpleInterop", func(t devtest.T) { NewSimpleInterop(t) }}, + {"NewSimpleInteropIsthmusSuper", func(t devtest.T) { NewSimpleInteropIsthmusSuper(t) }}, + {"NewThreeChainInterop", func(t devtest.T) { NewThreeChainInterop(t) }}, + {"NewSingleChainInterop", func(t devtest.T) { NewSingleChainInterop(t) }}, + {"NewSingleChainInteropIsthmusSuper", func(t devtest.T) { NewSingleChainInteropIsthmusSuper(t) }}, + {"NewSingleChainInteropSuperRootAtGenesis", func(t devtest.T) { NewSingleChainInteropSuperRootAtGenesis(t) }}, + {"NewSingleChainInteropNoSupernode", func(t devtest.T) { NewSingleChainInteropNoSupernode(t) }}, + {"NewSingleChainInteropNoSupernodeZKDispute", func(t devtest.T) { NewSingleChainInteropNoSupernodeZKDispute(t) }}, + {"NewMinimalInteropNoSupernode", func(t devtest.T) { NewMinimalInteropNoSupernode(t) }}, + {"NewTwoL2Supernode", func(t devtest.T) { NewTwoL2Supernode(t) }}, + {"NewTwoL2SupernodeInterop", func(t devtest.T) { NewTwoL2SupernodeInterop(t, 0) }}, + {"NewTwoL2SupernodeLightSequencerInterop", func(t devtest.T) { NewTwoL2SupernodeLightSequencerInterop(t, 0) }}, + {"NewTwoL2SupernodeFollowL2", func(t devtest.T) { NewTwoL2SupernodeFollowL2(t, 0) }}, + {"NewSingleSupernodeWithSyncTester", func(t devtest.T) { NewSingleSupernodeWithSyncTester(t) }}, + } { + require.Truef(t, runSkipped(t, p.name, p.newPreset), "%s did not skip under kona-node", p.name) + } +} + +// These presets start the CL kind DEVSTACK_L2CL_KIND selects, so they must still run in the +// kona-node job. +func TestKonaCapablePresetsRunOnKonaNode(t *testing.T) { + t.Setenv("DEVSTACK_L2CL_KIND", string(sysgo.MixedL2CLKona)) + for _, p := range []presetCase{ + {"NewMinimal", func(t devtest.T) { NewMinimal(t) }}, + {"NewMinimalNoFaultProofs", func(t devtest.T) { NewMinimalNoFaultProofs(t) }}, + {"NewMinimalWithConductors", func(t devtest.T) { NewMinimalWithConductors(t) }}, + {"NewMinimalWithKona", func(t devtest.T) { NewMinimalWithKona(t) }}, + {"NewSimpleWithSyncTester", func(t devtest.T) { NewSimpleWithSyncTester(t) }}, + {"NewSingleChainMultiNode", func(t devtest.T) { NewSingleChainMultiNode(t) }}, + {"NewSingleChainMultiNodeWithoutCheck", func(t devtest.T) { NewSingleChainMultiNodeWithoutCheck(t) }}, + {"NewSingleChainMultiNodeWithoutP2PWithoutCheck", func(t devtest.T) { NewSingleChainMultiNodeWithoutP2PWithoutCheck(t) }}, + {"NewSingleChainWithIsolatedVerifier", func(t devtest.T) { NewSingleChainWithIsolatedVerifier(t) }}, + {"NewSingleChainMultiNodeWithTestSeq", func(t devtest.T) { NewSingleChainMultiNodeWithTestSeq(t) }}, + {"NewSingleChainTwoVerifiersWithoutCheck", func(t devtest.T) { NewSingleChainTwoVerifiersWithoutCheck(t) }}, + } { + require.Falsef(t, runSkipped(t, p.name, p.newPreset), "%s skipped under kona-node", p.name) + } +} + +func TestSkipOpNodeOnlyPresetOnKonaNodeSkipsOnlyKonaNode(t *testing.T) { + for _, tc := range []struct { + kind sysgo.MixedL2CLKind + wantSkip bool + }{ + {"", false}, + {sysgo.MixedL2CLOpNode, false}, + {sysgo.MixedL2CLKona, true}, + } { + t.Setenv("DEVSTACK_L2CL_KIND", string(tc.kind)) + require.Equalf(t, tc.wantSkip, runSkipped(t, "kind="+string(tc.kind), skipOpNodeOnlyPresetOnKonaNode), + "DEVSTACK_L2CL_KIND=%q", tc.kind) + } +} + +// stopAtStartT stops a preset at its first temp dir, the JWT secret every runtime writes before +// it starts a node, so a test can see whether the preset skipped without starting a system. +type stopAtStartT struct{ devtest.T } + +type presetStarted struct{} + +func (stopAtStartT) TempDir() string { panic(presetStarted{}) } +func (stopAtStartT) TempDirWithPrefix(string) string { panic(presetStarted{}) } + +// runSkipped runs fn in a subtest, stopped at its first temp dir, and reports whether the +// subtest skipped before reaching it. +func runSkipped(t *testing.T, name string, fn func(devtest.T)) bool { + // With this set, devtest turns a skip into an error and carries on. + t.Setenv(devtest.ExpectPreconditionsMet, "") + var sub *testing.T + t.Run(name, func(t *testing.T) { + sub = t + defer func() { + if r := recover(); r != nil && r != (presetStarted{}) { + panic(r) + } + }() + fn(stopAtStartT{devtest.SerialT(t)}) + }) + return sub.Skipped() +} diff --git a/op-devstack/presets/singlechain_supernode_with_synctester.go b/op-devstack/presets/singlechain_supernode_with_synctester.go index 878af22b6db..b8219dfac3d 100644 --- a/op-devstack/presets/singlechain_supernode_with_synctester.go +++ b/op-devstack/presets/singlechain_supernode_with_synctester.go @@ -23,6 +23,7 @@ type SingleSupernodeWithSyncTester struct { } func NewSingleSupernodeWithSyncTester(t devtest.T, opts ...Option) *SingleSupernodeWithSyncTester { + skipOpNodeOnlyPresetOnKonaNode(t) presetCfg, presetOpts := collectSupportedPresetConfig( t, "NewSingleSupernodeWithSyncTester", diff --git a/op-devstack/presets/twol2.go b/op-devstack/presets/twol2.go index 12a84f994e7..5cc57a78f2d 100644 --- a/op-devstack/presets/twol2.go +++ b/op-devstack/presets/twol2.go @@ -37,6 +37,7 @@ type TwoL2 struct { // NewTwoL2Supernode creates a fresh TwoL2 target backed by a shared supernode for the // current test. func NewTwoL2Supernode(t devtest.T, opts ...Option) *TwoL2 { + skipOpNodeOnlyPresetOnKonaNode(t) presetCfg, _ := collectSupportedPresetConfig(t, "NewTwoL2Supernode", opts, twoL2SupernodePresetSupportedOptionKinds) return twoL2SupernodeFromRuntime(t, sysgo.NewTwoL2SupernodeRuntimeWithConfig(t, presetCfg)) } @@ -167,6 +168,7 @@ func (s *TwoL2SupernodeInterop) BootstrapLightSequencersViaVNHandoff() { // NewTwoL2SupernodeInterop creates a fresh TwoL2SupernodeInterop target for the current // test. func NewTwoL2SupernodeInterop(t devtest.T, delaySeconds uint64, opts ...Option) *TwoL2SupernodeInterop { + skipOpNodeOnlyPresetOnKonaNode(t) presetCfg, _ := collectSupportedPresetConfig(t, "NewTwoL2SupernodeInterop", opts, twoL2SupernodeInteropPresetSupportedOptionKinds) return twoL2SupernodeInteropFromRuntime(t, sysgo.NewTwoL2SupernodeInteropRuntimeWithConfig(t, delaySeconds, presetCfg)) } @@ -174,6 +176,7 @@ func NewTwoL2SupernodeInterop(t devtest.T, delaySeconds uint64, opts ...Option) // NewTwoL2SupernodeLightSequencerInterop creates a two-L2 interop setup where // light op-node CLs sequence blocks and the shared supernode derives safe heads. func NewTwoL2SupernodeLightSequencerInterop(t devtest.T, delaySeconds uint64, opts ...Option) *TwoL2SupernodeInterop { + skipOpNodeOnlyPresetOnKonaNode(t) presetCfg, _ := collectSupportedPresetConfig(t, "NewTwoL2SupernodeLightSequencerInterop", opts, twoL2SupernodeLightSequencerPresetSupportedOptionKinds) return twoL2SupernodeInteropFromRuntime(t, sysgo.NewTwoL2SupernodeLightSequencerInteropRuntimeWithConfig(t, delaySeconds, presetCfg)) } diff --git a/op-devstack/presets/twol2_follow_l2.go b/op-devstack/presets/twol2_follow_l2.go index 39645c22b70..ac62d3fea51 100644 --- a/op-devstack/presets/twol2_follow_l2.go +++ b/op-devstack/presets/twol2_follow_l2.go @@ -20,6 +20,7 @@ type TwoL2SupernodeFollowL2 struct { // NewTwoL2SupernodeFollowL2 creates a fresh follow-source variant of the two-L2 // supernode interop preset for the current test. func NewTwoL2SupernodeFollowL2(t devtest.T, delaySeconds uint64, opts ...Option) *TwoL2SupernodeFollowL2 { + skipOpNodeOnlyPresetOnKonaNode(t) presetCfg, _ := collectSupportedPresetConfig(t, "NewTwoL2SupernodeFollowL2", opts, twoL2SupernodeInteropPresetSupportedOptionKinds) return twoL2SupernodeFollowL2FromRuntime(t, sysgo.NewTwoL2SupernodeFollowL2RuntimeWithConfig(t, delaySeconds, presetCfg)) } diff --git a/op-devstack/sysgo/mixed_runtime.go b/op-devstack/sysgo/mixed_runtime.go index 8c133eee67c..08bc3aba0d6 100644 --- a/op-devstack/sysgo/mixed_runtime.go +++ b/op-devstack/sysgo/mixed_runtime.go @@ -62,18 +62,6 @@ func FlakyOnKonaNode(t devtest.T, reason string) { } } -// skipOpNodeOnlyRuntimeOnKonaNode skips the test under DEVSTACK_L2CL_KIND=kona-node. Call it first -// in a runtime constructor that starts only op-node and op-supernode CLs whatever the variable -// says: under kona-node such a run repeats the op-node run exactly. It is separate from -// SkipOnKonaNode so that list names only real kona-node gaps. Remove the call once the runtime -// starts the CL kind the variable selects, as kona-node or lokahi support for supernode and -// interop topologies would. -func skipOpNodeOnlyRuntimeOnKonaNode(t devtest.T) { - if devstackL2CLKind() == MixedL2CLKona { - t.Skip("skipping on kona-node: this runtime starts only op-node and op-supernode CLs whatever DEVSTACK_L2CL_KIND says") - } -} - // devstackL2CLKind returns the L2 CL kind requested via the DEVSTACK_L2CL_KIND // environment variable. Returns the empty string when the variable is unset, // meaning "use the runtime's default". diff --git a/op-devstack/sysgo/mixed_runtime_test.go b/op-devstack/sysgo/mixed_runtime_test.go index 421cf70f768..5c97f9ca742 100644 --- a/op-devstack/sysgo/mixed_runtime_test.go +++ b/op-devstack/sysgo/mixed_runtime_test.go @@ -83,84 +83,6 @@ func TestResolveMixedL2CLKind(t *testing.T) { } } -// startupProbeT stops a runtime constructor at a skip or at its first side effect, the temp dir -// it writes the JWT secret to, whichever comes first, so a test can tell which came first -// without starting a system. -type startupProbeT struct { - devtest.T -} - -type startupProbeOutcome string - -const ( - probeSkipped startupProbeOutcome = "skipped" - probeStarted startupProbeOutcome = "started" -) - -func (*startupProbeT) Skip(...any) { panic(probeSkipped) } -func (*startupProbeT) Skipf(string, ...any) { panic(probeSkipped) } -func (*startupProbeT) SkipNow() { panic(probeSkipped) } -func (*startupProbeT) TempDir() string { panic(probeStarted) } -func (*startupProbeT) TempDirWithPrefix(string) string { panic(probeStarted) } - -func TestOpNodeOnlyRuntimesSkipOnKonaNodeBeforeStarting(t *testing.T) { - runtimes := []struct { - name string - newRuntime func(devtest.T) - }{ - {name: "TwoL2Supernode", newRuntime: func(t devtest.T) { NewTwoL2SupernodeRuntimeWithConfig(t, PresetConfig{}) }}, - {name: "TwoL2SupernodeInterop", newRuntime: func(t devtest.T) { - NewTwoL2SupernodeInteropRuntimeWithConfig(t, 0, PresetConfig{}) - }}, - {name: "TwoL2SupernodeLightSequencerInterop", newRuntime: func(t devtest.T) { - NewTwoL2SupernodeLightSequencerInteropRuntimeWithConfig(t, 0, PresetConfig{}) - }}, - {name: "TwoL2SupernodeFollowL2", newRuntime: func(t devtest.T) { - NewTwoL2SupernodeFollowL2RuntimeWithConfig(t, 0, PresetConfig{}) - }}, - {name: "TwoL2SupernodeProofs", newRuntime: func(t devtest.T) { - NewTwoL2SupernodeProofsRuntimeWithConfig(t, true, PresetConfig{}) - }}, - {name: "ThreeL2SupernodeProofs", newRuntime: func(t devtest.T) { - NewThreeL2SupernodeProofsRuntimeWithConfig(t, true, PresetConfig{}) - }}, - {name: "SingleChainSupernodeProofs", newRuntime: func(t devtest.T) { - NewSingleChainSupernodeProofsRuntimeWithConfig(t, true, PresetConfig{}) - }}, - {name: "SingleChainSuperRootAtGenesis", newRuntime: func(t devtest.T) { - NewSingleChainSuperRootAtGenesisRuntimeWithConfig(t, PresetConfig{}) - }}, - {name: "SingleSupernodeWithSyncTester", newRuntime: func(t devtest.T) { - NewSingleSupernodeWithSyncTesterRuntimeWithConfig(t, PresetConfig{}) - }}, - {name: "MinimalInteropNoSupernode", newRuntime: func(t devtest.T) { NewMinimalInteropNoSupernodeRuntime(t) }}, - {name: "SingleChainInteropNoSupernodeSuperRoot", newRuntime: func(t devtest.T) { - NewSingleChainInteropNoSupernodeSuperRootRuntimeWithConfig(t, PresetConfig{}) - }}, - {name: "SingleChainInteropNoSupernodeZKDispute", newRuntime: func(t devtest.T) { - NewSingleChainInteropNoSupernodeZKDisputeRuntimeWithConfig(t, PresetConfig{}) - }}, - } - for _, rt := range runtimes { - t.Run(rt.name, func(t *testing.T) { - for _, tc := range []struct { - name string - kind MixedL2CLKind - want startupProbeOutcome - }{ - {name: "empty", kind: "", want: probeStarted}, - {name: "op-node", kind: MixedL2CLOpNode, want: probeStarted}, - {name: "kona-node", kind: MixedL2CLKona, want: probeSkipped}, - } { - t.Run(tc.name, func(t *testing.T) { - t.Setenv("DEVSTACK_L2CL_KIND", string(tc.kind)) - require.PanicsWithValue(t, tc.want, func() { rt.newRuntime(&startupProbeT{T: devtest.SerialT(t)}) }) - }) - } - }) - } -} - // An unknown kind fails at resolution, before any preset starts a node of that kind. func TestResolveMixedL2CLKindRejectsUnknownKind(t *testing.T) { for _, kind := range []string{"kona", "Kona-Node", "op-geth"} { @@ -172,11 +94,3 @@ func TestResolveMixedL2CLKindRejectsUnknownKind(t *testing.T) { }) } } - -// A runtime that starts the CL kind DEVSTACK_L2CL_KIND selects must still run in the kona-node job. -func TestKonaCapableRuntimeStartsOnKonaNode(t *testing.T) { - t.Setenv("DEVSTACK_L2CL_KIND", string(MixedL2CLKona)) - require.PanicsWithValue(t, probeStarted, func() { - NewMinimalRuntimeWithConfig(&startupProbeT{T: devtest.SerialT(t)}, PresetConfig{}) - }) -} diff --git a/op-devstack/sysgo/multichain_supernode_runtime.go b/op-devstack/sysgo/multichain_supernode_runtime.go index 853fe4b509a..bb54a37350b 100644 --- a/op-devstack/sysgo/multichain_supernode_runtime.go +++ b/op-devstack/sysgo/multichain_supernode_runtime.go @@ -121,7 +121,6 @@ func startSupernodeEL(t devtest.T, l2Net *L2Network, jwtPath string, jwtSecret [ } func newSingleChainSupernodeRuntimeWithConfig(t devtest.T, lagoonAtGenesis bool, cfg PresetConfig) *MultiChainRuntime { - skipOpNodeOnlyRuntimeOnKonaNode(t) require := t.Require() keys, err := devkeys.NewMnemonicDevKeys(devkeys.TestMnemonic) @@ -226,7 +225,6 @@ func newMultiL2SupernodeRuntimeWithConfigAndSequencerMode( supernodeSequencerEnabled bool, chainSpecs []runtimeChainSpec, ) (*MultiChainRuntime, uint64) { - skipOpNodeOnlyRuntimeOnKonaNode(t) require := t.Require() require.NotEmpty(chainSpecs, "multi-chain runtime needs at least one L2 chain") diff --git a/op-devstack/sysgo/singlechain_build.go b/op-devstack/sysgo/singlechain_build.go index 85f7446cfad..9e3796e5a61 100644 --- a/op-devstack/sysgo/singlechain_build.go +++ b/op-devstack/sysgo/singlechain_build.go @@ -91,9 +91,10 @@ func applyConfigPrefundedL2(t devtest.T, keys devkeys.Keys, l1ChainID, l2ChainID l1Config.WithPrefundedAccount(addrFor(devkeys.SystemConfigOwner), *millionEth) } -// startL2CLForKey starts an L2 CL node of the given kind for the given key. A runtime that calls -// skipOpNodeOnlyRuntimeOnKonaNode must drop that call when it starts a CL through here, or the -// kona-node run keeps skipping its tests. +// startL2CLForKey starts an L2 CL node of the given kind for the given key. The supernode and +// interop runtimes don't use it, so their presets skip under kona-node (presets' +// skipOpNodeOnlyPresetOnKonaNode); a runtime that passes it the kind DEVSTACK_L2CL_KIND selects +// must not keep that skip in its presets, or the kona-node job skips its tests. func startL2CLForKey( t devtest.T, keys devkeys.Keys, diff --git a/op-devstack/sysgo/singlechain_interop.go b/op-devstack/sysgo/singlechain_interop.go index 02251e1e8e7..80ba236837d 100644 --- a/op-devstack/sysgo/singlechain_interop.go +++ b/op-devstack/sysgo/singlechain_interop.go @@ -54,7 +54,6 @@ func startSingleChainInteropPrimaryNoSupernode( // NewMinimalInteropNoSupernodeRuntime constructs the single-chain interop world // without supernode wiring. func NewMinimalInteropNoSupernodeRuntime(t devtest.T) *SingleChainRuntime { - skipOpNodeOnlyRuntimeOnKonaNode(t) return newSingleChainRuntimeWithConfig(t, PresetConfig{}, singleChainRuntimeSpec{ BuildWorld: newSingleChainInteropWorldNoSupernode, SequencerCLKind: MixedL2CLOpNode, @@ -71,7 +70,6 @@ func NewMinimalInteropNoSupernodeRuntime(t devtest.T) *SingleChainRuntime { // games sourcing super roots directly from the op-node's superroot_atTimestamp endpoint. // The primary op-node enables its safe DB (required by superroot_atTimestamp). func NewSingleChainInteropNoSupernodeSuperRootRuntimeWithConfig(t devtest.T, cfg PresetConfig) *SingleChainRuntime { - skipOpNodeOnlyRuntimeOnKonaNode(t) cfg = withSuperRootGamesAtGenesisDeployerFeatures(cfg) cfg.AddedGameTypes = append(cfg.AddedGameTypes, gameTypes.SuperCannonKonaGameType) return newSingleChainRuntimeWithConfig(t, cfg, singleChainRuntimeSpec{ @@ -90,7 +88,6 @@ func NewSingleChainInteropNoSupernodeSuperRootRuntimeWithConfig(t devtest.T, cfg // roots directly from the op-node's superroot_atTimestamp endpoint. The primary op-node enables // its safe DB (required by superroot_atTimestamp). func NewSingleChainInteropNoSupernodeZKDisputeRuntimeWithConfig(t devtest.T, cfg PresetConfig) *SingleChainRuntime { - skipOpNodeOnlyRuntimeOnKonaNode(t) cfg = withSuperRootGamesAtGenesisDeployerFeatures(cfg) // ZK games resolve only after the challenge/prove windows elapse, so time travel is required. cfg.EnableTimeTravel = true diff --git a/op-devstack/sysgo/singlechain_supernode_synctester_variant.go b/op-devstack/sysgo/singlechain_supernode_synctester_variant.go index b13cf8a8bc5..009e11fbc41 100644 --- a/op-devstack/sysgo/singlechain_supernode_synctester_variant.go +++ b/op-devstack/sysgo/singlechain_supernode_synctester_variant.go @@ -21,7 +21,6 @@ func NewSingleSupernodeWithSyncTesterRuntime(t devtest.T) *MultiChainRuntime { } func NewSingleSupernodeWithSyncTesterRuntimeWithConfig(t devtest.T, cfg PresetConfig) *MultiChainRuntime { - skipOpNodeOnlyRuntimeOnKonaNode(t) require := t.Require() keys, err := devkeys.NewMnemonicDevKeys(devkeys.TestMnemonic) From 372b1178632425cf9d94737e19d8b846a89cd0ac Mon Sep 17 00:00:00 2001 From: Anton Evangelatov Date: Thu, 19 Nov 2026 11:16:31 +0100 Subject: [PATCH 4/4] op-devstack: require every preset to be classified for the kona-node job The two preset lists were written by hand, so a new preset on neither list passed without notice: an op-node-only preset that forgot the skip would repeat the op-node job under kona-node. TestEveryPresetIsClassified parses the package and requires every exported New* func whose first parameter is a devtest.T to be on exactly one of the op-node-only, kona-capable or not-a-preset lists. Co-Authored-By: Claude Opus 5.5 --- op-devstack/presets/op_node_only_test.go | 126 +++++++++++++++++------ 1 file changed, 93 insertions(+), 33 deletions(-) diff --git a/op-devstack/presets/op_node_only_test.go b/op-devstack/presets/op_node_only_test.go index 121481f50c2..9ab010850e1 100644 --- a/op-devstack/presets/op_node_only_test.go +++ b/op-devstack/presets/op_node_only_test.go @@ -1,6 +1,12 @@ package presets import ( + "go/ast" + "go/parser" + "go/token" + "path/filepath" + "slices" + "strings" "testing" "github.com/ethereum-optimism/optimism/op-devstack/devtest" @@ -13,51 +19,105 @@ type presetCase struct { newPreset func(devtest.T) } -// These presets start only op-node and op-supernode CLs, so under kona-node each must skip before -// it starts anything. +// opNodeOnlyPresets start only op-node and op-supernode CLs, so under kona-node each must skip +// before it starts anything. +var opNodeOnlyPresets = []presetCase{ + {"NewSimpleInterop", func(t devtest.T) { NewSimpleInterop(t) }}, + {"NewSimpleInteropIsthmusSuper", func(t devtest.T) { NewSimpleInteropIsthmusSuper(t) }}, + {"NewThreeChainInterop", func(t devtest.T) { NewThreeChainInterop(t) }}, + {"NewSingleChainInterop", func(t devtest.T) { NewSingleChainInterop(t) }}, + {"NewSingleChainInteropIsthmusSuper", func(t devtest.T) { NewSingleChainInteropIsthmusSuper(t) }}, + {"NewSingleChainInteropSuperRootAtGenesis", func(t devtest.T) { NewSingleChainInteropSuperRootAtGenesis(t) }}, + {"NewSingleChainInteropNoSupernode", func(t devtest.T) { NewSingleChainInteropNoSupernode(t) }}, + {"NewSingleChainInteropNoSupernodeZKDispute", func(t devtest.T) { NewSingleChainInteropNoSupernodeZKDispute(t) }}, + {"NewMinimalInteropNoSupernode", func(t devtest.T) { NewMinimalInteropNoSupernode(t) }}, + {"NewTwoL2Supernode", func(t devtest.T) { NewTwoL2Supernode(t) }}, + {"NewTwoL2SupernodeInterop", func(t devtest.T) { NewTwoL2SupernodeInterop(t, 0) }}, + {"NewTwoL2SupernodeLightSequencerInterop", func(t devtest.T) { NewTwoL2SupernodeLightSequencerInterop(t, 0) }}, + {"NewTwoL2SupernodeFollowL2", func(t devtest.T) { NewTwoL2SupernodeFollowL2(t, 0) }}, + {"NewSingleSupernodeWithSyncTester", func(t devtest.T) { NewSingleSupernodeWithSyncTester(t) }}, +} + +// konaCapablePresets start the CL kind DEVSTACK_L2CL_KIND selects, so they must still run in the +// kona-node job. +var konaCapablePresets = []presetCase{ + {"NewMinimal", func(t devtest.T) { NewMinimal(t) }}, + {"NewMinimalNoFaultProofs", func(t devtest.T) { NewMinimalNoFaultProofs(t) }}, + {"NewMinimalWithConductors", func(t devtest.T) { NewMinimalWithConductors(t) }}, + {"NewMinimalWithKona", func(t devtest.T) { NewMinimalWithKona(t) }}, + {"NewSimpleWithSyncTester", func(t devtest.T) { NewSimpleWithSyncTester(t) }}, + {"NewSingleChainMultiNode", func(t devtest.T) { NewSingleChainMultiNode(t) }}, + {"NewSingleChainMultiNodeWithoutCheck", func(t devtest.T) { NewSingleChainMultiNodeWithoutCheck(t) }}, + {"NewSingleChainMultiNodeWithoutP2PWithoutCheck", func(t devtest.T) { NewSingleChainMultiNodeWithoutP2PWithoutCheck(t) }}, + {"NewSingleChainWithIsolatedVerifier", func(t devtest.T) { NewSingleChainWithIsolatedVerifier(t) }}, + {"NewSingleChainMultiNodeWithTestSeq", func(t devtest.T) { NewSingleChainMultiNodeWithTestSeq(t) }}, + {"NewSingleChainTwoVerifiersWithoutCheck", func(t devtest.T) { NewSingleChainTwoVerifiersWithoutCheck(t) }}, +} + +// notPresets take a devtest.T but start nothing themselves. +var notPresets = []string{ + "NewMixedSingleChainFrontends", // wraps a runtime the caller already started +} + func TestOpNodeOnlyPresetsSkipOnKonaNode(t *testing.T) { t.Setenv("DEVSTACK_L2CL_KIND", string(sysgo.MixedL2CLKona)) - for _, p := range []presetCase{ - {"NewSimpleInterop", func(t devtest.T) { NewSimpleInterop(t) }}, - {"NewSimpleInteropIsthmusSuper", func(t devtest.T) { NewSimpleInteropIsthmusSuper(t) }}, - {"NewThreeChainInterop", func(t devtest.T) { NewThreeChainInterop(t) }}, - {"NewSingleChainInterop", func(t devtest.T) { NewSingleChainInterop(t) }}, - {"NewSingleChainInteropIsthmusSuper", func(t devtest.T) { NewSingleChainInteropIsthmusSuper(t) }}, - {"NewSingleChainInteropSuperRootAtGenesis", func(t devtest.T) { NewSingleChainInteropSuperRootAtGenesis(t) }}, - {"NewSingleChainInteropNoSupernode", func(t devtest.T) { NewSingleChainInteropNoSupernode(t) }}, - {"NewSingleChainInteropNoSupernodeZKDispute", func(t devtest.T) { NewSingleChainInteropNoSupernodeZKDispute(t) }}, - {"NewMinimalInteropNoSupernode", func(t devtest.T) { NewMinimalInteropNoSupernode(t) }}, - {"NewTwoL2Supernode", func(t devtest.T) { NewTwoL2Supernode(t) }}, - {"NewTwoL2SupernodeInterop", func(t devtest.T) { NewTwoL2SupernodeInterop(t, 0) }}, - {"NewTwoL2SupernodeLightSequencerInterop", func(t devtest.T) { NewTwoL2SupernodeLightSequencerInterop(t, 0) }}, - {"NewTwoL2SupernodeFollowL2", func(t devtest.T) { NewTwoL2SupernodeFollowL2(t, 0) }}, - {"NewSingleSupernodeWithSyncTester", func(t devtest.T) { NewSingleSupernodeWithSyncTester(t) }}, - } { + for _, p := range opNodeOnlyPresets { require.Truef(t, runSkipped(t, p.name, p.newPreset), "%s did not skip under kona-node", p.name) } } -// These presets start the CL kind DEVSTACK_L2CL_KIND selects, so they must still run in the -// kona-node job. func TestKonaCapablePresetsRunOnKonaNode(t *testing.T) { t.Setenv("DEVSTACK_L2CL_KIND", string(sysgo.MixedL2CLKona)) - for _, p := range []presetCase{ - {"NewMinimal", func(t devtest.T) { NewMinimal(t) }}, - {"NewMinimalNoFaultProofs", func(t devtest.T) { NewMinimalNoFaultProofs(t) }}, - {"NewMinimalWithConductors", func(t devtest.T) { NewMinimalWithConductors(t) }}, - {"NewMinimalWithKona", func(t devtest.T) { NewMinimalWithKona(t) }}, - {"NewSimpleWithSyncTester", func(t devtest.T) { NewSimpleWithSyncTester(t) }}, - {"NewSingleChainMultiNode", func(t devtest.T) { NewSingleChainMultiNode(t) }}, - {"NewSingleChainMultiNodeWithoutCheck", func(t devtest.T) { NewSingleChainMultiNodeWithoutCheck(t) }}, - {"NewSingleChainMultiNodeWithoutP2PWithoutCheck", func(t devtest.T) { NewSingleChainMultiNodeWithoutP2PWithoutCheck(t) }}, - {"NewSingleChainWithIsolatedVerifier", func(t devtest.T) { NewSingleChainWithIsolatedVerifier(t) }}, - {"NewSingleChainMultiNodeWithTestSeq", func(t devtest.T) { NewSingleChainMultiNodeWithTestSeq(t) }}, - {"NewSingleChainTwoVerifiersWithoutCheck", func(t devtest.T) { NewSingleChainTwoVerifiersWithoutCheck(t) }}, - } { + for _, p := range konaCapablePresets { require.Falsef(t, runSkipped(t, p.name, p.newPreset), "%s skipped under kona-node", p.name) } } +// Every exported New* func whose first parameter is a devtest.T must be on exactly one of the three +// lists, so a new preset can't land without a kona-node decision. An unlisted op-node-only preset +// would repeat the op-node job under kona-node. +func TestEveryPresetIsClassified(t *testing.T) { + var listed []string + for _, p := range slices.Concat(opNodeOnlyPresets, konaCapablePresets) { + listed = append(listed, p.name) + } + listed = append(listed, notPresets...) + + files, err := filepath.Glob("*.go") + require.NoError(t, err) + fset := token.NewFileSet() + var constructors []string + for _, path := range files { + if strings.HasSuffix(path, "_test.go") { + continue + } + f, err := parser.ParseFile(fset, path, nil, 0) + require.NoError(t, err) + for _, decl := range f.Decls { + fn, ok := decl.(*ast.FuncDecl) + if !ok || fn.Recv != nil || !fn.Name.IsExported() || !strings.HasPrefix(fn.Name.Name, "New") { + continue + } + if params := fn.Type.Params.List; len(params) > 0 && isDevtestT(params[0].Type) { + constructors = append(constructors, fn.Name.Name) + } + } + } + require.NotEmpty(t, constructors) + require.ElementsMatch(t, constructors, listed, + "an extra in list A needs adding to one of opNodeOnlyPresets, konaCapablePresets and notPresets; "+ + "an extra in list B is listed twice or is not an exported New* func taking a devtest.T") +} + +func isDevtestT(expr ast.Expr) bool { + sel, ok := expr.(*ast.SelectorExpr) + if !ok { + return false + } + pkg, ok := sel.X.(*ast.Ident) + return ok && pkg.Name == "devtest" && sel.Sel.Name == "T" +} + func TestSkipOpNodeOnlyPresetOnKonaNodeSkipsOnlyKonaNode(t *testing.T) { for _, tc := range []struct { kind sysgo.MixedL2CLKind