mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-01-27 04:26:07 +00:00
merged oph_*_kludge.nim sources => single oph_kludge.nim
This commit is contained in:
parent
69a1ee5fc8
commit
45558282f7
@ -46,8 +46,7 @@ when not breakCircularDependency:
|
||||
|
||||
else:
|
||||
import
|
||||
./oph_defs_kludge,
|
||||
./oph_helpers_kludge
|
||||
./oph_kludge
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Kludge END
|
||||
|
@ -47,8 +47,7 @@ when not breakCircularDependency:
|
||||
|
||||
else:
|
||||
import
|
||||
./oph_defs_kludge,
|
||||
./oph_helpers_kludge
|
||||
./oph_kludge
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Kludge END
|
||||
|
@ -13,10 +13,10 @@
|
||||
##
|
||||
|
||||
# Including types.nim needed unless included (not imported) into
|
||||
# oph_defs_kludge.nim
|
||||
# oph_kludge.nim
|
||||
#
|
||||
# Note that the nim compiler will distinguish <Vm2Ctx> tuples defined
|
||||
# here when imported and from oph_defs_kludge.nim. This is so due to the
|
||||
# here when imported and from oph_kludge.nim. This is so due to the
|
||||
# duplicate/different Computation definitions.
|
||||
#
|
||||
when not declared(Computation):
|
||||
|
@ -1,121 +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.
|
||||
|
||||
## EVM Opcodes, Definitions -- Kludge Version
|
||||
## ==========================================
|
||||
##
|
||||
|
||||
{.warning: "Circular dependency breaker kludge -- no production code".}
|
||||
|
||||
import
|
||||
../forks_list,
|
||||
../op_codes,
|
||||
../../memory,
|
||||
../../stack,
|
||||
eth/common/eth_types,
|
||||
sets
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Kludge BEGIN
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
type
|
||||
MsgFlags* = enum
|
||||
emvcNoFlags = 0
|
||||
emvcStatic = 1
|
||||
|
||||
CallKind* = enum
|
||||
evmcCall = 0 # CALL
|
||||
evmcDelegateCall = 1 # DELEGATECALL
|
||||
evmcCallCode = 2 # CALLCODE
|
||||
evmcCreate = 3 # CREATE
|
||||
evmcCreate2 = 4 # CREATE2
|
||||
|
||||
ReadOnlyStateDB* =
|
||||
seq[byte]
|
||||
|
||||
GasMeter* = object
|
||||
gasRefunded*: GasInt
|
||||
gasRemaining*: GasInt
|
||||
|
||||
CodeStream* = ref object
|
||||
bytes*: seq[byte]
|
||||
pc*: int
|
||||
|
||||
ChainId* = uint # distinct uint
|
||||
|
||||
ChainConfig* = object
|
||||
chainId*: ChainId
|
||||
homesteadBlock*: BlockNumber
|
||||
daoForkBlock*: BlockNumber
|
||||
daoForkSupport*: bool
|
||||
|
||||
AccountsCache* = ref object
|
||||
isDirty: bool
|
||||
|
||||
BaseChainDB* = ref object
|
||||
pruneTrie*: bool
|
||||
config*: ChainConfig
|
||||
|
||||
GasCost* = object
|
||||
opaq: int
|
||||
|
||||
GasCosts* = array[Op, GasCost]
|
||||
|
||||
BaseVMState* = ref object of RootObj
|
||||
chaindb* : BaseChainDB
|
||||
blockHeader* : BlockHeader
|
||||
logEntries* : seq[Log]
|
||||
accountDb* : AccountsCache
|
||||
touchedAccounts*: HashSet[EthAddress]
|
||||
suicides* : HashSet[EthAddress]
|
||||
txOrigin* : EthAddress
|
||||
txGasPrice* : GasInt
|
||||
gasCosts* : GasCosts
|
||||
fork* : Fork
|
||||
|
||||
Message* = ref object
|
||||
kind*: CallKind
|
||||
depth*: int
|
||||
gas*: GasInt
|
||||
contractAddress*: EthAddress
|
||||
codeAddress*: EthAddress
|
||||
sender*: EthAddress
|
||||
value*: UInt256
|
||||
data*: seq[byte]
|
||||
flags*: MsgFlags
|
||||
|
||||
Computation* = ref object
|
||||
returnStack*: seq[int]
|
||||
output*: seq[byte]
|
||||
vmState*: BaseVMState
|
||||
gasMeter*: GasMeter
|
||||
stack*: Stack
|
||||
memory*: Memory
|
||||
msg*: Message
|
||||
code*: CodeStream
|
||||
returnData*: seq[byte]
|
||||
fork*: Fork
|
||||
parent*, child*: Computation
|
||||
continuation*: proc() {.gcsafe.}
|
||||
touchedAccounts*: HashSet[EthAddress]
|
||||
suicides*: HashSet[EthAddress]
|
||||
logEntries*: seq[Log]
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Kludge END
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
include
|
||||
./oph_defs
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# End
|
||||
# ------------------------------------------------------------------------------
|
@ -13,9 +13,9 @@
|
||||
##
|
||||
|
||||
# Including types.nim and others unless included (not imported) into
|
||||
# oph_helpes_kludge.nim
|
||||
# oph_kludge.nim
|
||||
#
|
||||
when not declared(consumeGas):
|
||||
when not declared(Computation):
|
||||
import
|
||||
../../../db/accounts_cache,
|
||||
../../state,
|
||||
|
@ -8,17 +8,21 @@
|
||||
# at your option. This file may not be copied, modified, or distributed except
|
||||
# according to those terms.
|
||||
|
||||
## EVM Opcode Handlers: Helper Functions -- Kludge Version
|
||||
## =======================================================
|
||||
## EVM Opcodes, Definitions -- Kludge Version
|
||||
## ==========================================
|
||||
##
|
||||
|
||||
{.warning: "Circular dependency breaker kludge -- no production code".}
|
||||
|
||||
import
|
||||
../../../errors,
|
||||
../../memory,
|
||||
../../stack,
|
||||
../forks_list,
|
||||
../op_codes,
|
||||
./oph_defs_kludge,
|
||||
eth/common/eth_types,
|
||||
macros,
|
||||
sets,
|
||||
stint,
|
||||
strutils
|
||||
|
||||
@ -26,6 +30,89 @@ import
|
||||
# Kludge BEGIN
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
type
|
||||
MsgFlags* = enum
|
||||
emvcNoFlags = 0
|
||||
emvcStatic = 1
|
||||
|
||||
CallKind* = enum
|
||||
evmcCall = 0 # CALL
|
||||
evmcDelegateCall = 1 # DELEGATECALL
|
||||
evmcCallCode = 2 # CALLCODE
|
||||
evmcCreate = 3 # CREATE
|
||||
evmcCreate2 = 4 # CREATE2
|
||||
|
||||
ReadOnlyStateDB* =
|
||||
seq[byte]
|
||||
|
||||
GasMeter* = object
|
||||
gasRefunded*: GasInt
|
||||
gasRemaining*: GasInt
|
||||
|
||||
CodeStream* = ref object
|
||||
bytes*: seq[byte]
|
||||
pc*: int
|
||||
|
||||
ChainId* = uint # distinct uint
|
||||
|
||||
ChainConfig* = object
|
||||
chainId*: ChainId
|
||||
homesteadBlock*: BlockNumber
|
||||
daoForkBlock*: BlockNumber
|
||||
daoForkSupport*: bool
|
||||
|
||||
AccountsCache* = ref object
|
||||
isDirty: bool
|
||||
|
||||
BaseChainDB* = ref object
|
||||
pruneTrie*: bool
|
||||
config*: ChainConfig
|
||||
|
||||
GasCost* = object
|
||||
opaq: int
|
||||
|
||||
GasCosts* = array[Op, GasCost]
|
||||
|
||||
BaseVMState* = ref object of RootObj
|
||||
chaindb* : BaseChainDB
|
||||
blockHeader* : BlockHeader
|
||||
logEntries* : seq[Log]
|
||||
accountDb* : AccountsCache
|
||||
touchedAccounts*: HashSet[EthAddress]
|
||||
suicides* : HashSet[EthAddress]
|
||||
txOrigin* : EthAddress
|
||||
txGasPrice* : GasInt
|
||||
gasCosts* : GasCosts
|
||||
fork* : Fork
|
||||
|
||||
Message* = ref object
|
||||
kind*: CallKind
|
||||
depth*: int
|
||||
gas*: GasInt
|
||||
contractAddress*: EthAddress
|
||||
codeAddress*: EthAddress
|
||||
sender*: EthAddress
|
||||
value*: UInt256
|
||||
data*: seq[byte]
|
||||
flags*: MsgFlags
|
||||
|
||||
Computation* = ref object
|
||||
returnStack*: seq[int]
|
||||
output*: seq[byte]
|
||||
vmState*: BaseVMState
|
||||
gasMeter*: GasMeter
|
||||
stack*: Stack
|
||||
memory*: Memory
|
||||
msg*: Message
|
||||
code*: CodeStream
|
||||
returnData*: seq[byte]
|
||||
fork*: Fork
|
||||
parent*, child*: Computation
|
||||
continuation*: proc() {.gcsafe.}
|
||||
touchedAccounts*: HashSet[EthAddress]
|
||||
suicides*: HashSet[EthAddress]
|
||||
logEntries*: seq[Log]
|
||||
|
||||
const
|
||||
ColdAccountAccessCost* = 2
|
||||
WarmStorageReadCost* = 3
|
||||
@ -99,9 +186,9 @@ proc isCreate*(message: Message): bool = result
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
include
|
||||
./oph_defs,
|
||||
./oph_helpers
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# End
|
||||
# ------------------------------------------------------------------------------
|
||||
|
@ -38,7 +38,7 @@ when not breakCircularDependency:
|
||||
|
||||
else:
|
||||
import
|
||||
./interpreter/op_handlers/[oph_defs_kludge, oph_helpers_kludge]
|
||||
./interpreter/op_handlers/oph_kludge
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Kludge END
|
||||
|
Loading…
x
Reference in New Issue
Block a user