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
eab2201f
Commit
eab2201f
authored
Dec 06, 2017
by
Benoit Verkindt
Committed by
Felix Lange
Dec 06, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
eth: return rlp-decoded values from debug_storageRangeAt (#15476)
Fixes #15196
parent
e85b68ef
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
5 deletions
+12
-5
api.go
eth/api.go
+8
-4
api_test.go
eth/api_test.go
+4
-1
No files found.
eth/api.go
View file @
eab2201f
...
...
@@ -615,14 +615,18 @@ func (api *PrivateDebugAPI) StorageRangeAt(ctx context.Context, blockHash common
if
st
==
nil
{
return
StorageRangeResult
{},
fmt
.
Errorf
(
"account %x doesn't exist"
,
contractAddress
)
}
return
storageRangeAt
(
st
,
keyStart
,
maxResult
)
,
nil
return
storageRangeAt
(
st
,
keyStart
,
maxResult
)
}
func
storageRangeAt
(
st
state
.
Trie
,
start
[]
byte
,
maxResult
int
)
StorageRangeResult
{
func
storageRangeAt
(
st
state
.
Trie
,
start
[]
byte
,
maxResult
int
)
(
StorageRangeResult
,
error
)
{
it
:=
trie
.
NewIterator
(
st
.
NodeIterator
(
start
))
result
:=
StorageRangeResult
{
Storage
:
storageMap
{}}
for
i
:=
0
;
i
<
maxResult
&&
it
.
Next
();
i
++
{
e
:=
storageEntry
{
Value
:
common
.
BytesToHash
(
it
.
Value
)}
_
,
content
,
_
,
err
:=
rlp
.
Split
(
it
.
Value
)
if
err
!=
nil
{
return
StorageRangeResult
{},
err
}
e
:=
storageEntry
{
Value
:
common
.
BytesToHash
(
content
)}
if
preimage
:=
st
.
GetKey
(
it
.
Key
);
preimage
!=
nil
{
preimage
:=
common
.
BytesToHash
(
preimage
)
e
.
Key
=
&
preimage
...
...
@@ -634,7 +638,7 @@ func storageRangeAt(st state.Trie, start []byte, maxResult int) StorageRangeResu
next
:=
common
.
BytesToHash
(
it
.
Key
)
result
.
NextKey
=
&
next
}
return
result
return
result
,
nil
}
// GetModifiedAccountsByumber returns all accounts that have changed between the
...
...
eth/api_test.go
View file @
eab2201f
...
...
@@ -79,7 +79,10 @@ func TestStorageRangeAt(t *testing.T) {
},
}
for
_
,
test
:=
range
tests
{
result
:=
storageRangeAt
(
state
.
StorageTrie
(
addr
),
test
.
start
,
test
.
limit
)
result
,
err
:=
storageRangeAt
(
state
.
StorageTrie
(
addr
),
test
.
start
,
test
.
limit
)
if
err
!=
nil
{
t
.
Error
(
err
)
}
if
!
reflect
.
DeepEqual
(
result
,
test
.
want
)
{
t
.
Fatalf
(
"wrong result for range 0x%x.., limit %d:
\n
got %s
\n
want %s"
,
test
.
start
,
test
.
limit
,
dumper
.
Sdump
(
result
),
dumper
.
Sdump
(
&
test
.
want
))
...
...
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