nimbus-eth1
nimbus-eth1 copied to clipboard
Support Gas costs and balance >= 2^31 on 32-bit
#40 is introduce native integer for gas prices and balances via int64.
Internally it uses toInt
proc from stint implemented as follow:
func toInt*(num: Stint or StUint): int {.inline.}=
# Returns as int. Result is modulo 2^(sizeof(int)
num.data.least_significant_word.int
On 32-bit, int32 would be returned instead of int64.
TODO: introduce a toInt64
conversion in Stint
Optionally, toInt64
might be wrapped in Nimbus in a toGasInt
proc that will add logging and range check for example to make sure a gas value on the stack (uint256) is not over 2^63 - 1 before conversion.