Skip to content

Commit 787ea57

Browse files
authored
Merge pull request #3132 from OffchainLabs/eip_2935_arbos_40
Add HistoryStorageAddress as part of arbos 40 upgrade
2 parents 6b8ebe0 + ed9d716 commit 787ea57

File tree

4 files changed

+11
-14
lines changed

4 files changed

+11
-14
lines changed

arbos/arbosState/arbosstate.go

+4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"github.com/ethereum/go-ethereum/common"
1313
"github.com/ethereum/go-ethereum/core/rawdb"
1414
"github.com/ethereum/go-ethereum/core/state"
15+
"github.com/ethereum/go-ethereum/core/tracing"
1516
"github.com/ethereum/go-ethereum/core/vm"
1617
"github.com/ethereum/go-ethereum/params"
1718
"github.com/ethereum/go-ethereum/triedb"
@@ -339,6 +340,9 @@ func (state *ArbosState) UpgradeArbosVersion(
339340
// these versions are left to Orbit chains for custom upgrades.
340341

341342
case params.ArbosVersion_40:
343+
// EIP-2935: Add support for historical block hashes.
344+
stateDB.SetNonce(params.HistoryStorageAddress, 1, tracing.NonceChangeUnspecified)
345+
stateDB.SetCode(params.HistoryStorageAddress, params.HistoryStorageCodeArbitrum)
342346
// The MaxWasmSize was a constant before arbos version 40, and can
343347
// be read as a parameter after arbos version 40.
344348
params, err := state.Programs().Params()

system_tests/block_validator_test.go

+6
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,9 @@ func TestBlockValidatorSimpleOnchain(t *testing.T) {
312312
}
313313

314314
func TestBlockValidatorSimpleJITOnchainWithPublishedMachine(t *testing.T) {
315+
t.Skip("Fails cause EIP-2935 (part of arbOs 40) is not implemented in the latest published machine i.e Consensus V32")
316+
// TODO: Remove this skip when consensus V40 is published
317+
// TODO: Make this more robust in the future, so that it can handle if the latest consensus release is behind the arbOS version we want to test.
315318
cr, err := github.LatestConsensusRelease(context.Background())
316319
Require(t, err)
317320
machPath := populateMachineDir(t, cr)
@@ -326,6 +329,9 @@ func TestBlockValidatorSimpleJITOnchainWithPublishedMachine(t *testing.T) {
326329
}
327330

328331
func TestBlockValidatorSimpleOnchainWithPublishedMachine(t *testing.T) {
332+
t.Skip("Fails cause EIP-2935 (part of arbOs 40) is not implemented in the latest published machine i.e Consensus V32")
333+
// TODO: Remove this skip when consensus V40 is published
334+
// TODO: Make this more robust in the future, so that it can handle if the latest consensus release is behind the arbOS version we want to test.
329335
cr, err := github.LatestConsensusRelease(context.Background())
330336
Require(t, err)
331337
machPath := populateMachineDir(t, cr)

system_tests/historical_block_hash_test.go

-13
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ import (
99

1010
"github.com/ethereum/go-ethereum/common"
1111
"github.com/ethereum/go-ethereum/params"
12-
13-
"github.com/offchainlabs/nitro/statetransfer"
1412
)
1513

1614
func TestHistoricalBlockHash(t *testing.T) {
@@ -19,17 +17,6 @@ func TestHistoricalBlockHash(t *testing.T) {
1917
defer cancel()
2018

2119
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)
3320
cleanup := builder.Build(t)
3421
defer cleanup()
3522

0 commit comments

Comments
 (0)