good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
bor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open
bor
Commits
8ccde784
Commit
8ccde784
authored
Feb 1, 2015
by
Jeffrey Wilcke
Browse files
Options
Downloads
Patches
Plain Diff
Added (disabled) Jit validation
parent
d52878c7
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
core/execution.go
+1
-2
1 addition, 2 deletions
core/execution.go
core/state_transition.go
+25
-0
25 additions, 0 deletions
core/state_transition.go
core/vm_env.go
+4
-0
4 additions, 0 deletions
core/vm_env.go
eth/backend.go
+1
-2
1 addition, 2 deletions
eth/backend.go
vm/common.go
+12
-0
12 additions, 0 deletions
vm/common.go
with
43 additions
and
4 deletions
core/execution.go
+
1
−
2
View file @
8ccde784
...
@@ -33,8 +33,7 @@ func (self *Execution) Call(codeAddr []byte, caller vm.ContextRef) ([]byte, erro
...
@@ -33,8 +33,7 @@ func (self *Execution) Call(codeAddr []byte, caller vm.ContextRef) ([]byte, erro
func
(
self
*
Execution
)
exec
(
code
,
contextAddr
[]
byte
,
caller
vm
.
ContextRef
)
(
ret
[]
byte
,
err
error
)
{
func
(
self
*
Execution
)
exec
(
code
,
contextAddr
[]
byte
,
caller
vm
.
ContextRef
)
(
ret
[]
byte
,
err
error
)
{
env
:=
self
.
env
env
:=
self
.
env
evm
:=
vm
.
New
(
env
)
evm
:=
vm
.
NewVm
(
env
)
if
env
.
Depth
()
==
vm
.
MaxCallDepth
{
if
env
.
Depth
()
==
vm
.
MaxCallDepth
{
caller
.
ReturnGas
(
self
.
Gas
,
self
.
price
)
caller
.
ReturnGas
(
self
.
Gas
,
self
.
price
)
...
...
This diff is collapsed.
Click to expand it.
core/state_transition.go
+
25
−
0
View file @
8ccde784
...
@@ -10,6 +10,8 @@ import (
...
@@ -10,6 +10,8 @@ import (
"github.com/ethereum/go-ethereum/vm"
"github.com/ethereum/go-ethereum/vm"
)
)
const
tryJit
=
false
/*
/*
* The State transitioning model
* The State transitioning model
*
*
...
@@ -184,6 +186,7 @@ func (self *StateTransition) TransitionState() (ret []byte, err error) {
...
@@ -184,6 +186,7 @@ func (self *StateTransition) TransitionState() (ret []byte, err error) {
return
return
}
}
stateCopy
:=
self
.
env
.
State
()
.
Copy
()
vmenv
:=
self
.
env
vmenv
:=
self
.
env
var
ref
vm
.
ContextRef
var
ref
vm
.
ContextRef
if
MessageCreatesContract
(
msg
)
{
if
MessageCreatesContract
(
msg
)
{
...
@@ -196,8 +199,30 @@ func (self *StateTransition) TransitionState() (ret []byte, err error) {
...
@@ -196,8 +199,30 @@ func (self *StateTransition) TransitionState() (ret []byte, err error) {
ref
.
SetCode
(
ret
)
ref
.
SetCode
(
ret
)
}
}
}
}
if
vmenv
,
ok
:=
vmenv
.
(
*
VMEnv
);
ok
&&
tryJit
{
statelogger
.
Infof
(
"CREATE: re-running using JIT (PH=%x)
\n
"
,
stateCopy
.
Root
()[
:
4
])
// re-run using the JIT (validation for the JIT)
goodState
:=
vmenv
.
State
()
.
Copy
()
vmenv
.
state
=
stateCopy
vmenv
.
SetVmType
(
vm
.
JitVmTy
)
vmenv
.
Create
(
sender
,
contract
.
Address
(),
self
.
msg
.
Data
(),
self
.
gas
,
self
.
gasPrice
,
self
.
value
)
statelogger
.
Infof
(
"DONE PH=%x STD_H=%x JIT_H=%x
\n
"
,
stateCopy
.
Root
()[
:
4
],
goodState
.
Root
()[
:
4
],
vmenv
.
State
()
.
Root
()[
:
4
])
self
.
state
.
Set
(
goodState
)
}
}
else
{
}
else
{
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
)
if
vmenv
,
ok
:=
vmenv
.
(
*
VMEnv
);
ok
&&
tryJit
{
statelogger
.
Infof
(
"CALL: re-running using JIT (PH=%x)
\n
"
,
stateCopy
.
Root
()[
:
4
])
// re-run using the JIT (validation for the JIT)
goodState
:=
vmenv
.
State
()
.
Copy
()
vmenv
.
state
=
stateCopy
vmenv
.
SetVmType
(
vm
.
JitVmTy
)
vmenv
.
Call
(
self
.
From
(),
self
.
To
()
.
Address
(),
self
.
msg
.
Data
(),
self
.
gas
,
self
.
gasPrice
,
self
.
value
)
statelogger
.
Infof
(
"DONE PH=%x STD_H=%x JIT_H=%x
\n
"
,
stateCopy
.
Root
()[
:
4
],
goodState
.
Root
()[
:
4
],
vmenv
.
State
()
.
Root
()[
:
4
])
self
.
state
.
Set
(
goodState
)
}
}
}
if
err
!=
nil
{
if
err
!=
nil
{
...
...
This diff is collapsed.
Click to expand it.
core/vm_env.go
+
4
−
0
View file @
8ccde784
...
@@ -14,6 +14,7 @@ type VMEnv struct {
...
@@ -14,6 +14,7 @@ type VMEnv struct {
msg
Message
msg
Message
depth
int
depth
int
chain
*
ChainManager
chain
*
ChainManager
typ
vm
.
Type
}
}
func
NewEnv
(
state
*
state
.
StateDB
,
chain
*
ChainManager
,
msg
Message
,
block
*
types
.
Block
)
*
VMEnv
{
func
NewEnv
(
state
*
state
.
StateDB
,
chain
*
ChainManager
,
msg
Message
,
block
*
types
.
Block
)
*
VMEnv
{
...
@@ -22,6 +23,7 @@ func NewEnv(state *state.StateDB, chain *ChainManager, msg Message, block *types
...
@@ -22,6 +23,7 @@ func NewEnv(state *state.StateDB, chain *ChainManager, msg Message, block *types
state
:
state
,
state
:
state
,
block
:
block
,
block
:
block
,
msg
:
msg
,
msg
:
msg
,
typ
:
vm
.
StdVmTy
,
}
}
}
}
...
@@ -35,6 +37,8 @@ func (self *VMEnv) Value() *big.Int { return self.msg.Value() }
...
@@ -35,6 +37,8 @@ func (self *VMEnv) Value() *big.Int { return self.msg.Value() }
func
(
self
*
VMEnv
)
State
()
*
state
.
StateDB
{
return
self
.
state
}
func
(
self
*
VMEnv
)
State
()
*
state
.
StateDB
{
return
self
.
state
}
func
(
self
*
VMEnv
)
Depth
()
int
{
return
self
.
depth
}
func
(
self
*
VMEnv
)
Depth
()
int
{
return
self
.
depth
}
func
(
self
*
VMEnv
)
SetDepth
(
i
int
)
{
self
.
depth
=
i
}
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
{
func
(
self
*
VMEnv
)
GetHash
(
n
uint64
)
[]
byte
{
if
block
:=
self
.
chain
.
GetBlockByNumber
(
n
);
block
!=
nil
{
if
block
:=
self
.
chain
.
GetBlockByNumber
(
n
);
block
!=
nil
{
return
block
.
Hash
()
return
block
.
Hash
()
...
...
This diff is collapsed.
Click to expand it.
eth/backend.go
+
1
−
2
View file @
8ccde784
...
@@ -141,14 +141,13 @@ func New(config *Config) (*Ethereum, error) {
...
@@ -141,14 +141,13 @@ func New(config *Config) (*Ethereum, error) {
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
fmt
.
Println
(
nat
)
eth
.
net
=
&
p2p
.
Server
{
eth
.
net
=
&
p2p
.
Server
{
Identity
:
clientId
,
Identity
:
clientId
,
MaxPeers
:
config
.
MaxPeers
,
MaxPeers
:
config
.
MaxPeers
,
Protocols
:
protocols
,
Protocols
:
protocols
,
Blacklist
:
eth
.
blacklist
,
Blacklist
:
eth
.
blacklist
,
NAT
:
p2p
.
UPNP
()
,
NAT
:
nat
,
NoDial
:
!
config
.
Dial
,
NoDial
:
!
config
.
Dial
,
}
}
...
...
This diff is collapsed.
Click to expand it.
vm/common.go
+
12
−
0
View file @
8ccde784
...
@@ -18,6 +18,18 @@ const (
...
@@ -18,6 +18,18 @@ const (
MaxVmTy
MaxVmTy
)
)
func
NewVm
(
env
Environment
)
VirtualMachine
{
switch
env
.
VmType
()
{
case
JitVmTy
:
return
NewJitVm
(
env
)
default
:
vmlogger
.
Infoln
(
"unsupported vm type %d"
,
env
.
VmType
())
fallthrough
case
StdVmTy
:
return
New
(
env
)
}
}
var
(
var
(
GasStep
=
big
.
NewInt
(
1
)
GasStep
=
big
.
NewInt
(
1
)
GasSha
=
big
.
NewInt
(
10
)
GasSha
=
big
.
NewInt
(
10
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment