mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-25 06:06:44 +00:00
core/vm: replace GetCommittedState with GetStateAndCommittedState
This commit is contained in:
parent
b6417f2efe
commit
0d42fb83c3
3 changed files with 2 additions and 8 deletions
|
|
@ -85,10 +85,6 @@ func (s *hookedStateDB) GetRefund() uint64 {
|
|||
return s.inner.GetRefund()
|
||||
}
|
||||
|
||||
func (s *hookedStateDB) GetCommittedState(addr common.Address, hash common.Hash) common.Hash {
|
||||
return s.inner.GetCommittedState(addr, hash)
|
||||
}
|
||||
|
||||
func (s *hookedStateDB) GetStateAndCommittedState(addr common.Address, hash common.Hash) (common.Hash, common.Hash) {
|
||||
return s.inner.GetStateAndCommittedState(addr, hash)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ var (
|
|||
func gasSStore(evm *EVM, contract *Contract, stack *Stack, mem *Memory, memorySize uint64) (uint64, error) {
|
||||
var (
|
||||
y, x = stack.Back(1), stack.Back(0)
|
||||
current = evm.StateDB.GetState(contract.Address(), x.Bytes32())
|
||||
current, original = evm.StateDB.GetStateAndCommittedState(contract.Address(), x.Bytes32())
|
||||
)
|
||||
// The legacy gas metering only takes into consideration the current state
|
||||
// Legacy rules should be applied if we are in Petersburg (removal of EIP-1283)
|
||||
|
|
@ -139,7 +139,6 @@ func gasSStore(evm *EVM, contract *Contract, stack *Stack, mem *Memory, memorySi
|
|||
if current == value { // noop (1)
|
||||
return params.NetSstoreNoopGas, nil
|
||||
}
|
||||
original := evm.StateDB.GetCommittedState(contract.Address(), x.Bytes32())
|
||||
if original == current {
|
||||
if original == (common.Hash{}) { // create slot (2.1.1)
|
||||
return params.NetSstoreInitGas, nil
|
||||
|
|
|
|||
|
|
@ -50,7 +50,6 @@ type StateDB interface {
|
|||
SubRefund(uint64)
|
||||
GetRefund() uint64
|
||||
|
||||
GetCommittedState(common.Address, common.Hash) common.Hash
|
||||
GetStateAndCommittedState(common.Address, common.Hash) (common.Hash, common.Hash)
|
||||
GetState(common.Address, common.Hash) common.Hash
|
||||
SetState(common.Address, common.Hash, common.Hash) common.Hash
|
||||
|
|
|
|||
Loading…
Reference in a new issue