From d8932299a0a87e870f3a13284b87a91adca6924c Mon Sep 17 00:00:00 2001 From: Lee Bousfield Date: Mon, 20 Nov 2023 16:59:47 -0700 Subject: [PATCH 1/3] Revert "core/state: mark account as dirty when resetObject occurs" This reverts commit 15bd21f3c878155bc2254bb43460763298f58ad1. --- core/state/journal.go | 3 +-- core/state/statedb.go | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/core/state/journal.go b/core/state/journal.go index 137ec76395..57d4445be9 100644 --- a/core/state/journal.go +++ b/core/state/journal.go @@ -90,7 +90,6 @@ type ( account *common.Address } resetObjectChange struct { - account *common.Address prev *stateObject prevdestruct bool prevAccount []byte @@ -181,7 +180,7 @@ func (ch resetObjectChange) revert(s *StateDB) { } func (ch resetObjectChange) dirtied() *common.Address { - return ch.account + return nil } func (ch selfDestructChange) revert(s *StateDB) { diff --git a/core/state/statedb.go b/core/state/statedb.go index 9b56640de2..b176ecb627 100644 --- a/core/state/statedb.go +++ b/core/state/statedb.go @@ -718,7 +718,6 @@ func (s *StateDB) createObject(addr common.Address) (newobj, prev *stateObject) // cache the latest account/storage data. prevAccount, ok := s.accountsOrigin[prev.address] s.journal.append(resetObjectChange{ - account: &addr, prev: prev, prevdestruct: prevdestruct, prevAccount: s.accounts[prev.addrHash], From d8a45317fba1d2ae99cbb2da4d2f651d0666bda0 Mon Sep 17 00:00:00 2001 From: Lee Bousfield Date: Mon, 20 Nov 2023 17:25:01 -0700 Subject: [PATCH 2/3] Add comment explaining why resetObjectChange dirtied returns nil --- core/state/journal.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/state/journal.go b/core/state/journal.go index 57d4445be9..beaf6f3e17 100644 --- a/core/state/journal.go +++ b/core/state/journal.go @@ -180,6 +180,12 @@ func (ch resetObjectChange) revert(s *StateDB) { } func (ch resetObjectChange) dirtied() *common.Address { + // Arbitrum: We keep the behavior that existed before go-ethereum v1.12.1 and return nil, + // instead of returning the reset address as upstream go-ethereum v1.12.1 does. + // That's because, unlike for go-ethereum, whether this account is dirty or not is relevant for Arbitrum. + // Arbitrum hooks manipulate the state in some ways that go-ethereum doesn't which cause that relevance, + // e.g. subtracting balance from an account that hasn't been otherwise touched. + // See https://github.com/OffchainLabs/nitro/pull/1976 for details return nil } From f5328d1abc2f5e4f25cabf9a1345a57f8c10f0f6 Mon Sep 17 00:00:00 2001 From: Lee Bousfield Date: Tue, 21 Nov 2023 09:06:38 -0700 Subject: [PATCH 3/3] Skip TestStateChanges --- core/state/statedb_fuzz_test.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/state/statedb_fuzz_test.go b/core/state/statedb_fuzz_test.go index 17d60c9ba6..367a9e8054 100644 --- a/core/state/statedb_fuzz_test.go +++ b/core/state/statedb_fuzz_test.go @@ -365,6 +365,8 @@ func (test *stateTest) verify(root common.Hash, next common.Hash, db *trie.Datab } func TestStateChanges(t *testing.T) { + t.Skip("Arbitrum doesn't support some of these operations due to https://github.com/OffchainLabs/go-ethereum/pull/271") + config := &quick.Config{MaxCount: 1000} err := quick.Check((*stateTest).run, config) if cerr, ok := err.(*quick.CheckError); ok {