mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-02-10 19:17:16 +00:00
implement Tangerine fork gas cost changes
This commit is contained in:
parent
4ec1af0fe7
commit
77e9c18f91
@ -303,7 +303,7 @@ template gasCosts(fork: Fork, prefix, ResultGasCostsName: untyped) =
|
|||||||
|
|
||||||
# Cnew_account
|
# Cnew_account
|
||||||
if gasParams.c_isNewAccount and gasParams.kind == Call:
|
if gasParams.c_isNewAccount and gasParams.kind == Call:
|
||||||
if fork < FkSpurious:
|
when fork < FkSpurious:
|
||||||
# Pre-EIP161 all account creation calls consumed 25000 gas.
|
# Pre-EIP161 all account creation calls consumed 25000 gas.
|
||||||
result.gasCost += static(FeeSchedule[GasNewAccount])
|
result.gasCost += static(FeeSchedule[GasNewAccount])
|
||||||
else:
|
else:
|
||||||
@ -321,7 +321,7 @@ template gasCosts(fork: Fork, prefix, ResultGasCostsName: untyped) =
|
|||||||
result.gasCost += static(FeeSchedule[GasCall])
|
result.gasCost += static(FeeSchedule[GasCall])
|
||||||
|
|
||||||
# Cgascap
|
# Cgascap
|
||||||
if fork >= FkTangerine:
|
when fork >= FkTangerine:
|
||||||
# https://github.com/ethereum/EIPs/blob/master/EIPS/eip-150.md
|
# https://github.com/ethereum/EIPs/blob/master/EIPS/eip-150.md
|
||||||
result.gasRefund =
|
result.gasRefund =
|
||||||
if gasParams.c_gasBalance >= result.gasCost:
|
if gasParams.c_gasBalance >= result.gasCost:
|
||||||
@ -578,10 +578,11 @@ func homesteadGasFees(previous_fees: GasFeeSchedule): GasFeeSchedule =
|
|||||||
func tangerineGasFees(previous_fees: GasFeeSchedule): GasFeeSchedule =
|
func tangerineGasFees(previous_fees: GasFeeSchedule): GasFeeSchedule =
|
||||||
# https://github.com/ethereum/EIPs/blob/master/EIPS/eip-150.md
|
# https://github.com/ethereum/EIPs/blob/master/EIPS/eip-150.md
|
||||||
result = previous_fees
|
result = previous_fees
|
||||||
|
result[GasExtCode] = 700
|
||||||
result[GasSload] = 200
|
result[GasSload] = 200
|
||||||
result[GasSelfDestruct] = 5000
|
result[GasSelfDestruct] = 5000
|
||||||
result[GasBalance] = 400
|
result[GasBalance] = 400
|
||||||
result[GasCall] = 40
|
result[GasCall] = 700
|
||||||
|
|
||||||
func spuriousGasFees(previous_fees: GasFeeSchedule): GasFeeSchedule =
|
func spuriousGasFees(previous_fees: GasFeeSchedule): GasFeeSchedule =
|
||||||
# https://github.com/ethereum/EIPs/blob/master/EIPS/eip-160.md
|
# https://github.com/ethereum/EIPs/blob/master/EIPS/eip-160.md
|
||||||
|
@ -540,8 +540,13 @@ proc canTransfer(computation: BaseComputation, memPos, memLen: int, value: Uint2
|
|||||||
proc setupCreate(computation: BaseComputation, memPos, len: int, value: Uint256): BaseComputation =
|
proc setupCreate(computation: BaseComputation, memPos, len: int, value: Uint256): BaseComputation =
|
||||||
let
|
let
|
||||||
callData = computation.memory.read(memPos, len)
|
callData = computation.memory.read(memPos, len)
|
||||||
|
|
||||||
|
var
|
||||||
createMsgGas = computation.getGasRemaining()
|
createMsgGas = computation.getGasRemaining()
|
||||||
|
|
||||||
|
if getFork(computation) >= FkTangerine:
|
||||||
|
createMsgGas -= createMsgGas div 64
|
||||||
|
|
||||||
# Consume gas here that will be passed to child
|
# Consume gas here that will be passed to child
|
||||||
computation.gasMeter.consumeGas(createMsgGas, reason="CREATE")
|
computation.gasMeter.consumeGas(createMsgGas, reason="CREATE")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user