Commit b1338fe5 authored by Sebastian Stammler's avatar Sebastian Stammler Committed by GitHub

op-e2e: fix flaky TestCustomGasToken (#10657)

parent 72f29a8d
...@@ -5,6 +5,7 @@ import ( ...@@ -5,6 +5,7 @@ import (
"fmt" "fmt"
"math/big" "math/big"
"testing" "testing"
"time"
"github.com/ethereum-optimism/optimism/op-e2e/bindings" "github.com/ethereum-optimism/optimism/op-e2e/bindings"
"github.com/ethereum-optimism/optimism/op-e2e/e2eutils" "github.com/ethereum-optimism/optimism/op-e2e/e2eutils"
...@@ -17,6 +18,7 @@ import ( ...@@ -17,6 +18,7 @@ import (
"github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethclient" "github.com/ethereum/go-ethereum/ethclient"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )
...@@ -116,11 +118,13 @@ func TestCustomGasToken(t *testing.T) { ...@@ -116,11 +118,13 @@ func TestCustomGasToken(t *testing.T) {
_, err = wait.ForReceiptOK(context.Background(), l2Client, types.NewTx(depositTx).Hash()) _, err = wait.ForReceiptOK(context.Background(), l2Client, types.NewTx(depositTx).Hash())
require.NoError(t, err) require.NoError(t, err)
// check for balance increase on L2 require.EventuallyWithT(t, func(t *assert.CollectT) {
newL2Balance, err := l2Client.BalanceAt(context.Background(), recipient, nil) // check for balance increase on L2
require.NoError(t, err) newL2Balance, err := l2Client.BalanceAt(context.Background(), recipient, nil)
l2BalanceIncrease := big.NewInt(0).Sub(newL2Balance, previousL2Balance) require.NoError(t, err)
require.Equal(t, amountToBridge, l2BalanceIncrease) l2BalanceIncrease := big.NewInt(0).Sub(newL2Balance, previousL2Balance)
require.Equal(t, amountToBridge, l2BalanceIncrease)
}, 10*time.Second, 1*time.Second)
} else { } else {
require.Error(t, err) require.Error(t, err)
} }
...@@ -129,7 +133,6 @@ func TestCustomGasToken(t *testing.T) { ...@@ -129,7 +133,6 @@ func TestCustomGasToken(t *testing.T) {
// Function to prepare and execute withdrawal flow for CGTs // Function to prepare and execute withdrawal flow for CGTs
// and assert token balance is increased on L1. // and assert token balance is increased on L1.
checkWithdrawal := func(t *testing.T) { checkWithdrawal := func(t *testing.T) {
l2Seq := l2Client l2Seq := l2Client
l2Verif := sys.Clients["verifier"] l2Verif := sys.Clients["verifier"]
fromAddr := aliceOpts.From fromAddr := aliceOpts.From
......
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