implement EIP-2028

This commit is contained in:
andri lim 2019-11-11 12:20:46 +07:00 committed by zah
parent 4cf3931f34
commit 1937fd700d
2 changed files with 6 additions and 6 deletions

View File

@ -12,19 +12,19 @@ import
import eth/common/transaction as common_transaction import eth/common/transaction as common_transaction
export common_transaction export common_transaction
func intrinsicGas*(data: openarray[byte]): GasInt = func intrinsicGas*(data: openarray[byte], fork: Fork): GasInt =
result = 21_000 # GasTransaction result = gasFees[fork][GasTransaction]
for i in data: for i in data:
if i == 0: if i == 0:
result += 4 # GasTXDataZero result += gasFees[fork][GasTXDataZero]
else: else:
result += 68 # GasTXDataNonZero result += gasFees[fork][GasTXDataNonZero]
proc intrinsicGas*(tx: Transaction, fork: Fork): GasInt = proc intrinsicGas*(tx: Transaction, fork: Fork): GasInt =
# Compute the baseline gas cost for this transaction. This is the amount # Compute the baseline gas cost for this transaction. This is the amount
# of gas needed to send this transaction (but that is not actually used # of gas needed to send this transaction (but that is not actually used
# for computation) # for computation)
result = tx.payload.intrinsicGas result = tx.payload.intrinsicGas(fork)
if tx.isContractCreation: if tx.isContractCreation:
result = result + gasFees[fork][GasTXCreate] result = result + gasFees[fork][GasTXCreate]

View File

@ -609,7 +609,7 @@ func istanbulGasFees(previous_fees: GasFeeSchedule): GasFeeSchedule =
result[GasSload] = 800 result[GasSload] = 800
result[GasExtCodeHash] = 700 result[GasExtCodeHash] = 700
result[GasBalance] = 700 result[GasBalance] = 700
result[GasTXDataNonZero]= 16
const const
HomesteadGasFees = BaseGasFees.homesteadGasFees HomesteadGasFees = BaseGasFees.homesteadGasFees
TangerineGasFees = HomesteadGasFees.tangerineGasFees TangerineGasFees = HomesteadGasFees.tangerineGasFees