Moved and unstubbed intrinsicGas from vm_state_transactions
This commit is contained in:
parent
c2fae69318
commit
20933f494b
|
@ -20,11 +20,19 @@ proc initTransaction*(nonce: AccountNonce, gasPrice, gasLimit: GasInt, to: EthAd
|
||||||
result.S = S
|
result.S = S
|
||||||
result.isContractCreation = isContractCreation
|
result.isContractCreation = isContractCreation
|
||||||
|
|
||||||
|
func intrinsicGas*(data: openarray[byte]): GasInt =
|
||||||
|
result = 21_000 # GasTransaction
|
||||||
|
for i in data:
|
||||||
|
if i == 0:
|
||||||
|
result += 4 # GasTXDataZero
|
||||||
|
else:
|
||||||
|
result += 68 # GasTXDataNonZero
|
||||||
|
|
||||||
proc intrinsicGas*(t: Transaction): GasInt =
|
proc intrinsicGas*(t: Transaction): 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)
|
||||||
raise newException(ValueError, "not implemented intrinsicGas")
|
result = t.payload.intrinsicGas
|
||||||
|
|
||||||
proc validate*(t: Transaction) =
|
proc validate*(t: Transaction) =
|
||||||
# Hook called during instantiation to ensure that all transaction
|
# Hook called during instantiation to ensure that all transaction
|
||||||
|
|
|
@ -12,14 +12,6 @@ import
|
||||||
./transaction, ./vm_types, ./vm_state, ./block_types, ./db/[db_chain, state_db], ./utils/header,
|
./transaction, ./vm_types, ./vm_state, ./block_types, ./db/[db_chain, state_db], ./utils/header,
|
||||||
./vm/interpreter, ./vm/interpreter/gas_costs, ./utils/addresses
|
./vm/interpreter, ./vm/interpreter/gas_costs, ./utils/addresses
|
||||||
|
|
||||||
func intrinsicGas*(data: openarray[byte]): GasInt =
|
|
||||||
result = 21_000
|
|
||||||
for i in data:
|
|
||||||
if i == 0:
|
|
||||||
result += 4
|
|
||||||
else:
|
|
||||||
result += 68
|
|
||||||
|
|
||||||
proc validateTransaction*(vmState: BaseVMState, transaction: Transaction, sender: EthAddress): bool =
|
proc validateTransaction*(vmState: BaseVMState, transaction: Transaction, sender: EthAddress): bool =
|
||||||
# XXX: https://github.com/status-im/nimbus/issues/35#issuecomment-391726518
|
# XXX: https://github.com/status-im/nimbus/issues/35#issuecomment-391726518
|
||||||
# XXX: lots of avoidable u256 construction
|
# XXX: lots of avoidable u256 construction
|
||||||
|
|
Loading…
Reference in New Issue