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
f96876b4
Commit
f96876b4
authored
Apr 11, 2017
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
typo
parent
5335e9ab
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
storageResolver.js
src/storage/storageResolver.js
+10
-10
No files found.
src/storage/storageResolver.js
View file @
f96876b4
...
@@ -11,8 +11,8 @@ class StorageResolver {
...
@@ -11,8 +11,8 @@ class StorageResolver {
}
}
/**
/**
* return the storage for the given context (address and vm trace index)
* return
s
the storage for the given context (address and vm trace index)
* returns the range 0 => this.maxSize
* returns the range 0
x0
=> this.maxSize
*
*
* @param {Object} - tx - transaction
* @param {Object} - tx - transaction
* @param {Int} - stepIndex - Index of the stop in the vm trace
* @param {Int} - stepIndex - Index of the stop in the vm trace
...
@@ -31,11 +31,11 @@ class StorageResolver {
...
@@ -31,11 +31,11 @@ class StorageResolver {
* @param {Function} - callback - {key, hashedKey, value} -
* @param {Function} - callback - {key, hashedKey, value} -
*/
*/
storageSlot
(
slot
,
tx
,
stepIndex
,
callback
)
{
storageSlot
(
slot
,
tx
,
stepIndex
,
callback
)
{
storageRangeInternal
(
this
,
slot
,
tx
,
stepIndex
,
false
,
function
(
error
,
storage
)
{
var
hashed
=
helper
.
sha3_32
(
slot
)
storageRangeInternal
(
this
,
hashed
,
tx
,
stepIndex
,
false
,
function
(
error
,
storage
)
{
if
(
error
)
{
if
(
error
)
{
callback
(
error
)
callback
(
error
)
}
else
{
}
else
{
var
hashed
=
helper
.
sha3_32
(
slot
)
callback
(
null
,
storage
[
hashed
]
!==
undefined
?
storage
[
hashed
]
:
null
)
callback
(
null
,
storage
[
hashed
]
!==
undefined
?
storage
[
hashed
]
:
null
)
}
}
})
})
...
@@ -58,7 +58,7 @@ class StorageResolver {
...
@@ -58,7 +58,7 @@ class StorageResolver {
* even if the next 1000 items are not in the cache.
* even if the next 1000 items are not in the cache.
* - If @arg slot is not cached, the corresponding value will be resolved and the next 1000 slots.
* - If @arg slot is not cached, the corresponding value will be resolved and the next 1000 slots.
*/
*/
function
storageRangeInternal
(
self
,
slot
,
tx
,
stepIndex
,
fullStorage
,
callback
)
{
function
storageRangeInternal
(
self
,
slot
Key
,
tx
,
stepIndex
,
fullStorage
,
callback
)
{
resolveAddress
(
self
,
stepIndex
,
(
error
,
address
)
=>
{
resolveAddress
(
self
,
stepIndex
,
(
error
,
address
)
=>
{
if
(
error
)
{
if
(
error
)
{
return
callback
(
error
)
return
callback
(
error
)
...
@@ -67,19 +67,19 @@ function storageRangeInternal (self, slot, tx, stepIndex, fullStorage, callback)
...
@@ -67,19 +67,19 @@ function storageRangeInternal (self, slot, tx, stepIndex, fullStorage, callback)
if
(
error
)
{
if
(
error
)
{
return
callback
(
error
)
return
callback
(
error
)
}
}
if
(
!
fullStorage
&&
storageChanges
[
slot
])
{
if
(
!
fullStorage
&&
storageChanges
[
slot
Key
])
{
return
callback
(
null
,
storageChanges
)
return
callback
(
null
,
storageChanges
)
}
}
var
cached
=
fromCache
(
self
,
address
,
slot
)
var
cached
=
fromCache
(
self
,
address
,
slot
Key
)
if
(
cached
&&
cached
[
slot
])
{
// we have the current slot in the cache and maybe the next 1000 ...
if
(
cached
&&
cached
[
slot
Key
])
{
// we have the current slot in the cache and maybe the next 1000 ...
return
callback
(
null
,
Object
.
assign
(
cached
,
storageChanges
))
return
callback
(
null
,
Object
.
assign
(
cached
,
storageChanges
))
}
}
storageRangeWeb3Call
(
tx
,
address
,
slot
,
self
.
maxSize
,
(
error
,
storage
,
complete
)
=>
{
storageRangeWeb3Call
(
tx
,
address
,
slot
Key
,
self
.
maxSize
,
(
error
,
storage
,
complete
)
=>
{
if
(
error
)
{
if
(
error
)
{
return
callback
(
error
)
return
callback
(
error
)
}
}
toCache
(
self
,
address
,
storage
)
toCache
(
self
,
address
,
storage
)
if
(
slot
===
'0x0'
&&
Object
.
keys
(
storage
).
length
<
self
.
maxSize
)
{
if
(
slot
Key
===
'0x0'
&&
Object
.
keys
(
storage
).
length
<
self
.
maxSize
)
{
self
.
storageByAddress
[
address
].
complete
=
true
self
.
storageByAddress
[
address
].
complete
=
true
}
}
callback
(
null
,
Object
.
assign
(
storage
,
storageChanges
))
callback
(
null
,
Object
.
assign
(
storage
,
storageChanges
))
...
...
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