a couple of Nim 1.0.2-related fixes

This commit is contained in:
Ștefan Talpalaru 2019-10-16 15:00:23 +02:00 committed by andri lim
parent 25f70775be
commit 70bcce2132
No known key found for this signature in database
GPG Key ID: 31702AE10541E6B9
3 changed files with 5 additions and 5 deletions

View File

@ -247,7 +247,7 @@ proc setupEthRpc*(node: EthereumNode, chain: BaseChainDB, rpcsrv: RpcServer) =
let
source = send.source.toAddress
destination = send.to.toAddress
data = send.data.string.fromHex
data = nimcrypto.utils.fromHex(send.data.string)
contractCreation = false # TODO: Check if has code
v = 0.byte # TODO
r = 0.u256
@ -322,7 +322,7 @@ proc setupEthRpc*(node: EthereumNode, chain: BaseChainDB, rpcsrv: RpcServer) =
# if no wallets, remains as ZERO_ADDRESS
# TODO: Wallets
destination = if call.to.isSome: call.to.get.toAddress else: ZERO_ADDRESS
data = if call.data.isSome: call.data.get.string.fromHex else: @[]
data = if call.data.isSome: nimcrypto.utils.fromHex(call.data.get.string) else: @[]
value = if call.value.isSome: call.value.get else: 0.u256
comp = setupComputation(vmState, header.blockNumber, value, data, sender, destination, gasLimit, gasPrice, call.to.isNone)

View File

@ -358,7 +358,7 @@ template gasCosts(fork: Fork, prefix, ResultGasCostsName: untyped) =
# ###################################################################################################
# TODO - change this `let` into `const` - pending: https://github.com/nim-lang/Nim/issues/8015
let `ResultGasCostsName`*{.inject.}: GasCosts = block:
let `ResultGasCostsName`*{.inject, compileTime.}: GasCosts = block:
# We use a block expression to avoid name redefinition conflicts
# with "fixed" and "dynamic"

View File

@ -179,8 +179,8 @@ proc modExpInternal(computation: BaseComputation, base_len, exp_len, mod_len: in
# we should return a 256-bit big-endian byte array
# Force static evaluation
func zero(): static array[T.bits div 8, byte] = discard
func one(): static array[T.bits div 8, byte] =
func zero(): array[T.bits div 8, byte] {.compileTime.} = discard
func one(): array[T.bits div 8, byte] {.compileTime.} =
when cpuEndian == bigEndian:
result[0] = 1
else: