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
3069e36c
Commit
3069e36c
authored
Apr 21, 2017
by
yann300
Committed by
GitHub
Apr 21, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #489 from ethereum/fixStorage
Fix storage
parents
5ef4a06f
ed9a95df
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
13 additions
and
13 deletions
+13
-13
util.js
src/helpers/util.js
+3
-0
storageResolver.js
src/storage/storageResolver.js
+5
-5
storageViewer.js
src/storage/storageViewer.js
+1
-1
traceCache.js
src/trace/traceCache.js
+0
-1
web3VmProvider.js
src/web3Provider/web3VmProvider.js
+2
-2
vmdebugger.js
test-browser/vmdebugger.js
+2
-4
No files found.
src/helpers/util.js
View file @
3069e36c
...
...
@@ -133,6 +133,9 @@ module.exports = {
* @return {Object} - return sha3ied value
*/
sha3_256
:
function
(
value
)
{
if
(
typeof
value
===
'string'
&&
value
.
indexOf
(
'0x'
)
!==
0
)
{
value
=
'0x'
+
value
}
var
ret
=
ethutil
.
bufferToHex
(
ethutil
.
setLengthLeft
(
value
,
32
))
ret
=
ethutil
.
sha3
(
ret
)
return
ethutil
.
bufferToHex
(
ret
)
...
...
src/storage/storageResolver.js
View file @
3069e36c
...
...
@@ -62,18 +62,18 @@ function storageRangeInternal (self, slotKey, tx, stepIndex, address, callback)
if
(
cached
&&
cached
.
storage
[
slotKey
])
{
// we have the current slot in the cache and maybe the next 1000...
return
callback
(
null
,
cached
.
storage
)
}
storageRangeWeb3Call
(
tx
,
address
,
slotKey
,
self
.
maxSize
,
(
error
,
storage
,
complete
)
=>
{
storageRangeWeb3Call
(
tx
,
address
,
slotKey
,
self
.
maxSize
,
(
error
,
storage
,
nextKey
)
=>
{
if
(
error
)
{
return
callback
(
error
)
}
if
(
!
storage
[
slotKey
]
)
{
if
(
!
storage
[
slotKey
]
&&
slotKey
!==
zeroSlot
)
{
// we don't cache the zero slot (could lead to inconsistency)
storage
[
slotKey
]
=
{
key
:
slotKey
,
value
:
zeroSlot
}
}
toCache
(
self
,
address
,
storage
)
if
(
slotKey
===
zeroSlot
&&
Object
.
keys
(
storage
).
length
<
self
.
maxSize
)
{
// only working if keys are sorted !!
if
(
slotKey
===
zeroSlot
&&
!
nextKey
)
{
// only working if keys are sorted !!
self
.
storageByAddress
[
address
].
complete
=
true
}
callback
(
null
,
storage
)
...
...
@@ -110,7 +110,7 @@ function toCache (self, address, storage) {
function
storageRangeWeb3Call
(
tx
,
address
,
start
,
maxSize
,
callback
)
{
if
(
traceHelper
.
isContractCreation
(
address
))
{
callback
(
null
,
{},
true
)
callback
(
null
,
{},
null
)
}
else
{
util
.
web3
.
debug
.
storageRangeAt
(
tx
.
blockHash
,
tx
.
transactionIndex
===
undefined
?
tx
.
hash
:
tx
.
transactionIndex
,
...
...
@@ -121,7 +121,7 @@ function storageRangeWeb3Call (tx, address, start, maxSize, callback) {
if
(
error
)
{
callback
(
error
)
}
else
if
(
result
.
storage
)
{
callback
(
null
,
result
.
storage
,
result
.
complete
)
callback
(
null
,
result
.
storage
,
result
.
nextKey
)
}
else
{
callback
(
'the storage has not been provided'
)
}
...
...
src/storage/storageViewer.js
View file @
3069e36c
...
...
@@ -44,7 +44,7 @@ class StorageViewer {
if
(
error
)
{
callback
(
error
)
}
else
{
callback
(
null
,
storage
[
hashed
]
!==
undefined
?
storage
[
hashed
]
:
null
)
callback
(
null
,
storage
)
}
})
}
...
...
src/trace/traceCache.js
View file @
3069e36c
...
...
@@ -102,7 +102,6 @@ TraceCache.prototype.accumulateStorageChanges = function (index, address, storag
var
sstore
=
this
.
sstore
[
changesIndex
]
if
(
sstore
.
address
===
address
&&
sstore
.
key
)
{
ret
[
sstore
.
hashedKey
]
=
{
hashedKey
:
sstore
.
hashedKey
,
key
:
sstore
.
key
,
value
:
sstore
.
value
}
...
...
src/web3Provider/web3VmProvider.js
View file @
3069e36c
...
...
@@ -158,8 +158,8 @@ web3VmProvider.prototype.storageRangeAt = function (blockNumber, txIndex, addres
if
(
this
.
storageCache
[
txIndex
]
&&
this
.
storageCache
[
txIndex
][
address
])
{
var
storage
=
this
.
storageCache
[
txIndex
][
address
]
return
cb
(
null
,
{
storage
:
JSON
.
parse
(
JSON
.
stringify
(
storage
)),
// copy
complete
:
true
storage
:
JSON
.
parse
(
JSON
.
stringify
(
storage
)),
nextKey
:
null
})
}
else
{
cb
(
'unable to retrieve storage '
+
txIndex
+
' '
+
address
)
...
...
test-browser/vmdebugger.js
View file @
3069e36c
...
...
@@ -64,9 +64,7 @@ function panels (browser) {
.
click
(
'#load'
)
.
multipleClick
(
'#intoforward'
,
63
)
.
assertStack
([
'0:0x'
,
'1:0x60'
,
'2:0x65'
,
'3:0x38'
,
'4:0x55'
,
'5:0x60fe47b1'
])
.
assertStorageChanges
([
'0x0000000000000000000000000000000000000000000000000000000000000000:Objectkey:0x0000000000000000000000000000000000000000000000000000000000000000value:0x0000000000000000000000000000000000000000000000000000000000000000'
,
'0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563:ObjecthashedKey:0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563key:0x00value:0x38'
])
.
assertStorageChanges
([
'0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563:Objectkey:0x00value:0x38'
])
.
assertCallData
([
'0:0x60fe47b10000000000000000000000000000000000000000000000000000000000000038'
])
.
assertCallStack
([
'0:0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5'
])
.
assertStackValue
(
1
,
'1:0x60'
)
...
...
@@ -75,7 +73,7 @@ function panels (browser) {
.
assertMemoryValue
(
8
,
'0x80:5b806001016000600050819055505b50?????????P??UP?P'
)
.
click
(
'#intoforward'
)
// CREATE
.
assertStack
([
''
])
.
assertStorageChanges
([
'0x0000000000000000000000000000000000000000000000000000000000000000:Objectkey:0x0000000000000000000000000000000000000000000000000000000000000000value:0x0000000000000000000000000000000000000000000000000000000000000000'
])
.
assertStorageChanges
([])
.
assertMemory
([
''
])
.
assertCallData
([
'0:0x0000000000000000000000000000000000000000000000000000000000000000000000000000006060606040526040516020806045833981016040528080519060200190919050505b806001016000600050819055'
])
.
assertCallStack
([
'0:0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5'
,
'1:(ContractCreation-Step63)'
])
...
...
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