Merge pull request #490 from status-im/reduce_warning

reduce unused import warnings
This commit is contained in:
andri lim 2020-04-16 10:05:18 +07:00 committed by GitHub
commit 5b7742d09b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 30 additions and 34 deletions

View File

@ -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

View File

@ -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

View File

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

View File

@ -9,7 +9,7 @@
import
strformat, times, options,
eth/[common, rlp],
./difficulty, ../vm/interpreter/vm_forks, ../constants,
./difficulty, ../constants,
../config
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.
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],

View File

@ -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]

View File

@ -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):

View File

@ -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}

View File

@ -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

View File

@ -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:

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)
# 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:

View File

@ -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:

View File

@ -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]

View File

@ -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] = @[]

View File

@ -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

View File

@ -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)

View File

@ -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]

View File

@ -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

View File

@ -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,