Skip to content

Commit ec1fbcd

Browse files
authored
Merge branch 'master' into fix-workflows
2 parents d3b7185 + 7fdc568 commit ec1fbcd

File tree

7 files changed

+111
-8
lines changed

7 files changed

+111
-8
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ Save and close the file, then a commit command will appear in the terminal that
127127
**17. Update your pull request with the following command.**
128128

129129
```
130-
$ git push mynitrorepo feature-in-progress-branch -f
130+
$ git push mynitrorepo feature-in-progress-branch
131131
```
132132

133133
**18. Finally, again leave a comment to the Core Contributors on the pull request to let them know that the pull request has been updated.**

arbos/arbosState/initialization_test.go

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,43 @@ func checkRetryables(arbState *ArbosState, expected []statetransfer.Initializati
182182
if found == nil {
183183
Fail(t)
184184
}
185-
// TODO: detailed comparison
185+
186+
// Detailed comparison
187+
from, err := found.From()
188+
Require(t, err)
189+
if from != exp.From {
190+
t.Fatalf("Retryable %v: from mismatch. Expected %v, got %v", exp.Id, exp.From, from)
191+
}
192+
193+
to, err := found.To()
194+
Require(t, err)
195+
if (to == nil && exp.To != common.Address{}) || (to != nil && exp.To == common.Address{}) || (to != nil && exp.To != common.Address{} && *to != exp.To) {
196+
t.Fatalf("Retryable %v: to mismatch. Expected %v, got %v", exp.Id, exp.To, to)
197+
}
198+
199+
callvalue, err := found.Callvalue()
200+
Require(t, err)
201+
if callvalue.Cmp(exp.Callvalue) != 0 {
202+
t.Fatalf("Retryable %v: callvalue mismatch. Expected %v, got %v", exp.Id, exp.Callvalue, callvalue)
203+
}
204+
205+
beneficiary, err := found.Beneficiary()
206+
Require(t, err)
207+
if beneficiary != exp.Beneficiary {
208+
t.Fatalf("Retryable %v: beneficiary mismatch. Expected %v, got %v", exp.Id, exp.Beneficiary, beneficiary)
209+
}
210+
211+
calldata, err := found.Calldata()
212+
Require(t, err)
213+
if !bytes.Equal(calldata, exp.Calldata) {
214+
t.Fatalf("Retryable %v: calldata mismatch. Expected %v, got %v", exp.Id, exp.Calldata, calldata)
215+
}
216+
217+
timeout, err := found.CalculateTimeout()
218+
Require(t, err)
219+
if timeout != exp.Timeout {
220+
t.Fatalf("Retryable %v: timeout mismatch. Expected %v, got %v", exp.Id, exp.Timeout, timeout)
221+
}
186222
}
187223
}
188224

arbos/internal_tx.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"math/big"
1010

1111
"github.com/ethereum/go-ethereum/common"
12+
"github.com/ethereum/go-ethereum/core"
1213
"github.com/ethereum/go-ethereum/core/types"
1314
"github.com/ethereum/go-ethereum/core/vm"
1415
"github.com/ethereum/go-ethereum/log"
@@ -55,6 +56,15 @@ func ApplyInternalTxUpdate(tx *types.ArbitrumInternalTx, state *arbosState.Arbos
5556
return err
5657
}
5758

