diff --git a/op-e2e/interop/interop_test.go b/op-e2e/interop/interop_test.go index 302413dd98ed8..81f09c125aa4c 100644 --- a/op-e2e/interop/interop_test.go +++ b/op-e2e/interop/interop_test.go @@ -121,7 +121,9 @@ func TestInterop_EmitLogs(t *testing.T) { var emitParallel sync.WaitGroup emitOn := func(chainID string) { for i := 0; i < numEmits; i++ { - s2.EmitData(chainID, "Alice", payload1) + ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) + s2.EmitData(ctx, chainID, "Alice", payload1) + cancel() } emitParallel.Done() } @@ -218,7 +220,9 @@ func TestInteropBlockBuilding(t *testing.T) { // Add chain A as dependency to chain B, // such that we can execute a message on B that was initiated on A. - depRec := s2.AddDependency(chainB, s2.ChainID(chainA)) + ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) + depRec := s2.AddDependency(ctx, chainB, s2.ChainID(chainA)) + cancel() t.Logf("Dependency set in L1 block %d", depRec.BlockNumber) rollupClA, err := dial.DialRollupClientWithTimeout(context.Background(), time.Second*15, logger, s2.OpNode(chainA).UserRPC().RPC()) @@ -233,7 +237,9 @@ func TestInteropBlockBuilding(t *testing.T) { t.Log("Dependency information has been processed in L2 block") // emit log on chain A - emitRec := s2.EmitData(chainA, "Alice", "hello world") + ctx, cancel = context.WithTimeout(context.Background(), 30*time.Second) + emitRec := s2.EmitData(ctx, chainA, "Alice", "hello world") + cancel() t.Logf("Emitted a log event in block %d", emitRec.BlockNumber.Uint64()) // Wait for initiating side to become cross-unsafe diff --git a/op-e2e/interop/supersystem.go b/op-e2e/interop/supersystem.go index de7e25bb9c7b4..8fc663f377a0b 100644 --- a/op-e2e/interop/supersystem.go +++ b/op-e2e/interop/supersystem.go @@ -103,9 +103,9 @@ type SuperSystem interface { // Deploy the Emitter Contract, which emits Event Logs DeployEmitterContract(network string, username string) common.Address // Use the Emitter Contract to emit an Event Log - EmitData(network string, username string, data string) *types.Receipt + EmitData(ctx context.Context, network string, username string, data string) *types.Receipt // AddDependency adds a dependency (by chain ID) to the given chain - AddDependency(network string, dep *big.Int) *types.Receipt + AddDependency(ctx context.Context, network string, dep *big.Int) *types.Receipt // ExecuteMessage calls the CrossL2Inbox executeMessage function ExecuteMessage( ctx context.Context, @@ -767,7 +767,7 @@ func (s *interopE2ESystem) ExecuteMessage( return bind.WaitMined(ctx, s.L2GethClient(id), tx) } -func (s *interopE2ESystem) AddDependency(id string, dep *big.Int) *types.Receipt { +func (s *interopE2ESystem) AddDependency(ctx context.Context, id string, dep *big.Int) *types.Receipt { // There is a note in OPContractsManagerInterop that the proxy-admin is used for now, // even though it should be a separate dependency-set-manager address. secret, err := s.hdWallet.Secret(devkeys.ChainOperatorKey{ @@ -779,7 +779,7 @@ func (s *interopE2ESystem) AddDependency(id string, dep *big.Int) *types.Receipt auth, err := bind.NewKeyedTransactorWithChainID(secret, s.worldOutput.L1.Genesis.Config.ChainID) require.NoError(s.t, err) - balance, err := s.l1GethClient.BalanceAt(context.Background(), crypto.PubkeyToAddress(secret.PublicKey), nil) + balance, err := s.l1GethClient.BalanceAt(ctx, crypto.PubkeyToAddress(secret.PublicKey), nil) require.NoError(s.t, err) require.False(s.t, balance.Sign() == 0, "system config owner needs a balance") @@ -790,7 +790,7 @@ func (s *interopE2ESystem) AddDependency(id string, dep *big.Int) *types.Receipt tx, err := contract.SystemconfigTransactor.AddDependency(auth, dep) require.NoError(s.t, err) - receipt, err := wait.ForReceiptOK(context.Background(), s.L1GethClient(), tx.Hash()) + receipt, err := wait.ForReceiptOK(ctx, s.L1GethClient(), tx.Hash()) require.NoError(s.t, err) return receipt } @@ -813,6 +813,7 @@ func (s *interopE2ESystem) DeployEmitterContract( } func (s *interopE2ESystem) EmitData( + ctx context.Context, id string, sender string, data string, @@ -828,7 +829,7 @@ func (s *interopE2ESystem) EmitData( contract := s.Contract(id, "emitter").(*emit.Emit) tx, err := contract.EmitTransactor.EmitData(auth, []byte(data)) require.NoError(s.t, err) - receipt, err := bind.WaitMined(context.Background(), s.L2GethClient(id), tx) + receipt, err := bind.WaitMined(ctx, s.L2GethClient(id), tx) require.NoError(s.t, err) return receipt }