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
d15952c8
Commit
d15952c8
authored
Jul 01, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved debug hook to Vm directly
parent
1954ef47
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
9 deletions
+11
-9
closure.go
ethchain/closure.go
+2
-4
state_transition.go
ethchain/state_transition.go
+1
-1
vm.go
ethchain/vm.go
+8
-4
No files found.
ethchain/closure.go
View file @
d15952c8
...
...
@@ -74,12 +74,10 @@ func (c *Closure) Address() []byte {
return
c
.
object
.
Address
()
}
type
DebugHook
func
(
step
int
,
op
OpCode
,
mem
*
Memory
,
stack
*
Stack
,
stateObject
*
StateObject
)
bool
func
(
c
*
Closure
)
Call
(
vm
*
Vm
,
args
[]
byte
,
hook
DebugHook
)
([]
byte
,
*
big
.
Int
,
error
)
{
func
(
c
*
Closure
)
Call
(
vm
*
Vm
,
args
[]
byte
)
([]
byte
,
*
big
.
Int
,
error
)
{
c
.
Args
=
args
ret
,
err
:=
vm
.
RunClosure
(
c
,
hook
)
ret
,
err
:=
vm
.
RunClosure
(
c
)
return
ret
,
c
.
UsedGas
,
err
}
...
...
ethchain/state_transition.go
View file @
d15952c8
...
...
@@ -261,7 +261,7 @@ func (self *StateTransition) Eval(script []byte, context *StateObject) (ret []by
}
func
Call
(
vm
*
Vm
,
closure
*
Closure
,
data
[]
byte
)
(
ret
[]
byte
,
err
error
,
deepErr
bool
)
{
ret
,
_
,
err
=
closure
.
Call
(
vm
,
data
,
nil
)
ret
,
_
,
err
=
closure
.
Call
(
vm
,
data
)
deepErr
=
vm
.
err
!=
nil
Paranoia
:=
ethutil
.
Config
.
Paranoia
...
...
ethchain/vm.go
View file @
d15952c8
...
...
@@ -52,8 +52,12 @@ type Vm struct {
logStr
string
err
error
Hook
DebugHook
}
type
DebugHook
func
(
step
int
,
op
OpCode
,
mem
*
Memory
,
stack
*
Stack
,
stateObject
*
StateObject
)
bool
type
RuntimeVars
struct
{
Origin
[]
byte
Block
*
Block
...
...
@@ -91,7 +95,7 @@ var Pow256 = ethutil.BigPow(2, 256)
var
isRequireError
=
false
func
(
vm
*
Vm
)
RunClosure
(
closure
*
Closure
,
hook
DebugHook
)
(
ret
[]
byte
,
err
error
)
{
func
(
vm
*
Vm
)
RunClosure
(
closure
*
Closure
)
(
ret
[]
byte
,
err
error
)
{
// Recover from any require exception
defer
func
()
{
if
r
:=
recover
();
r
!=
nil
{
...
...
@@ -642,7 +646,7 @@ func (vm *Vm) RunClosure(closure *Closure, hook DebugHook) (ret []byte, err erro
// Call the closure and set the return value as
// main script.
var
err
error
c
.
Script
,
gas
,
err
=
c
.
Call
(
vm
,
nil
,
hook
)
c
.
Script
,
gas
,
err
=
c
.
Call
(
vm
,
nil
)
if
err
!=
nil
{
stack
.
Push
(
ethutil
.
BigFalse
)
...
...
@@ -738,8 +742,8 @@ func (vm *Vm) RunClosure(closure *Closure, hook DebugHook) (ret []byte, err erro
vm
.
Endl
()
if
h
ook
!=
nil
{
if
!
h
ook
(
prevStep
,
op
,
mem
,
stack
,
closure
.
Object
())
{
if
vm
.
H
ook
!=
nil
{
if
!
vm
.
H
ook
(
prevStep
,
op
,
mem
,
stack
,
closure
.
Object
())
{
return
nil
,
nil
}
}
...
...
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