Skip to content

Commit

Permalink
Changes based on PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
amsanghi committed Jun 21, 2023
1 parent dc01bf6 commit b517b8e
Show file tree
Hide file tree
Showing 19 changed files with 42 additions and 49 deletions.
2 changes: 1 addition & 1 deletion system_tests/bloom_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func TestBloom(t *testing.T) {
nodeconfig := arbnode.ConfigDefaultL2Test()
nodeconfig.RPC.BloomBitsBlocks = 256
nodeconfig.RPC.BloomConfirms = 1
l2info, node, client := CreateTestL2WithConfig(t, ctx, nil, nodeconfig, false)
l2info, node, client := CreateTestL2WithConfig(t, ctx, nil, nodeconfig, false, nil)
defer node.StopAndWait()

l2info.GenerateAccount("User2")
Expand Down
23 changes: 7 additions & 16 deletions system_tests/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -622,32 +622,23 @@ func createTestNodeOnL1WithConfigImpl(

// L2 -Only. Enough for tests that needs no interface to L1
// Requires precompiles.AllowDebugPrecompiles = true
func CreateTestL2(t *testing.T, ctx context.Context) (*BlockchainTestInfo, *arbnode.Node, *ethclient.Client) {
return CreateTestL2WithArbOS(t, ctx, 11)
}

func CreateTestL2WithArbOS(t *testing.T, ctx context.Context, arbOS uint64) (*BlockchainTestInfo, *arbnode.Node, *ethclient.Client) {
return CreateTestL2WithConfigArbOS(t, ctx, nil, arbnode.ConfigDefaultL2Test(), true, arbOS)
func CreateTestL2(t *testing.T, ctx context.Context, chainConfig *params.ChainConfig) (*BlockchainTestInfo, *arbnode.Node, *ethclient.Client) {
return CreateTestL2WithConfig(t, ctx, nil, arbnode.ConfigDefaultL2Test(), true, chainConfig)
}

func CreateTestL2WithConfig(
t *testing.T, ctx context.Context, l2Info *BlockchainTestInfo, nodeConfig *arbnode.Config, takeOwnership bool,
) (*BlockchainTestInfo, *arbnode.Node, *ethclient.Client) {
return CreateTestL2WithConfigArbOS(t, ctx, l2Info, nodeConfig, takeOwnership, 11)
}

func CreateTestL2WithConfigArbOS(
t *testing.T, ctx context.Context, l2Info *BlockchainTestInfo, nodeConfig *arbnode.Config, takeOwnership bool, arbOS uint64,
t *testing.T, ctx context.Context, l2Info *BlockchainTestInfo, nodeConfig *arbnode.Config, takeOwnership bool, chainConfig *params.ChainConfig,
) (*BlockchainTestInfo, *arbnode.Node, *ethclient.Client) {
feedErrChan := make(chan error, 10)

AddDefaultValNode(t, ctx, nodeConfig, true)
chainConfig := params.ArbitrumDevTestChainConfig()
chainConfig.ArbitrumChainParams.InitialArbOSVersion = arbOS

if chainConfig == nil {
chainConfig = params.ArbitrumDevTestChainConfig()
}
l2info, stack, chainDb, arbDb, blockchain := createL2BlockChain(t, l2Info, "", chainConfig)
currentNode, err := arbnode.CreateNode(ctx, stack, chainDb, arbDb, NewFetcherFromConfig(nodeConfig), blockchain, nil, nil, nil, nil, nil, feedErrChan)
Require(t, err)

// Give the node an init message
err = currentNode.TxStreamer.AddFakeInitMessage()
Require(t, err)
Expand Down
2 changes: 1 addition & 1 deletion system_tests/conditionaltx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ func TestSendRawTransactionConditionalBasic(t *testing.T) {
func TestSendRawTransactionConditionalMultiRoutine(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
l2info, node, client := CreateTestL2(t, ctx)
l2info, node, client := CreateTestL2(t, ctx, nil)
defer node.StopAndWait()
rpcClient, err := node.Stack.Attach()
Require(t, err)
Expand Down
2 changes: 1 addition & 1 deletion system_tests/contract_tx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func TestContractTxDeploy(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
nodeconfig := arbnode.ConfigDefaultL2Test()
l2info, node, client := CreateTestL2WithConfig(t, ctx, nil, nodeconfig, false)
l2info, node, client := CreateTestL2WithConfig(t, ctx, nil, nodeconfig, false, nil)
defer node.StopAndWait()

from := common.HexToAddress("0x123412341234")
Expand Down
16 changes: 9 additions & 7 deletions system_tests/estimation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func TestDeploy(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()

l2info, node, client := CreateTestL2(t, ctx)
l2info, node, client := CreateTestL2(t, ctx, nil)
defer node.StopAndWait()

auth := l2info.GetDefaultTransactOpts("Owner", ctx)
Expand All @@ -51,7 +51,7 @@ func TestEstimate(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()

l2info, node, client := CreateTestL2(t, ctx)
l2info, node, client := CreateTestL2(t, ctx, nil)
defer node.StopAndWait()

auth := l2info.GetDefaultTransactOpts("Owner", ctx)
Expand Down Expand Up @@ -131,7 +131,7 @@ func TestDifficultyForLatestArbOS(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()

l2info, node, client := CreateTestL2(t, ctx)
l2info, node, client := CreateTestL2(t, ctx, nil)
defer node.StopAndWait()

auth := l2info.GetDefaultTransactOpts("Owner", ctx)
Expand All @@ -143,15 +143,17 @@ func TestDifficultyForLatestArbOS(t *testing.T) {
difficulty, err := simple.GetBlockDifficulty(&bind.CallOpts{})
Require(t, err)
if arbmath.BigEquals(difficulty, common.Big1) {
Fail(t, "Expected difficulty to be 1 by got:", difficulty)
Fatal(t, "Expected difficulty to be 1 by got:", difficulty)
}
}

func TestDifficultyForArbOSTen(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()

l2info, node, client := CreateTestL2WithArbOS(t, ctx, 10)
chainConfig := params.ArbitrumDevTestChainConfig()
chainConfig.ArbitrumChainParams.InitialArbOSVersion = 10
l2info, node, client := CreateTestL2(t, ctx, chainConfig)
defer node.StopAndWait()

auth := l2info.GetDefaultTransactOpts("Owner", ctx)
Expand All @@ -163,15 +165,15 @@ func TestDifficultyForArbOSTen(t *testing.T) {
difficulty, err := simple.GetBlockDifficulty(&bind.CallOpts{})
Require(t, err)
if arbmath.BigEquals(difficulty, common.Big1) {
Fail(t, "Expected difficulty to be 1 by got:", difficulty)
Fatal(t, "Expected difficulty to be 1 by got:", difficulty)
}
}

func TestComponentEstimate(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()

l2info, node, client := CreateTestL2(t, ctx)
l2info, node, client := CreateTestL2(t, ctx, nil)
defer node.StopAndWait()

l1BaseFee := new(big.Int).Set(arbostypes.DefaultInitialL1BaseFee)
Expand Down
2 changes: 1 addition & 1 deletion system_tests/infra_fee_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func TestInfraFee(t *testing.T) {
defer cancel()
nodeconfig := arbnode.ConfigDefaultL2Test()

l2info, node, client := CreateTestL2WithConfig(t, ctx, nil, nodeconfig, true)
l2info, node, client := CreateTestL2WithConfig(t, ctx, nil, nodeconfig, true, nil)
defer node.StopAndWait()

l2info.GenerateAccount("User2")
Expand Down
2 changes: 1 addition & 1 deletion system_tests/initialization_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func TestInitContract(t *testing.T) {
l2info.ArbInitData.Accounts = append(l2info.ArbInitData.Accounts, accountInfo)
expectedSums[accountAddress] = sum
}
_, node, client := CreateTestL2WithConfig(t, ctx, l2info, arbnode.ConfigDefaultL2Test(), true)
_, node, client := CreateTestL2WithConfig(t, ctx, l2info, arbnode.ConfigDefaultL2Test(), true, nil)
defer node.StopAndWait()

for accountAddress, sum := range expectedSums {
Expand Down
2 changes: 1 addition & 1 deletion system_tests/log_subscription_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func TestLogSubscription(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()

l2info, node, client := CreateTestL2(t, ctx)
l2info, node, client := CreateTestL2(t, ctx, nil)
defer node.StopAndWait()

auth := l2info.GetDefaultTransactOpts("Owner", ctx)
Expand Down
2 changes: 1 addition & 1 deletion system_tests/outbox_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func TestOutboxProofs(t *testing.T) {
withdrawTopic := arbSysAbi.Events["L2ToL1Tx"].ID
merkleTopic := arbSysAbi.Events["SendMerkleUpdate"].ID

l2info, node, client := CreateTestL2(t, ctx)
l2info, node, client := CreateTestL2(t, ctx, nil)
defer node.StopAndWait()

auth := l2info.GetDefaultTransactOpts("Owner", ctx)
Expand Down
8 changes: 4 additions & 4 deletions system_tests/precompile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func TestPurePrecompileMethodCalls(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()

_, node, client := CreateTestL2(t, ctx)
_, node, client := CreateTestL2(t, ctx, nil)
defer node.StopAndWait()

arbSys, err := precompilesgen.NewArbSys(common.HexToAddress("0x64"), client)
Expand All @@ -37,7 +37,7 @@ func TestViewLogReverts(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()

_, node, client := CreateTestL2(t, ctx)
_, node, client := CreateTestL2(t, ctx, nil)
defer node.StopAndWait()

arbDebug, err := precompilesgen.NewArbDebug(common.HexToAddress("0xff"), client)
Expand All @@ -53,7 +53,7 @@ func TestCustomSolidityErrors(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()

_, node, client := CreateTestL2(t, ctx)
_, node, client := CreateTestL2(t, ctx, nil)
defer node.StopAndWait()

callOpts := &bind.CallOpts{Context: ctx}
Expand Down Expand Up @@ -86,7 +86,7 @@ func TestPrecompileErrorGasLeft(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()

info, node, client := CreateTestL2(t, ctx)
info, node, client := CreateTestL2(t, ctx, nil)
defer node.StopAndWait()

auth := info.GetDefaultTransactOpts("Faucet", ctx)
Expand Down
2 changes: 1 addition & 1 deletion system_tests/reorg_resequencing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func TestReorgResequencing(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()

l2info, node, client := CreateTestL2(t, ctx)
l2info, node, client := CreateTestL2(t, ctx, nil)
defer node.StopAndWait()

startMsgCount, err := node.TxStreamer.GetMessageCount()
Expand Down
2 changes: 1 addition & 1 deletion system_tests/retryable_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func retryableSetup(t *testing.T) (
func TestRetryableNoExist(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
_, node, l2client := CreateTestL2(t, ctx)
_, node, l2client := CreateTestL2(t, ctx, nil)
defer node.StopAndWait()

arbRetryableTx, err := precompilesgen.NewArbRetryableTx(common.HexToAddress("6e"), l2client)
Expand Down
2 changes: 1 addition & 1 deletion system_tests/seq_coordinator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func TestRedisSeqCoordinatorPriorities(t *testing.T) {

createStartNode := func(nodeNum int) {
nodeConfig.SeqCoordinator.MyUrlImpl = nodeNames[nodeNum]
_, node, _ := CreateTestL2WithConfig(t, ctx, l2Info, nodeConfig, false)
_, node, _ := CreateTestL2WithConfig(t, ctx, l2Info, nodeConfig, false, nil)
nodes[nodeNum] = node
}

Expand Down
6 changes: 3 additions & 3 deletions system_tests/seq_nonce_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func TestSequencerParallelNonces(t *testing.T) {

config := arbnode.ConfigDefaultL2Test()
config.Sequencer.NonceFailureCacheExpiry = time.Minute
l2info, node, client := CreateTestL2WithConfig(t, ctx, nil, config, false)
l2info, node, client := CreateTestL2WithConfig(t, ctx, nil, config, false, nil)
defer node.StopAndWait()

l2info.GenerateAccount("Destination")
Expand Down Expand Up @@ -63,7 +63,7 @@ func TestSequencerNonceTooHigh(t *testing.T) {
defer cancel()

config := arbnode.ConfigDefaultL2Test()
l2info, node, client := CreateTestL2WithConfig(t, ctx, nil, config, false)
l2info, node, client := CreateTestL2WithConfig(t, ctx, nil, config, false, nil)
defer node.StopAndWait()

l2info.GetInfoWithPrivKey("Owner").Nonce++
Expand Down Expand Up @@ -91,7 +91,7 @@ func TestSequencerNonceTooHighQueueFull(t *testing.T) {
config := arbnode.ConfigDefaultL2Test()
config.Sequencer.NonceFailureCacheSize = 5
config.Sequencer.NonceFailureCacheExpiry = time.Minute
l2info, node, client := CreateTestL2WithConfig(t, ctx, nil, config, false)
l2info, node, client := CreateTestL2WithConfig(t, ctx, nil, config, false, nil)
defer node.StopAndWait()

count := 15
Expand Down
2 changes: 1 addition & 1 deletion system_tests/seq_pause_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func TestSequencerPause(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()

l2info1, nodeA, client := CreateTestL2(t, ctx)
l2info1, nodeA, client := CreateTestL2(t, ctx, nil)
defer nodeA.StopAndWait()

const numUsers = 100
Expand Down
4 changes: 2 additions & 2 deletions system_tests/seq_reject_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ func TestSequencerRejection(t *testing.T) {
seqNodeConfig := arbnode.ConfigDefaultL2Test()
seqNodeConfig.Feed.Output = *newBroadcasterConfigTest()
feedErrChan := make(chan error, 10)
l2info1, nodeA, client1 := CreateTestL2WithConfig(t, ctx, nil, seqNodeConfig, true)
l2info1, nodeA, client1 := CreateTestL2WithConfig(t, ctx, nil, seqNodeConfig, true, nil)
defer nodeA.StopAndWait()

clientNodeConfig := arbnode.ConfigDefaultL2Test()
port := nodeA.BroadcastServer.ListenerAddr().(*net.TCPAddr).Port
clientNodeConfig.Feed.Input = *newBroadcastClientConfigTest(port)

_, nodeB, client2 := CreateTestL2WithConfig(t, ctx, nil, clientNodeConfig, false)
_, nodeB, client2 := CreateTestL2WithConfig(t, ctx, nil, clientNodeConfig, false, nil)
defer nodeB.StopAndWait()

auth := l2info1.GetDefaultTransactOpts("Owner", ctx)
Expand Down
2 changes: 1 addition & 1 deletion system_tests/seq_whitelist_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func TestSequencerWhitelist(t *testing.T) {

config := arbnode.ConfigDefaultL2Test()
config.Sequencer.SenderWhitelist = GetTestAddressForAccountName(t, "Owner").String() + "," + GetTestAddressForAccountName(t, "User").String()
l2info, l2node, client := CreateTestL2WithConfig(t, ctx, nil, config, true)
l2info, l2node, client := CreateTestL2WithConfig(t, ctx, nil, config, true, nil)
defer l2node.StopAndWait()

l2info.GenerateAccount("User")
Expand Down
8 changes: 4 additions & 4 deletions system_tests/seqfeed_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ func TestSequencerFeed(t *testing.T) {

seqNodeConfig := arbnode.ConfigDefaultL2Test()
seqNodeConfig.Feed.Output = *newBroadcasterConfigTest()
l2info1, nodeA, client1 := CreateTestL2WithConfig(t, ctx, nil, seqNodeConfig, true)
l2info1, nodeA, client1 := CreateTestL2WithConfig(t, ctx, nil, seqNodeConfig, true, nil)
defer nodeA.StopAndWait()
clientNodeConfig := arbnode.ConfigDefaultL2Test()
port := nodeA.BroadcastServer.ListenerAddr().(*net.TCPAddr).Port
clientNodeConfig.Feed.Input = *newBroadcastClientConfigTest(port)

_, nodeB, client2 := CreateTestL2WithConfig(t, ctx, nil, clientNodeConfig, false)
_, nodeB, client2 := CreateTestL2WithConfig(t, ctx, nil, clientNodeConfig, false, nil)
defer nodeB.StopAndWait()

l2info1.GenerateAccount("User2")
Expand Down Expand Up @@ -79,7 +79,7 @@ func TestRelayedSequencerFeed(t *testing.T) {

seqNodeConfig := arbnode.ConfigDefaultL2Test()
seqNodeConfig.Feed.Output = *newBroadcasterConfigTest()
l2info1, nodeA, client1 := CreateTestL2WithConfig(t, ctx, nil, seqNodeConfig, true)
l2info1, nodeA, client1 := CreateTestL2WithConfig(t, ctx, nil, seqNodeConfig, true, nil)
defer nodeA.StopAndWait()

bigChainId, err := client1.ChainID(ctx)
Expand All @@ -101,7 +101,7 @@ func TestRelayedSequencerFeed(t *testing.T) {
clientNodeConfig := arbnode.ConfigDefaultL2Test()
port = currentRelay.GetListenerAddr().(*net.TCPAddr).Port
clientNodeConfig.Feed.Input = *newBroadcastClientConfigTest(port)
_, nodeC, client3 := CreateTestL2WithConfig(t, ctx, nil, clientNodeConfig, false)
_, nodeC, client3 := CreateTestL2WithConfig(t, ctx, nil, clientNodeConfig, false, nil)
defer nodeC.StopAndWait()
StartWatchChanErr(t, ctx, feedErrChan, nodeC)

Expand Down
2 changes: 1 addition & 1 deletion system_tests/transfer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
func TestTransfer(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
l2info, l2node, client := CreateTestL2(t, ctx)
l2info, l2node, client := CreateTestL2(t, ctx, nil)
defer l2node.StopAndWait()

l2info.GenerateAccount("User2")
Expand Down

0 comments on commit b517b8e

Please sign in to comment.