From aee0fe39d22e87ba7b633cb62c889f1a74b2cf06 Mon Sep 17 00:00:00 2001 From: Jamie Lokier Date: Tue, 1 Jun 2021 11:54:13 +0100 Subject: [PATCH] EVM: Remove `vm_types2` everywhere, use common forks list instead File `vm_types2` is obsolete. Remove this file and divert all imports to the common forks list outside the EVM, or in some cases they don't need it anyway. Signed-off-by: Jamie Lokier --- nimbus/config.nim | 4 +--- nimbus/p2p/executor.nim | 3 +-- nimbus/p2p/validate.nim | 2 +- nimbus/transaction.nim | 2 +- nimbus/transaction/call_common.nim | 6 +++--- nimbus/transaction/call_evm.nim | 7 +++---- nimbus/vm_types2.nim | 24 ------------------------ tests/macro_assembler.nim | 4 ++-- tests/test_blockchain_json.nim | 2 +- tests/test_config.nim | 2 +- tests/test_difficulty.nim | 3 +-- tests/test_helpers.nim | 3 +-- tests/test_precompiles.nim | 2 +- 13 files changed, 17 insertions(+), 47 deletions(-) delete mode 100644 nimbus/vm_types2.nim diff --git a/nimbus/config.nim b/nimbus/config.nim index 50f3df601..dca5eb8d9 100644 --- a/nimbus/config.nim +++ b/nimbus/config.nim @@ -10,9 +10,7 @@ import parseopt, strutils, macros, os, times, json, tables, stew/[byteutils], chronos, eth/[keys, common, p2p, net/nat], chronicles, nimcrypto/hash, - eth/p2p/bootnodes, ./db/select_backend, eth/keys, ./chain_config - -from ./vm_types2 import Fork + eth/p2p/bootnodes, ./db/select_backend, eth/keys, ./chain_config, ./forks const NimbusName* = "Nimbus" diff --git a/nimbus/p2p/executor.nim b/nimbus/p2p/executor.nim index f1ba75fc9..c260e3d72 100644 --- a/nimbus/p2p/executor.nim +++ b/nimbus/p2p/executor.nim @@ -3,8 +3,7 @@ import options, sets, ../db/[db_chain, accounts_cache], ../utils, ../constants, ../transaction, ../vm_state, ../vm_types, - ../vm_types2, - ./dao, ./validate, ../config, + ./dao, ./validate, ../config, ../forks, ../transaction/call_evm diff --git a/nimbus/p2p/validate.nim b/nimbus/p2p/validate.nim index a11e8a436..f805b0f8b 100644 --- a/nimbus/p2p/validate.nim +++ b/nimbus/p2p/validate.nim @@ -16,7 +16,7 @@ import ../utils/header, ../vm_state, ../vm_types, - ../vm_types2, + ../forks, ./validate/epoch_hash_cache, chronicles, eth/[common, rlp, trie/trie_defs], diff --git a/nimbus/transaction.nim b/nimbus/transaction.nim index 74fe9dece..0cd55ffaf 100644 --- a/nimbus/transaction.nim +++ b/nimbus/transaction.nim @@ -8,7 +8,7 @@ import ./constants, ./errors, eth/[common, keys], ./utils, stew/shims/macros, - ./vm_types2, ./vm_gas_costs + ./forks, ./vm_gas_costs import eth/common/transaction as common_transaction export common_transaction diff --git a/nimbus/transaction/call_common.nim b/nimbus/transaction/call_common.nim index a08e1b835..8d2670f47 100644 --- a/nimbus/transaction/call_common.nim +++ b/nimbus/transaction/call_common.nim @@ -8,9 +8,9 @@ import eth/common/eth_types, stint, options, stew/ranges/ptr_arith, - ".."/[vm_types, vm_types2, vm_state, vm_computation, vm_state_transactions], - ".."/[db/accounts_cache, utils, vm_precompiles, vm_gas_costs], - ".."/vm_internals, + ".."/[vm_types, vm_state, vm_computation, vm_state_transactions], + ".."/[vm_internals, vm_precompiles, vm_gas_costs], + ".."/[db/accounts_cache, utils, forks], ./host_types type diff --git a/nimbus/transaction/call_evm.nim b/nimbus/transaction/call_evm.nim index d4647f7f2..a926cd114 100644 --- a/nimbus/transaction/call_evm.nim +++ b/nimbus/transaction/call_evm.nim @@ -8,10 +8,9 @@ import eth/common/eth_types, stint, options, stew/byteutils, - ".."/[vm_types, vm_types2, vm_state, utils], - ".."/[db/db_chain, config, rpc/hexstrings, utils], - ".."/[db/accounts_cache, utils, transaction, vm_gas_costs], eth/trie/db, - ".."/vm_internals, + ".."/[vm_types, vm_state, vm_internals, vm_gas_costs, forks], + ".."/[db/db_chain, db/accounts_cache, transaction], eth/trie/db, + ".."/[config, utils, rpc/hexstrings], ./call_common type diff --git a/nimbus/vm_types2.nim b/nimbus/vm_types2.nim deleted file mode 100644 index 389ba29f9..000000000 --- a/nimbus/vm_types2.nim +++ /dev/null @@ -1,24 +0,0 @@ -# Nimbus -# Copyright (c) 2018 Status Research & Development GmbH -# Licensed under either of -# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or -# http://www.apache.org/licenses/LICENSE-2.0) -# * 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. - -# The following should really go into vm_types once the circular computation.nim -# include/import dependency is solved. The problem is with vm_types.nim which -# includes computation.nim. -when defined(evmc_enabled) or not defined(vm2_enabled): - import - ./vm/interpreter/vm_forks as vmf -else: - import - ./vm2/interpreter/forks_list as vmf - -export - vmf.Fork - -# End diff --git a/tests/macro_assembler.nim b/tests/macro_assembler.nim index 949e29ea8..c1d42a66d 100644 --- a/tests/macro_assembler.nim +++ b/tests/macro_assembler.nim @@ -6,10 +6,10 @@ import import options, json, os, eth/trie/[db, hexary], ../nimbus/db/[db_chain, accounts_cache], - ../nimbus/[vm_types2, vm_internals], + ../nimbus/vm_internals, ../nimbus/transaction/call_evm -export vm_types2, byteutils +export byteutils {.experimental: "dynamicBindSym".} # backported from Nim 0.19.9 diff --git a/tests/test_blockchain_json.nim b/tests/test_blockchain_json.nim index d008d2569..3e2dd1ea9 100644 --- a/tests/test_blockchain_json.nim +++ b/tests/test_blockchain_json.nim @@ -12,7 +12,7 @@ import stew/endians2, nimcrypto, ./test_helpers, ./test_allowed_to_fail, ../premix/parser, test_config, - ../nimbus/[vm_state, utils, vm_types, errors, transaction, constants, vm_types2], + ../nimbus/[vm_state, utils, vm_types, errors, transaction, constants, forks], ../nimbus/db/[db_chain, accounts_cache], ../nimbus/utils/header, ../nimbus/p2p/[executor, validate], diff --git a/tests/test_config.nim b/tests/test_config.nim index 72514f64f..b313493f5 100644 --- a/tests/test_config.nim +++ b/tests/test_config.nim @@ -1,6 +1,6 @@ import parseopt, strutils, - ../nimbus/vm_types2 + ../nimbus/forks type ConfigStatus* = enum diff --git a/tests/test_difficulty.nim b/tests/test_difficulty.nim index 682ba7cef..8bbfe05fd 100644 --- a/tests/test_difficulty.nim +++ b/tests/test_difficulty.nim @@ -1,8 +1,7 @@ import unittest2, strutils, tables, os, json, ../nimbus/utils/difficulty, stint, times, eth/common, test_helpers, stew/byteutils, - ../nimbus/constants, ../nimbus/vm_types2, - ../nimbus/config + ../nimbus/constants, ../nimbus/config type Tester = object diff --git a/tests/test_helpers.nim b/tests/test_helpers.nim index 6beae33da..9d61852d6 100644 --- a/tests/test_helpers.nim +++ b/tests/test_helpers.nim @@ -9,8 +9,7 @@ import os, macros, json, strformat, strutils, parseutils, os, tables, stew/byteutils, net, eth/[common, keys, rlp, p2p], unittest2, testutils/markdown_reports, - ../nimbus/[constants, config, transaction, utils, errors], - ../nimbus/vm_types2, + ../nimbus/[constants, config, transaction, utils, errors, forks], ../nimbus/db/accounts_cache, ../nimbus/random_keys diff --git a/tests/test_precompiles.nim b/tests/test_precompiles.nim index 211227f41..13fdc3c77 100644 --- a/tests/test_precompiles.nim +++ b/tests/test_precompiles.nim @@ -8,7 +8,7 @@ import unittest2, ../nimbus/vm_precompiles, json, stew/byteutils, test_helpers, os, tables, strformat, strutils, eth/trie/db, eth/common, ../nimbus/db/db_chain, ../nimbus/constants, - ../nimbus/[vm_computation, vm_state, vm_types2], macros, + ../nimbus/[vm_computation, vm_state, forks], macros, test_allowed_to_fail, ../nimbus/transaction/call_evm, options