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
aaddc99c
Commit
aaddc99c
authored
Jun 17, 2015
by
Jeffrey Wilcke
Browse files
Options
Downloads
Patches
Plain Diff
core/state: fixed state tests
parent
a977f3c0
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/state/state_test.go
+10
-13
10 additions, 13 deletions
core/state/state_test.go
with
10 additions
and
13 deletions
core/state/state_test.go
+
10
−
13
View file @
aaddc99c
...
@@ -70,37 +70,34 @@ func TestNull(t *testing.T) {
...
@@ -70,37 +70,34 @@ func TestNull(t *testing.T) {
address
:=
common
.
HexToAddress
(
"0x823140710bf13990e4500136726d8b55"
)
address
:=
common
.
HexToAddress
(
"0x823140710bf13990e4500136726d8b55"
)
state
.
CreateAccount
(
address
)
state
.
CreateAccount
(
address
)
//value := common.FromHex("0x823140710bf13990e4500136726d8b55")
//value := common.FromHex("0x823140710bf13990e4500136726d8b55")
va
lue
:=
make
([]
byte
,
16
)
va
r
value
common
.
Hash
state
.
SetState
(
address
,
common
.
Hash
{},
value
)
state
.
SetState
(
address
,
common
.
Hash
{},
value
)
state
.
Update
()
state
.
Update
()
state
.
Sync
()
state
.
Sync
()
value
=
state
.
GetState
(
address
,
common
.
Hash
{})
value
=
state
.
GetState
(
address
,
common
.
Hash
{})
if
!
common
.
EmptyHash
(
value
)
{
t
.
Errorf
(
"expected empty hash. got %x"
,
value
)
}
}
}
func
(
s
*
StateSuite
)
TestSnapshot
(
c
*
checker
.
C
)
{
func
(
s
*
StateSuite
)
TestSnapshot
(
c
*
checker
.
C
)
{
stateobjaddr
:=
toAddr
([]
byte
(
"aa"
))
stateobjaddr
:=
toAddr
([]
byte
(
"aa"
))
storageaddr
:=
common
.
Big
(
"0"
)
var
storageaddr
common
.
Hash
data1
:=
common
.
NewValue
(
42
)
data1
:=
common
.
BytesToHash
([]
byte
{
42
}
)
data2
:=
common
.
NewValue
(
43
)
data2
:=
common
.
BytesToHash
([]
byte
{
43
}
)
// get state object
stateObject
:=
s
.
state
.
GetOrNewStateObject
(
stateobjaddr
)
// set inital state object value
// set inital state object value
state
Object
.
SetStorage
(
storageaddr
,
data1
)
s
.
state
.
SetState
(
stateobjaddr
,
storageaddr
,
data1
)
// get snapshot of current state
// get snapshot of current state
snapshot
:=
s
.
state
.
Copy
()
snapshot
:=
s
.
state
.
Copy
()
// get state object. is this strictly necessary?
stateObject
=
s
.
state
.
GetStateObject
(
stateobjaddr
)
// set new state object value
// set new state object value
state
Object
.
SetStorage
(
storageaddr
,
data2
)
s
.
state
.
SetState
(
stateobjaddr
,
storageaddr
,
data2
)
// restore snapshot
// restore snapshot
s
.
state
.
Set
(
snapshot
)
s
.
state
.
Set
(
snapshot
)
// get state object
stateObject
=
s
.
state
.
GetStateObject
(
stateobjaddr
)
// get state storage value
// get state storage value
res
:=
state
Object
.
GetStorage
(
storageaddr
)
res
:=
s
.
state
.
GetState
(
stateobjaddr
,
storageaddr
)
c
.
Assert
(
data1
,
checker
.
DeepEquals
,
res
)
c
.
Assert
(
data1
,
checker
.
DeepEquals
,
res
)
}
}
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