Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions op-e2e/interop/interop_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down Expand Up @@ -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())
Expand All @@ -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
Expand Down
13 changes: 7 additions & 6 deletions op-e2e/interop/supersystem.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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{
Expand All @@ -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")

Expand All @@ -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
}
Expand All @@ -813,6 +813,7 @@ func (s *interopE2ESystem) DeployEmitterContract(
}

func (s *interopE2ESystem) EmitData(
ctx context.Context,
id string,
sender string,
data string,
Expand All @@ -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
}
Expand Down