Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove gasSelfdestructAP1 #656

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions core/vm/eips.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,11 @@ func enable2929(jt *JumpTable) {
jt[SELFDESTRUCT].dynamicGas = gasSelfdestructEIP2929
}

// enableAP1 disables gas refunds for SSTORE and SELFDESTRUCT. It is very
// similar to EIP-3298: Removal of Refunds [DRAFT]
// (https://eips.ethereum.org/EIPS/eip-3298).
// enableAP1 uses gasSStoreAP1 for SSTORE.
// Prior to AP1, gasSStore does not apply NormalizeStateKey, which is incorrect.
// This fixes the use of GetCommittedState in SSTORE.
func enableAP1(jt *JumpTable) {
jt[SSTORE].dynamicGas = gasSStoreAP1
jt[SELFDESTRUCT].dynamicGas = gasSelfdestructAP1
}

// enable3198 applies EIP-3198 (BASEFEE Opcode)
Expand Down
20 changes: 0 additions & 20 deletions core/vm/gas_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -523,23 +523,3 @@ func gasSelfdestruct(evm *EVM, contract *Contract, stack *Stack, mem *Memory, me
}
return gas, nil
}

func gasSelfdestructAP1(evm *EVM, contract *Contract, stack *Stack, mem *Memory, memorySize uint64) (uint64, error) {
var gas uint64
// EIP150 homestead gas reprice fork:
if evm.chainRules.IsEIP150 {
gas = params.SelfdestructGasEIP150
var address = common.Address(stack.Back(0).Bytes20())

if evm.chainRules.IsEIP158 {
// if empty and transfers value
if evm.StateDB.Empty(address) && evm.StateDB.GetBalance(contract.Address()).Sign() != 0 {
gas += params.CreateBySelfdestructGas
}
} else if !evm.StateDB.Exist(address) {
gas += params.CreateBySelfdestructGas
}
}

return gas, nil
}
Loading