Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
6212175b
Commit
6212175b
authored
Dec 03, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reverted vm back
parent
6095edac
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
148 additions
and
135 deletions
+148
-135
environment.go
vm/environment.go
+7
-10
execution.go
vm/execution.go
+4
-2
vm_debug.go
vm/vm_debug.go
+137
-123
No files found.
vm/environment.go
View file @
6212175b
...
@@ -5,10 +5,11 @@ import (
...
@@ -5,10 +5,11 @@ import (
"math/big"
"math/big"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/state"
)
)
type
Environment
interface
{
type
Environment
interface
{
//
State() *state.State
State
()
*
state
.
State
Origin
()
[]
byte
Origin
()
[]
byte
BlockNumber
()
*
big
.
Int
BlockNumber
()
*
big
.
Int
...
@@ -18,16 +19,8 @@ type Environment interface {
...
@@ -18,16 +19,8 @@ type Environment interface {
Difficulty
()
*
big
.
Int
Difficulty
()
*
big
.
Int
BlockHash
()
[]
byte
BlockHash
()
[]
byte
GasLimit
()
*
big
.
Int
GasLimit
()
*
big
.
Int
Transfer
(
from
,
to
Account
,
amount
*
big
.
Int
)
error
Transfer
(
from
,
to
Account
,
amount
*
big
.
Int
)
error
AddLog
(
addr
[]
byte
,
topics
[][]
byte
,
data
[]
byte
)
AddLog
(
*
state
.
Log
)
DeleteAccount
(
addr
[]
byte
)
SetState
(
addr
,
key
,
value
[]
byte
)
GetState
(
addr
,
key
[]
byte
)
[]
byte
Balance
(
addr
[]
byte
)
*
big
.
Int
AddBalance
(
addr
[]
byte
,
balance
*
big
.
Int
)
GetCode
(
addr
[]
byte
)
[]
byte
Refund
(
addr
[]
byte
,
gas
,
price
*
big
.
Int
)
}
}
type
Object
interface
{
type
Object
interface
{
...
@@ -50,5 +43,9 @@ func Transfer(from, to Account, amount *big.Int) error {
...
@@ -50,5 +43,9 @@ func Transfer(from, to Account, amount *big.Int) error {
from
.
SubBalance
(
amount
)
from
.
SubBalance
(
amount
)
to
.
AddBalance
(
amount
)
to
.
AddBalance
(
amount
)
// Add default LOG. Default = big(sender.addr) + 1
//addr := ethutil.BigD(receiver.Address())
//tx.addLog(vm.Log{sender.Address(), [][]byte{ethutil.U256(addr.Add(addr, ethutil.Big1)).Bytes()}, nil})
return
nil
return
nil
}
}
vm/execution.go
View file @
6212175b
...
@@ -26,7 +26,7 @@ func (self *Execution) Addr() []byte {
...
@@ -26,7 +26,7 @@ func (self *Execution) Addr() []byte {
func
(
self
*
Execution
)
Exec
(
codeAddr
[]
byte
,
caller
ClosureRef
)
([]
byte
,
error
)
{
func
(
self
*
Execution
)
Exec
(
codeAddr
[]
byte
,
caller
ClosureRef
)
([]
byte
,
error
)
{
// Retrieve the executing code
// Retrieve the executing code
code
:=
self
.
vm
.
Env
()
.
GetCode
(
codeAddr
)
code
:=
self
.
vm
.
Env
()
.
State
()
.
GetCode
(
codeAddr
)
return
self
.
exec
(
code
,
codeAddr
,
caller
)
return
self
.
exec
(
code
,
codeAddr
,
caller
)
}
}
...
@@ -34,11 +34,13 @@ func (self *Execution) Exec(codeAddr []byte, caller ClosureRef) ([]byte, error)
...
@@ -34,11 +34,13 @@ func (self *Execution) Exec(codeAddr []byte, caller ClosureRef) ([]byte, error)
func
(
self
*
Execution
)
exec
(
code
,
caddr
[]
byte
,
caller
ClosureRef
)
(
ret
[]
byte
,
err
error
)
{
func
(
self
*
Execution
)
exec
(
code
,
caddr
[]
byte
,
caller
ClosureRef
)
(
ret
[]
byte
,
err
error
)
{
env
:=
self
.
vm
.
Env
()
env
:=
self
.
vm
.
Env
()
vmlogger
.
Debugf
(
"pre state %x
\n
"
,
env
.
State
()
.
Root
())
snapshot
:=
env
.
State
()
.
Copy
()
snapshot
:=
env
.
State
()
.
Copy
()
defer
func
()
{
defer
func
()
{
if
IsDepthErr
(
err
)
||
IsOOGErr
(
err
)
{
if
IsDepthErr
(
err
)
||
IsOOGErr
(
err
)
{
env
.
State
()
.
Set
(
snapshot
)
env
.
State
()
.
Set
(
snapshot
)
}
}
vmlogger
.
Debugf
(
"post state %x
\n
"
,
env
.
State
()
.
Root
())
}()
}()
msg
:=
env
.
State
()
.
Manifest
()
.
AddMessage
(
&
state
.
Message
{
msg
:=
env
.
State
()
.
Manifest
()
.
AddMessage
(
&
state
.
Message
{
...
@@ -89,6 +91,6 @@ func (self *Execution) exec(code, caddr []byte, caller ClosureRef) (ret []byte,
...
@@ -89,6 +91,6 @@ func (self *Execution) exec(code, caddr []byte, caller ClosureRef) (ret []byte,
return
return
}
}
func
(
self
*
Execution
)
Create
(
caller
[]
byte
)
(
ret
[]
byte
,
err
error
)
{
func
(
self
*
Execution
)
Create
(
caller
ClosureRef
)
(
ret
[]
byte
,
err
error
)
{
return
self
.
exec
(
self
.
input
,
nil
,
caller
)
return
self
.
exec
(
self
.
input
,
nil
,
caller
)
}
}
vm/vm_debug.go
View file @
6212175b
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment