From 70bcce2132543eb1d7080e0624b463ca54677505 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C8=98tefan=20Talpalaru?= Date: Wed, 16 Oct 2019 15:00:23 +0200 Subject: [PATCH] a couple of Nim 1.0.2-related fixes --- nimbus/rpc/p2p.nim | 4 ++-- nimbus/vm/interpreter/gas_costs.nim | 2 +- nimbus/vm/precompiles.nim | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/nimbus/rpc/p2p.nim b/nimbus/rpc/p2p.nim index 58a2ff89c..ae856fc82 100644 --- a/nimbus/rpc/p2p.nim +++ b/nimbus/rpc/p2p.nim @@ -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) diff --git a/nimbus/vm/interpreter/gas_costs.nim b/nimbus/vm/interpreter/gas_costs.nim index 400b0f886..90de3b2bf 100644 --- a/nimbus/vm/interpreter/gas_costs.nim +++ b/nimbus/vm/interpreter/gas_costs.nim @@ -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" diff --git a/nimbus/vm/precompiles.nim b/nimbus/vm/precompiles.nim index 5234087d8..90ab55243 100644 --- a/nimbus/vm/precompiles.nim +++ b/nimbus/vm/precompiles.nim @@ -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: