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
94505146
Commit
94505146
authored
Mar 16, 2015
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated vm env
parent
843db497
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
21 deletions
+23
-21
state_transition.go
core/state_transition.go
+3
-3
vm_env.go
core/vm_env.go
+17
-16
block.go
pow/block.go
+3
-2
No files found.
core/state_transition.go
View file @
94505146
...
...
@@ -4,8 +4,8 @@ import (
"fmt"
"math/big"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/state"
"github.com/ethereum/go-ethereum/vm"
)
...
...
@@ -45,8 +45,8 @@ type StateTransition struct {
}
type
Message
interface
{
From
()
[]
byte
To
()
[]
byte
From
()
common
.
Address
To
()
common
.
Address
GasPrice
()
*
big
.
Int
Gas
()
*
big
.
Int
...
...
core/vm_env.go
View file @
94505146
...
...
@@ -3,6 +3,7 @@ package core
import
(
"math/big"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/state"
"github.com/ethereum/go-ethereum/vm"
...
...
@@ -27,18 +28,18 @@ func NewEnv(state *state.StateDB, chain *ChainManager, msg Message, block *types
}
}
func
(
self
*
VMEnv
)
Origin
()
[]
byte
{
return
self
.
msg
.
From
()
}
func
(
self
*
VMEnv
)
BlockNumber
()
*
big
.
Int
{
return
self
.
block
.
Number
()
}
func
(
self
*
VMEnv
)
Coinbase
()
[]
byte
{
return
self
.
block
.
Coinbase
()
}
func
(
self
*
VMEnv
)
Time
()
int64
{
return
self
.
block
.
Time
()
}
func
(
self
*
VMEnv
)
Difficulty
()
*
big
.
Int
{
return
self
.
block
.
Difficulty
()
}
func
(
self
*
VMEnv
)
GasLimit
()
*
big
.
Int
{
return
self
.
block
.
GasLimit
()
}
func
(
self
*
VMEnv
)
Value
()
*
big
.
Int
{
return
self
.
msg
.
Value
()
}
func
(
self
*
VMEnv
)
State
()
*
state
.
StateDB
{
return
self
.
state
}
func
(
self
*
VMEnv
)
Depth
()
int
{
return
self
.
depth
}
func
(
self
*
VMEnv
)
SetDepth
(
i
int
)
{
self
.
depth
=
i
}
func
(
self
*
VMEnv
)
VmType
()
vm
.
Type
{
return
self
.
typ
}
func
(
self
*
VMEnv
)
SetVmType
(
t
vm
.
Type
)
{
self
.
typ
=
t
}
func
(
self
*
VMEnv
)
Origin
()
common
.
Address
{
return
self
.
msg
.
From
()
}
func
(
self
*
VMEnv
)
BlockNumber
()
*
big
.
Int
{
return
self
.
block
.
Number
()
}
func
(
self
*
VMEnv
)
Coinbase
()
[]
byte
{
return
self
.
block
.
Coinbase
()
}
func
(
self
*
VMEnv
)
Time
()
int64
{
return
self
.
block
.
Time
()
}
func
(
self
*
VMEnv
)
Difficulty
()
*
big
.
Int
{
return
self
.
block
.
Difficulty
()
}
func
(
self
*
VMEnv
)
GasLimit
()
*
big
.
Int
{
return
self
.
block
.
GasLimit
()
}
func
(
self
*
VMEnv
)
Value
()
*
big
.
Int
{
return
self
.
msg
.
Value
()
}
func
(
self
*
VMEnv
)
State
()
*
state
.
StateDB
{
return
self
.
state
}
func
(
self
*
VMEnv
)
Depth
()
int
{
return
self
.
depth
}
func
(
self
*
VMEnv
)
SetDepth
(
i
int
)
{
self
.
depth
=
i
}
func
(
self
*
VMEnv
)
VmType
()
vm
.
Type
{
return
self
.
typ
}
func
(
self
*
VMEnv
)
SetVmType
(
t
vm
.
Type
)
{
self
.
typ
=
t
}
func
(
self
*
VMEnv
)
GetHash
(
n
uint64
)
[]
byte
{
if
block
:=
self
.
chain
.
GetBlockByNumber
(
n
);
block
!=
nil
{
return
block
.
Hash
()
...
...
@@ -57,16 +58,16 @@ func (self *VMEnv) vm(addr, data []byte, gas, price, value *big.Int) *Execution
return
NewExecution
(
self
,
addr
,
data
,
gas
,
price
,
value
)
}
func
(
self
*
VMEnv
)
Call
(
me
vm
.
ContextRef
,
addr
,
data
[]
byte
,
gas
,
price
,
value
*
big
.
Int
)
([]
byte
,
error
)
{
func
(
self
*
VMEnv
)
Call
(
me
vm
.
ContextRef
,
addr
common
.
Address
,
data
[]
byte
,
gas
,
price
,
value
*
big
.
Int
)
([]
byte
,
error
)
{
exe
:=
self
.
vm
(
addr
,
data
,
gas
,
price
,
value
)
return
exe
.
Call
(
addr
,
me
)
}
func
(
self
*
VMEnv
)
CallCode
(
me
vm
.
ContextRef
,
addr
,
data
[]
byte
,
gas
,
price
,
value
*
big
.
Int
)
([]
byte
,
error
)
{
func
(
self
*
VMEnv
)
CallCode
(
me
vm
.
ContextRef
,
addr
common
.
Address
,
data
[]
byte
,
gas
,
price
,
value
*
big
.
Int
)
([]
byte
,
error
)
{
exe
:=
self
.
vm
(
me
.
Address
(),
data
,
gas
,
price
,
value
)
return
exe
.
Call
(
addr
,
me
)
}
func
(
self
*
VMEnv
)
Create
(
me
vm
.
ContextRef
,
addr
,
data
[]
byte
,
gas
,
price
,
value
*
big
.
Int
)
([]
byte
,
error
,
vm
.
ContextRef
)
{
exe
:=
self
.
vm
(
addr
,
data
,
gas
,
price
,
value
)
func
(
self
*
VMEnv
)
Create
(
me
vm
.
ContextRef
,
data
[]
byte
,
gas
,
price
,
value
*
big
.
Int
)
([]
byte
,
error
,
vm
.
ContextRef
)
{
exe
:=
self
.
vm
(
common
.
Address
{}
,
data
,
gas
,
price
,
value
)
return
exe
.
Create
(
me
)
}
pow/block.go
View file @
94505146
...
...
@@ -3,14 +3,15 @@ package pow
import
(
"math/big"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
)
type
Block
interface
{
Difficulty
()
*
big
.
Int
HashNoNonce
()
[]
byte
HashNoNonce
()
common
.
Hash
Nonce
()
uint64
MixDigest
()
[]
byte
MixDigest
()
common
.
Hash
NumberU64
()
uint64
}
...
...
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