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
b2760e67
Commit
b2760e67
authored
Dec 08, 2016
by
chriseth
Committed by
GitHub
Dec 08, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #158 from ethereum/storageRangeat
add storageRangeAt
parents
703c8579
3c0742c6
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
35 additions
and
19 deletions
+35
-19
traceRetriever.js
src/trace/traceRetriever.js
+11
-3
FullStoragesChanges.js
src/ui/FullStoragesChanges.js
+1
-1
web3Admin.js
src/util/web3Admin.js
+8
-5
dummyProvider.js
src/web3Provider/dummyProvider.js
+2
-2
web3VmProvider.js
src/web3Provider/web3VmProvider.js
+7
-3
vmdebugger.js
test-browser/vmdebugger.js
+1
-0
init.js
test/init.js
+1
-1
insertTestWeb3.js
test/resources/insertTestWeb3.js
+2
-2
testWeb3.js
test/resources/testWeb3.js
+2
-2
No files found.
src/trace/traceRetriever.js
View file @
b2760e67
...
...
@@ -21,9 +21,17 @@ TraceRetriever.prototype.getStorage = function (tx, address, callback) {
if
(
traceHelper
.
isContractCreation
(
address
))
{
callback
(
null
,
{})
}
else
{
util
.
web3
.
debug
.
storageAt
(
null
,
tx
.
hash
,
address
,
function
(
error
,
result
)
{
callback
(
error
,
result
)
})
if
(
util
.
web3
.
debug
.
storageRangeAt
)
{
var
end
=
'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff'
var
maxSize
=
10000
// The VM gives only a tx hash
// TODO: get rid of that and use the range parameters
util
.
web3
.
debug
.
storageRangeAt
(
tx
.
blockHash
,
tx
.
transactionIndex
===
undefined
?
tx
.
hash
:
tx
.
transactionIndex
,
address
,
'0x0'
,
'0x'
+
end
,
maxSize
,
function
(
error
,
result
)
{
callback
(
error
,
result
.
storage
)
})
}
else
{
callback
(
'no storageRangeAt endpoint found'
)
}
}
}
...
...
src/ui/FullStoragesChanges.js
View file @
b2760e67
...
...
@@ -45,7 +45,7 @@ FullStoragesChanges.prototype.init = function () {
if
(
index
===
self
.
traceLength
-
1
)
{
var
storageJSON
=
{}
for
(
var
k
in
self
.
addresses
)
{
self
.
traceManager
.
getStorageAt
(
index
,
null
,
function
(
error
,
result
)
{
self
.
traceManager
.
getStorageAt
(
index
,
this
.
parent
.
tx
,
function
(
error
,
result
)
{
if
(
!
error
)
{
storageJSON
[
self
.
addresses
[
k
]]
=
result
self
.
basicPanel
.
update
(
storageJSON
)
...
...
src/util/web3Admin.js
View file @
b2760e67
'use strict'
module
.
exports
=
{
extend
:
function
(
web3
)
{
if
(
!
web3
.
_extend
)
{
return
}
// DEBUG
var
methods
=
[]
if
(
!
(
web3
.
debug
&&
web3
.
debug
.
traceTransaction
))
{
...
...
@@ -12,12 +15,12 @@ module.exports = {
}))
}
if
(
!
(
web3
.
debug
&&
web3
.
debug
.
storageAt
))
{
if
(
!
(
web3
.
debug
&&
web3
.
debug
.
storage
Range
At
))
{
methods
.
push
(
new
web3
.
_extend
.
Method
({
name
:
'storageAt'
,
call
:
'debug_storageAt'
,
inputFormatter
:
[
null
,
null
,
null
],
params
:
3
name
:
'storage
Range
At'
,
call
:
'debug_storage
Range
At'
,
inputFormatter
:
[
null
,
null
,
null
,
null
,
null
,
null
],
params
:
6
}))
}
if
(
methods
.
length
>
0
)
{
...
...
src/web3Provider/dummyProvider.js
View file @
b2760e67
...
...
@@ -7,7 +7,7 @@ function dummyProvider () {
this
.
eth
.
getTransactionFromBlock
=
function
(
blockNumber
,
txIndex
,
cb
)
{
return
self
.
getTransactionFromBlock
(
blockNumber
,
txIndex
,
cb
)
}
this
.
eth
.
getBlockNumber
=
function
(
cb
)
{
return
self
.
getBlockNumber
(
cb
)
}
this
.
debug
.
traceTransaction
=
function
(
hash
,
options
,
cb
)
{
return
self
.
traceTransaction
(
hash
,
options
,
cb
)
}
this
.
debug
.
storage
At
=
function
(
blockNumber
,
txIndex
,
address
,
cb
)
{
return
self
.
storageAt
(
blockNumber
,
txIndex
,
address
,
cb
)
}
this
.
debug
.
storage
RangeAt
=
function
(
blockNumber
,
txIndex
,
address
,
start
,
end
,
maxLength
,
cb
)
{
return
self
.
storageRangeAt
(
blockNumber
,
txIndex
,
address
,
start
,
end
,
maxLength
,
cb
)
}
this
.
providers
=
{
'HttpProvider'
:
function
(
url
)
{}
}
this
.
currentProvider
=
{
'host'
:
''
}
}
...
...
@@ -25,7 +25,7 @@ dummyProvider.prototype.traceTransaction = function (txHash, options, cb) {
return
{}
}
dummyProvider
.
prototype
.
storage
At
=
function
(
blockNumber
,
txIndex
,
address
,
cb
)
{
cb
(
null
,
{})
}
dummyProvider
.
prototype
.
storage
RangeAt
=
function
(
blockNumber
,
txIndex
,
address
,
start
,
end
,
maxLength
,
cb
)
{
cb
(
null
,
{})
}
dummyProvider
.
prototype
.
getBlockNumber
=
function
(
cb
)
{
cb
(
null
,
''
)
}
...
...
src/web3Provider/web3VmProvider.js
View file @
b2760e67
...
...
@@ -17,7 +17,7 @@ function web3VmProvider () {
this
.
eth
.
getTransactionFromBlock
=
function
(
blockNumber
,
txIndex
,
cb
)
{
return
self
.
getTransactionFromBlock
(
blockNumber
,
txIndex
,
cb
)
}
this
.
eth
.
getBlockNumber
=
function
(
cb
)
{
return
self
.
getBlockNumber
(
cb
)
}
this
.
debug
.
traceTransaction
=
function
(
hash
,
options
,
cb
)
{
return
self
.
traceTransaction
(
hash
,
options
,
cb
)
}
this
.
debug
.
storage
At
=
function
(
blockNumber
,
txIndex
,
address
,
cb
)
{
return
self
.
storageAt
(
blockNumber
,
txIndex
,
address
,
cb
)
}
this
.
debug
.
storage
RangeAt
=
function
(
blockNumber
,
txIndex
,
address
,
start
,
end
,
maxLength
,
cb
)
{
return
self
.
storageRangeAt
(
blockNumber
,
txIndex
,
address
,
start
,
end
,
maxLength
,
cb
)
}
this
.
providers
=
{
'HttpProvider'
:
function
(
url
)
{}
}
this
.
currentProvider
=
{
'host'
:
'vm provider'
}
this
.
storageCache
=
{}
...
...
@@ -127,10 +127,14 @@ web3VmProvider.prototype.traceTransaction = function (txHash, options, cb) {
}
}
web3VmProvider
.
prototype
.
storageAt
=
function
(
blockNumber
,
txIndex
,
address
,
cb
)
{
// txIndex is the hash in the case of the VM
web3VmProvider
.
prototype
.
storageRangeAt
=
function
(
blockNumber
,
txIndex
,
address
,
start
,
end
,
maxLength
,
cb
)
{
// txIndex is the hash in the case of the VM
// we don't use the range params here
if
(
this
.
storageCache
[
txIndex
]
&&
this
.
storageCache
[
txIndex
][
address
])
{
var
storage
=
this
.
storageCache
[
txIndex
][
address
]
return
cb
(
null
,
JSON
.
parse
(
JSON
.
stringify
(
storage
)))
// copy creation...
return
cb
(
null
,
{
storage
:
JSON
.
parse
(
JSON
.
stringify
(
storage
)),
// copy
complete
:
true
})
}
else
{
cb
(
'unable to retrieve storage '
+
txIndex
+
' '
+
address
)
}
...
...
test-browser/vmdebugger.js
View file @
b2760e67
...
...
@@ -64,6 +64,7 @@ function panels (browser) {
.
click
(
'#load'
)
.
click
(
'#nextcall'
)
.
assertStack
([
'0x'
,
'0x60'
,
'0x65'
,
'0x38'
,
'0x55'
,
'0x60fe47b1'
])
.
pause
(
5000
)
.
assertStorageChanges
([
'0x000x38'
])
.
assertCallData
([
'0x60fe47b10000000000000000000000000000000000000000000000000000000000000038'
])
.
assertCallStack
([
'0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5'
])
...
...
test/init.js
View file @
b2760e67
...
...
@@ -2,7 +2,7 @@ var init = {
overrideWeb3
:
function
(
web3
,
web3Override
)
{
web3
.
eth
.
getCode
=
web3Override
.
getCode
web3
.
debug
.
traceTransaction
=
web3Override
.
traceTransaction
web3
.
debug
.
storage
At
=
web3Override
.
stora
geAt
web3
.
debug
.
storage
RangeAt
=
web3Override
.
storageRan
geAt
web3
.
eth
.
getTransaction
=
web3Override
.
getTransaction
web3
.
eth
.
getTransactionFromBlock
=
web3Override
.
getTransactionFromBlock
web3
.
eth
.
getBlockNumber
=
web3Override
.
getBlockNumber
...
...
test/resources/insertTestWeb3.js
View file @
b2760e67
...
...
@@ -28,8 +28,8 @@ function loadTestWeb3 (data) {
callback
(
null
,
data
.
testTraces
[
txHash
])
}
uiTestweb3
.
debug
.
storage
At
=
function
(
blockNumber
,
txIndex
,
address
,
callback
)
{
callback
(
null
,
{})
uiTestweb3
.
debug
.
storage
RangeAt
=
function
(
blockNumber
,
txIndex
,
address
,
start
,
end
,
size
,
callback
)
{
callback
(
null
,
{
storage
:
{},
complete
:
true
})
}
uiTestweb3
.
eth
.
getTransaction
=
function
(
txHash
,
callback
)
{
...
...
test/resources/testWeb3.js
View file @
b2760e67
...
...
@@ -18,8 +18,8 @@ web3Override.debug.traceTransaction = function (txHash, options, callback) {
callback
(
null
,
data
.
testTraces
[
txHash
])
}
web3Override
.
debug
.
storage
At
=
function
(
blockNumber
,
txIndex
,
address
,
callback
)
{
callback
(
null
,
{})
web3Override
.
debug
.
storage
RangeAt
=
function
(
blockNumber
,
txIndex
,
address
,
start
,
end
,
maxSize
,
callback
)
{
callback
(
null
,
{
storage
:
{},
complete
:
true
})
}
web3Override
.
eth
.
getTransaction
=
function
(
txHash
,
callback
)
{
...
...
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