From e768d240f32a0baa7ae20d9a6a49937b294ad897 Mon Sep 17 00:00:00 2001 From: Aman Sanghi <asanghi@offchainlabs.com> Date: Thu, 18 Apr 2024 20:12:35 +0530 Subject: [PATCH 1/5] Add a check to make sure we don't allow accidentally downgrading ArbOS --- cmd/nitro/init.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmd/nitro/init.go b/cmd/nitro/init.go index 72c767d00f..6921d431aa 100644 --- a/cmd/nitro/init.go +++ b/cmd/nitro/init.go @@ -155,6 +155,10 @@ func validateBlockChain(blockChain *core.BlockChain, chainConfig *params.ChainCo return fmt.Errorf("invalid chain config, not compatible with previous: %w", err) } } + // Add a check to make sure we don't allow accidentally downgrading ArbOS + if currentArbosState.ArbOSVersion() > chainConfig.ArbitrumChainParams.InitialArbOSVersion { + return fmt.Errorf("attempted to launch node with ArbOS version %v on ArbOS state with version %v", chainConfig.ArbitrumChainParams.InitialArbOSVersion, currentArbosState.ArbOSVersion()) + } return nil } From 8572000887c6c64dcd53f26a91dd5da85ac920cd Mon Sep 17 00:00:00 2001 From: Aman Sanghi <asanghi@offchainlabs.com> Date: Thu, 18 Apr 2024 21:29:50 +0530 Subject: [PATCH 2/5] minor fix --- cmd/nitro/init.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/nitro/init.go b/cmd/nitro/init.go index 58a75b0345..54a4eeea81 100644 --- a/cmd/nitro/init.go +++ b/cmd/nitro/init.go @@ -155,7 +155,7 @@ func validateBlockChain(blockChain *core.BlockChain, chainConfig *params.ChainCo return fmt.Errorf("invalid chain config, not compatible with previous: %w", err) } } - // Add a check to make sure we don't allow accidentally downgrading ArbOS + // Make sure we don't allow accidentally downgrading ArbOS if currentArbosState.ArbOSVersion() > chainConfig.ArbitrumChainParams.InitialArbOSVersion { return fmt.Errorf("attempted to launch node with ArbOS version %v on ArbOS state with version %v", chainConfig.ArbitrumChainParams.InitialArbOSVersion, currentArbosState.ArbOSVersion()) } From 7aff250bb80689088d99d2d18c7c5a610aa77d19 Mon Sep 17 00:00:00 2001 From: Aman Sanghi <asanghi@offchainlabs.com> Date: Fri, 19 Apr 2024 11:13:38 +0530 Subject: [PATCH 3/5] Changes based on offline discussion --- arbos/arbosState/arbosstate.go | 48 +++++++++++++++++++++------------- cmd/nitro/init.go | 11 ++++++-- 2 files changed, 39 insertions(+), 20 deletions(-) diff --git a/arbos/arbosState/arbosstate.go b/arbos/arbosState/arbosstate.go index 9e3b90532e..f7b7f0e7f6 100644 --- a/arbos/arbosState/arbosstate.go +++ b/arbos/arbosState/arbosstate.go @@ -36,24 +36,26 @@ import ( // persisted beyond the end of the test.) type ArbosState struct { - arbosVersion uint64 // version of the ArbOS storage format and semantics - upgradeVersion storage.StorageBackedUint64 // version we're planning to upgrade to, or 0 if not planning to upgrade - upgradeTimestamp storage.StorageBackedUint64 // when to do the planned upgrade - networkFeeAccount storage.StorageBackedAddress - l1PricingState *l1pricing.L1PricingState - l2PricingState *l2pricing.L2PricingState - retryableState *retryables.RetryableState - addressTable *addressTable.AddressTable - chainOwners *addressSet.AddressSet - sendMerkle *merkleAccumulator.MerkleAccumulator - blockhashes *blockhash.Blockhashes - chainId storage.StorageBackedBigInt - chainConfig storage.StorageBackedBytes - genesisBlockNum storage.StorageBackedUint64 - infraFeeAccount storage.StorageBackedAddress - brotliCompressionLevel storage.StorageBackedUint64 // brotli compression level used for pricing - backingStorage *storage.Storage - Burner burn.Burner + arbosVersion uint64 // version of the ArbOS storage format and semantics + maxArbosVersionSupported uint64 // maximum ArbOS version supported by this code + maxDebugArbosVersionSupported uint64 // maximum ArbOS version supported by this code in debug mode + upgradeVersion storage.StorageBackedUint64 // version we're planning to upgrade to, or 0 if not planning to upgrade + upgradeTimestamp storage.StorageBackedUint64 // when to do the planned upgrade + networkFeeAccount storage.StorageBackedAddress + l1PricingState *l1pricing.L1PricingState + l2PricingState *l2pricing.L2PricingState + retryableState *retryables.RetryableState + addressTable *addressTable.AddressTable + chainOwners *addressSet.AddressSet + sendMerkle *merkleAccumulator.MerkleAccumulator + blockhashes *blockhash.Blockhashes + chainId storage.StorageBackedBigInt + chainConfig storage.StorageBackedBytes + genesisBlockNum storage.StorageBackedUint64 + infraFeeAccount storage.StorageBackedAddress + brotliCompressionLevel storage.StorageBackedUint64 // brotli compression level used for pricing + backingStorage *storage.Storage + Burner burn.Burner } var ErrUninitializedArbOS = errors.New("ArbOS uninitialized") @@ -70,6 +72,8 @@ func OpenArbosState(stateDB vm.StateDB, burner burn.Burner) (*ArbosState, error) } return &ArbosState{ arbosVersion, + 20, + 20, backingStorage.OpenStorageBackedUint64(uint64(upgradeVersionOffset)), backingStorage.OpenStorageBackedUint64(uint64(upgradeTimestampOffset)), backingStorage.OpenStorageBackedAddress(uint64(networkFeeAccountOffset)), @@ -400,6 +404,14 @@ func (state *ArbosState) RetryableState() *retryables.RetryableState { return state.retryableState } +func (state *ArbosState) MaxArbosVersionSupported() uint64 { + return state.maxArbosVersionSupported +} + +func (state *ArbosState) MaxDebugArbosVersionSupported() uint64 { + return state.maxDebugArbosVersionSupported +} + func (state *ArbosState) L1PricingState() *l1pricing.L1PricingState { return state.l1PricingState } diff --git a/cmd/nitro/init.go b/cmd/nitro/init.go index 54a4eeea81..a45ec054a1 100644 --- a/cmd/nitro/init.go +++ b/cmd/nitro/init.go @@ -156,8 +156,15 @@ func validateBlockChain(blockChain *core.BlockChain, chainConfig *params.ChainCo } } // Make sure we don't allow accidentally downgrading ArbOS - if currentArbosState.ArbOSVersion() > chainConfig.ArbitrumChainParams.InitialArbOSVersion { - return fmt.Errorf("attempted to launch node with ArbOS version %v on ArbOS state with version %v", chainConfig.ArbitrumChainParams.InitialArbOSVersion, currentArbosState.ArbOSVersion()) + if chainConfig.DebugMode() { + if currentArbosState.ArbOSVersion() > currentArbosState.MaxDebugArbosVersionSupported() { + return fmt.Errorf("attempted to launch node in debug mode with ArbOS version %v on ArbOS state with version %v", currentArbosState.MaxDebugArbosVersionSupported(), currentArbosState.ArbOSVersion()) + } + } else { + if currentArbosState.ArbOSVersion() > currentArbosState.MaxArbosVersionSupported() { + return fmt.Errorf("attempted to launch node with ArbOS version %v on ArbOS state with version %v", currentArbosState.MaxArbosVersionSupported(), currentArbosState.ArbOSVersion()) + } + } return nil From 8dc2806e87dca5143c22635254d9ce422f096d60 Mon Sep 17 00:00:00 2001 From: Lee Bousfield <ljbousfield@gmail.com> Date: Wed, 24 Apr 2024 18:07:42 -0500 Subject: [PATCH 4/5] Pull in geth fix for stopping the flat call tracer --- go-ethereum | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go-ethereum b/go-ethereum index daccadb06c..73a00015ac 160000 --- a/go-ethereum +++ b/go-ethereum @@ -1 +1 @@ -Subproject commit daccadb06c7bd9ad7e86c74f33ea39d897f0ece4 +Subproject commit 73a00015ac5e4c856f10167226823cd355897832 From 634495e809549f58d93452fe6ca4d60df5e06060 Mon Sep 17 00:00:00 2001 From: Lee Bousfield <ljbousfield@gmail.com> Date: Wed, 24 Apr 2024 18:21:31 -0500 Subject: [PATCH 5/5] Bump pin to geth master --- go-ethereum | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go-ethereum b/go-ethereum index 73a00015ac..19f8227480 160000 --- a/go-ethereum +++ b/go-ethereum @@ -1 +1 @@ -Subproject commit 73a00015ac5e4c856f10167226823cd355897832 +Subproject commit 19f82274804e2e21fbbb3379a02502910413b46c