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
7fb5e993
Commit
7fb5e993
authored
Jun 20, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved 0 check to state object for now
parent
0251fae5
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
12 deletions
+21
-12
state_object.go
ethchain/state_object.go
+7
-0
vm.go
ethchain/vm.go
+14
-12
No files found.
ethchain/state_object.go
View file @
7fb5e993
...
...
@@ -90,6 +90,13 @@ func (c *StateObject) SetAddr(addr []byte, value interface{}) {
func
(
c
*
StateObject
)
SetStorage
(
num
*
big
.
Int
,
val
*
ethutil
.
Value
)
{
addr
:=
ethutil
.
BigToBytes
(
num
,
256
)
// FIXME This should be handled in the Trie it self
if
val
.
BigInt
()
.
Cmp
(
ethutil
.
Big0
)
==
0
{
c
.
state
.
trie
.
Delete
(
string
(
addr
))
return
}
//fmt.Printf("sstore %x => %v\n", addr, val)
c
.
SetAddr
(
addr
,
val
)
}
...
...
ethchain/vm.go
View file @
7fb5e993
...
...
@@ -325,21 +325,21 @@ func (vm *Vm) RunClosure(closure *Closure, hook DebugHook) (ret []byte, err erro
stack
.
Push
(
base
)
case
LT
:
require
(
2
)
y
,
x
:=
stack
.
Popn
()
vm
.
Printf
(
" %v < %v"
,
x
,
y
)
x
,
y
:=
stack
.
Popn
()
vm
.
Printf
(
" %v < %v"
,
y
,
x
)
// x < y
if
x
.
Cmp
(
y
)
<
0
{
if
y
.
Cmp
(
x
)
<
0
{
stack
.
Push
(
ethutil
.
BigTrue
)
}
else
{
stack
.
Push
(
ethutil
.
BigFalse
)
}
case
GT
:
require
(
2
)
y
,
x
:=
stack
.
Popn
()
vm
.
Printf
(
" %v > %v"
,
x
,
y
)
x
,
y
:=
stack
.
Popn
()
vm
.
Printf
(
" %v > %v"
,
y
,
x
)
// x > y
if
x
.
Cmp
(
y
)
>
0
{
if
y
.
Cmp
(
x
)
>
0
{
stack
.
Push
(
ethutil
.
BigTrue
)
}
else
{
stack
.
Push
(
ethutil
.
BigFalse
)
...
...
@@ -520,7 +520,10 @@ func (vm *Vm) RunClosure(closure *Closure, hook DebugHook) (ret []byte, err erro
case
MLOAD
:
require
(
1
)
offset
:=
stack
.
Pop
()
stack
.
Push
(
ethutil
.
BigD
(
mem
.
Get
(
offset
.
Int64
(),
32
)))
val
:=
ethutil
.
BigD
(
mem
.
Get
(
offset
.
Int64
(),
32
))
stack
.
Push
(
val
)
vm
.
Printf
(
" => 0x%x"
,
val
.
Bytes
())
case
MSTORE
:
// Store the value at stack top-1 in to memory at location stack top
require
(
2
)
// Pop value of the stack
...
...
@@ -541,15 +544,14 @@ func (vm *Vm) RunClosure(closure *Closure, hook DebugHook) (ret []byte, err erro
val
:=
closure
.
GetMem
(
loc
)
stack
.
Push
(
val
.
BigInt
())
vm
.
Printf
(
" {
} 0x%x"
,
val
)
vm
.
Printf
(
" {
0x%x} 0x%x"
,
loc
.
Bytes
()
,
val
)
case
SSTORE
:
require
(
2
)
val
,
loc
:=
stack
.
Popn
()
// FIXME This should be handled in the Trie it self
if
val
.
Cmp
(
big
.
NewInt
(
0
))
!=
0
{
//if val.Cmp(big.NewInt(0)) != 0 {
closure
.
SetStorage
(
loc
,
ethutil
.
NewValue
(
val
))
}
//
}
// Add the change to manifest
vm
.
state
.
manifest
.
AddStorageChange
(
closure
.
Object
(),
loc
.
Bytes
(),
val
)
...
...
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