Commit da9c9585 authored by Adrian Sutton's avatar Adrian Sutton

op-e2e: Wait for dispute game factory creation tx to be included, not just pending

parent 4862c2e6
...@@ -7,6 +7,7 @@ import ( ...@@ -7,6 +7,7 @@ import (
"github.com/ethereum-optimism/optimism/op-bindings/bindings" "github.com/ethereum-optimism/optimism/op-bindings/bindings"
"github.com/ethereum-optimism/optimism/op-chain-ops/deployer" "github.com/ethereum-optimism/optimism/op-chain-ops/deployer"
"github.com/ethereum-optimism/optimism/op-service/client/utils"
"github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/ethclient" "github.com/ethereum/go-ethereum/ethclient"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
...@@ -55,7 +56,11 @@ func deployDisputeGameContracts(require *require.Assertions, ctx context.Context ...@@ -55,7 +56,11 @@ func deployDisputeGameContracts(require *require.Assertions, ctx context.Context
require.NoError(err) require.NoError(err)
// Set the fault game type implementation // Set the fault game type implementation
_, err = factory.SetImplementation(opts, faultGameType, faultDisputeGameAddr) tx, err = factory.SetImplementation(opts, faultGameType, faultDisputeGameAddr)
require.NoError(err) require.NoError(err)
_, err = utils.WaitReceiptOK(ctx, client, tx.Hash())
require.NoError(err, "wait for final transaction to be included and OK")
return factory return factory
} }
...@@ -69,11 +69,11 @@ func (h *FactoryHelper) StartAlphabetGame(ctx context.Context, claimedAlphabet s ...@@ -69,11 +69,11 @@ func (h *FactoryHelper) StartAlphabetGame(ctx context.Context, claimedAlphabet s
defer cancel() defer cancel()
trace := alphabet.NewAlphabetProvider(claimedAlphabet, 4) trace := alphabet.NewAlphabetProvider(claimedAlphabet, 4)
rootClaim, err := trace.Get(lastAlphabetTraceIndex) rootClaim, err := trace.Get(lastAlphabetTraceIndex)
h.require.NoError(err) h.require.NoError(err, "get root claim")
tx, err := h.factory.Create(h.opts, faultGameType, rootClaim, alphaExtraData) tx, err := h.factory.Create(h.opts, faultGameType, rootClaim, alphaExtraData)
h.require.NoError(err) h.require.NoError(err, "create fault dispute game")
rcpt, err := utils.WaitReceiptOK(ctx, h.client, tx.Hash()) rcpt, err := utils.WaitReceiptOK(ctx, h.client, tx.Hash())
h.require.NoError(err) h.require.NoError(err, "wait for create fault dispute game receipt to be OK")
h.require.Len(rcpt.Logs, 1, "should have emitted a single DisputeGameCreated event") h.require.Len(rcpt.Logs, 1, "should have emitted a single DisputeGameCreated event")
createdEvent, err := h.factory.ParseDisputeGameCreated(*rcpt.Logs[0]) createdEvent, err := h.factory.ParseDisputeGameCreated(*rcpt.Logs[0])
h.require.NoError(err) h.require.NoError(err)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment