Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test flatCallTracer on Arbitrum blocks inside existing tests #2676

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Changes from 6 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
21 changes: 21 additions & 0 deletions system_tests/retryable_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@ import (
"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/eth/gasestimator"
"github.com/ethereum/go-ethereum/eth/tracers"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/rpc"
"github.com/offchainlabs/nitro/arbnode"
"github.com/offchainlabs/nitro/arbos"
"github.com/offchainlabs/nitro/arbos/arbostypes"
Expand Down Expand Up @@ -237,6 +240,7 @@ func TestSubmitRetryableImmediateSuccess(t *testing.T) {
if !arbmath.BigEquals(l2balance, callValue) {
Fatal(t, "Unexpected balance:", l2balance)
}
testFlatCallTracer(t, ctx, builder.L2.Client.Client())
}

func testSubmitRetryableEmptyEscrow(t *testing.T, arbosVersion uint64) {
Expand Down Expand Up @@ -421,6 +425,7 @@ func TestSubmitRetryableFailThenRetry(t *testing.T) {
if parsed.Redeemer != ownerTxOpts.From {
Fatal(t, "Unexpected redeemer", parsed.Redeemer, "expected", ownerTxOpts.From)
}
testFlatCallTracer(t, ctx, builder.L2.Client.Client())
}

func TestGetLifetime(t *testing.T) {
Expand Down Expand Up @@ -747,6 +752,7 @@ func TestDepositETH(t *testing.T) {
if got := new(big.Int); got.Sub(newBalance, oldBalance).Cmp(txOpts.Value) != 0 {
t.Errorf("Got transferred: %v, want: %v", got, txOpts.Value)
}
testFlatCallTracer(t, ctx, builder.L2.Client.Client())
}

func TestArbitrumContractTx(t *testing.T) {
Expand Down Expand Up @@ -798,6 +804,7 @@ func TestArbitrumContractTx(t *testing.T) {
if err != nil {
t.Fatalf("EnsureTxSucceeded(%v) unexpected error: %v", unsignedTx.Hash(), err)
}
testFlatCallTracer(t, ctx, builder.L2.Client.Client())
}

func TestL1FundedUnsignedTransaction(t *testing.T) {
Expand Down Expand Up @@ -870,6 +877,7 @@ func TestL1FundedUnsignedTransaction(t *testing.T) {
if receipt.Status != types.ReceiptStatusSuccessful {
t.Errorf("L2 transaction: %v has failed", receipt.TxHash)
}
testFlatCallTracer(t, ctx, builder.L2.Client.Client())
}

func TestRetryableSubmissionAndRedeemFees(t *testing.T) {
Expand Down Expand Up @@ -1206,3 +1214,16 @@ func setupFeeAddresses(t *testing.T, ctx context.Context, builder *NodeBuilder)
t.Log("Network fee account: ", networkFeeAccount)
return infraFeeAddr, networkFeeAddr
}

func testFlatCallTracer(t *testing.T, ctx context.Context, client rpc.ClientInterface) {
var blockNumber hexutil.Uint64
err := client.CallContext(ctx, &blockNumber, "eth_blockNumber")
Require(t, err)
// #nosec G115
for i := int64(1); i < int64(blockNumber); i++ {
flatCallTracer := "flatCallTracer"
var result interface{}
err = client.CallContext(ctx, result, "debug_traceBlockByNumber", rpc.BlockNumber(i).String(), &tracers.TraceConfig{Tracer: &flatCallTracer})
Require(t, err)
}
}
Loading