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
ff9d66e0
Commit
ff9d66e0
authored
Mar 24, 2015
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleaned up changes
parent
23bccbbc
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
9 additions
and
13 deletions
+9
-13
state_transition.go
core/state_transition.go
+2
-5
environment.go
core/vm/environment.go
+1
-2
vm.go
core/vm/vm.go
+1
-1
vm_env.go
core/vm_env.go
+3
-3
vm.go
tests/helper/vm.go
+2
-2
No files found.
core/state_transition.go
View file @
ff9d66e0
...
@@ -195,14 +195,10 @@ func (self *StateTransition) transitionState() (ret []byte, usedGas *big.Int, er
...
@@ -195,14 +195,10 @@ func (self *StateTransition) transitionState() (ret []byte, usedGas *big.Int, er
return
nil
,
nil
,
InvalidTxError
(
err
)
return
nil
,
nil
,
InvalidTxError
(
err
)
}
}
// Increment the nonce for the next transaction
vmenv
:=
self
.
env
vmenv
:=
self
.
env
var
ref
vm
.
ContextRef
var
ref
vm
.
ContextRef
if
MessageCreatesContract
(
msg
)
{
if
MessageCreatesContract
(
msg
)
{
//contract := makeContract(msg, self.state)
ret
,
err
,
ref
=
vmenv
.
Create
(
sender
,
self
.
msg
.
Data
(),
self
.
gas
,
self
.
gasPrice
,
self
.
value
)
//addr := contract.Address()
ret
,
err
,
ref
=
vmenv
.
Create
(
sender
,
nil
,
self
.
msg
.
Data
(),
self
.
gas
,
self
.
gasPrice
,
self
.
value
)
if
err
==
nil
{
if
err
==
nil
{
dataGas
:=
big
.
NewInt
(
int64
(
len
(
ret
)))
dataGas
:=
big
.
NewInt
(
int64
(
len
(
ret
)))
dataGas
.
Mul
(
dataGas
,
vm
.
GasCreateByte
)
dataGas
.
Mul
(
dataGas
,
vm
.
GasCreateByte
)
...
@@ -213,6 +209,7 @@ func (self *StateTransition) transitionState() (ret []byte, usedGas *big.Int, er
...
@@ -213,6 +209,7 @@ func (self *StateTransition) transitionState() (ret []byte, usedGas *big.Int, er
}
}
}
}
}
else
{
}
else
{
// Increment the nonce for the next transaction
self
.
state
.
SetNonce
(
sender
.
Address
(),
sender
.
Nonce
()
+
1
)
self
.
state
.
SetNonce
(
sender
.
Address
(),
sender
.
Nonce
()
+
1
)
ret
,
err
=
vmenv
.
Call
(
self
.
From
(),
self
.
To
()
.
Address
(),
self
.
msg
.
Data
(),
self
.
gas
,
self
.
gasPrice
,
self
.
value
)
ret
,
err
=
vmenv
.
Call
(
self
.
From
(),
self
.
To
()
.
Address
(),
self
.
msg
.
Data
(),
self
.
gas
,
self
.
gasPrice
,
self
.
value
)
}
}
...
...
core/vm/environment.go
View file @
ff9d66e0
...
@@ -31,7 +31,7 @@ type Environment interface {
...
@@ -31,7 +31,7 @@ type Environment interface {
Call
(
me
ContextRef
,
addr
common
.
Address
,
data
[]
byte
,
gas
,
price
,
value
*
big
.
Int
)
([]
byte
,
error
)
Call
(
me
ContextRef
,
addr
common
.
Address
,
data
[]
byte
,
gas
,
price
,
value
*
big
.
Int
)
([]
byte
,
error
)
CallCode
(
me
ContextRef
,
addr
common
.
Address
,
data
[]
byte
,
gas
,
price
,
value
*
big
.
Int
)
([]
byte
,
error
)
CallCode
(
me
ContextRef
,
addr
common
.
Address
,
data
[]
byte
,
gas
,
price
,
value
*
big
.
Int
)
([]
byte
,
error
)
Create
(
me
ContextRef
,
addr
*
common
.
Address
,
data
[]
byte
,
gas
,
price
,
value
*
big
.
Int
)
([]
byte
,
error
,
ContextRef
)
Create
(
me
ContextRef
,
data
[]
byte
,
gas
,
price
,
value
*
big
.
Int
)
([]
byte
,
error
,
ContextRef
)
}
}
type
Account
interface
{
type
Account
interface
{
...
@@ -43,7 +43,6 @@ type Account interface {
...
@@ -43,7 +43,6 @@ type Account interface {
// generic transfer method
// generic transfer method
func
Transfer
(
from
,
to
Account
,
amount
*
big
.
Int
)
error
{
func
Transfer
(
from
,
to
Account
,
amount
*
big
.
Int
)
error
{
//fmt.Printf(":::%x::: %v < %v\n", from.Address(), from.Balance(), amount)
if
from
.
Balance
()
.
Cmp
(
amount
)
<
0
{
if
from
.
Balance
()
.
Cmp
(
amount
)
<
0
{
return
errors
.
New
(
"Insufficient balance in account"
)
return
errors
.
New
(
"Insufficient balance in account"
)
}
}
...
...
core/vm/vm.go
View file @
ff9d66e0
...
@@ -636,7 +636,7 @@ func (self *Vm) Run(context *Context, callData []byte) (ret []byte, err error) {
...
@@ -636,7 +636,7 @@ func (self *Vm) Run(context *Context, callData []byte) (ret []byte, err error) {
self
.
Endl
()
self
.
Endl
()
context
.
UseGas
(
context
.
Gas
)
context
.
UseGas
(
context
.
Gas
)
ret
,
suberr
,
ref
:=
self
.
env
.
Create
(
context
,
nil
,
input
,
gas
,
price
,
value
)
ret
,
suberr
,
ref
:=
self
.
env
.
Create
(
context
,
input
,
gas
,
price
,
value
)
if
suberr
!=
nil
{
if
suberr
!=
nil
{
stack
.
push
(
common
.
BigFalse
)
stack
.
push
(
common
.
BigFalse
)
...
...
core/vm_env.go
View file @
ff9d66e0
...
@@ -4,8 +4,8 @@ import (
...
@@ -4,8 +4,8 @@ import (
"math/big"
"math/big"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/core/vm"
)
)
...
@@ -68,7 +68,7 @@ func (self *VMEnv) CallCode(me vm.ContextRef, addr common.Address, data []byte,
...
@@ -68,7 +68,7 @@ func (self *VMEnv) CallCode(me vm.ContextRef, addr common.Address, data []byte,
return
exe
.
Call
(
addr
,
me
)
return
exe
.
Call
(
addr
,
me
)
}
}
func
(
self
*
VMEnv
)
Create
(
me
vm
.
ContextRef
,
addr
*
common
.
Address
,
data
[]
byte
,
gas
,
price
,
value
*
big
.
Int
)
([]
byte
,
error
,
vm
.
ContextRef
)
{
func
(
self
*
VMEnv
)
Create
(
me
vm
.
ContextRef
,
data
[]
byte
,
gas
,
price
,
value
*
big
.
Int
)
([]
byte
,
error
,
vm
.
ContextRef
)
{
exe
:=
self
.
vm
(
addr
,
data
,
gas
,
price
,
value
)
exe
:=
self
.
vm
(
nil
,
data
,
gas
,
price
,
value
)
return
exe
.
Create
(
me
)
return
exe
.
Create
(
me
)
}
}
tests/helper/vm.go
View file @
ff9d66e0
...
@@ -119,8 +119,8 @@ func (self *Env) CallCode(caller vm.ContextRef, addr common.Address, data []byte
...
@@ -119,8 +119,8 @@ func (self *Env) CallCode(caller vm.ContextRef, addr common.Address, data []byte
return
exe
.
Call
(
addr
,
caller
)
return
exe
.
Call
(
addr
,
caller
)
}
}
func
(
self
*
Env
)
Create
(
caller
vm
.
ContextRef
,
addr
*
common
.
Address
,
data
[]
byte
,
gas
,
price
,
value
*
big
.
Int
)
([]
byte
,
error
,
vm
.
ContextRef
)
{
func
(
self
*
Env
)
Create
(
caller
vm
.
ContextRef
,
data
[]
byte
,
gas
,
price
,
value
*
big
.
Int
)
([]
byte
,
error
,
vm
.
ContextRef
)
{
exe
:=
self
.
vm
(
addr
,
data
,
gas
,
price
,
value
)
exe
:=
self
.
vm
(
nil
,
data
,
gas
,
price
,
value
)
if
self
.
vmTest
{
if
self
.
vmTest
{
caller
.
ReturnGas
(
gas
,
price
)
caller
.
ReturnGas
(
gas
,
price
)
...
...
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