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
bbb57fd6
Unverified
Commit
bbb57fd6
authored
Apr 30, 2021
by
aaronbuchwald
Committed by
GitHub
Apr 30, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core/state: remove toAddr helper in tests (#22772)
parent
f66f1a16
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
11 deletions
+9
-11
state_test.go
core/state/state_test.go
+6
-8
statedb_test.go
core/state/statedb_test.go
+3
-3
No files found.
core/state/state_test.go
View file @
bbb57fd6
...
...
@@ -27,8 +27,6 @@ import (
"github.com/ethereum/go-ethereum/ethdb"
)
var
toAddr
=
common
.
BytesToAddress
type
stateTest
struct
{
db
ethdb
.
Database
state
*
StateDB
...
...
@@ -46,11 +44,11 @@ func TestDump(t *testing.T) {
s
:=
&
stateTest
{
db
:
db
,
state
:
sdb
}
// generate a few entries
obj1
:=
s
.
state
.
GetOrNewStateObject
(
toAddr
([]
byte
{
0x01
}))
obj1
:=
s
.
state
.
GetOrNewStateObject
(
common
.
BytesToAddress
([]
byte
{
0x01
}))
obj1
.
AddBalance
(
big
.
NewInt
(
22
))
obj2
:=
s
.
state
.
GetOrNewStateObject
(
toAddr
([]
byte
{
0x01
,
0x02
}))
obj2
:=
s
.
state
.
GetOrNewStateObject
(
common
.
BytesToAddress
([]
byte
{
0x01
,
0x02
}))
obj2
.
SetCode
(
crypto
.
Keccak256Hash
([]
byte
{
3
,
3
,
3
,
3
,
3
,
3
,
3
}),
[]
byte
{
3
,
3
,
3
,
3
,
3
,
3
,
3
})
obj3
:=
s
.
state
.
GetOrNewStateObject
(
toAddr
([]
byte
{
0x02
}))
obj3
:=
s
.
state
.
GetOrNewStateObject
(
common
.
BytesToAddress
([]
byte
{
0x02
}))
obj3
.
SetBalance
(
big
.
NewInt
(
44
))
// write some of them to the trie
...
...
@@ -108,7 +106,7 @@ func TestNull(t *testing.T) {
}
func
TestSnapshot
(
t
*
testing
.
T
)
{
stateobjaddr
:=
toAddr
([]
byte
(
"aa"
))
stateobjaddr
:=
common
.
BytesToAddress
([]
byte
(
"aa"
))
var
storageaddr
common
.
Hash
data1
:=
common
.
BytesToHash
([]
byte
{
42
})
data2
:=
common
.
BytesToHash
([]
byte
{
43
})
...
...
@@ -150,8 +148,8 @@ func TestSnapshotEmpty(t *testing.T) {
func
TestSnapshot2
(
t
*
testing
.
T
)
{
state
,
_
:=
New
(
common
.
Hash
{},
NewDatabase
(
rawdb
.
NewMemoryDatabase
()),
nil
)
stateobjaddr0
:=
toAddr
([]
byte
(
"so0"
))
stateobjaddr1
:=
toAddr
([]
byte
(
"so1"
))
stateobjaddr0
:=
common
.
BytesToAddress
([]
byte
(
"so0"
))
stateobjaddr1
:=
common
.
BytesToAddress
([]
byte
(
"so1"
))
var
storageaddr
common
.
Hash
data0
:=
common
.
BytesToHash
([]
byte
{
17
})
...
...
core/state/statedb_test.go
View file @
bbb57fd6
...
...
@@ -672,7 +672,7 @@ func TestDeleteCreateRevert(t *testing.T) {
// Create an initial state with a single contract
state
,
_
:=
New
(
common
.
Hash
{},
NewDatabase
(
rawdb
.
NewMemoryDatabase
()),
nil
)
addr
:=
toAddr
([]
byte
(
"so"
))
addr
:=
common
.
BytesToAddress
([]
byte
(
"so"
))
state
.
SetBalance
(
addr
,
big
.
NewInt
(
1
))
root
,
_
:=
state
.
Commit
(
false
)
...
...
@@ -705,11 +705,11 @@ func TestMissingTrieNodes(t *testing.T) {
db
:=
NewDatabase
(
memDb
)
var
root
common
.
Hash
state
,
_
:=
New
(
common
.
Hash
{},
db
,
nil
)
addr
:=
toAddr
([]
byte
(
"so"
))
addr
:=
common
.
BytesToAddress
([]
byte
(
"so"
))
{
state
.
SetBalance
(
addr
,
big
.
NewInt
(
1
))
state
.
SetCode
(
addr
,
[]
byte
{
1
,
2
,
3
})
a2
:=
toAddr
([]
byte
(
"another"
))
a2
:=
common
.
BytesToAddress
([]
byte
(
"another"
))
state
.
SetBalance
(
a2
,
big
.
NewInt
(
100
))
state
.
SetCode
(
a2
,
[]
byte
{
1
,
2
,
4
})
root
,
_
=
state
.
Commit
(
false
)
...
...
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