From a12cc85feb7fc3c4ef3d8761ef351651c92e5d99 Mon Sep 17 00:00:00 2001 From: devopsbo3 <69951731+devopsbo3@users.noreply.github.com> Date: Fri, 10 Nov 2023 12:27:53 -0600 Subject: [PATCH] Revert "core/state, light, trie: add UpdateContractCode to the Trie interface (#27476)" This reverts commit 7e3ba8b727c8fb60aa6cb98b52bbc98ed86a6c34. --- core/state/database.go | 4 ---- core/state/statedb.go | 1 - light/trie.go | 4 ---- trie/secure_trie.go | 4 ---- 4 files changed, 13 deletions(-) diff --git a/core/state/database.go b/core/state/database.go index b16536fff5..2c8a7afee6 100644 --- a/core/state/database.go +++ b/core/state/database.go @@ -93,10 +93,6 @@ type Trie interface { // in the trie with provided address. UpdateAccount(address common.Address, account *types.StateAccount) error - // UpdateContractCode abstracts code write to the trie. It is expected - // to be moved to the stateWriter interface when the latter is ready. - UpdateContractCode(address common.Address, codeHash common.Hash, code []byte) error - // DeleteStorage removes any existing value for key from the trie. If a node // was not found in the database, a trie.MissingNodeError is returned. DeleteStorage(addr common.Address, key []byte) error diff --git a/core/state/statedb.go b/core/state/statedb.go index 9ea6afc401..f8457c6de3 100644 --- a/core/state/statedb.go +++ b/core/state/statedb.go @@ -1012,7 +1012,6 @@ func (s *StateDB) Commit(deleteEmptyObjects bool) (common.Hash, error) { if obj := s.stateObjects[addr]; !obj.deleted { // Write any contract code associated with the state object if obj.code != nil && obj.dirtyCode { - s.trie.UpdateContractCode(obj.Address(), common.BytesToHash(obj.CodeHash()), obj.code) rawdb.WriteCode(codeWriter, common.BytesToHash(obj.CodeHash()), obj.code) obj.dirtyCode = false } diff --git a/light/trie.go b/light/trie.go index b90b43c1dd..e0675f98c9 100644 --- a/light/trie.go +++ b/light/trie.go @@ -147,10 +147,6 @@ func (t *odrTrie) UpdateAccount(address common.Address, acc *types.StateAccount) }) } -func (t *odrTrie) UpdateContractCode(_ common.Address, _ common.Hash, _ []byte) error { - return nil -} - func (t *odrTrie) UpdateStorage(_ common.Address, key, value []byte) error { key = crypto.Keccak256(key) v, _ := rlp.EncodeToBytes(value) diff --git a/trie/secure_trie.go b/trie/secure_trie.go index 1df0b6a8f9..a6d5676197 100644 --- a/trie/secure_trie.go +++ b/trie/secure_trie.go @@ -176,10 +176,6 @@ func (t *StateTrie) UpdateAccount(address common.Address, acc *types.StateAccoun return nil } -func (t *StateTrie) UpdateContractCode(_ common.Address, _ common.Hash, _ []byte) error { - return nil -} - // MustDelete removes any existing value for key from the trie. This function // will omit any encountered error but just print out an error message. func (t *StateTrie) MustDelete(key []byte) {