provide vm_computation as import/export wrapper

details:
  moved original vm/computation.nim => vm/nvm_computation.nim
This commit is contained in:
Jordan Hrycaj 2021-03-31 11:47:04 +01:00
parent 689458a346
commit cf3a356d76
No known key found for this signature in database
GPG Key ID: 4101B9BC5A0DB080
12 changed files with 73 additions and 12 deletions

View File

@ -1,5 +1,5 @@
import ../db/db_chain, eth/common, chronicles, ../vm_state, ../vm_types,
../vm/[computation, message], ./vm_forks, stint, nimcrypto,
../vm_computation, ../vm/message, ./vm_forks, stint, nimcrypto,
../utils, eth/trie/db, ./executor, ../config, ../genesis, ../utils,
stew/endians2

View File

@ -3,7 +3,7 @@ import options, sets,
../db/[db_chain, accounts_cache],
../utils, ../constants, ../transaction,
../vm_state, ../vm_types, ../vm_state_transactions,
../vm/[computation, message, precompiles],
../vm_computation, vm/[message, precompiles],
./vm_forks,
./dao, ../config

View File

@ -14,7 +14,7 @@ import
eth/p2p/rlpx_protocols/eth_protocol,
../transaction, ../config, ../vm_state, ../constants, ../vm_types,
../utils, ../db/[db_chain, state_db],
rpc_types, rpc_utils, ../vm/[message, computation],
rpc_types, rpc_utils, ../vm/message, ../vm_computation,
../vm_forks
#[

View File

@ -11,7 +11,7 @@ import hexstrings, eth/[common, rlp, keys, trie/db], stew/byteutils, nimcrypto,
../db/[db_chain, accounts_cache], strutils, algorithm, options, times, json,
../constants, stint, hexstrings, rpc_types, ../config,
../vm_state_transactions, ../vm_state, ../vm_types, ../vm_forks,
../vm/computation, ../p2p/executor, ../utils, ../transaction
../vm_computation, ../p2p/executor, ../utils, ../transaction
type
UnsignedTx* = object

View File

@ -9,11 +9,11 @@ import
vm/interpreter/[opcode_values, gas_meter, nvm_forks]
import # Used in vm_types. Beware of recursive dependencies
vm/[code_stream, computation, stack, message]
vm/[code_stream, nvm_computation, stack, message]
export
opcode_values, gas_meter,
nvm_forks
export
code_stream, computation, stack, message
code_stream, nvm_computation, stack, message

View File

@ -10,7 +10,7 @@ import
chronicles, stint, nimcrypto, stew/ranges/ptr_arith, eth/common,
vm/interpreter/utils/[macros_procs_opcodes, utils_numeric],
vm/interpreter/[gas_meter, nvm_gas_costs, opcode_values, nvm_forks],
vm/[memory, stack, code_stream, computation, nvm_state, nvm_types],
vm/[memory, stack, code_stream, nvm_computation, nvm_state, nvm_types],
errors, constants,
db/[db_chain, accounts_cache]

View File

@ -10,7 +10,7 @@
import
macros, strformat, stint, eth/common,
vm/[computation, stack, code_stream, memory],
vm/[nvm_computation, stack, code_stream, memory],
vm/nvm_types, errors, vm/interpreter/[gas_meter, opcode_values],
vm/interpreter/utils/utils_numeric

View File

@ -9,7 +9,7 @@ import
options, sets,
eth/common, chronicles, db/accounts_cache,
transaction,
vm/[computation, interpreter, nvm_state, nvm_types]
vm/[nvm_computation, interpreter, nvm_state, nvm_types]
proc validateTransaction*(vmState: BaseVMState, tx: Transaction, sender: EthAddress, fork: Fork): bool =
let balance = vmState.readOnlyStateDB.getBalance(sender)

61
nimbus/vm_computation.nim Normal file
View File

@ -0,0 +1,61 @@
# 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 computation module suffers from a circular include/import dependency.
# After fixing this wrapper should be re-factored.
import
./vm/nvm_computation as vmc
export
vmc.accountExists,
vmc.addLogEntry,
vmc.commit,
vmc.dispose,
vmc.execCall,
vmc.execCreate,
vmc.execSelfDestruct,
vmc.executeOpcodes,
vmc.fork,
vmc.getBalance,
vmc.getBlockHash,
vmc.getBlockNumber,
vmc.getChainId,
vmc.getCode,
vmc.getCodeHash,
vmc.getCodeSize,
vmc.getCoinbase,
vmc.getDifficulty,
vmc.getGasLimit,
vmc.getGasPrice,
vmc.getGasRefund,
vmc.getOrigin,
vmc.getStorage,
vmc.getTimestamp,
vmc.isError,
vmc.isOriginComputation,
vmc.isSuccess,
vmc.isSuicided,
vmc.merge,
vmc.newComputation,
vmc.prepareTracer,
vmc.refundSelfDestruct,
vmc.rollback,
vmc.selfDestruct,
vmc.setError,
vmc.shouldBurnGas,
vmc.snapshot,
vmc.traceError,
vmc.traceOpCodeEnded,
vmc.traceOpCodeStarted,
vmc.tracingEnabled,
vmc.writeContract
# End

View File

@ -8,8 +8,8 @@ import
options, json, os, eth/trie/[db, hexary],
../nimbus/[vm_state, vm_types, transaction, utils],
../nimbus/db/[db_chain, accounts_cache],
../nimbus/[vm_state_transactions, vm_forks],
../nimbus/vm/[message, computation, memory]
../nimbus/[vm_computation, vm_state_transactions, vm_forks],
../nimbus/vm/[message, memory]
export opcode_values, byteutils
{.experimental: "dynamicBindSym".}

View File

@ -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/[vm_types, vm_state, vm_forks], ../nimbus/vm/computation, macros,
../nimbus/[vm_computation, vm_types, vm_state, vm_forks], macros,
test_allowed_to_fail
proc initAddress(i: byte): EthAddress = result[19] = i