diff --git a/nimbus/vm2/stack.nim b/nimbus/vm2/stack.nim index 5026f01cc..4857d5f02 100644 --- a/nimbus/vm2/stack.nim +++ b/nimbus/vm2/stack.nim @@ -7,17 +7,11 @@ import chronicles, strformat, strutils, sequtils, macros, eth/common, nimcrypto, - ../errors, ../validation + ../errors, ../validation, ./stack_defs logScope: topics = "vm stack" -type - Stack* = ref object of RootObj - values*: seq[StackElement] - - StackElement = UInt256 - template ensureStackLimit: untyped = if len(stack.values) > 1023: raise newException(FullStack, "Stack limit reached") diff --git a/nimbus/vm2/stack_defs.nim b/nimbus/vm2/stack_defs.nim new file mode 100644 index 000000000..6ddc5d9b1 --- /dev/null +++ b/nimbus/vm2/stack_defs.nim @@ -0,0 +1,23 @@ +# 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. + +import + stint + +export + UInt256 + +type + StackElement* = UInt256 + + Stack* = ref object of RootObj + values*: seq[StackElement] + +# End diff --git a/nimbus/vm2/v2interpreter.nim b/nimbus/vm2/v2interpreter.nim index db317a2eb..0f6ccc684 100644 --- a/nimbus/vm2/v2interpreter.nim +++ b/nimbus/vm2/v2interpreter.nim @@ -116,9 +116,10 @@ export import + ./stack_defs as sdf, ./stack as stk export - stk.Stack, + sdf.Stack, stk.`$`, stk.`[]`, stk.dup, diff --git a/nimbus/vm2/v2types.nim b/nimbus/vm2/v2types.nim index 8db916743..4ccb60d9b 100644 --- a/nimbus/vm2/v2types.nim +++ b/nimbus/vm2/v2types.nim @@ -16,7 +16,7 @@ when defined(evmc_enabled): import tables, eth/common, options, json, sets, - ./v2memory, ./stack, ./code_stream, + ./v2memory, ./stack_defs, ./code_stream, ./interpreter/[v2gas_costs, v2opcode_values, v2forks], # TODO - will be hidden at a lower layer ../db/[db_chain, accounts_cache]