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
b08abe64
Commit
b08abe64
authored
Jul 07, 2015
by
Gustav Simonsson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Unskip SimpleTx3, check err in pre/post state validations
parent
0b53a5c6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
14 deletions
+33
-14
block_test_util.go
tests/block_test_util.go
+32
-8
init.go
tests/init.go
+1
-6
No files found.
tests/block_test_util.go
View file @
b08abe64
...
@@ -208,10 +208,22 @@ func (t *BlockTest) InsertPreState(ethereum *eth.Ethereum) (*state.StateDB, erro
...
@@ -208,10 +208,22 @@ func (t *BlockTest) InsertPreState(ethereum *eth.Ethereum) (*state.StateDB, erro
db
:=
ethereum
.
StateDb
()
db
:=
ethereum
.
StateDb
()
statedb
:=
state
.
New
(
common
.
Hash
{},
db
)
statedb
:=
state
.
New
(
common
.
Hash
{},
db
)
for
addrString
,
acct
:=
range
t
.
preAccounts
{
for
addrString
,
acct
:=
range
t
.
preAccounts
{
addr
,
_
:=
hex
.
DecodeString
(
addrString
)
addr
,
err
:=
hex
.
DecodeString
(
addrString
)
code
,
_
:=
hex
.
DecodeString
(
strings
.
TrimPrefix
(
acct
.
Code
,
"0x"
))
if
err
!=
nil
{
balance
,
_
:=
new
(
big
.
Int
)
.
SetString
(
acct
.
Balance
,
0
)
return
nil
,
err
nonce
,
_
:=
strconv
.
ParseUint
(
acct
.
Nonce
,
16
,
64
)
}
code
,
err
:=
hex
.
DecodeString
(
strings
.
TrimPrefix
(
acct
.
Code
,
"0x"
))
if
err
!=
nil
{
return
nil
,
err
}
balance
,
ok
:=
new
(
big
.
Int
)
.
SetString
(
acct
.
Balance
,
0
)
if
!
ok
{
return
nil
,
err
}
nonce
,
err
:=
strconv
.
ParseUint
(
prepInt
(
16
,
acct
.
Nonce
),
16
,
64
)
if
err
!=
nil
{
return
nil
,
err
}
if
acct
.
PrivateKey
!=
""
{
if
acct
.
PrivateKey
!=
""
{
privkey
,
err
:=
hex
.
DecodeString
(
strings
.
TrimPrefix
(
acct
.
PrivateKey
,
"0x"
))
privkey
,
err
:=
hex
.
DecodeString
(
strings
.
TrimPrefix
(
acct
.
PrivateKey
,
"0x"
))
...
@@ -365,10 +377,22 @@ func (s *BlockTest) validateBlockHeader(h *btHeader, h2 *types.Header) error {
...
@@ -365,10 +377,22 @@ func (s *BlockTest) validateBlockHeader(h *btHeader, h2 *types.Header) error {
func
(
t
*
BlockTest
)
ValidatePostState
(
statedb
*
state
.
StateDB
)
error
{
func
(
t
*
BlockTest
)
ValidatePostState
(
statedb
*
state
.
StateDB
)
error
{
for
addrString
,
acct
:=
range
t
.
preAccounts
{
for
addrString
,
acct
:=
range
t
.
preAccounts
{
// XXX: is is worth it checking for errors here?
// XXX: is is worth it checking for errors here?
addr
,
_
:=
hex
.
DecodeString
(
addrString
)
addr
,
err
:=
hex
.
DecodeString
(
addrString
)
code
,
_
:=
hex
.
DecodeString
(
strings
.
TrimPrefix
(
acct
.
Code
,
"0x"
))
if
err
!=
nil
{
balance
,
_
:=
new
(
big
.
Int
)
.
SetString
(
acct
.
Balance
,
0
)
return
err
nonce
,
_
:=
strconv
.
ParseUint
(
acct
.
Nonce
,
16
,
64
)
}
code
,
err
:=
hex
.
DecodeString
(
strings
.
TrimPrefix
(
acct
.
Code
,
"0x"
))
if
err
!=
nil
{
return
err
}
balance
,
ok
:=
new
(
big
.
Int
)
.
SetString
(
acct
.
Balance
,
0
)
if
!
ok
{
return
err
}
nonce
,
err
:=
strconv
.
ParseUint
(
prepInt
(
16
,
acct
.
Nonce
),
16
,
64
)
if
err
!=
nil
{
return
err
}
// address is indirectly verified by the other fields, as it's the db key
// address is indirectly verified by the other fields, as it's the db key
code2
:=
statedb
.
GetCode
(
common
.
BytesToAddress
(
addr
))
code2
:=
statedb
.
GetCode
(
common
.
BytesToAddress
(
addr
))
...
...
tests/init.go
View file @
b08abe64
...
@@ -37,11 +37,6 @@ var (
...
@@ -37,11 +37,6 @@ var (
vmTestDir
=
filepath
.
Join
(
baseDir
,
"VMTests"
)
vmTestDir
=
filepath
.
Join
(
baseDir
,
"VMTests"
)
BlockSkipTests
=
[]
string
{
BlockSkipTests
=
[]
string
{
// Fails in InsertPreState with: computed state root does not
// match genesis block bba25a96 0d8f85c8 Christoph said it will be
// fixed eventually
"SimpleTx3"
,
// These tests are not valid, as they are out of scope for RLP and
// These tests are not valid, as they are out of scope for RLP and
// the consensus protocol.
// the consensus protocol.
"BLOCK__RandomByteAtTheEnd"
,
"BLOCK__RandomByteAtTheEnd"
,
...
@@ -50,7 +45,7 @@ var (
...
@@ -50,7 +45,7 @@ var (
"TRANSCT__ZeroByteAtTheEnd"
,
"TRANSCT__ZeroByteAtTheEnd"
,
}
}
/* Go does not support transaction (account) nonces above 2^64. This
/* Go
client
does not support transaction (account) nonces above 2^64. This
technically breaks consensus but is regarded as "reasonable
technically breaks consensus but is regarded as "reasonable
engineering constraint" as accounts cannot easily reach such high
engineering constraint" as accounts cannot easily reach such high
nonce values in practice
nonce values in practice
...
...
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