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
430bcdb2
Commit
430bcdb2
authored
Jun 18, 2015
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core/vm: clarified SSTORE
parent
15e169e5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
7 deletions
+5
-7
vm.go
core/vm/vm.go
+5
-7
No files found.
core/vm/vm.go
View file @
430bcdb2
...
@@ -686,6 +686,11 @@ func (self *Vm) calculateGasAndSize(context *Context, caller ContextRef, op OpCo
...
@@ -686,6 +686,11 @@ func (self *Vm) calculateGasAndSize(context *Context, caller ContextRef, op OpCo
var
g
*
big
.
Int
var
g
*
big
.
Int
y
,
x
:=
stack
.
data
[
stack
.
len
()
-
2
],
stack
.
data
[
stack
.
len
()
-
1
]
y
,
x
:=
stack
.
data
[
stack
.
len
()
-
2
],
stack
.
data
[
stack
.
len
()
-
1
]
val
:=
statedb
.
GetState
(
context
.
Address
(),
common
.
BigToHash
(
x
))
val
:=
statedb
.
GetState
(
context
.
Address
(),
common
.
BigToHash
(
x
))
// This checks for 3 scenario's and calculates gas accordingly
// 1. From a zero-value address to a non-zero value (NEW VALUE)
// 2. From a non-zero value address to a zero-value address (DELETE)
// 3. From a nen-zero to a non-zero (CHANGE)
if
common
.
EmptyHash
(
val
)
&&
!
common
.
EmptyHash
(
common
.
BigToHash
(
y
))
{
if
common
.
EmptyHash
(
val
)
&&
!
common
.
EmptyHash
(
common
.
BigToHash
(
y
))
{
// 0 => non 0
// 0 => non 0
g
=
params
.
SstoreSetGas
g
=
params
.
SstoreSetGas
...
@@ -697,13 +702,6 @@ func (self *Vm) calculateGasAndSize(context *Context, caller ContextRef, op OpCo
...
@@ -697,13 +702,6 @@ func (self *Vm) calculateGasAndSize(context *Context, caller ContextRef, op OpCo
// non 0 => non 0 (or 0 => 0)
// non 0 => non 0 (or 0 => 0)
g
=
params
.
SstoreClearGas
g
=
params
.
SstoreClearGas
}
}
/*
if len(val) == 0 && len(y.Bytes()) > 0 {
} else if len(val) > 0 && len(y.Bytes()) == 0 {
} else {
}
*/
gas
.
Set
(
g
)
gas
.
Set
(
g
)
case
SUICIDE
:
case
SUICIDE
:
if
!
statedb
.
IsDeleted
(
context
.
Address
())
{
if
!
statedb
.
IsDeleted
(
context
.
Address
())
{
...
...
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