Skip to content

Commit e167107

Browse files
Enable ArbOS 50 in system tests (#3550)
* Enable ArbOS 50 in system tests * fix remaining tests * code refactor * fix TestTimeboostTxsTimeoutByBlock system test
1 parent 2027db3 commit e167107

File tree

9 files changed

+78
-33
lines changed

9 files changed

+78
-33
lines changed

cmd/chaininfo/arbitrum_chain_info.json

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@
170170
"EnableArbOS": true,
171171
"AllowDebugPrecompiles": true,
172172
"DataAvailabilityCommittee": false,
173-
"InitialArbOSVersion": 40,
173+
"InitialArbOSVersion": 50,
174174
"InitialChainOwner": "0x0000000000000000000000000000000000000000",
175175
"GenesisBlockNum": 0
176176
}
@@ -263,8 +263,7 @@
263263
"chain-name": "stylus-testnet",
264264
"sequencer-url": "https://stylus-testnet-sequencer.arbitrum.io/rpc",
265265
"feed-url": "wss://stylus-testnet.arbitrum.io/feed",
266-
"chain-config":
267-
{
266+
"chain-config": {
268267
"chainId": 23011913,
269268
"homesteadBlock": 0,
270269
"daoForkBlock": null,
@@ -280,13 +279,11 @@
280279
"muirGlacierBlock": 0,
281280
"berlinBlock": 0,
282281
"londonBlock": 0,
283-
"clique":
284-
{
282+
"clique": {
285283
"period": 0,
286284
"epoch": 0
287285
},
288-
"arbitrum":
289-
{
286+
"arbitrum": {
290287
"EnableArbOS": true,
291288
"AllowDebugPrecompiles": false,
292289
"DataAvailabilityCommittee": false,
@@ -295,8 +292,7 @@
295292
"GenesisBlockNum": 0
296293
}
297294
},
298-
"rollup":
299-
{
295+
"rollup": {
300296
"bridge": "0x35aa95ac4747D928E2Cd42FE4461F6D9d1826346",
301297
"inbox": "0xe1e3b1CBaCC870cb6e5F4Bdf246feB6eB5cD351B",
302298
"sequencer-inbox": "0x00A0F15b79d1D3e5991929FaAbCF2AA65623530c",
@@ -306,4 +302,4 @@
306302
"deployed-at": 1847
307303
}
308304
}
309-
]
305+
]

system_tests/batch_poster_test.go

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
"github.com/offchainlabs/nitro/arbnode/dataposter"
2626
"github.com/offchainlabs/nitro/arbnode/dataposter/externalsignertest"
2727
"github.com/offchainlabs/nitro/solgen/go/bridgegen"
28+
pgen "github.com/offchainlabs/nitro/solgen/go/precompilesgen"
2829
"github.com/offchainlabs/nitro/solgen/go/upgrade_executorgen"
2930
"github.com/offchainlabs/nitro/util/redisutil"
3031
)
@@ -366,6 +367,7 @@ func TestBatchPosterLargeTx(t *testing.T) {
366367
defer cancel()
367368

368369
builder := NewNodeBuilder(ctx).DefaultConfig(t, true)
370+
builder.takeOwnership = true
369371
builder.execConfig.Sequencer.MaxTxDataSize = 110000
370372
cleanup := builder.Build(t)
371373
defer cleanup()
@@ -376,9 +378,18 @@ func TestBatchPosterLargeTx(t *testing.T) {
376378
data := make([]byte, 100000)
377379
_, err := rand.Read(data)
378380
Require(t, err)
381+
gas := builder.L2Info.TransferGas + 2000*uint64(len(data))
382+
383+
auth := builder.L2Info.GetDefaultTransactOpts("Owner", ctx)
384+
arbOwner, err := pgen.NewArbOwner(types.ArbOwnerAddress, builder.L2.Client)
385+
Require(t, err)
386+
tx, err := arbOwner.SetMaxTxGasLimit(&auth, gas)
387+
Require(t, err)
388+
_, err = EnsureTxSucceeded(ctx, builder.L2.Client, tx)
389+
Require(t, err)
390+
379391
faucetAddr := builder.L2Info.GetAddress("Faucet")
380-
gas := builder.L2Info.TransferGas + 20000*uint64(len(data))
381-
tx := builder.L2Info.PrepareTxTo("Faucet", &faucetAddr, gas, common.Big0, data)
392+
tx = builder.L2Info.PrepareTxToCustomGas("Faucet", &faucetAddr, gas, common.Big0, data)
382393
err = builder.L2.Client.SendTransaction(ctx, tx)
383394
Require(t, err)
384395
receiptA, err := builder.L2.EnsureTxSucceeded(tx)

system_tests/common_test.go

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,10 @@ func (b *NodeBuilder) BuildL2OnL1(t *testing.T) func() {
764764
b.addresses,
765765
)
766766

767+
if b.takeOwnership {
768+
becomeChainOwner(t, b.ctx, b.L2Info.GetDefaultTransactOpts("Owner", b.ctx), b.L2.Client)
769+
}
770+
767771
return func() {
768772
b.L2.cleanup()
769773
if b.L1 != nil && b.L1.cleanup != nil {
@@ -818,17 +822,7 @@ func (b *NodeBuilder) BuildL2(t *testing.T) func() {
818822
b.L2.Client = ClientForStack(t, b.L2.Stack)
819823

820824
if b.takeOwnership {
821-
debugAuth := b.L2Info.GetDefaultTransactOpts("Owner", b.ctx)
822-
823-
// make auth a chain owner
824-
arbdebug, err := precompilesgen.NewArbDebug(common.HexToAddress("0xff"), b.L2.Client)
825-
Require(t, err, "failed to deploy ArbDebug")
826-
827-
tx, err := arbdebug.BecomeChainOwner(&debugAuth)
828-
Require(t, err, "failed to deploy ArbDebug")
829-
830-
_, err = EnsureTxSucceeded(b.ctx, b.L2.Client, tx)
831-
Require(t, err)
825+
becomeChainOwner(t, b.ctx, b.L2Info.GetDefaultTransactOpts("Owner", b.ctx), b.L2.Client)
832826
}
833827

834828
StartWatchChanErr(t, b.ctx, fatalErrChan, b.L2.ConsensusNode)
@@ -2125,3 +2119,13 @@ func populateMachineDir(t *testing.T, cr *github.ConsensusRelease) string {
21252119
Require(t, err)
21262120
return machineDir
21272121
}
2122+
2123+
func becomeChainOwner(t *testing.T, ctx context.Context, opts bind.TransactOpts, client *ethclient.Client) {
2124+
t.Helper()
2125+
arbdebug, err := precompilesgen.NewArbDebug(types.ArbDebugAddress, client)
2126+
Require(t, err, "failed to deploy ArbDebug")
2127+
tx, err := arbdebug.BecomeChainOwner(&opts)
2128+
Require(t, err, "failed to deploy ArbDebug")
2129+
_, err = EnsureTxSucceeded(ctx, client, tx)
2130+
Require(t, err)
2131+
}

system_tests/precompile_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -414,12 +414,12 @@ func TestGasAccountingParams(t *testing.T) {
414414
ctx := builder.ctx
415415

416416
speedLimit := uint64(18)
417-
txGasLimit := uint64(19)
417+
blockGasLimit := uint64(19)
418418
tx, err := arbOwner.SetSpeedLimit(&auth, speedLimit)
419419
Require(t, err)
420420
_, err = builder.L2.EnsureTxSucceeded(tx)
421421
Require(t, err)
422-
tx, err = arbOwner.SetMaxTxGasLimit(&auth, txGasLimit)
422+
tx, err = arbOwner.SetMaxBlockGasLimit(&auth, blockGasLimit)
423423
Require(t, err)
424424
_, err = builder.L2.EnsureTxSucceeded(tx)
425425
Require(t, err)
@@ -430,12 +430,12 @@ func TestGasAccountingParams(t *testing.T) {
430430
Fatal(t, "expected speed limit to be", speedLimit, "got", arbGasInfoSpeedLimit)
431431
}
432432
// #nosec G115
433-
if arbGasInfoPoolSize.Cmp(big.NewInt(int64(txGasLimit))) != 0 {
434-
Fatal(t, "expected pool size to be", txGasLimit, "got", arbGasInfoPoolSize)
433+
if arbGasInfoPoolSize.Cmp(big.NewInt(int64(blockGasLimit))) != 0 {
434+
Fatal(t, "expected pool size to be", blockGasLimit, "got", arbGasInfoPoolSize)
435435
}
436436
// #nosec G115
437-
if arbGasInfoTxGasLimit.Cmp(big.NewInt(int64(txGasLimit))) != 0 {
438-
Fatal(t, "expected tx gas limit to be", txGasLimit, "got", arbGasInfoTxGasLimit)
437+
if arbGasInfoTxGasLimit.Cmp(big.NewInt(int64(blockGasLimit))) != 0 {
438+
Fatal(t, "expected tx gas limit to be", blockGasLimit, "got", arbGasInfoTxGasLimit)
439439
}
440440
}
441441

system_tests/program_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1057,6 +1057,7 @@ func testMemory(t *testing.T, jit bool) {
10571057
Require(t, err)
10581058

10591059
ensure(arbOwner.SetInkPrice(&auth, 1e4))
1060+
ensure(arbOwner.SetMaxBlockGasLimit(&auth, 34000000))
10601061
ensure(arbOwner.SetMaxTxGasLimit(&auth, 34000000))
10611062

10621063
memoryAddr := deployWasm(t, ctx, auth, l2client, watFile("memory"))
@@ -1092,7 +1093,7 @@ func testMemory(t *testing.T, jit bool) {
10921093
args := argsForMulticall(vm.CALL, memoryAddr, nil, []byte{126, 50})
10931094
args = multicallAppend(args, vm.CALL, memoryAddr, []byte{126, 80})
10941095

1095-
tx := l2info.PrepareTxTo("Owner", &multiAddr, 1e9, nil, args)
1096+
tx := l2info.PrepareTxToCustomGas("Owner", &multiAddr, 33000000, nil, args)
10961097
receipt := ensure(tx, l2client.SendTransaction(ctx, tx))
10971098
gasCost := receipt.GasUsedForL2()
10981099
memCost := model.GasCost(128, 0, 0) + model.GasCost(126, 2, 128)
@@ -1102,6 +1103,7 @@ func testMemory(t *testing.T, jit bool) {
11021103
}
11031104

11041105
// check that we'd normally run out of gas
1106+
ensure(arbOwner.SetMaxBlockGasLimit(&auth, 32000000))
11051107
ensure(arbOwner.SetMaxTxGasLimit(&auth, 32000000))
11061108
expectFailure(multiAddr, args, oneEth)
11071109

system_tests/retryable_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ func TestSubmitManyRetryableFailThenRetry(t *testing.T) {
581581
}
582582

583583
l2FaucetTxOpts := builder.L2Info.GetDefaultTransactOpts("Faucet", ctx)
584-
l2FaucetTxOpts.GasLimit = uint64(1e8)
584+
l2FaucetTxOpts.GasLimit = l2pricing.InitialPerTxGasLimitV50
585585
l2FaucetAddress := builder.L2Info.GetAddress("Faucet")
586586
colors.PrintBlue("L2 Faucet ", l2FaucetAddress)
587587
var addressesToCreate []common.Address

system_tests/storage_trie_test.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ import (
1111
"time"
1212

1313
"github.com/ethereum/go-ethereum/core/rawdb"
14+
"github.com/ethereum/go-ethereum/core/types"
1415

16+
pgen "github.com/offchainlabs/nitro/solgen/go/precompilesgen"
1517
"github.com/offchainlabs/nitro/util/arbmath"
1618
"github.com/offchainlabs/nitro/validator/valnode"
1719
)
@@ -22,6 +24,7 @@ func TestStorageTrie(t *testing.T) {
2224

2325
var withL1 = true
2426
builder := NewNodeBuilder(ctx).DefaultConfig(t, withL1)
27+
builder.takeOwnership = true
2528

2629
// This test tests validates blocks at the end.
2730
// For now, validation only works with HashScheme set.
@@ -41,6 +44,13 @@ func TestStorageTrie(t *testing.T) {
4144
defer cleanup()
4245

4346
ownerTxOpts := builder.L2Info.GetDefaultTransactOpts("Owner", ctx)
47+
arbOwner, err := pgen.NewArbOwner(types.ArbOwnerAddress, builder.L2.Client)
48+
Require(t, err)
49+
tx, err := arbOwner.SetMaxTxGasLimit(&ownerTxOpts, 33000000)
50+
Require(t, err)
51+
_, err = EnsureTxSucceeded(ctx, builder.L2.Client, tx)
52+
Require(t, err)
53+
4454
_, bigMap := builder.L2.DeployBigMap(t, ownerTxOpts)
4555

4656
// Store enough values to use just over 32M gas
@@ -49,7 +59,8 @@ func TestStorageTrie(t *testing.T) {
4959
toClear := big.NewInt(0)
5060

5161
userTxOpts := builder.L2Info.GetDefaultTransactOpts("Faucet", ctx)
52-
tx, err := bigMap.ClearAndAddValues(&userTxOpts, toClear, toAdd)
62+
userTxOpts.GasMargin = 0
63+
tx, err = bigMap.ClearAndAddValues(&userTxOpts, toClear, toAdd)
5364
Require(t, err)
5465

5566
receipt, err := builder.L2.EnsureTxSucceeded(tx)

system_tests/test_info.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,15 @@ func (b *BlockchainTestInfo) PrepareTx(from, to string, gas uint64, value *big.I
227227

228228
func (b *BlockchainTestInfo) PrepareTxTo(
229229
from string, to *common.Address, gas uint64, value *big.Int, data []byte,
230+
) *types.Transaction {
231+
// After arbos_50 l2 txs consuming more than 32,000,000 in compute gas are rejected, this makes
232+
// sure our current tests pass and we shouldnt reach compute gas consumption of 32,000,000 anyway
233+
gas = min(gas, l2pricing.InitialPerTxGasLimitV50)
234+
return b.PrepareTxToCustomGas(from, to, gas, value, data)
235+
}
236+
237+
func (b *BlockchainTestInfo) PrepareTxToCustomGas(
238+
from string, to *common.Address, gas uint64, value *big.Int, data []byte,
230239
) *types.Transaction {
231240
b.T.Helper()
232241
info := b.GetInfoWithPrivKey(from)

system_tests/timeboost_test.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ import (
4141
"github.com/offchainlabs/nitro/pubsub"
4242
"github.com/offchainlabs/nitro/solgen/go/express_lane_auctiongen"
4343
"github.com/offchainlabs/nitro/solgen/go/localgen"
44+
pgen "github.com/offchainlabs/nitro/solgen/go/precompilesgen"
4445
"github.com/offchainlabs/nitro/timeboost"
4546
"github.com/offchainlabs/nitro/timeboost/bindings"
4647
"github.com/offchainlabs/nitro/util/arbmath"
@@ -63,6 +64,16 @@ func TestTimeboostTxsTimeoutByBlock(t *testing.T) {
6364
seqClient, seqInfo := builderSeq.L2.Client, builderSeq.L2Info
6465
defer cleanupSeq()
6566
seqInfo.GenerateAccount("User2")
67+
builderSeq.L2.TransferBalance(t, "Owner", "User2", big.NewInt(1e18), seqInfo)
68+
69+
user2Opts := seqInfo.GetDefaultTransactOpts("User2", ctx)
70+
becomeChainOwner(t, ctx, user2Opts, seqClient)
71+
arbOwner, err := pgen.NewArbOwner(types.ArbOwnerAddress, seqClient)
72+
Require(t, err)
73+
tx, err := arbOwner.SetMaxTxGasLimit(&user2Opts, 700000000)
74+
Require(t, err)
75+
_, err = EnsureTxSucceeded(ctx, seqClient, tx)
76+
Require(t, err)
6677

6778
auctionContract, err := express_lane_auctiongen.NewExpressLaneAuction(auctionContractAddr, seqClient)
6879
Require(t, err)
@@ -97,7 +108,8 @@ func TestTimeboostTxsTimeoutByBlock(t *testing.T) {
97108

98109
var txs types.Transactions
99110
for i := uint64(0); i < numTxs; i++ {
100-
txs = append(txs, seqInfo.PrepareTx("Owner", "User2", 700000000, big.NewInt(1e8), data)) // this tx should consume one block
111+
user2 := seqInfo.GetAddress("User2")
112+
txs = append(txs, seqInfo.PrepareTxToCustomGas("Owner", &user2, 700000000, big.NewInt(1e8), data)) // this tx should consume one block
101113
}
102114
// Buffer future sequence numbered txs
103115
for seq := uint64(1); seq < numTxs; seq++ {

0 commit comments

Comments
 (0)