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
44b60c4d
Commit
44b60c4d
authored
Apr 21, 2016
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change vmTrace call
styling
parent
998de81a
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
142 additions
and
57 deletions
+142
-57
assemblyItemsBrowser.js
src/assemblyItemsBrowser.js
+75
-41
basicPanel.js
src/basicPanel.js
+7
-7
basicStyles.js
src/basicStyles.js
+15
-7
sticker.js
src/sticker.js
+36
-0
txBrowser.js
src/txBrowser.js
+1
-1
vmTraceManager.js
src/vmTraceManager.js
+1
-1
web3Admin.js
src/web3Admin.js
+7
-0
No files found.
src/assemblyItemsBrowser.js
View file @
44b60c4d
var
React
=
require
(
'react'
);
var
React
=
require
(
'react'
);
var
BasicPanel
=
require
(
'./basicPanel'
)
var
BasicPanel
=
require
(
'./basicPanel'
)
var
Sticker
=
require
(
'./sticker'
)
var
codeUtils
=
require
(
'./codeUtils'
)
var
codeUtils
=
require
(
'./codeUtils'
)
var
style
=
require
(
'./basicStyles'
)
var
style
=
require
(
'./basicStyles'
)
...
@@ -16,12 +17,10 @@ module.exports = React.createClass({
...
@@ -16,12 +17,10 @@ module.exports = React.createClass({
currentStorage
:
null
,
currentStorage
:
null
,
currentMemory
:
null
,
currentMemory
:
null
,
currentCallData
:
null
,
currentCallData
:
null
,
lastLevels
:
null
,
currentStepInfo
:
null
,
lastStorage
:
null
,
lastMemory
:
null
,
lastCallData
:
null
,
codes
:
{},
// assembly items instructions list by contract addesses
codes
:
{},
// assembly items instructions list by contract addesses
instructionsIndexByBytesOffset
:
{}
// mapping between bytes offset and instructions index.
instructionsIndexByBytesOffset
:
{},
// mapping between bytes offset and instructions index.
levels
:
{}
};
};
},
},
...
@@ -37,25 +36,50 @@ module.exports = React.createClass({
...
@@ -37,25 +36,50 @@ module.exports = React.createClass({
return
(
return
(
<
div
style
=
{
this
.
props
.
vmTrace
===
null
?
style
.
hidden
:
style
.
display
}
>
<
div
style
=
{
this
.
props
.
vmTrace
===
null
?
style
.
hidden
:
style
.
display
}
>
<
div
style
=
{
style
.
container
}
><
span
style
=
{
style
.
address
}
>
{
this
.
state
.
currentAddress
}
<
/span></
div
>
<
div
style
=
{
style
.
container
}
><
span
style
=
{
style
.
address
}
>
{
this
.
state
.
currentAddress
}
<
/span></
div
>
<
div
style
=
{
style
.
container
}
>
<
div
style
=
{
style
.
container
}
>
<
button
onClick
=
{
this
.
stepIntoBack
}
disabled
=
{
this
.
checkButtonState
(
-
1
)
}
>
stepInto
Back
<
/button
>
<
button
onClick
=
{
this
.
stepIntoBack
}
disabled
=
{
this
.
checkButtonState
(
-
1
)
}
>
Step
Into
Back
<
/button
>
<
button
onClick
=
{
this
.
stepOverBack
}
disabled
=
{
this
.
checkButtonState
(
-
1
)
}
>
stepOver
Back
<
/button
>
<
button
onClick
=
{
this
.
stepOverBack
}
disabled
=
{
this
.
checkButtonState
(
-
1
)
}
>
Step
Over
Back
<
/button
>
<
button
onClick
=
{
this
.
stepOverForward
}
disabled
=
{
this
.
checkButtonState
(
1
)
}
>
stepOver
Forward
<
/button
>
<
button
onClick
=
{
this
.
stepOverForward
}
disabled
=
{
this
.
checkButtonState
(
1
)
}
>
Step
Over
Forward
<
/button
>
<
button
onClick
=
{
this
.
stepIntoForward
}
disabled
=
{
this
.
checkButtonState
(
1
)
}
>
stepInto
Forward
<
/button
>
<
button
onClick
=
{
this
.
stepIntoForward
}
disabled
=
{
this
.
checkButtonState
(
1
)
}
>
Step
Into
Forward
<
/button
>
<
/div
>
<
/div
>
<
div
style
=
{
style
.
container
}
>
<
div
style
=
{
style
.
container
}
>
<
select
size
=
"10"
ref
=
'itemsList'
style
=
{
style
.
instuctions
}
value
=
{
this
.
state
.
selectedInst
}
>
<
table
>
{
this
.
renderAssemblyItems
()
}
<
tbody
>
<
/select
>
<
tr
>
<
/div
>
<
td
>
<
div
>
<
select
size
=
"10"
ref
=
'itemsList'
style
=
{
style
.
instructionsList
}
value
=
{
this
.
state
.
selectedInst
}
>
<
BasicPanel
name
=
"Stack"
data
=
{
this
.
state
.
currentStack
}
/
>
{
this
.
renderAssemblyItems
()
}
<
BasicPanel
name
=
"CallStack"
data
=
{
this
.
state
.
currentCallStack
}
/
>
<
/select
>
<
BasicPanel
name
=
"Storage"
data
=
{
this
.
state
.
currentStorage
}
renderRow
=
{
this
.
renderStorageRow
}
/
>
<
div
style
=
{
Object
.
assign
(
style
.
inline
,
style
.
sticker
)}
>
<
BasicPanel
name
=
"Memory"
data
=
{
this
.
state
.
currentMemory
}
renderRow
=
{
this
.
renderMemoryRow
}
/
>
<
Sticker
data
=
{
this
.
state
.
currentStepInfo
}
/
>
<
BasicPanel
name
=
"CallData"
data
=
{
this
.
state
.
currentCallData
}
/
>
<
/div
>
<
/div
>
<
/td
>
<
/div
>
<
td
>
<
BasicPanel
name
=
"CallData"
data
=
{
this
.
state
.
currentCallData
}
/
>
<
/td
>
<
/tr
>
<
tr
>
<
td
>
<
BasicPanel
name
=
"Stack"
data
=
{
this
.
state
.
currentStack
}
/
>
<
/td
>
<
td
>
<
BasicPanel
name
=
"CallStack"
data
=
{
this
.
state
.
currentCallStack
}
/>
<
/td>
<
/tr
>
<
tr
>
<
td
>
<
BasicPanel
name
=
"Storage"
data
=
{
this
.
state
.
currentStorage
}
renderRow
=
{
this
.
renderStorageRow
}
/
>
<
/td
>
<
td
>
<
BasicPanel
name
=
"Memory"
data
=
{
this
.
state
.
currentMemory
}
renderRow
=
{
this
.
renderMemoryRow
}
/
>
<
/td
>
<
/tr
>
<
/tbody
>
<
/table
>
<
/div>
<
/div>
);
);
},
},
...
@@ -108,7 +132,7 @@ module.exports = React.createClass({
...
@@ -108,7 +132,7 @@ module.exports = React.createClass({
renderAssemblyItems
:
function
()
renderAssemblyItems
:
function
()
{
{
if
(
this
.
props
.
vmTrace
)
if
(
this
.
props
.
vmTrace
)
{
{
return
this
.
state
.
codes
[
this
.
state
.
currentAddress
].
map
(
function
(
item
,
i
)
return
this
.
state
.
codes
[
this
.
state
.
currentAddress
].
map
(
function
(
item
,
i
)
{
{
return
<
option
key
=
{
i
}
value
=
{
i
}
>
{
item
}
<
/option>
;
return
<
option
key
=
{
i
}
value
=
{
i
}
>
{
item
}
<
/option>
;
...
@@ -117,10 +141,28 @@ module.exports = React.createClass({
...
@@ -117,10 +141,28 @@ module.exports = React.createClass({
},
},
componentWillReceiveProps
:
function
(
nextProps
)
componentWillReceiveProps
:
function
(
nextProps
)
{
{
this
.
buildCallStack
(
nextProps
.
vmTrace
)
this
.
updateState
(
nextProps
,
0
)
this
.
updateState
(
nextProps
,
0
)
},
},
buildCallStack
:
function
(
vmTrace
)
{
this
.
state
.
levels
=
{}
var
depth
=
0
var
currentAddress
=
vmTrace
[
0
].
address
var
callStack
=
[
currentAddress
]
for
(
var
k
in
vmTrace
)
{
var
trace
=
vmTrace
[
k
]
if
(
trace
.
depth
>
depth
)
callStack
.
push
(
trace
.
address
)
// new context
else
if
(
trace
.
depth
<
depth
)
callStack
.
pop
()
// returning from context
this
.
state
.
levels
[
trace
.
steps
]
=
callStack
}
},
updateState
:
function
(
props
,
vmTraceIndex
)
updateState
:
function
(
props
,
vmTraceIndex
)
{
{
var
previousState
=
this
.
state
.
currentSelected
var
previousState
=
this
.
state
.
currentSelected
...
@@ -142,41 +184,33 @@ module.exports = React.createClass({
...
@@ -142,41 +184,33 @@ module.exports = React.createClass({
stateChanges
[
"currentStack"
]
=
stack
stateChanges
[
"currentStack"
]
=
stack
}
}
if
(
props
.
vmTrace
[
vmTraceIndex
].
levels
)
if
(
this
.
state
.
levels
[
vmTraceIndex
])
{
stateChanges
[
"currentCallStack"
]
=
this
.
state
.
levels
[
vmTraceIndex
]
var
levels
=
props
.
vmTrace
[
vmTraceIndex
].
levels
var
callStack
=
[]
for
(
var
k
in
levels
)
callStack
.
push
(
props
.
vmTrace
[
levels
[
k
]].
address
)
stateChanges
[
"currentCallStack"
]
=
callStack
lastCallStack
=
callStack
}
var
storageIndex
=
vmTraceIndex
var
storageIndex
=
vmTraceIndex
if
(
vmTraceIndex
<
previousState
)
if
(
vmTraceIndex
<
previousState
)
storageIndex
=
this
.
retrieveLastSeenProperty
(
vmTraceIndex
,
"storage"
,
props
.
vmTrace
)
storageIndex
=
this
.
retrieveLastSeenProperty
(
vmTraceIndex
,
"storage"
,
props
.
vmTrace
)
if
(
props
.
vmTrace
[
storageIndex
].
storage
||
storageIndex
===
0
)
if
(
props
.
vmTrace
[
storageIndex
].
storage
||
storageIndex
===
0
)
{
stateChanges
[
"currentStorage"
]
=
props
.
vmTrace
[
storageIndex
].
storage
stateChanges
[
"currentStorage"
]
=
props
.
vmTrace
[
storageIndex
].
storage
lastStorage
=
props
.
vmTrace
[
storageIndex
].
storage
}
var
memoryIndex
=
vmTraceIndex
var
memoryIndex
=
vmTraceIndex
if
(
vmTraceIndex
<
previousState
)
if
(
vmTraceIndex
<
previousState
)
memoryIndex
=
this
.
retrieveLastSeenProperty
(
vmTraceIndex
,
"memory"
,
props
.
vmTrace
)
memoryIndex
=
this
.
retrieveLastSeenProperty
(
vmTraceIndex
,
"memory"
,
props
.
vmTrace
)
if
(
props
.
vmTrace
[
memoryIndex
].
memory
||
memoryIndex
===
0
)
if
(
props
.
vmTrace
[
memoryIndex
].
memory
||
memoryIndex
===
0
)
{
stateChanges
[
"currentMemory"
]
=
this
.
formatMemory
(
props
.
vmTrace
[
memoryIndex
].
memory
,
16
)
stateChanges
[
"currentMemory"
]
=
this
.
formatMemory
(
props
.
vmTrace
[
memoryIndex
].
memory
,
16
)
lastMemory
=
this
.
formatMemory
(
props
.
vmTrace
[
memoryIndex
].
memory
,
16
)
}
if
(
props
.
vmTrace
[
vmTraceIndex
].
calldata
)
if
(
props
.
vmTrace
[
vmTraceIndex
].
calldata
)
{
stateChanges
[
"currentCallData"
]
=
props
.
vmTrace
[
vmTraceIndex
].
calldata
stateChanges
[
"currentCallData"
]
=
props
.
vmTrace
[
vmTraceIndex
].
calldata
lastCallData
=
props
.
vmTrace
[
vmTraceIndex
].
calldata
}
stateChanges
[
"selectedInst"
]
=
this
.
state
.
instructionsIndexByBytesOffset
[
currentAddress
][
props
.
vmTrace
[
vmTraceIndex
].
pc
]
stateChanges
[
"selectedInst"
]
=
this
.
state
.
instructionsIndexByBytesOffset
[
currentAddress
][
props
.
vmTrace
[
vmTraceIndex
].
pc
]
stateChanges
[
"currentSelected"
]
=
vmTraceIndex
stateChanges
[
"currentSelected"
]
=
vmTraceIndex
stateChanges
[
"currentStepInfo"
]
=
[
"Current Step: "
+
props
.
vmTrace
[
vmTraceIndex
].
steps
,
"Adding Memory: "
+
(
props
.
vmTrace
[
vmTraceIndex
].
memexpand
?
props
.
vmTrace
[
vmTraceIndex
].
memexpand
:
""
),
"Step Cost: "
+
props
.
vmTrace
[
vmTraceIndex
].
gascost
,
"Remaining Gas: "
+
props
.
vmTrace
[
vmTraceIndex
].
gas
]
this
.
setState
(
stateChanges
)
this
.
setState
(
stateChanges
)
},
},
...
...
src/basicPanel.js
View file @
44b60c4d
...
@@ -17,13 +17,13 @@ module.exports = React.createClass({
...
@@ -17,13 +17,13 @@ module.exports = React.createClass({
return
(
return
(
<
div
style
=
{
style
.
panel
.
container
}
>
<
div
style
=
{
style
.
panel
.
container
}
>
<
div
style
=
{
style
.
panel
.
title
}
>
{
this
.
props
.
name
}
<
/div
>
<
div
style
=
{
style
.
panel
.
title
}
>
{
this
.
props
.
name
}
<
/div
>
<
div
style
=
{
style
.
panel
.
tableContainer
}
>
<
div
style
=
{
style
.
panel
.
tableContainer
}
>
<
table
style
=
{
style
.
panel
.
table
}
>
<
table
style
=
{
style
.
panel
.
table
}
>
<
tbody
>
<
tbody
>
{
this
.
renderItems
()}
{
this
.
renderItems
()}
<
/tbody
>
<
/tbody
>
<
/table
>
<
/table
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
);
);
},
},
...
...
src/basicStyles.js
View file @
44b60c4d
...
@@ -12,23 +12,21 @@ module.exports = {
...
@@ -12,23 +12,21 @@ module.exports = {
{
{
'fontStyle'
:
'italic'
'fontStyle'
:
'italic'
},
},
instructions
:
instructions
List
:
{
{
'width'
:
'650px'
'width'
:
"320px"
},
},
panel
:
panel
:
{
{
container
:
container
:
{
{
'margin'
:
'10px'
,
'border'
:
'1px solid'
,
'border'
:
'1px solid'
,
'width'
:
'6
5
0px'
'width'
:
'6
0
0px'
},
},
tableContainer
:
tableContainer
:
{
{
'minHeight'
:
'50px'
,
'height'
:
'150px'
,
'maxHeight'
:
'200px'
,
'overflowY'
:
'auto'
'overflowY'
:
'scroll'
},
},
table
:
table
:
{
{
...
@@ -47,5 +45,14 @@ module.exports = {
...
@@ -47,5 +45,14 @@ module.exports = {
display
:
display
:
{
{
'display'
:
'block'
'display'
:
'block'
},
sticker
:
{
'verticalAlign'
:
'top'
,
'margin'
:
'5px'
},
inline
:
{
'display'
:
'inline-block'
}
}
}
}
\ No newline at end of file
src/sticker.js
0 → 100644
View file @
44b60c4d
var
React
=
require
(
'react'
);
var
style
=
require
(
'./basicStyles'
)
module
.
exports
=
React
.
createClass
({
getDefaultProps
:
function
()
{
return
{
data
:
null
,
};
},
render
:
function
()
{
return
(
<
div
>
<
table
><
tbody
>
{
this
.
renderItems
()}
<
/tbody></
table
>
<
/div
>
);
},
renderItems
:
function
()
{
if
(
this
.
props
.
data
)
{
var
ret
=
[]
for
(
var
key
in
this
.
props
.
data
)
ret
.
push
(
<
tr
key
=
{
key
}
><
td
>
{
this
.
props
.
data
[
key
]}
<
/td></
tr
>
)
return
ret
}
return
null
},
})
src/txBrowser.js
View file @
44b60c4d
...
@@ -26,7 +26,7 @@ module.exports = React.createClass({
...
@@ -26,7 +26,7 @@ module.exports = React.createClass({
render
:
function
()
{
render
:
function
()
{
return
(
return
(
<
div
style
=
{
style
.
container
}
>
<
div
style
=
{
style
.
container
}
>
<
input
onChange
=
{
this
.
updateBlockN
}
type
=
"text"
placeholder
=
{
"Block number e.g. : "
+
this
.
state
.
blockNumber
}
><
/input
>
<
input
onChange
=
{
this
.
updateBlockN
}
type
=
"text"
placeholder
=
{
"Block number
or hash
e.g. : "
+
this
.
state
.
blockNumber
}
><
/input
>
<
input
onChange
=
{
this
.
updateTxN
}
type
=
"text"
placeholder
=
{
"Transaction Number e.g. : "
+
this
.
state
.
txNumber
}
><
/input
>
<
input
onChange
=
{
this
.
updateTxN
}
type
=
"text"
placeholder
=
{
"Transaction Number e.g. : "
+
this
.
state
.
txNumber
}
><
/input
>
<
button
onClick
=
{
this
.
submit
}
>
Get
<
/button
>
<
button
onClick
=
{
this
.
submit
}
>
Get
<
/button
>
<
/div
>
<
/div
>
...
...
src/vmTraceManager.js
View file @
44b60c4d
module
.
exports
=
{
module
.
exports
=
{
retrieveVmTrace
:
function
(
blockNumber
,
txNumber
)
{
retrieveVmTrace
:
function
(
blockNumber
,
txNumber
)
{
return
web3
.
admin
.
vmTrace
(
blockNumber
,
parseInt
(
txNumber
),
"T0Li2pYtq70="
);
return
web3
.
debug
.
debugTrace
(
blockNumber
,
parseInt
(
txNumber
)
);
}
}
}
}
src/web3Admin.js
View file @
44b60c4d
...
@@ -92,6 +92,13 @@ module.exports = {
...
@@ -92,6 +92,13 @@ module.exports = {
property
:
'debug'
,
property
:
'debug'
,
methods
:
methods
:
[
[
new
web3
.
_extend
.
Method
({
name
:
'debugTrace'
,
call
:
'debug_trace'
,
params
:
1
,
inputFormatter
:
[
null
,
null
],
params
:
2
}),
new
web3
.
_extend
.
Method
({
new
web3
.
_extend
.
Method
({
name
:
'printBlock'
,
name
:
'printBlock'
,
call
:
'debug_printBlock'
,
call
:
'debug_printBlock'
,
...
...
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