Sitelet https://github.com/ethereum-optimism/optimism/commit/85d9c9b653674749f0d26978a09d96bbd44ec779
Skip to content

Commit 85d9c9b

Browse files
authored
op-supernode: Initial Chain Container Framework (#17659)
* op-supernode: Initial Chain Container Framework * op-supernode: Shared L1 * Context Exit Cleanup * op-supernode: RPC Router Resource for Virtual Nodes * op-supernode: Virutal Node Lifecycle Fixes * op-supernode: Node and Chain Lifecycle Updates ; Unit Tests * just coverage * op-supernode minor 2-chain runtime fixes * op-supernode: Single Chain TestCLAdvance for Supernode * op-acceptance-tests: 2 L2 System ; Supernode Multi-Tenant-CL Test * remove e2e changes * README * Restructure Packages/Files * Rename Proxy to Router ; Rewrite Acceptance Tests * update to new op-node InitializationOverrides struct * Update to CLI Interface ; Related/Required Edits * Shared Metrics * Repair Acceptance Tests ; Register optimism handler for supernode * Flake Shake ; Remove Sample Flag * Delete unused preset * Remove Sample from Tests * Fix chain_container_test signatures * lint * remove unused * Review Comments * Use eth.ChainID * Use OP Service HTTP Server
1 parent 4b59c05 commit 85d9c9b

41 files changed

Lines changed: 3588 additions & 34 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Makefile‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,10 @@ op-dispute-mon: ## Builds op-dispute-mon binary
119119
make -C ./op-dispute-mon op-dispute-mon
120120
.PHONY: op-dispute-mon
121121

122+
op-supernode: ## Builds op-supernode binary
123+
just $(JUSTFLAGS) ./op-supernode/op-supernode
124+
.PHONY: op-supernode
125+
122126
op-program: ## Builds op-program binary
123127
make -C ./op-program op-program
124128
.PHONY: op-program

‎op-acceptance-tests/acceptance-tests.yaml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ gates:
1515
- id: flake-shake
1616
description: "Quarantine gate for new and potentially flaky tests requiring stability validation."
1717
tests:
18+
- package: github.com/ethereum-optimism/optimism/op-acceptance-tests/tests/supernode
19+
name: TestCLAdvanceMultiple
20+
timeout: 10m
21+
metadata:
22+
owner: "axel"
1823
- package: github.com/ethereum-optimism/optimism/op-acceptance-tests/tests/sync/elsync/gap_elp2p
1924
name: TestL2ELP2PCanonicalChainAdvancedByFCU
2025
timeout: 30m
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
package supernode
2+
3+
import (
4+
"net/url"
5+
"testing"
6+
"time"
7+
8+
"github.com/ethereum-optimism/optimism/op-devstack/devtest"
9+
"github.com/ethereum-optimism/optimism/op-devstack/presets"
10+
"github.com/stretchr/testify/require"
11+
)
12+
13+
// TestCLAdvanceMultiple verifies two L2 chains advance when using a shared CL
14+
// it confirms:
15+
// - the two L2 chains are on different chains
16+
// - the two CLs are using the same supernode
17+
// - the two CLs are advancing
18+
func TestCLAdvanceMultiple(gt *testing.T) {
19+
t := devtest.ParallelT(gt)
20+
sys := presets.NewTwoL2(t)
21+
22+
blockTime := sys.L2A.Escape().RollupConfig().BlockTime
23+
waitTime := time.Duration(blockTime+1) * time.Second
24+
25+
// Check L2A advances
26+
numA := sys.L2ACL.SyncStatus().UnsafeL2.Number
27+
numB := sys.L2BCL.SyncStatus().UnsafeL2.Number
28+
29+
// Check that the two CLs are on different chains
30+
require.NotEqual(t, sys.L2ACL.ChainID(), sys.L2BCL.ChainID())
31+
32+
// Check that the two CLs are using the same supernode
33+
uA, err := url.Parse(sys.L2ACL.Escape().UserRPC())
34+
require.NoError(t, err)
35+
uB, err := url.Parse(sys.L2BCL.Escape().UserRPC())
36+
require.NoError(t, err)
37+
require.Equal(t, uA.Scheme, uB.Scheme)
38+
require.Equal(t, uA.Host, uB.Host)
39+
40+
require.Eventually(t, func() bool {
41+
newA := sys.L2ACL.SyncStatus().UnsafeL2.Number
42+
newB := sys.L2BCL.SyncStatus().UnsafeL2.Number
43+
return newA > numA && newB > numB
44+
}, 30*time.Second, waitTime)
45+
46+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package supernode
2+
3+
import (
4+
"os"
5+
"testing"
6+
7+
"github.com/ethereum-optimism/optimism/op-devstack/presets"
8+
)
9+
10+
// TestMain creates a two-L2 setup against the shared backend
11+
func TestMain(m *testing.M) {
12+
_ = os.Setenv("DEVSTACK_L2CL_KIND", "supernode")
13+
presets.DoMain(m, presets.WithTwoL2Supernode())
14+
}

‎op-alt-da/cli.go‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"net/url"
66
"time"
77

8+
"github.com/ethereum-optimism/optimism/op-service/cliiface"
89
"github.com/urfave/cli/v2"
910
)
1011

@@ -106,7 +107,7 @@ func (c CLIConfig) NewDAClient() *DAClient {
106107
return &DAClient{url: c.DAServerURL, verify: c.VerifyOnRead, precompute: !c.GenericDA, getTimeout: c.GetTimeout, putTimeout: c.PutTimeout}
107108
}
108109

109-
func ReadCLIConfig(c *cli.Context) CLIConfig {
110+
func ReadCLIConfig(c cliiface.Context) CLIConfig {
110111
return CLIConfig{
111112
Enabled: c.Bool(EnabledFlagName),
112113
DAServerURL: c.String(DaServerAddressFlagName),

‎op-devstack/presets/twol2.go‎

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
package presets
2+
3+
import (
4+
"github.com/ethereum/go-ethereum/log"
5+
"github.com/stretchr/testify/require"
6+
7+
"github.com/ethereum-optimism/optimism/op-devstack/devtest"
8+
"github.com/ethereum-optimism/optimism/op-devstack/dsl"
9+
"github.com/ethereum-optimism/optimism/op-devstack/shim"
10+
"github.com/ethereum-optimism/optimism/op-devstack/stack"
11+
"github.com/ethereum-optimism/optimism/op-devstack/stack/match"
12+
"github.com/ethereum-optimism/optimism/op-devstack/sysgo"
13+
)
14+
15+
// TwoL2 represents a two-L2 setup without interop considerations.
16+
// It is useful for testing components which bridge multiple L2s without necessarily using interop.
17+
type TwoL2 struct {
18+
Log log.Logger
19+
T devtest.T
20+
ControlPlane stack.ControlPlane
21+
22+
L1Network *dsl.L1Network
23+
L1EL *dsl.L1ELNode
24+
25+
L2A *dsl.L2Network
26+
L2B *dsl.L2Network
27+
L2ACL *dsl.L2CLNode
28+
L2BCL *dsl.L2CLNode
29+
}
30+
31+
func WithTwoL2() stack.CommonOption {
32+
return stack.MakeCommon(sysgo.DefaultTwoL2System(&sysgo.DefaultTwoL2SystemIDs{}))
33+
}
34+
35+
func WithTwoL2Supernode() stack.CommonOption {
36+
return stack.MakeCommon(sysgo.DefaultSupernodeTwoL2System(&sysgo.DefaultTwoL2SystemIDs{}))
37+
}
38+
39+
func NewTwoL2(t devtest.T) *TwoL2 {
40+
system := shim.NewSystem(t)
41+
orch := Orchestrator()
42+
orch.Hydrate(system)
43+
44+
l1Net := system.L1Network(match.FirstL1Network)
45+
l2a := system.L2Network(match.Assume(t, match.L2ChainA))
46+
l2b := system.L2Network(match.Assume(t, match.L2ChainB))
47+
l2aCL := l2a.L2CLNode(match.Assume(t, match.WithSequencerActive(t.Ctx())))
48+
l2bCL := l2b.L2CLNode(match.Assume(t, match.WithSequencerActive(t.Ctx())))
49+
50+
require.NotEqual(t, l2a.ChainID(), l2b.ChainID())
51+
52+
return &TwoL2{
53+
Log: t.Logger(),
54+
T: t,
55+
ControlPlane: orch.ControlPlane(),
56+
L1Network: dsl.NewL1Network(l1Net),
57+
L1EL: dsl.NewL1ELNode(l1Net.L1ELNode(match.Assume(t, match.FirstL1EL))),
58+
L2A: dsl.NewL2Network(l2a, orch.ControlPlane()),
59+
L2B: dsl.NewL2Network(l2b, orch.ControlPlane()),
60+
L2ACL: dsl.NewL2CLNode(l2aCL, orch.ControlPlane()),
61+
L2BCL: dsl.NewL2CLNode(l2bCL, orch.ControlPlane()),
62+
}
63+
}

‎op-devstack/sysgo/l2_cl.go‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ func WithL2CLNode(l2CLID stack.L2CLNodeID, l1CLID stack.L1CLNodeID, l1ELID stack
9393
switch os.Getenv("DEVSTACK_L2CL_KIND") {
9494
case "kona":
9595
return WithKonaNode(l2CLID, l1CLID, l1ELID, l2ELID, opts...)
96+
case "supernode":
97+
return WithSuperNode(l2CLID, l1CLID, l1ELID, l2ELID, opts...)
9698
default:
9799
return WithOpNode(l2CLID, l1CLID, l1ELID, l2ELID, opts...)
98100
}

0 commit comments

Comments
 (0)