isolate stack type definition
how: extract from methods implementation source into separate file
This commit is contained in:
parent
579fed5010
commit
a868108ae7
|
@ -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")
|
||||
|
|
|
@ -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
|
|
@ -116,9 +116,10 @@ export
|
|||
|
||||
|
||||
import
|
||||
./stack_defs as sdf,
|
||||
./stack as stk
|
||||
export
|
||||
stk.Stack,
|
||||
sdf.Stack,
|
||||
stk.`$`,
|
||||
stk.`[]`,
|
||||
stk.dup,
|
||||
|
|
|
@ -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]
|
||||
|
|
Loading…
Reference in New Issue