59+
var prevHash common.Hash
60+
if evm.Context.BlockNumber.Sign() > 0 {
61+
prevHash = evm.Context.GetHash(evm.Context.BlockNumber.Uint64() - 1)
62+
}
63+
// For ArbOS versions >= 40 we need to call ProcessParentBlockHash to fill
64+
// the historyStorage with the block hash to support EIP-2935.
65+
if state.ArbOSVersion() >= params.ArbosVersion_40 {
66+
core.ProcessParentBlockHash(prevHash, evm)
67+
}
5868
l1BlockNumber := util.SafeMapGet[uint64](inputs, "l1BlockNumber")
5969
timePassed := util.SafeMapGet[uint64](inputs, "timePassed")
6070
if state.ArbOSVersion() < params.ArbosVersion_3 {
@@ -73,10 +83,6 @@ func ApplyInternalTxUpdate(tx *types.ArbitrumInternalTx, state *arbosState.Arbos
7383
state.Restrict(err)
7484

7585
if l1BlockNumber > oldL1BlockNumber {
76-
var prevHash common.Hash
77-
if evm.Context.BlockNumber.Sign() > 0 {
78-
prevHash = evm.Context.GetHash(evm.Context.BlockNumber.Uint64() - 1)
79-
}
8086
state.Restrict(state.Blockhashes().RecordNewL1Block(l1BlockNumber-1, prevHash, state.ArbOSVersion()))
8187
}
8288

system_tests/bold_state_provider_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ func TestChallengeProtocolBOLD_Bisections(t *testing.T) {
156156
}
157157

158158
func TestChallengeProtocolBOLD_StateProvider(t *testing.T) {
159-
// t.Parallel()
159+
t.Parallel()
160160
ctx, cancelCtx := context.WithCancel(context.Background())
161161
defer cancelCtx()
162162
maxNumBlocks := uint64(1 << 14)
@@ -358,6 +358,7 @@ func setupBoldStateProvider(t *testing.T, ctx context.Context, blockChallengeHei
358358
sconf := setup.RollupStackConfig{
359359
UseMockBridge: false,
360360
UseMockOneStepProver: false,
361+
UseBlobs: true,
361362
MinimumAssertionPeriod: 0,
362363
}
363364

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
package arbtest
2+
3+
import (
4+
"bytes"
5+
"context"
6+
"encoding/binary"
7+
"math/big"
8+
"testing"
9+
10+
"github.com/ethereum/go-ethereum/common"
11+
"github.com/ethereum/go-ethereum/params"
12+
13+
"github.com/offchainlabs/nitro/statetransfer"
14+
)
15+
16+
func TestHistoricalBlockHash(t *testing.T) {
17+
t.Parallel()
18+
ctx, cancel := context.WithCancel(context.Background())
19+
defer cancel()
20+
21+
builder := NewNodeBuilder(ctx).DefaultConfig(t, true)
22+
contractInfo := &statetransfer.AccountInitContractInfo{
23+
Code: params.HistoryStorageCodeArbitrum,
24+
ContractStorage: make(map[common.Hash]common.Hash),
25+
}
26+
accountInfo := statetransfer.AccountInitializationInfo{
27+
Addr: params.HistoryStorageAddress,
28+
EthBalance: big.NewInt(0),
29+
Nonce: 1,
30+
ContractInfo: contractInfo,
31+
}
32+
builder.L2Info.ArbInitData.Accounts = append(builder.L2Info.ArbInitData.Accounts, accountInfo)
33+
cleanup := builder.Build(t)
34+
defer cleanup()
35+
36+
for {
37+
builder.L2.TransferBalance(t, "Faucet", "Faucet", common.Big1, builder.L2Info)
38+
number, err := builder.L2.Client.BlockNumber(ctx)
39+
Require(t, err)
40+
if number > 300 {
41+
break
42+
}
43+
}
44+
45+
block, err := builder.L2.Client.BlockByNumber(ctx, nil)
46+
Require(t, err)
47+
48+
for i := uint64(0); i < block.Number().Uint64(); i++ {
49+
var key common.Hash
50+
binary.BigEndian.PutUint64(key[24:], i)
51+
expectedBlock, err := builder.L2.Client.BlockByNumber(ctx, new(big.Int).SetUint64(i))
52+
Require(t, err)
53+
blockHash := sendContractCall(t, ctx, params.HistoryStorageAddress, builder.L2.Client, key.Bytes())
54+
if !bytes.Equal(blockHash, expectedBlock.Hash().Bytes()) {
55+
t.Fatalf("Expected block hash %s, got %s", expectedBlock.Hash(), blockHash)
56+
}
57+
}
58+
59+
}

system_tests/overflow_assertions_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ func TestOverflowAssertions(t *testing.T) {
6969
UseMockBridge: false,
7070
UseMockOneStepProver: false,
7171
MinimumAssertionPeriod: minAssertionBlocks,
72+
UseBlobs: true,
7273
}
7374

7475
_, l2node, _, _, l1info, _, l1client, l1stack, assertionChain, _ := createTestNodeOnL1ForBoldProtocol(t, ctx, true, nil, l2chainConfig, nil, sconf, l2info)

0 commit comments

Comments
 (0)