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
0898e10a
Commit
0898e10a
authored
Apr 28, 2016
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slider - bugfix
parent
5d54ced5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
49 deletions
+65
-49
assemblyItemsBrowser.js
src/assemblyItemsBrowser.js
+49
-42
slider.js
src/slider.js
+14
-6
txBrowser.js
src/txBrowser.js
+2
-1
No files found.
src/assemblyItemsBrowser.js
View file @
0898e10a
...
@@ -11,8 +11,8 @@ module.exports = React.createClass({
...
@@ -11,8 +11,8 @@ module.exports = React.createClass({
getInitialState
:
function
()
getInitialState
:
function
()
{
{
return
{
return
{
currentSelected
:
0
,
// current selected item in the vmTrace
currentSelected
:
-
1
,
// current selected item in the vmTrace
selectedInst
:
0
,
// current selected item in the contract assembly code
selectedInst
:
-
1
,
// current selected item in the contract assembly code
currentAddress
:
null
,
currentAddress
:
null
,
currentStack
:
null
,
currentStack
:
null
,
currentLevels
:
null
,
currentLevels
:
null
,
...
@@ -39,7 +39,7 @@ module.exports = React.createClass({
...
@@ -39,7 +39,7 @@ module.exports = React.createClass({
<
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
}
>
Current
code
:
{
this
.
state
.
currentAddress
}
<
/span></
div
>
<
div
style
=
{
style
.
container
}
><
span
style
=
{
style
.
address
}
>
Current
code
:
{
this
.
state
.
currentAddress
}
<
/span></
div
>
<
div
style
=
{
style
.
container
}
>
<
div
style
=
{
style
.
container
}
>
<
Slider
step
=
{
this
.
state
.
currentSelected
}
onChange
=
{
this
.
selectState
}
min
=
"0"
max
=
{
this
.
props
.
vmTrace
?
this
.
props
.
vmTrace
.
length
:
0
}
/
>
<
Slider
ref
=
"slider"
onChange
=
{
this
.
selectState
}
min
=
"0"
max
=
{
this
.
props
.
vmTrace
?
this
.
props
.
vmTrace
.
length
:
0
}
/
>
<
ButtonNavigator
vmTraceLength
=
{
this
.
props
.
vmTrace
?
this
.
props
.
vmTrace
.
length
:
0
}
step
=
{
this
.
state
.
currentSelected
}
stepIntoBack
=
{
this
.
stepIntoBack
}
stepIntoForward
=
{
this
.
stepIntoForward
}
stepOverBack
=
{
this
.
stepOverBack
}
stepOverForward
=
{
this
.
stepOverForward
}
/
>
<
ButtonNavigator
vmTraceLength
=
{
this
.
props
.
vmTrace
?
this
.
props
.
vmTrace
.
length
:
0
}
step
=
{
this
.
state
.
currentSelected
}
stepIntoBack
=
{
this
.
stepIntoBack
}
stepIntoForward
=
{
this
.
stepIntoForward
}
stepOverBack
=
{
this
.
stepOverBack
}
stepOverForward
=
{
this
.
stepOverForward
}
/
>
<
/div
>
<
/div
>
<
div
style
=
{
style
.
container
}
>
<
div
style
=
{
style
.
container
}
>
...
@@ -133,6 +133,7 @@ module.exports = React.createClass({
...
@@ -133,6 +133,7 @@ module.exports = React.createClass({
if
(
!
nextProps
.
vmTrace
)
if
(
!
nextProps
.
vmTrace
)
return
return
this
.
buildCallStack
(
nextProps
.
vmTrace
)
this
.
buildCallStack
(
nextProps
.
vmTrace
)
this
.
setState
({
"currentSelected"
:
-
1
})
this
.
updateState
(
nextProps
,
0
)
this
.
updateState
(
nextProps
,
0
)
},
},
...
@@ -142,7 +143,7 @@ module.exports = React.createClass({
...
@@ -142,7 +143,7 @@ module.exports = React.createClass({
return
return
var
callStack
=
[]
var
callStack
=
[]
var
depth
=
-
1
var
depth
=
-
1
for
(
var
k
=
1
;
k
<
vmTrace
.
length
;
k
++
)
for
(
var
k
=
0
;
k
<
vmTrace
.
length
;
k
++
)
{
{
var
trace
=
vmTrace
[
k
]
var
trace
=
vmTrace
[
k
]
if
(
trace
.
depth
===
undefined
||
trace
.
depth
===
depth
)
if
(
trace
.
depth
===
undefined
||
trace
.
depth
===
depth
)
...
@@ -160,49 +161,41 @@ module.exports = React.createClass({
...
@@ -160,49 +161,41 @@ module.exports = React.createClass({
{
{
if
(
!
props
.
vmTrace
||
!
props
.
vmTrace
[
vmTraceIndex
])
if
(
!
props
.
vmTrace
||
!
props
.
vmTrace
[
vmTraceIndex
])
return
return
var
previous
State
=
this
.
state
.
currentSelected
var
previous
Index
=
this
.
state
.
currentSelected
var
stateChanges
=
{}
var
stateChanges
=
{}
var
currentAddress
=
this
.
state
.
currentAddress
if
(
props
.
vmTrace
[
vmTraceIndex
].
stack
)
// there's always a stack
if
(
!
currentAddress
)
currentAddress
=
props
.
vmTrace
[
vmTraceIndex
].
address
if
(
props
.
vmTrace
[
vmTraceIndex
].
address
&&
props
.
vmTrace
[
vmTraceIndex
].
address
!==
this
.
state
.
currentAddress
)
{
this
.
resolveAddress
(
props
.
vmTrace
[
vmTraceIndex
].
address
)
stateChanges
[
"currentAddress"
]
=
props
.
vmTrace
[
vmTraceIndex
].
address
}
if
(
props
.
vmTrace
[
vmTraceIndex
].
stack
)
{
{
var
stack
=
props
.
vmTrace
[
vmTraceIndex
].
stack
var
stack
=
props
.
vmTrace
[
vmTraceIndex
].
stack
stack
.
reverse
()
stack
.
reverse
()
stateChanges
[
"currentStack"
]
=
stack
stateChanges
[
"currentStack"
]
=
stack
}
}
var
callStackIndex
=
vmTraceIndex
var
currentAddress
=
this
.
state
.
currentAddress
if
(
vmTraceIndex
<
previousState
)
var
addressIndex
=
this
.
shouldUpdateStateProperty
(
"address"
,
vmTraceIndex
,
previousIndex
,
props
.
vmTrace
)
callStackIndex
=
this
.
retrieveLastSeenProperty
(
vmTraceIndex
,
"depth"
,
props
.
vmTrace
)
if
(
addressIndex
>
-
1
)
if
(
this
.
state
.
callStack
[
callStackIndex
]
||
callStackIndex
===
0
)
{
stateChanges
[
"currentCallStack"
]
=
this
.
state
.
callStack
[
callStackIndex
]
currentAddress
=
props
.
vmTrace
[
addressIndex
].
address
this
.
resolveAddress
(
currentAddress
)
var
storageIndex
=
vmTraceIndex
Object
.
assign
(
stateChanges
,
{
"currentAddress"
:
currentAddress
})
if
(
vmTraceIndex
<
previousState
)
}
storageIndex
=
this
.
retrieveLastSeenProperty
(
vmTraceIndex
,
"storage"
,
props
.
vmTrace
)
if
(
props
.
vmTrace
[
storageIndex
].
storage
||
storageIndex
===
0
)
var
depthIndex
=
this
.
shouldUpdateStateProperty
(
"depth"
,
vmTraceIndex
,
previousIndex
,
props
.
vmTrace
)
stateChanges
[
"currentStorage"
]
=
props
.
vmTrace
[
storageIndex
].
storage
if
(
depthIndex
>
-
1
)
Object
.
assign
(
stateChanges
,
{
"currentCallStack"
:
this
.
state
.
callStack
[
depthIndex
]
})
var
memoryIndex
=
vmTraceIndex
if
(
vmTraceIndex
<
previousState
)
var
storageIndex
=
this
.
shouldUpdateStateProperty
(
"storage"
,
vmTraceIndex
,
previousIndex
,
props
.
vmTrace
)
memoryIndex
=
this
.
retrieveLastSeenProperty
(
vmTraceIndex
,
"memory"
,
props
.
vmTrace
)
if
(
storageIndex
>
-
1
)
if
(
props
.
vmTrace
[
memoryIndex
].
memory
||
memoryIndex
===
0
)
Object
.
assign
(
stateChanges
,
{
"currentStorage"
:
props
.
vmTrace
[
storageIndex
].
storage
})
stateChanges
[
"currentMemory"
]
=
this
.
formatMemory
(
props
.
vmTrace
[
memoryIndex
].
memory
,
16
)
var
memoryIndex
=
this
.
shouldUpdateStateProperty
(
"memory"
,
vmTraceIndex
,
previousIndex
,
props
.
vmTrace
)
var
callDataIndex
=
vmTraceIndex
if
(
memoryIndex
>
-
1
)
if
(
vmTraceIndex
<
previousState
)
Object
.
assign
(
stateChanges
,
{
"currentMemory"
:
this
.
formatMemory
(
props
.
vmTrace
[
memoryIndex
].
memory
,
16
)
})
callDataIndex
=
this
.
retrieveLastSeenProperty
(
vmTraceIndex
,
"calldata"
,
props
.
vmTrace
)
if
(
props
.
vmTrace
[
vmTraceIndex
].
calldata
||
callDataIndex
===
0
)
var
callDataIndex
=
this
.
shouldUpdateStateProperty
(
"calldata"
,
vmTraceIndex
,
previousIndex
,
props
.
vmTrace
)
stateChanges
[
"currentCallData"
]
=
[
props
.
vmTrace
[
callDataIndex
].
calldata
]
if
(
callDataIndex
>
-
1
)
Object
.
assign
(
stateChanges
,
{
"currentCallData"
:
[
props
.
vmTrace
[
callDataIndex
].
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
...
@@ -212,9 +205,23 @@ module.exports = React.createClass({
...
@@ -212,9 +205,23 @@ module.exports = React.createClass({
"Step Cost: "
+
props
.
vmTrace
[
vmTraceIndex
].
gascost
,
"Step Cost: "
+
props
.
vmTrace
[
vmTraceIndex
].
gascost
,
"Remaining Gas: "
+
props
.
vmTrace
[
vmTraceIndex
].
gas
"Remaining Gas: "
+
props
.
vmTrace
[
vmTraceIndex
].
gas
]
]
this
.
refs
.
slider
.
setValue
(
vmTraceIndex
)
this
.
setState
(
stateChanges
)
this
.
setState
(
stateChanges
)
},
},
shouldUpdateStateProperty
:
function
(
vmTraceName
,
nextIndex
,
previousIndex
,
vmTrace
)
{
var
propIndex
=
-
1
if
(
previousIndex
+
1
===
nextIndex
)
propIndex
=
nextIndex
else
propIndex
=
this
.
retrieveLastSeenProperty
(
nextIndex
,
vmTraceName
,
vmTrace
)
if
(
propIndex
>
-
1
&&
vmTrace
[
propIndex
][
vmTraceName
]
!==
undefined
)
return
propIndex
else
return
-
1
},
retrieveLastSeenProperty
:
function
(
currentIndex
,
propertyName
,
vmTrace
)
retrieveLastSeenProperty
:
function
(
currentIndex
,
propertyName
,
vmTrace
)
{
{
...
...
src/slider.js
View file @
0898e10a
...
@@ -11,21 +11,29 @@ module.exports = React.createClass({
...
@@ -11,21 +11,29 @@ module.exports = React.createClass({
{
{
return
{
return
{
min
:
0
,
min
:
0
,
max
:
500
,
max
:
500
step
:
0
};
};
},
},
render
:
function
()
{
render
:
function
()
{
return
(
return
(
<
div
>
<
div
>
<
input
style
=
{
style
.
rule
}
type
=
"range"
value
=
{
this
.
props
.
step
}
min
=
{
this
.
props
.
min
}
max
=
{
this
.
props
.
max
}
onChange
=
{
this
.
onChange
}
/>
<
input
ref
=
"rule"
style
=
{
style
.
rule
}
type
=
"range"
min
=
{
this
.
props
.
min
}
max
=
{
this
.
props
.
max
}
onMouseUp
=
{
this
.
onMouseUp
}
/>
<
/div
>
<
/div
>
);
);
},
},
on
Change
:
function
(
event
)
on
MouseUp
:
function
(
event
)
{
{
this
.
props
.
onChange
(
event
.
currentTarget
.
value
)
this
.
props
.
onChange
(
parseInt
(
this
.
refs
.
rule
.
value
))
}
},
setValue
:
function
(
value
)
{
var
diff
=
value
-
this
.
refs
.
rule
.
value
if
(
diff
>
0
)
this
.
refs
.
rule
.
stepUp
(
diff
)
else
this
.
refs
.
rule
.
stepDown
(
Math
.
abs
(
diff
))
}
})
})
src/txBrowser.js
View file @
0898e10a
...
@@ -13,7 +13,8 @@ module.exports = React.createClass({
...
@@ -13,7 +13,8 @@ module.exports = React.createClass({
submit
:
function
()
submit
:
function
()
{
{
var
tx
=
web3
.
eth
.
getTransactionFromBlock
(
this
.
state
.
blockNumber
,
this
.
state
.
txNumber
)
var
tx
=
web3
.
eth
.
getTransactionFromBlock
(
this
.
state
.
blockNumber
,
this
.
state
.
txNumber
)
this
.
setState
({
from
:
tx
.
from
,
to
:
tx
.
to
,
hash
:
tx
.
hash
})
if
(
tx
)
this
.
setState
({
from
:
tx
.
from
,
to
:
tx
.
to
,
hash
:
tx
.
hash
})
this
.
props
.
onNewTxRequested
(
this
.
state
.
blockNumber
,
parseInt
(
this
.
state
.
txNumber
))
this
.
props
.
onNewTxRequested
(
this
.
state
.
blockNumber
,
parseInt
(
this
.
state
.
txNumber
))
},
},
...
...
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