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
200f6653
Commit
200f6653
authored
Mar 2, 2015
by
Jeffrey Wilcke
Browse files
Options
Downloads
Patches
Plain Diff
updated tests
parent
0823254c
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/vm/gh_test.go
+25
-13
25 additions, 13 deletions
tests/vm/gh_test.go
vm/vm.go
+5
-5
5 additions, 5 deletions
vm/vm.go
with
30 additions
and
18 deletions
tests/vm/gh_test.go
+
25
−
13
View file @
200f6653
...
@@ -79,10 +79,12 @@ func RunVmTest(p string, t *testing.T) {
...
@@ -79,10 +79,12 @@ func RunVmTest(p string, t *testing.T) {
helper
.
CreateFileTests
(
t
,
p
,
&
tests
)
helper
.
CreateFileTests
(
t
,
p
,
&
tests
)
for
name
,
test
:=
range
tests
{
for
name
,
test
:=
range
tests
{
/*
helper.Logger.SetLogLevel(4)
helper.Logger.SetLogLevel(4)
if
name
!=
"
TransactionNonceCheck2
"
{
if name != "
log1_nonEmptyMem_logMemSize1_logMemStart31
" {
continue
continue
}
}
*/
db
,
_
:=
ethdb
.
NewMemDatabase
()
db
,
_
:=
ethdb
.
NewMemDatabase
()
statedb
:=
state
.
New
(
nil
,
db
)
statedb
:=
state
.
New
(
nil
,
db
)
for
addr
,
account
:=
range
test
.
Pre
{
for
addr
,
account
:=
range
test
.
Pre
{
...
@@ -159,6 +161,9 @@ func RunVmTest(p string, t *testing.T) {
...
@@ -159,6 +161,9 @@ func RunVmTest(p string, t *testing.T) {
}
}
if
len
(
test
.
Logs
)
>
0
{
if
len
(
test
.
Logs
)
>
0
{
if
len
(
test
.
Logs
)
!=
len
(
logs
)
{
t
.
Errorf
(
"log length mismatch. Expected %d, got %d"
,
len
(
test
.
Logs
),
len
(
logs
))
}
else
{
for
i
,
log
:=
range
test
.
Logs
{
for
i
,
log
:=
range
test
.
Logs
{
genBloom
:=
ethutil
.
LeftPadBytes
(
types
.
LogsBloom
(
state
.
Logs
{
logs
[
i
]})
.
Bytes
(),
64
)
genBloom
:=
ethutil
.
LeftPadBytes
(
types
.
LogsBloom
(
state
.
Logs
{
logs
[
i
]})
.
Bytes
(),
64
)
if
!
bytes
.
Equal
(
genBloom
,
ethutil
.
Hex2Bytes
(
log
.
BloomF
))
{
if
!
bytes
.
Equal
(
genBloom
,
ethutil
.
Hex2Bytes
(
log
.
BloomF
))
{
...
@@ -167,6 +172,7 @@ func RunVmTest(p string, t *testing.T) {
...
@@ -167,6 +172,7 @@ func RunVmTest(p string, t *testing.T) {
}
}
}
}
}
}
}
logger
.
Flush
()
logger
.
Flush
()
}
}
...
@@ -176,11 +182,6 @@ func TestVMArithmetic(t *testing.T) {
...
@@ -176,11 +182,6 @@ func TestVMArithmetic(t *testing.T) {
RunVmTest
(
fn
,
t
)
RunVmTest
(
fn
,
t
)
}
}
func
TestSystemOperations
(
t
*
testing
.
T
)
{
const
fn
=
"../files/VMTests/vmSystemOperationsTest.json"
RunVmTest
(
fn
,
t
)
}
func
TestBitwiseLogicOperation
(
t
*
testing
.
T
)
{
func
TestBitwiseLogicOperation
(
t
*
testing
.
T
)
{
const
fn
=
"../files/VMTests/vmBitwiseLogicOperationTest.json"
const
fn
=
"../files/VMTests/vmBitwiseLogicOperationTest.json"
RunVmTest
(
fn
,
t
)
RunVmTest
(
fn
,
t
)
...
@@ -201,6 +202,17 @@ func TestFlowOperation(t *testing.T) {
...
@@ -201,6 +202,17 @@ func TestFlowOperation(t *testing.T) {
RunVmTest
(
fn
,
t
)
RunVmTest
(
fn
,
t
)
}
}
func
TestLogTest
(
t
*
testing
.
T
)
{
const
fn
=
"../files/VMTests/vmLogTest.json"
RunVmTest
(
fn
,
t
)
}
func
TestPerformance
(
t
*
testing
.
T
)
{
t
.
Skip
()
const
fn
=
"../files/VMTests/vmPerformance.json"
RunVmTest
(
fn
,
t
)
}
func
TestPushDupSwap
(
t
*
testing
.
T
)
{
func
TestPushDupSwap
(
t
*
testing
.
T
)
{
const
fn
=
"../files/VMTests/vmPushDupSwapTest.json"
const
fn
=
"../files/VMTests/vmPushDupSwapTest.json"
RunVmTest
(
fn
,
t
)
RunVmTest
(
fn
,
t
)
...
...
This diff is collapsed.
Click to expand it.
vm/vm.go
+
5
−
5
View file @
200f6653
...
@@ -34,7 +34,7 @@ func New(env Environment) *Vm {
...
@@ -34,7 +34,7 @@ func New(env Environment) *Vm {
lt
=
LogTyDiff
lt
=
LogTyDiff
}
}
return
&
Vm
{
debug
:
fals
e
,
env
:
env
,
logTy
:
lt
,
Recoverable
:
true
}
return
&
Vm
{
debug
:
tru
e
,
env
:
env
,
logTy
:
lt
,
Recoverable
:
true
}
}
}
func
(
self
*
Vm
)
Run
(
me
,
caller
ContextRef
,
code
[]
byte
,
value
,
gas
,
price
*
big
.
Int
,
callData
[]
byte
)
(
ret
[]
byte
,
err
error
)
{
func
(
self
*
Vm
)
Run
(
me
,
caller
ContextRef
,
code
[]
byte
,
value
,
gas
,
price
*
big
.
Int
,
callData
[]
byte
)
(
ret
[]
byte
,
err
error
)
{
...
@@ -56,8 +56,6 @@ func (self *Vm) Run(me, caller ContextRef, code []byte, value, gas, price *big.I
...
@@ -56,8 +56,6 @@ func (self *Vm) Run(me, caller ContextRef, code []byte, value, gas, price *big.I
err
=
fmt
.
Errorf
(
"%v"
,
r
)
err
=
fmt
.
Errorf
(
"%v"
,
r
)
}
else
{
fmt
.
Println
(
me
.
(
*
state
.
StateObject
)
.
Storage
())
}
}
}()
}()
}
}
...
@@ -668,7 +666,6 @@ func (self *Vm) Run(me, caller ContextRef, code []byte, value, gas, price *big.I
...
@@ -668,7 +666,6 @@ func (self *Vm) Run(me, caller ContextRef, code []byte, value, gas, price *big.I
}
}
addr
=
ref
.
Address
()
addr
=
ref
.
Address
()
fmt
.
Printf
(
"CREATE %X
\n
"
,
addr
)
stack
.
Push
(
ethutil
.
BigD
(
addr
))
stack
.
Push
(
ethutil
.
BigD
(
addr
))
}
}
...
@@ -860,6 +857,8 @@ func (self *Vm) calculateGasAndSize(context *Context, caller ContextRef, op OpCo
...
@@ -860,6 +857,8 @@ func (self *Vm) calculateGasAndSize(context *Context, caller ContextRef, op OpCo
// Stack Check, memory resize & gas phase
// Stack Check, memory resize & gas phase
switch
op
{
switch
op
{
case
PUSH1
,
PUSH2
,
PUSH3
,
PUSH4
,
PUSH5
,
PUSH6
,
PUSH7
,
PUSH8
,
PUSH9
,
PUSH10
,
PUSH11
,
PUSH12
,
PUSH13
,
PUSH14
,
PUSH15
,
PUSH16
,
PUSH17
,
PUSH18
,
PUSH19
,
PUSH20
,
PUSH21
,
PUSH22
,
PUSH23
,
PUSH24
,
PUSH25
,
PUSH26
,
PUSH27
,
PUSH28
,
PUSH29
,
PUSH30
,
PUSH31
,
PUSH32
:
gas
.
Set
(
GasFastestStep
)
case
SWAP1
,
SWAP2
,
SWAP3
,
SWAP4
,
SWAP5
,
SWAP6
,
SWAP7
,
SWAP8
,
SWAP9
,
SWAP10
,
SWAP11
,
SWAP12
,
SWAP13
,
SWAP14
,
SWAP15
,
SWAP16
:
case
SWAP1
,
SWAP2
,
SWAP3
,
SWAP4
,
SWAP5
,
SWAP6
,
SWAP7
,
SWAP8
,
SWAP9
,
SWAP10
,
SWAP11
,
SWAP12
,
SWAP13
,
SWAP14
,
SWAP15
,
SWAP16
:
n
:=
int
(
op
-
SWAP1
+
2
)
n
:=
int
(
op
-
SWAP1
+
2
)
stack
.
require
(
n
)
stack
.
require
(
n
)
...
@@ -897,11 +896,12 @@ func (self *Vm) calculateGasAndSize(context *Context, caller ContextRef, op OpCo
...
@@ -897,11 +896,12 @@ func (self *Vm) calculateGasAndSize(context *Context, caller ContextRef, op OpCo
g
=
GasStorageMod
g
=
GasStorageMod
}
}
gas
.
Set
(
g
)
gas
.
Set
(
g
)
newMemSize
=
calcMemSize
(
stack
.
Peek
(),
u256
(
32
))
case
MLOAD
:
case
MLOAD
:
newMemSize
=
calcMemSize
(
stack
.
Peek
(),
u256
(
32
))
newMemSize
=
calcMemSize
(
stack
.
Peek
(),
u256
(
32
))
case
MSTORE8
:
case
MSTORE8
:
newMemSize
=
calcMemSize
(
stack
.
Peek
(),
u256
(
1
))
newMemSize
=
calcMemSize
(
stack
.
Peek
(),
u256
(
1
))
case
MSTORE
:
newMemSize
=
calcMemSize
(
stack
.
Peek
(),
u256
(
32
))
case
RETURN
:
case
RETURN
:
newMemSize
=
calcMemSize
(
stack
.
Peek
(),
stack
.
data
[
stack
.
Len
()
-
2
])
newMemSize
=
calcMemSize
(
stack
.
Peek
(),
stack
.
data
[
stack
.
Len
()
-
2
])
case
SHA3
:
case
SHA3
:
...
...
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