reduce unused import warnings

This commit is contained in:
andri lim 2020-04-15 18:09:49 +07:00
parent ad28b641cd
commit af02a3b1b2
No known key found for this signature in database
GPG Key ID: 31702AE10541E6B9
19 changed files with 30 additions and 34 deletions

View File

@ -1,5 +1,5 @@
import import
tables, json, strutils, times, tables, json, times,
eth/[common, rlp, trie], stint, stew/[byteutils, ranges], eth/[common, rlp, trie], stint, stew/[byteutils, ranges],
chronicles, eth/trie/db, chronicles, eth/trie/db,
db/[db_chain, state_db], genesis_alloc, config, constants db/[db_chain, state_db], genesis_alloc, config, constants

View File

@ -117,7 +117,7 @@ proc processBlock*(chainDB: BaseChainDB, header: BlockHeader, body: BlockBody, v
for txIndex, tx in body.transactions: for txIndex, tx in body.transactions:
var sender: EthAddress var sender: EthAddress
if tx.getSender(sender): if tx.getSender(sender):
let gasUsed = processTransaction(tx, sender, vmState, fork) discard processTransaction(tx, sender, vmState, fork)
else: else:
debug "Could not get sender", txIndex, tx debug "Could not get sender", txIndex, tx
return ValidationResult.Error return ValidationResult.Error

View File

@ -1,8 +1,7 @@
import import
times, times,
eth/common, stint, eth/common, stint,
../constants, ../vm/interpreter/vm_forks, ../constants, ../config
../config
const const
ExpDiffPeriod = 100000.u256 ExpDiffPeriod = 100000.u256

View File

@ -9,7 +9,7 @@
import import
strformat, times, options, strformat, times, options,
eth/[common, rlp], eth/[common, rlp],
./difficulty, ../vm/interpreter/vm_forks, ../constants, ./difficulty, ../constants,
../config ../config
export BlockHeader export BlockHeader

View File

@ -6,7 +6,7 @@
# at your option. This file may not be copied, modified, or distributed except according to those terms. # at your option. This file may not be copied, modified, or distributed except according to those terms.
import import
chronicles, strformat, strutils, sequtils, macros, math, options, times, chronicles, strformat, macros, options, times,
sets, eth/[common, keys], eth/trie/db as triedb, sets, eth/[common, keys], eth/trie/db as triedb,
../constants, ../errors, ../vm_state, ../vm_types, ../constants, ../errors, ../vm_state, ../vm_types,
./interpreter/[opcode_values, gas_meter, gas_costs, vm_forks], ./interpreter/[opcode_values, gas_meter, gas_costs, vm_forks],

View File

@ -10,7 +10,7 @@ import
chronicles, stint, nimcrypto, stew/ranges/[typedranges, ptr_arith], eth/common, chronicles, stint, nimcrypto, stew/ranges/[typedranges, ptr_arith], eth/common,
./utils/[macros_procs_opcodes, utils_numeric], ./utils/[macros_procs_opcodes, utils_numeric],
./gas_meter, ./gas_costs, ./opcode_values, ./vm_forks, ./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, ../../vm_state, ../../errors, ../../constants, ../../vm_types,
../../db/[db_chain, state_db] ../../db/[db_chain, state_db]

View File

@ -12,7 +12,7 @@ import
macros, strformat, stint, eth/common, macros, strformat, stint, eth/common,
../../computation, ../../stack, ../../code_stream, ../../computation, ../../stack, ../../code_stream,
../../../vm_types, ../../memory, ../../../vm_types, ../../memory,
../../../errors, ../../message, ../../interpreter/[gas_meter, opcode_values], ../../../errors, ../../interpreter/[gas_meter, opcode_values],
../../interpreter/utils/utils_numeric ../../interpreter/utils/utils_numeric
when defined(evmc_enabled): when defined(evmc_enabled):

View File

@ -5,9 +5,7 @@
# * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT) # * 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. # at your option. This file may not be copied, modified, or distributed except according to those terms.
import import ../vm_types
eth/common,
../constants, ../validation, ../vm_types, chronicles
proc isCreate*(message: Message): bool = proc isCreate*(message: Message): bool =
message.kind in {evmcCreate, evmcCreate2} message.kind in {evmcCreate, evmcCreate2}

View File

@ -1,7 +1,7 @@
import import
../vm_types, interpreter/[gas_meter, gas_costs, utils/utils_numeric, vm_forks], ../vm_types, interpreter/[gas_meter, gas_costs, utils/utils_numeric, vm_forks],
../errors, stint, eth/[keys, common], chronicles, tables, macros, ../errors, stint, eth/[keys, common], chronicles, tables, macros,
message, math, nimcrypto, bncurve/[fields, groups], blake2b_f math, nimcrypto, bncurve/[fields, groups], blake2b_f
type type
PrecompileAddresses* = enum PrecompileAddresses* = enum

View File

@ -2,7 +2,7 @@ import
json, strutils, sets, hashes, json, strutils, sets, hashes,
chronicles, nimcrypto, eth/common, stint, chronicles, nimcrypto, eth/common, stint,
../vm_types, memory, stack, ../db/state_db, ../vm_types, memory, stack, ../db/state_db,
eth/trie/hexary, ./message, stew/ranges/typedranges, eth/trie/hexary, stew/ranges/typedranges,
./interpreter/opcode_values ./interpreter/opcode_values
logScope: logScope:

View File

@ -263,9 +263,9 @@ proc runVM*(blockNumber: Uint256, chainDB: BaseChainDB, boa: Assembler): bool =
var computation = initComputation(blockNumber, chainDB, boa.code, boa.data, boa.fork) var computation = initComputation(blockNumber, chainDB, boa.code, boa.data, boa.fork)
# TODO: support gas comsumption validation # TODO: support gas comsumption validation
let gas = computation.gasMeter.gasRemaining # let gas = computation.gasMeter.gasRemaining
execComputation(computation) execComputation(computation)
let gasUsed = gas - computation.gasMeter.gasRemaining # let gasUsed = gas - computation.gasMeter.gasRemaining
if computation.isSuccess: if computation.isSuccess:
if boa.success == false: if boa.success == false:

View File

@ -8,7 +8,7 @@
import import
unittest2, json, os, tables, strutils, sets, strformat, times, unittest2, json, os, tables, strutils, sets, strformat, times,
options, options,
eth/[common, rlp, bloom], eth/trie/[db, trie_defs], eth/[common, rlp], eth/trie/[db, trie_defs],
ethash, stew/endians2, nimcrypto, ethash, stew/endians2, nimcrypto,
./test_helpers, ./test_allowed_to_fail, ./test_helpers, ./test_allowed_to_fail,
../premix/parser, test_config, ../premix/parser, test_config,
@ -330,7 +330,7 @@ proc processBlock(chainDB: BaseChainDB, vmState: BaseVMState, minedBlock: PlainB
for txIndex, tx in minedBlock.transactions: for txIndex, tx in minedBlock.transactions:
var sender: EthAddress var sender: EthAddress
if tx.getSender(sender): if tx.getSender(sender):
let gasUsed = processTransaction(tx, sender, vmState, fork) discard processTransaction(tx, sender, vmState, fork)
else: else:
raise newException(ValidationError, "could not get sender") raise newException(ValidationError, "could not get sender")
vmState.receipts[txIndex] = makeReceipt(vmState, fork) vmState.receipts[txIndex] = makeReceipt(vmState, fork)
@ -622,7 +622,7 @@ proc runTester(tester: var Tester, chainDB: BaseChainDB, testStatusIMPL: var Tes
if shouldBeGoodBlock: if shouldBeGoodBlock:
try: try:
let (preminedBlock, minedBlock, blockRlp) = tester.applyFixtureBlockToChain( let (preminedBlock, _, _) = tester.applyFixtureBlockToChain(
testerBlock, chainDB, checkSeal, validation = false) # we manually validate below testerBlock, chainDB, checkSeal, validation = false) # we manually validate below
check validateBlock(chainDB, preminedBlock, checkSeal) == true check validateBlock(chainDB, preminedBlock, checkSeal) == true
except: except:

View File

@ -6,13 +6,13 @@
# at your option. This file may not be copied, modified, or distributed except according to those terms. # at your option. This file may not be copied, modified, or distributed except according to those terms.
import import
unittest2, strformat, strutils, tables, json, times, os, sets, unittest2, strutils, tables, json, times, os, sets,
stew/ranges/typedranges, nimcrypto, options, stew/ranges/typedranges, nimcrypto, options,
eth/[rlp, common], eth/trie/[db, trie_defs], chronicles, eth/[rlp, common], eth/trie/[db, trie_defs], chronicles,
./test_helpers, ./test_allowed_to_fail, ./test_helpers, ./test_allowed_to_fail,
../nimbus/p2p/executor, test_config, ../nimbus/p2p/executor, test_config,
../nimbus/transaction, ../nimbus/transaction,
../nimbus/[vm_state, vm_types, vm_state_transactions, utils], ../nimbus/[vm_state, vm_types, utils],
../nimbus/vm/interpreter, ../nimbus/vm/interpreter,
../nimbus/db/[db_chain, state_db] ../nimbus/db/[db_chain, state_db]

View File

@ -9,9 +9,9 @@ import
os, macros, json, strformat, strutils, parseutils, os, tables, os, macros, json, strformat, strutils, parseutils, os, tables,
stew/byteutils, stew/ranges/typedranges, net, eth/[common, keys, rlp, p2p], unittest2, stew/byteutils, stew/ranges/typedranges, net, eth/[common, keys, rlp, p2p], unittest2,
testutils/markdown_reports, testutils/markdown_reports,
../nimbus/[vm_state, config, transaction, utils, errors], ../nimbus/[config, transaction, utils, errors],
../nimbus/db/[db_chain, state_db], ../nimbus/vm/interpreter/vm_forks,
../nimbus/vm/interpreter/vm_forks ../nimbus/db/state_db
func revmap(x: Table[Fork, string]): Table[string, Fork] = func revmap(x: Table[Fork, string]): Table[string, Fork] =
result = initTable[string, Fork]() result = initTable[string, Fork]()
@ -70,10 +70,10 @@ macro jsonTest*(s: static[string], handler: untyped, skipTest: untyped = skipNot
testStatusIMPL = ident("testStatusIMPL") testStatusIMPL = ident("testStatusIMPL")
testName = ident("testName") testName = ident("testName")
# workaround for strformat in quote do: https://github.com/nim-lang/Nim/issues/8220 # workaround for strformat in quote do: https://github.com/nim-lang/Nim/issues/8220
symbol = newIdentNode"symbol" symbol {.used.} = newIdentNode"symbol"
final = newIdentNode"final" final {.used.} = newIdentNode"final"
name = newIdentNode"name" name {.used.} = newIdentNode"name"
formatted = newStrLitNode"{symbol[final]} {name:<64}{$final}{'\n'}" formatted {.used.} = newStrLitNode"{symbol[final]} {name:<64}{$final}{'\n'}"
result = quote: result = quote:
var filenames: seq[string] = @[] var filenames: seq[string] = @[]

View File

@ -6,7 +6,7 @@
# at your option. This file may not be copied, modified, or distributed except according to those terms. # at your option. This file may not be copied, modified, or distributed except according to those terms.
import import
unittest2, json, os, tables, strformat, strutils, unittest2, json, os, tables, strutils,
eth/[common, rlp], stew/byteutils, eth/trie/db, eth/[common, rlp], stew/byteutils, eth/trie/db,
./test_helpers, ../nimbus/db/db_chain, ./test_helpers, ../nimbus/db/db_chain,
../nimbus/p2p/chain ../nimbus/p2p/chain

View File

@ -16,7 +16,7 @@ template testPush(value: untyped, expected: untyped): untyped =
stack.push(value) stack.push(value)
check(stack.values == @[expected]) check(stack.values == @[expected])
template testFailPush(value: untyped): untyped = template testFailPush(value: untyped): untyped {.used.} =
var stack = newStack() var stack = newStack()
expect(ValidationError): expect(ValidationError):
stack.push(value) stack.push(value)

View File

@ -6,7 +6,7 @@
# at your option. This file may not be copied, modified, or distributed except according to those terms. # at your option. This file may not be copied, modified, or distributed except according to those terms.
import import
unittest2, json, os, tables, strformat, strutils, unittest2, json, os, tables, strutils,
eth/common, stew/byteutils, eth/trie/db, eth/common, stew/byteutils, eth/trie/db,
./test_helpers, ../nimbus/db/db_chain, ../nimbus/[tracer, vm_types] ./test_helpers, ../nimbus/db/db_chain, ../nimbus/[tracer, vm_types]

View File

@ -1,7 +1,7 @@
import import
unittest2, json, os, tables, strformat, strutils, unittest2, json, os, tables, strutils,
eth/[common, rlp], eth/[common, rlp],
./test_helpers, ./test_allowed_to_fail, ./test_helpers,
../nimbus/[transaction, utils, errors] ../nimbus/[transaction, utils, errors]
const const

View File

@ -10,7 +10,7 @@ import
stew/byteutils, stew/ranges/typedranges, eth/[rlp, common], eth/trie/db, stew/byteutils, stew/ranges/typedranges, eth/[rlp, common], eth/trie/db,
./test_helpers, ./test_allowed_to_fail, ../nimbus/vm/interpreter, ./test_helpers, ./test_allowed_to_fail, ../nimbus/vm/interpreter,
../nimbus/[constants, vm_state, vm_types, utils], ../nimbus/[constants, vm_state, vm_types, utils],
../nimbus/db/[db_chain, state_db] ../nimbus/db/[db_chain]
func bytesToHex(x: openarray[byte]): string {.inline.} = func bytesToHex(x: openarray[byte]): string {.inline.} =
## TODO: use seq[byte] for raw data and delete this proc ## 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"] let fexec = fixture["exec"]
vmState.mutateStateDB: vmState.mutateStateDB:
setupStateDB(fixture{"pre"}, db) setupStateDB(fixture{"pre"}, db)
let address = fexec{"address"}.getStr.parseAddress
vmState.setupTxContext( vmState.setupTxContext(
origin = fexec{"origin"}.getStr.parseAddress, origin = fexec{"origin"}.getStr.parseAddress,