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
6 changes: 2 additions & 4 deletions op-acceptance-tests/tests/base/deposit/deposit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ import (
supervisorTypes "github.com/ethereum-optimism/optimism/op-supervisor/supervisor/types"
)

func TestMain(m *testing.M) {
presets.DoMain(m, presets.WithMinimal())
}

func TestL1ToL2Deposit(gt *testing.T) {
// Create a test environment using op-devstack
t := devtest.SerialT(gt)
Expand All @@ -30,6 +26,8 @@ func TestL1ToL2Deposit(gt *testing.T) {
fundingAmount := eth.ThreeHundredthsEther
alice := sys.FunderL1.NewFundedEOA(fundingAmount)
t.Log("Alice L1 address", alice.Address())

alice.WaitForBalance(fundingAmount)
initialBalance := alice.GetBalance()
t.Log("Alice L1 balance", initialBalance)

Expand Down
11 changes: 11 additions & 0 deletions op-acceptance-tests/tests/base/deposit/init_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package deposit

import (
"testing"

"github.com/ethereum-optimism/optimism/op-devstack/presets"
)

func TestMain(m *testing.M) {
presets.DoMain(m, presets.WithMinimal())
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ func TestERC20Bridge(gt *testing.T) {
depositCall := wethContract.Deposit()
contract.Write(l1User, depositCall, txplan.WithValue(mintAmount))

l1User.VerifyTokenBalance(l1TokenAddress, mintAmount)
l1User.WaitForTokenBalance(l1TokenAddress, mintAmount)
t.Logger().Info("User has WETH tokens on L1", "balance", mintAmount)

bridge := dsl.NewStandardBridge(t, sys.L2Chain, nil, sys.L1EL)
l2TokenAddress := bridge.CreateL2Token(l1TokenAddress, "L2 WETH", "L2WETH", l2User)
t.Logger().Info("Created L2 token", "address", l2TokenAddress)

l2User.VerifyTokenBalance(l2TokenAddress, eth.ZeroWei)
l2User.WaitForTokenBalance(l2TokenAddress, eth.ZeroWei)

l1BridgeAddress := sys.L2Chain.Escape().Deployment().L1StandardBridgeProxyAddr()

Expand All @@ -63,7 +63,6 @@ func TestERC20Bridge(gt *testing.T) {
t.Logger().Info("Waiting for deposit to be processed on L2...")
l2User.WaitForTokenBalance(l2TokenAddress, bridgeAmount)

l2User.VerifyTokenBalance(l2TokenAddress, bridgeAmount)
t.Logger().Info("Successfully verified tokens on L2", "balance", bridgeAmount)

t.Logger().Info("ERC20 bridge test completed successfully!")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,25 @@ import (
"github.com/ethereum-optimism/optimism/op-service/eth"
)

func TestOperatorFeeDevstack(gt *testing.T) {
func TestOperatorFee(gt *testing.T) {
t := devtest.SerialT(gt)
sys := presets.NewMinimal(t)
require := t.Require()

err := dsl.RequiresL2Fork(t.Ctx(), sys, 0, rollup.Isthmus)
require.NoError(err, "Isthmus fork must be active for this test")

alice := sys.FunderL2.NewFundedEOA(eth.OneTenthEther)
fundAmount := eth.OneTenthEther
alice := sys.FunderL2.NewFundedEOA(fundAmount)

alice.WaitForBalance(fundAmount)
bob := sys.Wallet.NewEOA(sys.L2EL)

operatorFee := dsl.NewOperatorFee(t, sys.L2Chain, sys.L1EL)

operatorFee.CheckCompatibility()
systemOwner := operatorFee.GetSystemOwner()
sys.FunderL1.FundAtLeast(systemOwner, eth.OneTenthEther)
sys.FunderL1.FundAtLeast(systemOwner, fundAmount)

// First, ensure L2 is synced with current L1 state before starting tests
t.Log("Ensuring L2 is synced with current L1 state...")
Expand Down
4 changes: 2 additions & 2 deletions op-devstack/dsl/eoa.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ func (u *EOA) VerifyBalanceAtLeast(v eth.ETH) {

func (u *EOA) WaitForBalance(v eth.ETH) {
u.t.Require().Eventually(func() bool {
u.VerifyBalanceExact(v)
return true
actual := u.balance()
return actual == v
}, u.el.stackEL().TransactionTimeout(), time.Second, "awaiting balance to be updated")
}

Expand Down
3 changes: 3 additions & 0 deletions op-devstack/dsl/funder.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ func (f *Funder) FundAtLeast(wallet *EOA, amount eth.ETH) eth.ETH {
if currentBalance.Lt(amount) {
missing := amount.Sub(currentBalance)
f.faucet.Fund(wallet.Address(), missing)
finalBalance := currentBalance.Add(missing)
wallet.WaitForBalance(finalBalance)
return finalBalance
}
return currentBalance
}