mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-01-12 21:34:33 +00:00
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
|
import
|
||||||
chronicles, strformat, strutils, sequtils, macros, eth/common, nimcrypto,
|
chronicles, strformat, strutils, sequtils, macros, eth/common, nimcrypto,
|
||||||
../errors, ../validation
|
../errors, ../validation, ./stack_defs
|
||||||
|
|
||||||
logScope:
|
logScope:
|
||||||
topics = "vm stack"
|
topics = "vm stack"
|
||||||
|
|
||||||
type
|
|
||||||
Stack* = ref object of RootObj
|
|
||||||
values*: seq[StackElement]
|
|
||||||
|
|
||||||
StackElement = UInt256
|
|
||||||
|
|
||||||
template ensureStackLimit: untyped =
|
template ensureStackLimit: untyped =
|
||||||
if len(stack.values) > 1023:
|
if len(stack.values) > 1023:
|
||||||
raise newException(FullStack, "Stack limit reached")
|
raise newException(FullStack, "Stack limit reached")
|
||||||
|
23
nimbus/vm2/stack_defs.nim
Normal file
23
nimbus/vm2/stack_defs.nim
Normal file
@ -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
|
import
|
||||||
|
./stack_defs as sdf,
|
||||||
./stack as stk
|
./stack as stk
|
||||||
export
|
export
|
||||||
stk.Stack,
|
sdf.Stack,
|
||||||
stk.`$`,
|
stk.`$`,
|
||||||
stk.`[]`,
|
stk.`[]`,
|
||||||
stk.dup,
|
stk.dup,
|
||||||
|
@ -16,7 +16,7 @@ when defined(evmc_enabled):
|
|||||||
import
|
import
|
||||||
tables, eth/common,
|
tables, eth/common,
|
||||||
options, json, sets,
|
options, json, sets,
|
||||||
./v2memory, ./stack, ./code_stream,
|
./v2memory, ./stack_defs, ./code_stream,
|
||||||
./interpreter/[v2gas_costs, v2opcode_values, v2forks],
|
./interpreter/[v2gas_costs, v2opcode_values, v2forks],
|
||||||
# TODO - will be hidden at a lower layer
|
# TODO - will be hidden at a lower layer
|
||||||
../db/[db_chain, accounts_cache]
|
../db/[db_chain, accounts_cache]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user