Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
ea44e8a4
Commit
ea44e8a4
authored
Apr 10, 2017
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
complete only i we are sure to have the full storage
parent
7557d0b9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
8 deletions
+9
-8
storageResolver.js
src/storage/storageResolver.js
+9
-8
No files found.
src/storage/storageResolver.js
View file @
ea44e8a4
...
...
@@ -17,7 +17,7 @@ class StorageResolver {
* @param {Function} - callback - contains a map: [hashedKey] = {key, hashedKey, value}
*/
storageRange
(
tx
,
stepIndex
,
callback
)
{
storageRangeInternal
(
this
,
'0x0'
,
1000
,
tx
,
stepIndex
,
callback
)
storageRangeInternal
(
this
,
'0x0'
,
true
,
tx
,
stepIndex
,
callback
)
}
/**
...
...
@@ -28,7 +28,7 @@ class StorageResolver {
* @param {Function} - callback - {key, hashedKey, value} -
*/
storageSlot
(
slot
,
tx
,
stepIndex
,
callback
)
{
storageRangeInternal
(
this
,
slot
,
100
,
tx
,
stepIndex
,
function
(
error
,
storage
)
{
storageRangeInternal
(
this
,
slot
,
false
,
tx
,
stepIndex
,
function
(
error
,
storage
)
{
if
(
error
)
{
callback
(
error
)
}
else
{
...
...
@@ -80,7 +80,8 @@ function resolveAddress (self, stepIndex, callback) {
})
}
function
storageRangeWeb3Call
(
tx
,
address
,
start
,
maxSize
,
callback
)
{
function
storageRangeWeb3Call
(
tx
,
address
,
start
,
fullStorage
,
callback
)
{
var
maxSize
=
fullStorage
?
1000
:
100
util
.
web3
.
debug
.
storageRangeAt
(
tx
.
blockHash
,
tx
.
transactionIndex
===
undefined
?
tx
.
hash
:
tx
.
transactionIndex
,
address
,
...
...
@@ -97,7 +98,7 @@ function storageRangeWeb3Call (tx, address, start, maxSize, callback) {
})
}
function
storageRangeInternal
(
self
,
start
,
maxSiz
e
,
tx
,
stepIndex
,
callback
)
{
function
storageRangeInternal
(
self
,
start
,
fullStorag
e
,
tx
,
stepIndex
,
callback
)
{
resolveAddress
(
self
,
stepIndex
,
(
error
,
address
)
=>
{
if
(
error
)
{
callback
(
error
)
...
...
@@ -112,11 +113,11 @@ function storageRangeInternal (self, start, maxSize, tx, stepIndex, callback) {
var
cached
=
fromCache
(
self
,
address
)
self
.
accumulateStorageChanges
(
stepIndex
,
address
,
cached
,
callback
)
}
else
{
storageRangeWeb3Call
(
tx
,
address
,
start
,
maxSiz
e
,
(
error
,
storage
,
complete
)
=>
{
storageRangeWeb3Call
(
tx
,
address
,
start
,
fullStorag
e
,
(
error
,
storage
,
complete
)
=>
{
if
(
error
)
{
callback
(
error
)
}
else
{
toCache
(
self
,
address
,
storage
,
complete
)
toCache
(
self
,
address
,
storage
,
fullStorage
,
complete
)
self
.
accumulateStorageChanges
(
stepIndex
,
address
,
storage
,
callback
)
}
})
...
...
@@ -148,12 +149,12 @@ function fromCache (self, address, hashedKey) {
* @param {Object} storage - result of `storageRangeAtInternal`, contains {key, hashedKey, value}
* @param {Bool} complete - True if the storage is complete
*/
function
toCache
(
self
,
address
,
storage
,
complete
)
{
function
toCache
(
self
,
address
,
storage
,
fullStorageRequest
,
complete
)
{
if
(
!
self
.
storageByAddress
[
address
])
{
self
.
storageByAddress
[
address
]
=
{}
}
self
.
storageByAddress
[
address
].
storage
=
Object
.
assign
(
self
.
storageByAddress
[
address
].
storage
||
{},
storage
)
if
(
complete
!==
undefined
)
{
if
(
Object
.
keys
(
storage
).
length
<
1000
&&
fullStorageRequest
&&
complete
)
{
self
.
storageByAddress
[
address
].
complete
=
complete
}
}
...
...
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