diff --git a/nimbus/genesis.nim b/nimbus/genesis.nim index 993c28b56..765885b2e 100644 --- a/nimbus/genesis.nim +++ b/nimbus/genesis.nim @@ -1,5 +1,5 @@ import - tables, json, strutils, times, + tables, json, times, eth/[common, rlp, trie], stint, stew/[byteutils, ranges], chronicles, eth/trie/db, db/[db_chain, state_db], genesis_alloc, config, constants diff --git a/nimbus/p2p/executor.nim b/nimbus/p2p/executor.nim index 8d0859e76..b79846122 100644 --- a/nimbus/p2p/executor.nim +++ b/nimbus/p2p/executor.nim @@ -117,7 +117,7 @@ proc processBlock*(chainDB: BaseChainDB, header: BlockHeader, body: BlockBody, v for txIndex, tx in body.transactions: var sender: EthAddress if tx.getSender(sender): - let gasUsed = processTransaction(tx, sender, vmState, fork) + discard processTransaction(tx, sender, vmState, fork) else: debug "Could not get sender", txIndex, tx return ValidationResult.Error diff --git a/nimbus/utils/difficulty.nim b/nimbus/utils/difficulty.nim index 11b58db9a..8bb747e08 100644 --- a/nimbus/utils/difficulty.nim +++ b/nimbus/utils/difficulty.nim @@ -1,8 +1,7 @@ import times, eth/common, stint, - ../constants, ../vm/interpreter/vm_forks, - ../config + ../constants, ../config const ExpDiffPeriod = 100000.u256 diff --git a/nimbus/utils/header.nim b/nimbus/utils/header.nim index be157d4df..45ca23976 100644 --- a/nimbus/utils/header.nim +++ b/nimbus/utils/header.nim @@ -9,7 +9,7 @@ import strformat, times, options, eth/[common, rlp], - ./difficulty, ../vm/interpreter/vm_forks, ../constants, + ./difficulty, ../constants, ../config export BlockHeader diff --git a/nimbus/vm/computation.nim b/nimbus/vm/computation.nim index 989981ddf..51ba53de2 100644 --- a/nimbus/vm/computation.nim +++ b/nimbus/vm/computation.nim @@ -6,7 +6,7 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - chronicles, strformat, strutils, sequtils, macros, math, options, times, + chronicles, strformat, macros, options, times, sets, eth/[common, keys], eth/trie/db as triedb, ../constants, ../errors, ../vm_state, ../vm_types, ./interpreter/[opcode_values, gas_meter, gas_costs, vm_forks], diff --git a/nimbus/vm/interpreter/opcodes_impl.nim b/nimbus/vm/interpreter/opcodes_impl.nim index 8abf0cdfc..813d2bcb6 100644 --- a/nimbus/vm/interpreter/opcodes_impl.nim +++ b/nimbus/vm/interpreter/opcodes_impl.nim @@ -10,7 +10,7 @@ import chronicles, stint, nimcrypto, stew/ranges/[typedranges, ptr_arith], eth/common, ./utils/[macros_procs_opcodes, utils_numeric], ./gas_meter, ./gas_costs, ./opcode_values, ./vm_forks, - ../memory, ../message, ../stack, ../code_stream, ../computation, + ../memory, ../stack, ../code_stream, ../computation, ../../vm_state, ../../errors, ../../constants, ../../vm_types, ../../db/[db_chain, state_db] diff --git a/nimbus/vm/interpreter/utils/macros_procs_opcodes.nim b/nimbus/vm/interpreter/utils/macros_procs_opcodes.nim index 8c70315d2..d339c078c 100644 --- a/nimbus/vm/interpreter/utils/macros_procs_opcodes.nim +++ b/nimbus/vm/interpreter/utils/macros_procs_opcodes.nim @@ -12,7 +12,7 @@ import macros, strformat, stint, eth/common, ../../computation, ../../stack, ../../code_stream, ../../../vm_types, ../../memory, - ../../../errors, ../../message, ../../interpreter/[gas_meter, opcode_values], + ../../../errors, ../../interpreter/[gas_meter, opcode_values], ../../interpreter/utils/utils_numeric when defined(evmc_enabled): diff --git a/nimbus/vm/message.nim b/nimbus/vm/message.nim index f26adb00e..5478a9ea6 100644 --- a/nimbus/vm/message.nim +++ b/nimbus/vm/message.nim @@ -5,9 +5,7 @@ # * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT) # at your option. This file may not be copied, modified, or distributed except according to those terms. -import - eth/common, - ../constants, ../validation, ../vm_types, chronicles +import ../vm_types proc isCreate*(message: Message): bool = message.kind in {evmcCreate, evmcCreate2} diff --git a/nimbus/vm/precompiles.nim b/nimbus/vm/precompiles.nim index ddd635592..b3b50b75c 100644 --- a/nimbus/vm/precompiles.nim +++ b/nimbus/vm/precompiles.nim @@ -1,7 +1,7 @@ import ../vm_types, interpreter/[gas_meter, gas_costs, utils/utils_numeric, vm_forks], ../errors, stint, eth/[keys, common], chronicles, tables, macros, - message, math, nimcrypto, bncurve/[fields, groups], blake2b_f + math, nimcrypto, bncurve/[fields, groups], blake2b_f type PrecompileAddresses* = enum diff --git a/nimbus/vm/transaction_tracer.nim b/nimbus/vm/transaction_tracer.nim index ee0a1f206..2fa5555cf 100644 --- a/nimbus/vm/transaction_tracer.nim +++ b/nimbus/vm/transaction_tracer.nim @@ -2,7 +2,7 @@ import json, strutils, sets, hashes, chronicles, nimcrypto, eth/common, stint, ../vm_types, memory, stack, ../db/state_db, - eth/trie/hexary, ./message, stew/ranges/typedranges, + eth/trie/hexary, stew/ranges/typedranges, ./interpreter/opcode_values logScope: diff --git a/tests/macro_assembler.nim b/tests/macro_assembler.nim index 7a71a2478..c4270c376 100644 --- a/tests/macro_assembler.nim +++ b/tests/macro_assembler.nim @@ -263,9 +263,9 @@ proc runVM*(blockNumber: Uint256, chainDB: BaseChainDB, boa: Assembler): bool = var computation = initComputation(blockNumber, chainDB, boa.code, boa.data, boa.fork) # TODO: support gas comsumption validation - let gas = computation.gasMeter.gasRemaining + # let gas = computation.gasMeter.gasRemaining execComputation(computation) - let gasUsed = gas - computation.gasMeter.gasRemaining + # let gasUsed = gas - computation.gasMeter.gasRemaining if computation.isSuccess: if boa.success == false: diff --git a/tests/test_blockchain_json.nim b/tests/test_blockchain_json.nim index a5b1c490d..a0749682f 100644 --- a/tests/test_blockchain_json.nim +++ b/tests/test_blockchain_json.nim @@ -8,7 +8,7 @@ import unittest2, json, os, tables, strutils, sets, strformat, times, options, - eth/[common, rlp, bloom], eth/trie/[db, trie_defs], + eth/[common, rlp], eth/trie/[db, trie_defs], ethash, stew/endians2, nimcrypto, ./test_helpers, ./test_allowed_to_fail, ../premix/parser, test_config, @@ -330,7 +330,7 @@ proc processBlock(chainDB: BaseChainDB, vmState: BaseVMState, minedBlock: PlainB for txIndex, tx in minedBlock.transactions: var sender: EthAddress if tx.getSender(sender): - let gasUsed = processTransaction(tx, sender, vmState, fork) + discard processTransaction(tx, sender, vmState, fork) else: raise newException(ValidationError, "could not get sender") vmState.receipts[txIndex] = makeReceipt(vmState, fork) @@ -622,7 +622,7 @@ proc runTester(tester: var Tester, chainDB: BaseChainDB, testStatusIMPL: var Tes if shouldBeGoodBlock: try: - let (preminedBlock, minedBlock, blockRlp) = tester.applyFixtureBlockToChain( + let (preminedBlock, _, _) = tester.applyFixtureBlockToChain( testerBlock, chainDB, checkSeal, validation = false) # we manually validate below check validateBlock(chainDB, preminedBlock, checkSeal) == true except: diff --git a/tests/test_generalstate_json.nim b/tests/test_generalstate_json.nim index da6e77970..e5f4cd9ec 100644 --- a/tests/test_generalstate_json.nim +++ b/tests/test_generalstate_json.nim @@ -6,13 +6,13 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - unittest2, strformat, strutils, tables, json, times, os, sets, + unittest2, strutils, tables, json, times, os, sets, stew/ranges/typedranges, nimcrypto, options, eth/[rlp, common], eth/trie/[db, trie_defs], chronicles, ./test_helpers, ./test_allowed_to_fail, ../nimbus/p2p/executor, test_config, ../nimbus/transaction, - ../nimbus/[vm_state, vm_types, vm_state_transactions, utils], + ../nimbus/[vm_state, vm_types, utils], ../nimbus/vm/interpreter, ../nimbus/db/[db_chain, state_db] diff --git a/tests/test_helpers.nim b/tests/test_helpers.nim index 24f88f4f8..911bdef63 100644 --- a/tests/test_helpers.nim +++ b/tests/test_helpers.nim @@ -9,9 +9,9 @@ import os, macros, json, strformat, strutils, parseutils, os, tables, stew/byteutils, stew/ranges/typedranges, net, eth/[common, keys, rlp, p2p], unittest2, testutils/markdown_reports, - ../nimbus/[vm_state, config, transaction, utils, errors], - ../nimbus/db/[db_chain, state_db], - ../nimbus/vm/interpreter/vm_forks + ../nimbus/[config, transaction, utils, errors], + ../nimbus/vm/interpreter/vm_forks, + ../nimbus/db/state_db func revmap(x: Table[Fork, string]): Table[string, Fork] = result = initTable[string, Fork]() @@ -70,10 +70,10 @@ macro jsonTest*(s: static[string], handler: untyped, skipTest: untyped = skipNot testStatusIMPL = ident("testStatusIMPL") testName = ident("testName") # workaround for strformat in quote do: https://github.com/nim-lang/Nim/issues/8220 - symbol = newIdentNode"symbol" - final = newIdentNode"final" - name = newIdentNode"name" - formatted = newStrLitNode"{symbol[final]} {name:<64}{$final}{'\n'}" + symbol {.used.} = newIdentNode"symbol" + final {.used.} = newIdentNode"final" + name {.used.} = newIdentNode"name" + formatted {.used.} = newStrLitNode"{symbol[final]} {name:<64}{$final}{'\n'}" result = quote: var filenames: seq[string] = @[] diff --git a/tests/test_persistblock_json.nim b/tests/test_persistblock_json.nim index d05b3dd4e..3934f0eea 100644 --- a/tests/test_persistblock_json.nim +++ b/tests/test_persistblock_json.nim @@ -6,7 +6,7 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - unittest2, json, os, tables, strformat, strutils, + unittest2, json, os, tables, strutils, eth/[common, rlp], stew/byteutils, eth/trie/db, ./test_helpers, ../nimbus/db/db_chain, ../nimbus/p2p/chain diff --git a/tests/test_stack.nim b/tests/test_stack.nim index 990cf0a20..a1027226b 100644 --- a/tests/test_stack.nim +++ b/tests/test_stack.nim @@ -16,7 +16,7 @@ template testPush(value: untyped, expected: untyped): untyped = stack.push(value) check(stack.values == @[expected]) -template testFailPush(value: untyped): untyped = +template testFailPush(value: untyped): untyped {.used.} = var stack = newStack() expect(ValidationError): stack.push(value) diff --git a/tests/test_tracer_json.nim b/tests/test_tracer_json.nim index dd20ac1c8..b8530c569 100644 --- a/tests/test_tracer_json.nim +++ b/tests/test_tracer_json.nim @@ -6,7 +6,7 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - unittest2, json, os, tables, strformat, strutils, + unittest2, json, os, tables, strutils, eth/common, stew/byteutils, eth/trie/db, ./test_helpers, ../nimbus/db/db_chain, ../nimbus/[tracer, vm_types] diff --git a/tests/test_transaction_json.nim b/tests/test_transaction_json.nim index bf5b483aa..4c813f301 100644 --- a/tests/test_transaction_json.nim +++ b/tests/test_transaction_json.nim @@ -1,7 +1,7 @@ import - unittest2, json, os, tables, strformat, strutils, + unittest2, json, os, tables, strutils, eth/[common, rlp], - ./test_helpers, ./test_allowed_to_fail, + ./test_helpers, ../nimbus/[transaction, utils, errors] const diff --git a/tests/test_vm_json.nim b/tests/test_vm_json.nim index d426c9cee..258468963 100644 --- a/tests/test_vm_json.nim +++ b/tests/test_vm_json.nim @@ -10,7 +10,7 @@ import stew/byteutils, stew/ranges/typedranges, eth/[rlp, common], eth/trie/db, ./test_helpers, ./test_allowed_to_fail, ../nimbus/vm/interpreter, ../nimbus/[constants, vm_state, vm_types, utils], - ../nimbus/db/[db_chain, state_db] + ../nimbus/db/[db_chain] func bytesToHex(x: openarray[byte]): string {.inline.} = ## TODO: use seq[byte] for raw data and delete this proc @@ -43,7 +43,6 @@ proc testFixture(fixtures: JsonNode, testStatusIMPL: var TestStatus) = let fexec = fixture["exec"] vmState.mutateStateDB: setupStateDB(fixture{"pre"}, db) - let address = fexec{"address"}.getStr.parseAddress vmState.setupTxContext( origin = fexec{"origin"}.getStr.parseAddress,