mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-01-13 22:04:52 +00:00
fix block 2.463.413 problem
This commit is contained in:
parent
34fd831d6f
commit
69c1d9e357
@ -8,7 +8,7 @@
|
|||||||
import
|
import
|
||||||
math, eth/common/eth_types,
|
math, eth/common/eth_types,
|
||||||
./utils/[macros_gen_opcodes, utils_numeric],
|
./utils/[macros_gen_opcodes, utils_numeric],
|
||||||
./opcode_values, ./vm_forks
|
./opcode_values, ./vm_forks, ../../errors
|
||||||
|
|
||||||
# Gas Fee Schedule
|
# Gas Fee Schedule
|
||||||
# Yellow Paper Appendix G - https://ethereum.github.io/yellowpaper/paper.pdf
|
# Yellow Paper Appendix G - https://ethereum.github.io/yellowpaper/paper.pdf
|
||||||
@ -67,7 +67,7 @@ type
|
|||||||
of Call, CallCode, DelegateCall, StaticCall:
|
of Call, CallCode, DelegateCall, StaticCall:
|
||||||
c_isNewAccount*: bool
|
c_isNewAccount*: bool
|
||||||
c_gasBalance*: GasInt
|
c_gasBalance*: GasInt
|
||||||
c_contractGas*: Gasint
|
c_contractGas*: Uint256
|
||||||
c_currentMemSize*: Natural
|
c_currentMemSize*: Natural
|
||||||
c_memOffset*: Natural
|
c_memOffset*: Natural
|
||||||
c_memLength*: Natural
|
c_memLength*: Natural
|
||||||
@ -325,16 +325,16 @@ template gasCosts(fork: Fork, prefix, ResultGasCostsName: untyped) =
|
|||||||
# Cgascap
|
# Cgascap
|
||||||
when 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 =
|
let gas = `prefix all_but_one_64th`(gasParams.c_gasBalance - result.gasCost)
|
||||||
if gasParams.c_gasBalance >= result.gasCost:
|
if gasParams.c_contractGas > high(GasInt).u256 or
|
||||||
min(
|
gas < gasParams.c_contractGas.truncate(GasInt):
|
||||||
`prefix all_but_one_64th`(gasParams.c_gasBalance - result.gasCost),
|
result.gasRefund = gas
|
||||||
gasParams.c_contractGas
|
else:
|
||||||
)
|
result.gasRefund = gasParams.c_contractGas.truncate(GasInt)
|
||||||
else:
|
|
||||||
gasParams.c_contractGas
|
|
||||||
else:
|
else:
|
||||||
result.gasRefund += gasParams.c_contractGas
|
if gasParams.c_contractGas > high(GasInt).u256:
|
||||||
|
raise newException(TypeError, "GasInt Overflow (" & $gasParams.kind & ") " & $gasParams.c_contractGas)
|
||||||
|
result.gasRefund = gasParams.c_contractGas.truncate(GasInt)
|
||||||
|
|
||||||
result.gasCost += result.gasRefund
|
result.gasCost += result.gasRefund
|
||||||
|
|
||||||
|
@ -710,15 +710,12 @@ template genCall(callName: untyped, opCode: Op): untyped =
|
|||||||
else:
|
else:
|
||||||
(memOutPos, memOutLen)
|
(memOutPos, memOutLen)
|
||||||
|
|
||||||
if gas > high(GasInt).u256:
|
|
||||||
raise newException(TypeError, "GasInt Overflow (" & callNameStr & ")")
|
|
||||||
|
|
||||||
let (childGasFee, childGasLimit) = computation.gasCosts[opCode].c_handler(
|
let (childGasFee, childGasLimit) = computation.gasCosts[opCode].c_handler(
|
||||||
value,
|
value,
|
||||||
GasParams(kind: opCode,
|
GasParams(kind: opCode,
|
||||||
c_isNewAccount: isNewAccount,
|
c_isNewAccount: isNewAccount,
|
||||||
c_gasBalance: computation.gasMeter.gasRemaining,
|
c_gasBalance: computation.gasMeter.gasRemaining,
|
||||||
c_contractGas: gas.truncate(GasInt),
|
c_contractGas: gas,
|
||||||
c_currentMemSize: computation.memory.len,
|
c_currentMemSize: computation.memory.len,
|
||||||
c_memOffset: memOffset,
|
c_memOffset: memOffset,
|
||||||
c_memLength: memLength
|
c_memLength: memLength
|
||||||
|
Loading…
x
Reference in New Issue
Block a user