From 86d93f005ea96f62013625ab411abc23629095ad Mon Sep 17 00:00:00 2001 From: Li Dongwei Date: Fri, 25 Jun 2021 20:34:09 +0800 Subject: [PATCH] core/state: remove unused methods ReturnGas, GetStorageProofByHash (#23092) Co-authored-by: lidongwei --- core/state/state_object.go | 3 --- core/state/statedb.go | 12 ------------ core/vm/logger_test.go | 1 - eth/tracers/tracer_test.go | 1 - 4 files changed, 17 deletions(-) diff --git a/core/state/state_object.go b/core/state/state_object.go index f93f47d5f5b1..38621ffb6159 100644 --- a/core/state/state_object.go +++ b/core/state/state_object.go @@ -450,9 +450,6 @@ func (s *stateObject) setBalance(amount *big.Int) { s.data.Balance = amount } -// Return the gas back to the origin. Used by the Virtual machine or Closures -func (s *stateObject) ReturnGas(gas *big.Int) {} - func (s *stateObject) deepCopy(db *StateDB) *stateObject { stateObject := newObject(db, s.address, s.data) if s.trie != nil { diff --git a/core/state/statedb.go b/core/state/statedb.go index 203556c6b76a..78393dea3cf8 100644 --- a/core/state/statedb.go +++ b/core/state/statedb.go @@ -333,17 +333,6 @@ func (s *StateDB) GetStorageProof(a common.Address, key common.Hash) ([][]byte, return proof, err } -// GetStorageProofByHash returns the Merkle proof for given storage slot. -func (s *StateDB) GetStorageProofByHash(a common.Address, key common.Hash) ([][]byte, error) { - var proof proofList - trie := s.StorageTrie(a) - if trie == nil { - return proof, errors.New("storage trie for requested address does not exist") - } - err := trie.Prove(crypto.Keccak256(key.Bytes()), 0, &proof) - return proof, err -} - // GetCommittedState retrieves a value from the given account's committed storage trie. func (s *StateDB) GetCommittedState(addr common.Address, hash common.Hash) common.Hash { stateObject := s.getStateObject(addr) @@ -597,7 +586,6 @@ func (s *StateDB) createObject(addr common.Address) (newobj, prev *stateObject) } } newobj = newObject(s, addr, Account{}) - newobj.setNonce(0) // sets the object to dirty if prev == nil { s.journal.append(createObjectChange{account: &addr}) } else { diff --git a/core/vm/logger_test.go b/core/vm/logger_test.go index 0bbfd4469206..730d8374bb91 100644 --- a/core/vm/logger_test.go +++ b/core/vm/logger_test.go @@ -30,7 +30,6 @@ type dummyContractRef struct { calledForEach bool } -func (dummyContractRef) ReturnGas(*big.Int) {} func (dummyContractRef) Address() common.Address { return common.Address{} } func (dummyContractRef) Value() *big.Int { return new(big.Int) } func (dummyContractRef) SetCode(common.Hash, []byte) {} diff --git a/eth/tracers/tracer_test.go b/eth/tracers/tracer_test.go index 038b3944c31b..cd1a8cddc59a 100644 --- a/eth/tracers/tracer_test.go +++ b/eth/tracers/tracer_test.go @@ -39,7 +39,6 @@ func (account) SetBalance(*big.Int) {} func (account) SetNonce(uint64) {} func (account) Balance() *big.Int { return nil } func (account) Address() common.Address { return common.Address{} } -func (account) ReturnGas(*big.Int) {} func (account) SetCode(common.Hash, []byte) {} func (account) ForEachStorage(cb func(key, value common.Hash) bool) {}