diff --git a/op-acceptance-tests/README.md b/op-acceptance-tests/README.md index cbb90becf6d..a74e82d8f04 100644 --- a/op-acceptance-tests/README.md +++ b/op-acceptance-tests/README.md @@ -62,7 +62,7 @@ When invoked with `go test`, devstack acceptance tests support configuring loggi Example: ```bash -LOG_LEVEL=info go test -v ./op-acceptance-tests/tests/interop/sync/multisupervisor_interop/... -run TestL2CLAheadOfSupervisor +LOG_LEVEL=info go test -v ./op-acceptance-tests/tests/interop/message/... -run TestInteropHappyTx ``` ## Adding Tests diff --git a/op-acceptance-tests/tests/interop/sync/multisupervisor_interop/interop_sync_test.go b/op-acceptance-tests/tests/interop/sync/multisupervisor_interop/interop_sync_test.go deleted file mode 100644 index 3c741a148bf..00000000000 --- a/op-acceptance-tests/tests/interop/sync/multisupervisor_interop/interop_sync_test.go +++ /dev/null @@ -1,245 +0,0 @@ -//go:build !ci - -package sync - -import ( - "testing" - - "github.com/ethereum-optimism/optimism/op-devstack/devtest" - "github.com/ethereum-optimism/optimism/op-devstack/dsl" - "github.com/ethereum-optimism/optimism/op-devstack/presets" - "github.com/ethereum-optimism/optimism/op-service/eth" - "github.com/ethereum-optimism/optimism/op-supervisor/supervisor/types" -) - -// TestL2CLAheadOfSupervisor tests the below scenario: -// L2CL ahead of supervisor, aka supervisor needs to reset the L2CL, to reproduce old data. Currently supervisor has only indexing mode implemented, so the supervisor will ask the L2CL to reset back. -func TestL2CLAheadOfSupervisor(gt *testing.T) { - gt.Skip("Skipping Interop Acceptance Test") - t := devtest.ParallelT(gt) - - sys := presets.NewMultiSupervisorInterop(t) - logger := sys.Log.With("Test", "TestL2CLAheadOfSupervisor") - require := sys.T.Require() - - // Make sequencers (L2CL), verifiers (L2CL), and supervisors sync for a few blocks. - // Sequencer and verifier are connected via P2P, which makes their unsafe heads in sync. - // Both L2CLs are in indexing mode, digesting L1 blocks from the supervisor and reporting unsafe and safe blocks back to the supervisor. - delta := uint64(10) - logger.Info("Make sure verifiers advances unsafe head", "delta", delta) - dsl.CheckAll(t, - sys.L2CLA.AdvancedFn(types.LocalUnsafe, delta, 30), sys.L2CLA2.AdvancedFn(types.LocalUnsafe, delta, 30), - sys.L2CLB.AdvancedFn(types.LocalUnsafe, delta, 30), sys.L2CLB2.AdvancedFn(types.LocalUnsafe, delta, 30), - ) - - safeHeadViewA2 := sys.SupervisorSecondary.SafeBlockID(sys.L2CLA.ChainID()) - safeHeadViewB2 := sys.SupervisorSecondary.SafeBlockID(sys.L2CLB.ChainID()) - - logger.Info("Stop secondary supervisor") - sys.SupervisorSecondary.Stop() - - safeHeadA2 := sys.L2CLA2.SafeL2BlockRef() - safeHeadB2 := sys.L2CLB2.SafeL2BlockRef() - require.Equal(safeHeadViewA2.Hash, safeHeadA2.Hash) - require.Equal(safeHeadViewB2.Hash, safeHeadB2.Hash) - logger.Info("Secondary supervisor(stopped) safe head view", "chainA", safeHeadA2, "chainB", safeHeadB2) - - // Wait enough to make sequencers and primary supervisor advance safe head enough. - logger.Info("Sequencers advances safe heads but not verifiers", "delta", delta) - logger.Info("Every CL advance unsafe heads since sequencer and verifier are connected with P2P", "delta", delta) - dsl.CheckAll(t, - // verifier CLs cannot advance their safe head because secondary supervisor is down, no supervisor to provide them L1 data. - sys.L2CLA2.NotAdvancedFn(types.CrossSafe, 15), sys.L2CLB2.NotAdvancedFn(types.CrossSafe, 15), - // sequencer CLs advance their safe heads - sys.L2CLA.AdvancedFn(types.CrossSafe, delta, 30), sys.L2CLB.AdvancedFn(types.CrossSafe, delta, 30), - // All the L2CLs advance their unsafe heads - // Verifiers advances unsafe head because they still have P2P connection with each sequencers - sys.L2CLA.AdvancedFn(types.LocalUnsafe, delta, 30), sys.L2CLB.AdvancedFn(types.LocalUnsafe, delta, 30), - sys.L2CLA2.AdvancedFn(types.LocalUnsafe, delta, 30), sys.L2CLB2.AdvancedFn(types.LocalUnsafe, delta, 30), - ) - - logger.Info("Stop primary supervisor to disconnect every CL connection") - sys.Supervisor.Stop() - - logger.Info("Restart primary supervisor") - sys.Supervisor.Start() - - // Primary supervisor has safe heads synced with sequencers. - // After connection, verifiers will sync with primary supervisor, matching supervisor safe head view. - logger.Info("Connect verifier CLs to primary supervisor to advance verifier safe heads") - sys.Supervisor.AddManagedL2CL(sys.L2CLA2) - sys.Supervisor.AddManagedL2CL(sys.L2CLB2) - - // Secondary supervisor and verifiers becomes out-of-sync with safe heads. - target := max(sys.L2CLA.SafeL2BlockRef().Number, sys.L2CLB.SafeL2BlockRef().Number) + delta - logger.Info("Verifiers advances safe heads but not sequencers", "delta", delta, "target", target) - logger.Info("Every CL advance unsafe heads since sequencer and verifier are connected with P2P", "delta", delta) - dsl.CheckAll(t, - // verifier CLs advance their safe heads - sys.L2CLA2.ReachedFn(types.CrossSafe, target, 30), sys.L2CLB2.ReachedFn(types.CrossSafe, target, 30), - // sequencer CLs cannot advance their safe head because no supervisor is connected to provide them L1 data. - sys.L2CLA.NotAdvancedFn(types.CrossSafe, 15), sys.L2CLB.NotAdvancedFn(types.CrossSafe, 15), - // Verifiers advances unsafe head because they still have P2P connection with each sequencers - sys.L2CLA.AdvancedFn(types.LocalUnsafe, delta, 30), sys.L2CLB.AdvancedFn(types.LocalUnsafe, delta, 30), - sys.L2CLA2.AdvancedFn(types.LocalUnsafe, delta, 30), sys.L2CLB2.AdvancedFn(types.LocalUnsafe, delta, 30), - ) - - logger.Info("Stop primary supervisor to disconnect every CL connection") - sys.Supervisor.Stop() - - logger.Info("Restart primary supervisor") - sys.Supervisor.Start() - - logger.Info("No CL connected to supervisor so every CL safe head will not advance") - dsl.CheckAll(t, - sys.L2CLA.NotAdvancedFn(types.CrossSafe, 30), sys.L2CLA2.NotAdvancedFn(types.CrossSafe, 30), - sys.L2CLB.NotAdvancedFn(types.CrossSafe, 30), sys.L2CLB2.NotAdvancedFn(types.CrossSafe, 30), - ) - - // Sequencers will resume advancing safe heads, but not verifiers. - logger.Info("Reconnect sequencer CLs to primary supervisor") - sys.Supervisor.AddManagedL2CL(sys.L2CLA) - sys.Supervisor.AddManagedL2CL(sys.L2CLB) - - logger.Info("Restart secondary supervisor") - sys.SupervisorSecondary.Start() - - logger.Info("Reconnect verifier CLs to secondary supervisor") - sys.SupervisorSecondary.AddManagedL2CL(sys.L2CLA2) - sys.SupervisorSecondary.AddManagedL2CL(sys.L2CLB2) - - // Secondary supervisor will compare its safe head knowledge with L2CLs, and find out L2CLs are ahead of the Secondary supervisor. - // Secondary supervisor asks the verifiers (L2CL) to rewind(reset) back to match Secondary supervisor safe head view. - rewind := uint64(3) - logger.Info("Check verifier CLs safe head rewinded", "rewind", rewind) - dsl.CheckAll(t, - sys.L2CLA2.RewindedFn(types.CrossSafe, rewind, 120), - sys.L2CLB2.RewindedFn(types.CrossSafe, rewind, 120), - ) - - // After rewinding(reset), verifier will advance safe heads again because Secondary supervisor gives L1 data to the verifiers. - // Wait until verifiers advance safe head enough - target = max(sys.L2CLA.SafeL2BlockRef().Number, sys.L2CLB.SafeL2BlockRef().Number) + delta - logger.Info("Every CLs advance safe heads", "delta", delta, "target", target) - dsl.CheckAll(t, - sys.L2CLA.ReachedFn(types.CrossSafe, target, 30), sys.L2CLA2.ReachedFn(types.CrossSafe, target, 30), - sys.L2CLB.ReachedFn(types.CrossSafe, target, 30), sys.L2CLB2.ReachedFn(types.CrossSafe, target, 30), - ) - - // Make sure each chain did not diverge - require.Equal(sys.L2ELA.BlockRefByNumber(target).Hash, sys.L2ELA2.BlockRefByNumber(target).Hash) - require.Equal(sys.L2ELB.BlockRefByNumber(target).Hash, sys.L2ELB2.BlockRefByNumber(target).Hash) -} - -// TestUnsafeChainKnownToL2CL tests the below scenario: -// supervisor cross-safe ahead of L2CL cross-safe, aka L2CL can "skip" forward to match safety of supervisor. -func TestUnsafeChainKnownToL2CL(gt *testing.T) { - gt.Skip("Skipping Interop Acceptance Test") - - t := devtest.ParallelT(gt) - - sys := presets.NewMultiSupervisorInterop(t) - logger := sys.Log.With("Test", "TestUnsafeChainKnownToL2CL") - require := sys.T.Require() - - logger.Info("Make sure verifier safe head advances") - dsl.CheckAll(t, - sys.L2CLA.AdvancedFn(types.CrossSafe, 5, 30), - sys.L2CLA2.AdvancedFn(types.CrossSafe, 5, 30), - ) - - safeA2 := sys.L2ELA2.BlockRefByLabel(eth.Safe) - logger.Info("Verifier advanced safe head", "number", safeA2.Number) - unsafeA2 := sys.L2ELA2.BlockRefByLabel(eth.Unsafe) - logger.Info("Verifier advanced unsafe head", "number", unsafeA2.Number) - - // The verifier stops advancing unsafe head because it will not receive unsafe heads via P2P, and can only update unsafe heads matching with safe heads by reading L1 batches, - // The verifier safe head will lag behind or match the sequencer and primary supervisor because all three components share the same L1 view. - logger.Info("Disconnect p2p between L2CLs") - sys.L2CLA.DisconnectPeer(sys.L2CLA2) - sys.L2CLA2.DisconnectPeer(sys.L2CLA) - - // For making verifier not sync at all, both unsafe head and safe head - // The sequencer will advance unsafe head and safe head, as well as synced with primary supervisor. - logger.Info("Stop verifier") - sys.L2CLA2.Stop() - - // Wait until sequencer and primary supervisor diverged enough from the verifier. - // To make the verifier held unsafe blocks are already as safe by sequencer and primary supervisor, we wait. - delta := uint64(10) - logger.Info("Wait until supervisor reaches safe head", "delta", delta) - sys.Supervisor.AdvancedSafeHead(sys.L2ChainA.ChainID(), delta, 30) - - // Restarted verifier will advance its unsafe head and safe head by reading L1 but not by P2P - logger.Info("Restart verifier") - sys.L2CLA2.Start() - - safeA2 = sys.L2ELA2.BlockRefByLabel(eth.Safe) - logger.Info("Verifier safe head after restart", "number", safeA2.Number) - unsafeA2 = sys.L2ELA2.BlockRefByLabel(eth.Unsafe) - logger.Info("Verifier unsafe head after restart", "number", unsafeA2.Number) - - // Make sure there are unsafe blocks to be consolidated: - // To check verifier does not have to process blocks since unsafe blocks are already processed - require.Greater(unsafeA2.Number, safeA2.Number) - - // The verifier will quickly catch up with the sequencer safe head as well as the primary supervisor. - // The verifier will "skip" processing already known unsafe blocks, and consolidate them into safe blocks. - logger.Info("Make sure verifier unsafe head was consolidated to safe") - sys.L2CLA2.Reached(types.CrossSafe, unsafeA2.Number, 30) - - safeA := sys.L2ELA.BlockRefByLabel(eth.Safe) - target := safeA.Number + delta - logger.Info("Make sure verifier unsafe head advances due to safe head advances", "target", target, "delta", delta) - sys.L2CLA2.Reached(types.LocalUnsafe, target, 30) - - block := sys.L2ELA2.BlockRefByNumber(unsafeA2.Number) - require.Equal(unsafeA2.Hash, block.Hash) - - // Cleanup - logger.Info("Explicit reconnection of L2CL P2P between sequencer and verifier") - sys.L2CLA2.ConnectPeer(sys.L2CLA) - sys.L2CLA.ConnectPeer(sys.L2CLA2) -} - -// TestUnsafeChainUnknownToL2CL tests the below scenario: -// supervisor unsafe ahead of L2CL unsafe, aka L2CL processes new blocks first. -func TestUnsafeChainUnknownToL2CL(gt *testing.T) { - gt.Skip("Skipping Interop Acceptance Test") - - t := devtest.ParallelT(gt) - - sys := presets.NewMultiSupervisorInterop(t) - logger := sys.Log.With("Test", "TestUnsafeChainUnknownToL2CL") - - logger.Info("Make sure sequencer and verifier unsafe head advances") - dsl.CheckAll(t, - sys.L2CLA.AdvancedFn(types.LocalUnsafe, 5, 30), - sys.L2CLA2.AdvancedFn(types.LocalUnsafe, 5, 30), - ) - - logger.Info("Disconnect p2p between L2CLs") - sys.L2CLA.DisconnectPeer(sys.L2CLA2) - sys.L2CLA2.DisconnectPeer(sys.L2CLA) - - // verifier lost its P2P connection with sequencer, and will advance its unsafe head by reading L1 but not by P2P - logger.Info("Make sure verifier advances safe head by reading L1") - sys.L2CLA2.Advanced(types.CrossSafe, 5, 30) - - // The verifier will not receive unsafe heads via P2P, and can only update unsafe heads matching with safe heads by reading L1 batches. - logger.Info("Verifier heads will lag compared from sequencer heads and primary supervisor view") - dsl.CheckAll(t, - sys.L2CLA2.LaggedFn(sys.L2CLA, types.LocalUnsafe, 10, false), - sys.L2CLA2.LaggedFn(sys.Supervisor, types.LocalUnsafe, 10, true), - ) - - logger.Info("Explicit reconnection of L2CL P2P between sequencer and verifier") - sys.L2CLA2.ConnectPeer(sys.L2CLA) - sys.L2CLA.ConnectPeer(sys.L2CLA2) - - // The sequencer will broadcast all unknown unsafe blocks to the verifier. - // The verifier will quickly catch up with the sequencer unsafe head as well as the primary supervisor. - // The verifier will process previously unknown unsafe blocks and advance its unsafe head. - logger.Info("Verifier catches up sequencer unsafe chain with was unknown for verifier") - sys.L2CLA2.InSync(sys.L2CLA, types.LocalUnsafe, 5) -} diff --git a/op-devstack/dsl/supervisor.go b/op-devstack/dsl/supervisor.go index 04f5ba5ac6d..015848d41f6 100644 --- a/op-devstack/dsl/supervisor.go +++ b/op-devstack/dsl/supervisor.go @@ -8,7 +8,6 @@ import ( "time" "github.com/ethereum-optimism/optimism/op-devstack/stack" - "github.com/ethereum-optimism/optimism/op-e2e/e2eutils/wait" "github.com/ethereum-optimism/optimism/op-service/eth" "github.com/ethereum-optimism/optimism/op-service/retry" "github.com/ethereum-optimism/optimism/op-supervisor/supervisor/backend/status" @@ -36,59 +35,6 @@ func (s *Supervisor) Escape() stack.Supervisor { return s.inner } -type VerifySyncStatusConfig struct { - AllUnsafeHeadsAdvance uint64 -} - -// WithAllLocalUnsafeHeadsAdvancedBy verifies that the local unsafe head of every chain advances by at least the -// specified number of blocks compared to the value when VerifySyncStatus is called. -func WithAllLocalUnsafeHeadsAdvancedBy(blocks uint64) func(cfg *VerifySyncStatusConfig) { - return func(cfg *VerifySyncStatusConfig) { - cfg.AllUnsafeHeadsAdvance = blocks - } -} - -// VerifySyncStatus performs assertions based on the supervisor's SyncStatus endpoint. -func (s *Supervisor) VerifySyncStatus(opts ...func(config *VerifySyncStatusConfig)) { - cfg := applyOpts(VerifySyncStatusConfig{}, opts...) - initial := s.FetchSyncStatus() - ctx, cancel := context.WithTimeout(s.ctx, DefaultTimeout) - defer cancel() - err := wait.For(ctx, 1*time.Second, func() (bool, error) { - status := s.FetchSyncStatus() - s.require.Equalf(len(initial.Chains), len(status.Chains), "Expected %d chains in status but got %d", len(initial.Chains), len(status.Chains)) - for chID, chStatus := range status.Chains { - chInitial := initial.Chains[chID] - required := chInitial.LocalUnsafe.Number + cfg.AllUnsafeHeadsAdvance - if chStatus.LocalUnsafe.Number < required { - s.log.Info("Required sync status not reached. Chain local unsafe has not advanced enough", - "chain", chID, "initialUnsafe", chInitial.LocalUnsafe, "currentUnsafe", chStatus.LocalUnsafe, "minRequired", required) - return false, nil - } - } - return true, nil - }) - s.require.NoError(err, "Expected sync status not found") -} - -func (s *Supervisor) AwaitMinL1(minL1 uint64) { - ctx, cancel := context.WithTimeout(s.ctx, DefaultTimeout) - defer cancel() - err := wait.For(ctx, 1*time.Second, func() (bool, error) { - return s.FetchSyncStatus().MinSyncedL1.Number >= minL1, nil - }) - s.require.NoError(err, "Expected sync status not found") -} - -func (s *Supervisor) AwaitMinCrossSafeTimestamp(timestamp uint64) { - ctx, cancel := context.WithTimeout(s.ctx, DefaultTimeout) - defer cancel() - err := wait.For(ctx, 1*time.Second, func() (bool, error) { - return s.FetchSyncStatus().SafeTimestamp >= timestamp, nil - }) - s.require.NoError(err, "Expected sync status not found") -} - func (s *Supervisor) FetchSyncStatus() eth.SupervisorSyncStatus { s.log.Debug("Fetching supervisor sync status") ctx, cancel := context.WithTimeout(s.ctx, DefaultTimeout) @@ -199,10 +145,6 @@ func (s *Supervisor) WaitForUnsafeHeadToAdvance(chainID eth.ChainID, delta uint6 s.WaitForL2HeadToAdvance(chainID, delta, types.LocalUnsafe, attempts) } -func (s *Supervisor) AdvancedSafeHead(chainID eth.ChainID, delta uint64, attempts int) { - s.WaitForL2HeadToAdvance(chainID, delta, types.CrossSafe, attempts) -} - func (s *Supervisor) FetchSuperRootAtTimestamp(timestamp uint64) eth.SuperRootResponse { response, err := s.inner.QueryAPI().SuperRootAtTimestamp(s.ctx, hexutil.Uint64(timestamp)) s.require.NoError(err, "Unable to fetch super root at timestamp") @@ -220,9 +162,3 @@ func (s *Supervisor) Stop() { s.require.Truef(ok, "supervisor %s is not lifecycle-controllable", s.inner.Name()) lifecycle.Stop() } - -func (s *Supervisor) AddManagedL2CL(cl *L2CLNode) { - interopEndpoint, secret := cl.inner.InteropRPC() - err := s.inner.AdminAPI().AddL2RPC(s.ctx, interopEndpoint, secret) - s.require.NoError(err, "failed to connect L2CL to supervisor") -} diff --git a/op-devstack/example/example_test.go b/op-devstack/example/example_test.go deleted file mode 100644 index cdd7a6e1505..00000000000 --- a/op-devstack/example/example_test.go +++ /dev/null @@ -1,63 +0,0 @@ -package example - -import ( - "testing" - - "github.com/ethereum/go-ethereum/params" - - "github.com/ethereum-optimism/optimism/op-service/eth" - - "github.com/ethereum-optimism/optimism/op-devstack/devtest" - "github.com/ethereum-optimism/optimism/op-devstack/dsl" - "github.com/ethereum-optimism/optimism/op-devstack/presets" -) - -// TestExample1 starts an interop chain and verifies that the local unsafe head advances. -func TestExample1(gt *testing.T) { - t := devtest.ParallelT(gt) - sys := presets.NewSimpleInterop(t) - - t.Require().NotEqual(sys.L2ChainA.ChainID(), sys.L2ChainB.ChainID(), "sanity-check we have two different chains") - sys.Supervisor.VerifySyncStatus(dsl.WithAllLocalUnsafeHeadsAdvancedBy(10)) -} - -func TestExample2(gt *testing.T) { - t := devtest.ParallelT(gt) - sys := presets.NewSimpleInterop(t) - - sys.Supervisor.VerifySyncStatus(dsl.WithAllLocalUnsafeHeadsAdvancedBy(4)) -} - -func TestExampleTxsTracing(gt *testing.T) { - t := devtest.ParallelT(gt) - ctx := t.Ctx() - require := t.Require() - tracer := t.Tracer() - logger := t.Logger() - - ctx, acquiring := tracer.Start(ctx, "acquiring interop sys") - sys := presets.NewSimpleInterop(t) - acquiring.End() - - ctx, funded := tracer.Start(ctx, "acquiring funded eoa") - pre := eth.OneEther - alice := sys.FunderA.NewFundedEOA(pre) - funded.End() - - ctx, unfunded := tracer.Start(ctx, "acquiring unfunded eoa") - bob := sys.Wallet.NewEOA(sys.L2ELA) - bob.VerifyBalanceExact(eth.ZeroWei) - unfunded.End() - - ctx, transfer := tracer.Start(ctx, "transferring") - transferred := eth.GWei(42) - tx := alice.Transfer(bob.Address(), transferred) - logger.InfoContext(ctx, "transferred", "amount", transferred, "gas", tx.Included.Value().GasUsed) - require.Equal(params.TxGas, tx.Included.Value().GasUsed, "transfers cost 21k gas") - transfer.End() - - _, verifying := tracer.Start(ctx, "verifying") - alice.VerifyBalanceLessThan(pre.Sub(transferred)) // less than, because of the tx fee - bob.VerifyBalanceExact(transferred) - verifying.End() -} diff --git a/op-devstack/presets/interop.go b/op-devstack/presets/interop.go index bb3a455677f..a0da5b05a6b 100644 --- a/op-devstack/presets/interop.go +++ b/op-devstack/presets/interop.go @@ -181,25 +181,6 @@ func WithInteropNotAtGenesis() Option { return WithRequireInteropNotAtGenesis() } -type MultiSupervisorInterop struct { - SimpleInterop - - // Supervisor does not support multinode so need a additional supervisor for verifier nodes - SupervisorSecondary *dsl.Supervisor - - L2ELA2 *dsl.L2ELNode - L2CLA2 *dsl.L2CLNode - L2ELB2 *dsl.L2ELNode - L2CLB2 *dsl.L2CLNode -} - -// NewMultiSupervisorInterop initializes a fresh multi-supervisor interop target for the -// current test. -func NewMultiSupervisorInterop(t devtest.T, opts ...Option) *MultiSupervisorInterop { - _, _ = collectSupportedPresetConfig(t, "NewMultiSupervisorInterop", opts, 0) - return multiSupervisorInteropFromRuntime(t, sysgo.NewMultiSupervisorInteropRuntime(t)) -} - // MinimalInteropNoSupervisor is like Minimal but with interop contracts deployed. // No supervisor is running - this tests interop contract deployment with local finality. type MinimalInteropNoSupervisor struct { diff --git a/op-devstack/presets/interop_from_runtime.go b/op-devstack/presets/interop_from_runtime.go index c9e917ce091..fcb3602fb73 100644 --- a/op-devstack/presets/interop_from_runtime.go +++ b/op-devstack/presets/interop_from_runtime.go @@ -144,70 +144,3 @@ func simpleInteropFromRuntime(t devtest.T, runtime *sysgo.MultiChainRuntime) *Si out.FunderB = dsl.NewFunder(out.Wallet, out.FaucetB, out.L2ELB) return out } - -func multiSupervisorInteropFromRuntime(t devtest.T, runtime *sysgo.MultiChainRuntime) *MultiSupervisorInterop { - simpleInterop := simpleInteropFromRuntime(t, runtime) - chainA := runtime.Chains["l2a"] - chainB := runtime.Chains["l2b"] - t.Require().NotNil(chainA, "missing l2a interop chain") - t.Require().NotNil(chainB, "missing l2b interop chain") - t.Require().NotNil(chainA.Followers, "missing l2a followers") - t.Require().NotNil(chainB.Followers, "missing l2b followers") - l2A2 := chainA.Followers["verifier"] - l2B2 := chainB.Followers["verifier"] - t.Require().NotNil(l2A2, "missing l2a verifier follower") - t.Require().NotNil(l2B2, "missing l2b verifier follower") - l2AChainID := chainA.Network.ChainID() - l2BChainID := chainB.Network.ChainID() - - l2ELA2 := newL2ELFrontend( - t, - "verifier", - l2AChainID, - l2A2.EL.UserRPC(), - l2A2.EL.EngineRPC(), - l2A2.EL.JWTPath(), - chainA.Network.RollupConfig(), - l2A2.EL, - ) - l2CLA2 := newL2CLFrontend(t, "verifier", l2AChainID, l2A2.CL.UserRPC(), l2A2.CL) - l2CLA2.attachEL(l2ELA2) - - l2ELB2 := newL2ELFrontend( - t, - "verifier", - l2BChainID, - l2B2.EL.UserRPC(), - l2B2.EL.EngineRPC(), - l2B2.EL.JWTPath(), - chainB.Network.RollupConfig(), - l2B2.EL, - ) - l2CLB2 := newL2CLFrontend(t, "verifier", l2BChainID, l2B2.CL.UserRPC(), l2B2.CL) - l2CLB2.attachEL(l2ELB2) - - l2ANet, ok := simpleInterop.L2ChainA.Escape().(*presetL2Network) - t.Require().True(ok, "expected preset L2 network A") - l2ANet.AddL2ELNode(l2ELA2) - l2ANet.AddL2CLNode(l2CLA2) - l2BNet, ok := simpleInterop.L2ChainB.Escape().(*presetL2Network) - t.Require().True(ok, "expected preset L2 network B") - l2BNet.AddL2ELNode(l2ELB2) - l2BNet.AddL2CLNode(l2CLB2) - - supervisorSecondary := newSupervisorFrontend( - t, - "2-secondary", - runtime.SecondarySupervisor.UserRPC(), - runtime.SecondarySupervisor, - ) - - return &MultiSupervisorInterop{ - SimpleInterop: *simpleInterop, - SupervisorSecondary: dsl.NewSupervisor(supervisorSecondary), - L2ELA2: dsl.NewL2ELNode(l2ELA2), - L2CLA2: dsl.NewL2CLNode(l2CLA2), - L2ELB2: dsl.NewL2ELNode(l2ELB2), - L2CLB2: dsl.NewL2CLNode(l2CLB2), - } -} diff --git a/op-devstack/sysgo/multichain_supervisor_runtime.go b/op-devstack/sysgo/multichain_supervisor_runtime.go index cd30b86934d..9ea22183f9a 100644 --- a/op-devstack/sysgo/multichain_supervisor_runtime.go +++ b/op-devstack/sysgo/multichain_supervisor_runtime.go @@ -224,82 +224,6 @@ func validateSimpleInteropPresetConfig(t devtest.T, cfg PresetConfig, l2Nets ... } } -func NewMultiSupervisorInteropRuntime(t devtest.T) *MultiChainRuntime { - runtime := NewSimpleInteropRuntime(t) - chainA := runtime.Chains["l2a"] - chainB := runtime.Chains["l2b"] - t.Require().NotNil(chainA, "missing l2a interop chain") - t.Require().NotNil(chainB, "missing l2b interop chain") - - supervisorSecondary := startSupervisor( - t, - "2-secondary", - runtime.L1EL, - runtime.FullConfigSet, - map[eth.ChainID]*rollup.Config{ - chainA.Network.ChainID(): chainA.Network.rollupCfg, - chainB.Network.ChainID(): chainB.Network.rollupCfg, - }, - ) - - l2A2EL := startL2ELNodeWithSupervisor( - t, - chainA.Network, - chainA.EL.JWTPath(), - readJWTSecretFromPath(t, chainA.EL.JWTPath()), - "verifier", - NewELNodeIdentity(0), - supervisorSecondary.UserRPC(), - ) - l2A2CL := startL2CLNode(t, runtime.Keys, runtime.L1Network, chainA.Network, runtime.L1EL, runtime.L1CL, l2A2EL, readJWTSecretFromPath(t, chainA.EL.JWTPath()), l2CLNodeStartConfig{ - Key: "verifier", - IsSequencer: false, - NoDiscovery: true, - EnableReqResp: true, - UseReqResp: true, - IndexingMode: true, - DependencySet: runtime.DependencySet, - L2FollowSource: "", - }) - - l2B2EL := startL2ELNodeWithSupervisor( - t, - chainB.Network, - chainB.EL.JWTPath(), - readJWTSecretFromPath(t, chainB.EL.JWTPath()), - "verifier", - NewELNodeIdentity(0), - supervisorSecondary.UserRPC(), - ) - l2B2CL := startL2CLNode(t, runtime.Keys, runtime.L1Network, chainB.Network, runtime.L1EL, runtime.L1CL, l2B2EL, readJWTSecretFromPath(t, chainB.EL.JWTPath()), l2CLNodeStartConfig{ - Key: "verifier", - IsSequencer: false, - NoDiscovery: true, - EnableReqResp: true, - UseReqResp: true, - IndexingMode: true, - DependencySet: runtime.DependencySet, - L2FollowSource: "", - }) - - connectL2CLPeers(t, t.Logger(), chainA.CL, l2A2CL) - connectL2CLPeers(t, t.Logger(), chainB.CL, l2B2CL) - - connectManagedL2CLToSupervisor(t, supervisorSecondary, l2A2CL) - connectManagedL2CLToSupervisor(t, supervisorSecondary, l2B2CL) - - if chainA.Followers == nil { - chainA.Followers = make(map[string]*SingleChainNodeRuntime) - } - if chainB.Followers == nil { - chainB.Followers = make(map[string]*SingleChainNodeRuntime) - } - chainA.Followers["verifier"] = &SingleChainNodeRuntime{Name: "verifier", EL: l2A2EL, CL: l2A2CL} - chainB.Followers["verifier"] = &SingleChainNodeRuntime{Name: "verifier", EL: l2B2EL, CL: l2B2CL} - runtime.SecondarySupervisor = supervisorSecondary - return runtime -} - func startSupervisor( t devtest.T, supervisorName string, diff --git a/op-devstack/sysgo/runtime_state.go b/op-devstack/sysgo/runtime_state.go index 5c08657cf79..60d7d8b49b4 100644 --- a/op-devstack/sysgo/runtime_state.go +++ b/op-devstack/sysgo/runtime_state.go @@ -143,9 +143,8 @@ type MultiChainRuntime struct { Chains map[string]*MultiChainNodeRuntime - PrimarySupervisor Supervisor - SecondarySupervisor Supervisor - Supernode *SuperNode + PrimarySupervisor Supervisor + Supernode *SuperNode FaucetService *faucet.Service TimeTravel *clock.AdvancingClock