aboutsummaryrefslogtreecommitdiffstats
path: root/core/vm/environment.go
diff options
context:
space:
mode:
authorJeffrey Wilcke <geffobscura@gmail.com>2016-02-04 06:46:27 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2016-03-24 06:02:42 +0800
commit14013372aeca2d7f1d8c3a87b7df7c27868314be (patch)
treed4951dbe1d7f1b25b4bbde786b14b5b0b6107bcc /core/vm/environment.go
parent342ae7ce7dfd7a0eab2dd06bfa65199825279f05 (diff)
downloadgo-tangerine-14013372aeca2d7f1d8c3a87b7df7c27868314be.tar.gz
go-tangerine-14013372aeca2d7f1d8c3a87b7df7c27868314be.tar.zst
go-tangerine-14013372aeca2d7f1d8c3a87b7df7c27868314be.zip
core: Added EVM configuration options
The EVM is now initialised with an additional configured object that allows you to turn on debugging options.
Diffstat (limited to 'core/vm/environment.go')
-rw-r--r--core/vm/environment.go35
1 files changed, 12 insertions, 23 deletions
diff --git a/core/vm/environment.go b/core/vm/environment.go
index 3c530962b..568218edd 100644
--- a/core/vm/environment.go
+++ b/core/vm/environment.go
@@ -22,9 +22,6 @@ import (
"github.com/ethereum/go-ethereum/common"
)
-// Environment is is required by the virtual machine to get information from
-// it's own isolated environment.
-
// Environment is an EVM requirement and helper which allows access to outside
// information such as states.
type Environment interface {
@@ -54,12 +51,8 @@ type Environment interface {
Transfer(from, to Account, amount *big.Int)
// Adds a LOG to the state
AddLog(*Log)
- // Adds a structured log to the env
- AddStructLog(StructLog)
- // Returns all coalesced structured logs
- StructLogs() []StructLog
// Type of the VM
- Vm() *Vm
+ Vm() Vm
// Current calling depth
Depth() int
SetDepth(i int)
@@ -74,7 +67,15 @@ type Environment interface {
Create(me ContractRef, data []byte, gas, price, value *big.Int) ([]byte, common.Address, error)
}
-// Database is a EVM database for full state querying
+// Vm is the basic interface for an implementation of the EVM.
+type Vm interface {
+ // Run should execute the given contract with the input given in in
+ // and return the contract execution return bytes or an error if it
+ // failed.
+ Run(c *Contract, in []byte) ([]byte, error)
+}
+
+// Database is a EVM database for full state querying.
type Database interface {
GetAccount(common.Address) Account
CreateAccount(common.Address) Account
@@ -99,19 +100,7 @@ type Database interface {
IsDeleted(common.Address) bool
}
-// StructLog is emitted to the Environment each cycle and lists information about the current internal state
-// prior to the execution of the statement.
-type StructLog struct {
- Pc uint64
- Op OpCode
- Gas *big.Int
- GasCost *big.Int
- Memory []byte
- Stack []*big.Int
- Storage map[common.Hash][]byte
- Err error
-}
-
+// Account represents a contract or basic ethereum account.
type Account interface {
SubBalance(amount *big.Int)
AddBalance(amount *big.Int)
@@ -121,6 +110,6 @@ type Account interface {
Address() common.Address
ReturnGas(*big.Int, *big.Int)
SetCode([]byte)
- EachStorage(cb func(key, value []byte))
+ ForEachStorage(cb func(key, value common.Hash) bool)
Value() *big.Int
}