From ecab64adab1e574669ade87167eb89551d3d95b1 Mon Sep 17 00:00:00 2001 From: jangko Date: Wed, 28 Sep 2022 13:09:33 +0700 Subject: [PATCH] reduce imported but not used warning when evmc enabled --- nimbus/debug.nim | 2 +- nimbus/genesis.nim | 2 -- nimbus/p2p/clique/clique_cfg.nim | 3 --- nimbus/vm2/interpreter/op_handlers/oph_blockdata.nim | 7 ++++--- nimbus/vm2/interpreter/op_handlers/oph_call.nim | 7 +++++-- nimbus/vm2/interpreter/op_handlers/oph_create.nim | 6 +++++- nimbus/vm2/interpreter/op_handlers/oph_envinfo.nim | 4 +++- nimbus/vm2/interpreter/op_handlers/oph_helpers.nim | 6 ++++-- nimbus/vm2/interpreter/op_handlers/oph_memory.nim | 11 +++++++++-- nimbus/vm2/interpreter/op_handlers/oph_sysops.nim | 7 +++++-- nimbus/vm2/state.nim | 2 +- test_macro.nim | 1 - tests/test_blockchain_json.nim | 7 +++---- tests/test_generalstate_json.nim | 1 - tests/test_graphql.nim | 1 - 15 files changed, 40 insertions(+), 27 deletions(-) diff --git a/nimbus/debug.nim b/nimbus/debug.nim index dafcb3beb..cb389443c 100644 --- a/nimbus/debug.nim +++ b/nimbus/debug.nim @@ -17,7 +17,7 @@ proc `$`(nonce: BlockNonce): string = proc `$`(data: Blob): string = data.toHex - + proc debug*(h: BlockHeader): string = result.add "parentHash : " & $h.parentHash & "\n" result.add "ommersHash : " & $h.ommersHash & "\n" diff --git a/nimbus/genesis.nim b/nimbus/genesis.nim index 0fc6e50f2..4cf77dedb 100644 --- a/nimbus/genesis.nim +++ b/nimbus/genesis.nim @@ -13,8 +13,6 @@ import proc newStateDB*(db: TrieDatabaseRef, pruneTrie: bool): AccountStateDB = newAccountStateDB(db, emptyRlpHash, pruneTrie) -import debug - proc toGenesisHeader*(db: BaseChainDB, sdb: AccountStateDB): BlockHeader {.raises: [Defect, RlpError].} = ## Initialise block chain DB accounts derived from the `genesis.alloc` table diff --git a/nimbus/p2p/clique/clique_cfg.nim b/nimbus/p2p/clique/clique_cfg.nim index bce69877b..e01fa4b60 100644 --- a/nimbus/p2p/clique/clique_cfg.nim +++ b/nimbus/p2p/clique/clique_cfg.nim @@ -32,9 +32,6 @@ const prngSeed = 42 type - SimpleTypePP = BlockNonce|EthAddress|Blob|BlockHeader - SeqTypePP = EthAddress|BlockHeader - CliqueCfg* = ref object of RootRef db*: BaseChainDB ##\ ## All purpose (incl. blockchain) database. diff --git a/nimbus/vm2/interpreter/op_handlers/oph_blockdata.nim b/nimbus/vm2/interpreter/op_handlers/oph_blockdata.nim index 7d71df99e..b86559eb0 100644 --- a/nimbus/vm2/interpreter/op_handlers/oph_blockdata.nim +++ b/nimbus/vm2/interpreter/op_handlers/oph_blockdata.nim @@ -15,12 +15,13 @@ import ../../computation, ../../stack, - ../../state, ../op_codes, ./oph_defs, eth/common, - stint, - times + stint + +when not defined(evmc_enabled): + import ../../state # ------------------------------------------------------------------------------ # Private, op handlers implementation diff --git a/nimbus/vm2/interpreter/op_handlers/oph_call.nim b/nimbus/vm2/interpreter/op_handlers/oph_call.nim index c0a02ab4c..880887e34 100644 --- a/nimbus/vm2/interpreter/op_handlers/oph_call.nim +++ b/nimbus/vm2/interpreter/op_handlers/oph_call.nim @@ -14,13 +14,11 @@ import ../../../constants, - ../../../db/accounts_cache, ../../../errors, ../../../forks, ../../computation, ../../memory, ../../stack, - ../../state, ../../types, ../gas_costs, ../gas_meter, @@ -32,6 +30,11 @@ import eth/common/eth_types, stint +when not defined(evmc_enabled): + import + ../../state, + ../../../db/accounts_cache + # ------------------------------------------------------------------------------ # Private # ------------------------------------------------------------------------------ diff --git a/nimbus/vm2/interpreter/op_handlers/oph_create.nim b/nimbus/vm2/interpreter/op_handlers/oph_create.nim index 3835c414c..461ccbf4b 100644 --- a/nimbus/vm2/interpreter/op_handlers/oph_create.nim +++ b/nimbus/vm2/interpreter/op_handlers/oph_create.nim @@ -20,7 +20,6 @@ import ../../computation, ../../memory, ../../stack, - ../../state, ../../types, ../gas_costs, ../gas_meter, @@ -34,6 +33,11 @@ import stint, strformat +when not defined(evmc_enabled): + import + ../../state, + ../../../db/accounts_cache + # ------------------------------------------------------------------------------ # Private helpers # ------------------------------------------------------------------------------ diff --git a/nimbus/vm2/interpreter/op_handlers/oph_envinfo.nim b/nimbus/vm2/interpreter/op_handlers/oph_envinfo.nim index 8a946c877..263db7f1a 100644 --- a/nimbus/vm2/interpreter/op_handlers/oph_envinfo.nim +++ b/nimbus/vm2/interpreter/op_handlers/oph_envinfo.nim @@ -18,7 +18,6 @@ import ../../computation, ../../memory, ../../stack, - ../../state, ../gas_costs, ../gas_meter, ../op_codes, @@ -30,6 +29,9 @@ import stint, strformat +when not defined(evmc_enabled): + import ../../state + # ------------------------------------------------------------------------------ # Private helpers # ------------------------------------------------------------------------------ diff --git a/nimbus/vm2/interpreter/op_handlers/oph_helpers.nim b/nimbus/vm2/interpreter/op_handlers/oph_helpers.nim index 67899bc9a..d1354fb46 100644 --- a/nimbus/vm2/interpreter/op_handlers/oph_helpers.nim +++ b/nimbus/vm2/interpreter/op_handlers/oph_helpers.nim @@ -13,9 +13,7 @@ ## import - ../../../db/accounts_cache, ../../../errors, - ../../state, ../../types, ../gas_costs, ../gas_meter, @@ -26,6 +24,10 @@ import when defined(evmc_enabled): import ../../evmc_api, ../../evmc_helpers, evmc/evmc +else: + import + ../../state, + ../../../db/accounts_cache # ------------------------------------------------------------------------------ # Public diff --git a/nimbus/vm2/interpreter/op_handlers/oph_memory.nim b/nimbus/vm2/interpreter/op_handlers/oph_memory.nim index 4ea721753..5e674ca93 100644 --- a/nimbus/vm2/interpreter/op_handlers/oph_memory.nim +++ b/nimbus/vm2/interpreter/op_handlers/oph_memory.nim @@ -13,13 +13,11 @@ ## import - ../../../db/accounts_cache, ../../../errors, ../../code_stream, ../../computation, ../../memory, ../../stack, - ../../state, ../../types, ../gas_costs, ../gas_meter, @@ -31,6 +29,11 @@ import stint, strformat +when not defined(evmc_enabled): + import + ../../state, + ../../../db/accounts_cache + # ------------------------------------------------------------------------------ # Private helpers # ------------------------------------------------------------------------------ @@ -288,6 +291,9 @@ const ## on machine state during execution. discard +#[ + EIP-2315: temporary disabled + Reason : not included in berlin hard fork beginSubOp: Vm2OpFn = proc (k: var Vm2Ctx) = ## 0x5c, Marks the entry point to a subroutine raise newException( @@ -327,6 +333,7 @@ const k.cpt.returnStack.add returnPC inc k.cpt.code.pc +]# # ------------------------------------------------------------------------------ # Public, op exec table entries diff --git a/nimbus/vm2/interpreter/op_handlers/oph_sysops.nim b/nimbus/vm2/interpreter/op_handlers/oph_sysops.nim index d4c63763d..8f4c3ca26 100644 --- a/nimbus/vm2/interpreter/op_handlers/oph_sysops.nim +++ b/nimbus/vm2/interpreter/op_handlers/oph_sysops.nim @@ -13,12 +13,10 @@ ## import - ../../../db/accounts_cache, ../../../errors, ../../computation, ../../memory, ../../stack, - ../../state, ../../types, ../gas_costs, ../gas_meter, @@ -29,6 +27,11 @@ import eth/common, stint +when not defined(evmc_enabled): + import + ../../state, + ../../../db/accounts_cache + # ------------------------------------------------------------------------------ # Private # ------------------------------------------------------------------------------ diff --git a/nimbus/vm2/state.nim b/nimbus/vm2/state.nim index 55d221067..8f0b9e62f 100644 --- a/nimbus/vm2/state.nim +++ b/nimbus/vm2/state.nim @@ -15,7 +15,7 @@ import ../db/[db_chain, accounts_cache], ../errors, ../forks, - ../utils/[difficulty, ec_recover], + ../utils/[ec_recover], ./transaction_tracer, ./types, eth/[common, keys] diff --git a/test_macro.nim b/test_macro.nim index ba757a3b0..a628c6671 100644 --- a/test_macro.nim +++ b/test_macro.nim @@ -84,7 +84,6 @@ macro cliBuilder*(stmtList: typed): untyped = const names = `moduleNames` quit(executeMyself(`moduleCount`, names)) else: - disableParamFiltering() `caseStmt` # if you want to add new test module(s) diff --git a/tests/test_blockchain_json.nim b/tests/test_blockchain_json.nim index e5f95f00b..9e237d758 100644 --- a/tests/test_blockchain_json.nim +++ b/tests/test_blockchain_json.nim @@ -327,7 +327,7 @@ proc runTester(tester: var Tester, chainDB: BaseChainDB, testStatusIMPL: var Tes for idx, testBlock in tester.blocks: if testBlock.goodBlock: - try: + #try: let (preminedBlock, _, _) = tester.applyFixtureBlockToChain( testBlock, chainDB, checkSeal, validation = false) @@ -346,8 +346,8 @@ proc runTester(tester: var Tester, chainDB: BaseChainDB, testStatusIMPL: var Tes debugEcho "error message: ", res.error debugEcho "ttdReached: ", ttdReached - except: - debugEcho "FATAL ERROR(WE HAVE BUG): ", getCurrentExceptionMsg() + #except: + #debugEcho "FATAL ERROR(WE HAVE BUG): ", getCurrentExceptionMsg() else: var noError = true @@ -537,7 +537,6 @@ when isMainModule: echo message quit(QuitSuccess) - disableParamFiltering() blockchainJsonMain(true) # lastBlockHash -> every fixture has it, hash of a block header diff --git a/tests/test_generalstate_json.nim b/tests/test_generalstate_json.nim index e3049db3f..411039673 100644 --- a/tests/test_generalstate_json.nim +++ b/tests/test_generalstate_json.nim @@ -255,5 +255,4 @@ when isMainModule: echo message quit(QuitSuccess) - disableParamFiltering() generalStateJsonMain(true) diff --git a/tests/test_graphql.nim b/tests/test_graphql.nim index 4ed7f74d9..547d79118 100644 --- a/tests/test_graphql.nim +++ b/tests/test_graphql.nim @@ -107,7 +107,6 @@ proc graphqlMain*() = when isMainModule: ctx.main(caseFolder, purgeSchema = false) else: - disableParamFiltering() ctx.executeCases(caseFolder, purgeSchema = false) when isMainModule: