From 77da75a635b2726eaed14c43b0fbcbca1c904a6a Mon Sep 17 00:00:00 2001 From: Aman Sanghi Date: Tue, 15 Apr 2025 15:19:57 +0530 Subject: [PATCH 1/5] Add HistoryStorageAddress as part of arbos 40 upgrade --- arbos/arbosState/arbosstate.go | 4 ++++ system_tests/historical_block_hash_test.go | 13 ------------- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/arbos/arbosState/arbosstate.go b/arbos/arbosState/arbosstate.go index c6e1973486..3fb43327d0 100644 --- a/arbos/arbosState/arbosstate.go +++ b/arbos/arbosState/arbosstate.go @@ -12,6 +12,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/rawdb" "github.com/ethereum/go-ethereum/core/state" + "github.com/ethereum/go-ethereum/core/tracing" "github.com/ethereum/go-ethereum/core/vm" "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/triedb" @@ -339,6 +340,9 @@ func (state *ArbosState) UpgradeArbosVersion( // these versions are left to Orbit chains for custom upgrades. case params.ArbosVersion_40: + // EIP-2935: Add support for historical block hashes. + stateDB.SetNonce(params.HistoryStorageAddress, 1, tracing.NonceChangeUnspecified) + stateDB.SetCode(params.HistoryStorageAddress, params.HistoryStorageCodeArbitrum) // The MaxWasmSize was a constant before arbos version 40, and can // be read as a parameter after arbos version 40. params, err := state.Programs().Params() diff --git a/system_tests/historical_block_hash_test.go b/system_tests/historical_block_hash_test.go index 0c3ccbddca..77fd5a8cd2 100644 --- a/system_tests/historical_block_hash_test.go +++ b/system_tests/historical_block_hash_test.go @@ -9,8 +9,6 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/params" - - "github.com/offchainlabs/nitro/statetransfer" ) func TestHistoricalBlockHash(t *testing.T) { @@ -19,17 +17,6 @@ func TestHistoricalBlockHash(t *testing.T) { defer cancel() builder := NewNodeBuilder(ctx).DefaultConfig(t, true) - contractInfo := &statetransfer.AccountInitContractInfo{ - Code: params.HistoryStorageCodeArbitrum, - ContractStorage: make(map[common.Hash]common.Hash), - } - accountInfo := statetransfer.AccountInitializationInfo{ - Addr: params.HistoryStorageAddress, - EthBalance: big.NewInt(0), - Nonce: 1, - ContractInfo: contractInfo, - } - builder.L2Info.ArbInitData.Accounts = append(builder.L2Info.ArbInitData.Accounts, accountInfo) cleanup := builder.Build(t) defer cleanup() From c9c76fe5db830f9a681fa884b8c035cc047871b1 Mon Sep 17 00:00:00 2001 From: Aman Sanghi Date: Tue, 15 Apr 2025 21:17:42 +0530 Subject: [PATCH 2/5] Skip calling ProcessParentBlockHash in geth for arbitrum chain --- arbos/arbosState/arbosstate.go | 6 ++++-- go-ethereum | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/arbos/arbosState/arbosstate.go b/arbos/arbosState/arbosstate.go index 3fb43327d0..1b24dd93d3 100644 --- a/arbos/arbosState/arbosstate.go +++ b/arbos/arbosState/arbosstate.go @@ -341,8 +341,10 @@ func (state *ArbosState) UpgradeArbosVersion( case params.ArbosVersion_40: // EIP-2935: Add support for historical block hashes. - stateDB.SetNonce(params.HistoryStorageAddress, 1, tracing.NonceChangeUnspecified) - stateDB.SetCode(params.HistoryStorageAddress, params.HistoryStorageCodeArbitrum) + if firstTime { + stateDB.SetNonce(params.HistoryStorageAddress, 1, tracing.NonceChangeUnspecified) + stateDB.SetCode(params.HistoryStorageAddress, params.HistoryStorageCodeArbitrum) + } // The MaxWasmSize was a constant before arbos version 40, and can // be read as a parameter after arbos version 40. params, err := state.Programs().Params() diff --git a/go-ethereum b/go-ethereum index 1b11b946c8..0651aff685 160000 --- a/go-ethereum +++ b/go-ethereum @@ -1 +1 @@ -Subproject commit 1b11b946c87a5538f81aef89c0ed0b2a648a67a3 +Subproject commit 0651aff6857541e40b3abd888ac2fc3313f3f46f From dce18f472f98d22cd55ef8ce48cb0f48f570c14c Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Tue, 15 Apr 2025 18:27:16 +0200 Subject: [PATCH 3/5] Update the pin for go-ethereum --- go-ethereum | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go-ethereum b/go-ethereum index 0651aff685..2a0b8b6f14 160000 --- a/go-ethereum +++ b/go-ethereum @@ -1 +1 @@ -Subproject commit 0651aff6857541e40b3abd888ac2fc3313f3f46f +Subproject commit 2a0b8b6f146f62e609fc240b99a9f65df8f2eace From 0afe9a2a717144aec45c1f7280f79a4d6e29607b Mon Sep 17 00:00:00 2001 From: Aman Sanghi Date: Wed, 16 Apr 2025 11:35:25 +0530 Subject: [PATCH 4/5] remove first time --- arbos/arbosState/arbosstate.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/arbos/arbosState/arbosstate.go b/arbos/arbosState/arbosstate.go index 1b24dd93d3..3fb43327d0 100644 --- a/arbos/arbosState/arbosstate.go +++ b/arbos/arbosState/arbosstate.go @@ -341,10 +341,8 @@ func (state *ArbosState) UpgradeArbosVersion( case params.ArbosVersion_40: // EIP-2935: Add support for historical block hashes. - if firstTime { - stateDB.SetNonce(params.HistoryStorageAddress, 1, tracing.NonceChangeUnspecified) - stateDB.SetCode(params.HistoryStorageAddress, params.HistoryStorageCodeArbitrum) - } + stateDB.SetNonce(params.HistoryStorageAddress, 1, tracing.NonceChangeUnspecified) + stateDB.SetCode(params.HistoryStorageAddress, params.HistoryStorageCodeArbitrum) // The MaxWasmSize was a constant before arbos version 40, and can // be read as a parameter after arbos version 40. params, err := state.Programs().Params() From d0bffb3eaf87e02ea9b9da91dabb075be39b22ac Mon Sep 17 00:00:00 2001 From: Aman Sanghi Date: Wed, 16 Apr 2025 13:24:37 +0530 Subject: [PATCH 5/5] Skip PublishedMachine tests --- system_tests/block_validator_test.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/system_tests/block_validator_test.go b/system_tests/block_validator_test.go index 52f733b4a7..d697e6fee2 100644 --- a/system_tests/block_validator_test.go +++ b/system_tests/block_validator_test.go @@ -312,6 +312,9 @@ func TestBlockValidatorSimpleOnchain(t *testing.T) { } func TestBlockValidatorSimpleJITOnchainWithPublishedMachine(t *testing.T) { + t.Skip("Fails cause EIP-2935 (part of arbOs 40) is not implemented in the latest published machine i.e Consensus V32") + // TODO: Remove this skip when consensus V40 is published + // 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. cr, err := github.LatestConsensusRelease(context.Background()) Require(t, err) machPath := populateMachineDir(t, cr) @@ -326,6 +329,9 @@ func TestBlockValidatorSimpleJITOnchainWithPublishedMachine(t *testing.T) { } func TestBlockValidatorSimpleOnchainWithPublishedMachine(t *testing.T) { + t.Skip("Fails cause EIP-2935 (part of arbOs 40) is not implemented in the latest published machine i.e Consensus V32") + // TODO: Remove this skip when consensus V40 is published + // 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. cr, err := github.LatestConsensusRelease(context.Background()) Require(t, err) machPath := populateMachineDir(t, cr)