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
5c34c7c3
Commit
5c34c7c3
authored
Jun 27, 2016
by
yann300
Committed by
GitHub
Jun 27, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into yann300-patch-3
parents
37ccb6f2
b7b13e81
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
5 deletions
+20
-5
traceAnalyser.js
src/trace/traceAnalyser.js
+14
-4
traceCache.js
src/trace/traceCache.js
+5
-0
traceManager.js
src/trace/traceManager.js
+1
-1
No files found.
src/trace/traceAnalyser.js
View file @
5c34c7c3
...
@@ -11,7 +11,9 @@ TraceAnalyser.prototype.analyse = function (trace, tx, callback) {
...
@@ -11,7 +11,9 @@ TraceAnalyser.prototype.analyse = function (trace, tx, callback) {
this
.
traceCache
.
pushStoreChanges
(
0
,
tx
.
to
)
this
.
traceCache
.
pushStoreChanges
(
0
,
tx
.
to
)
var
context
=
{
var
context
=
{
currentStorageAddress
:
tx
.
to
,
currentStorageAddress
:
tx
.
to
,
previousStorageAddress
:
tx
.
to
previousStorageAddress
:
tx
.
to
,
currentCallIndex
:
0
,
lastCallIndex
:
0
}
}
var
callStack
=
[
tx
.
to
]
var
callStack
=
[
tx
.
to
]
this
.
traceCache
.
pushCallStack
(
0
,
{
this
.
traceCache
.
pushCallStack
(
0
,
{
...
@@ -22,11 +24,10 @@ TraceAnalyser.prototype.analyse = function (trace, tx, callback) {
...
@@ -22,11 +24,10 @@ TraceAnalyser.prototype.analyse = function (trace, tx, callback) {
this
.
traceCache
.
pushContractCreation
(
tx
.
to
,
tx
.
input
)
this
.
traceCache
.
pushContractCreation
(
tx
.
to
,
tx
.
input
)
}
}
this
.
buildCalldata
(
0
,
this
.
trace
[
0
],
tx
,
true
)
this
.
buildCalldata
(
0
,
this
.
trace
[
0
],
tx
,
true
)
for
(
var
k
=
0
;
k
<
this
.
trace
.
length
;
k
++
)
{
for
(
var
k
=
0
;
k
<
this
.
trace
.
length
;
k
++
)
{
var
step
=
this
.
trace
[
k
]
var
step
=
this
.
trace
[
k
]
this
.
buildMemory
(
k
,
step
)
this
.
buildMemory
(
k
,
step
)
this
.
buildDepth
(
k
,
step
,
tx
,
callStack
)
context
=
this
.
buildDepth
(
k
,
step
,
tx
,
callStack
,
context
)
context
=
this
.
buildStorage
(
k
,
step
,
context
)
context
=
this
.
buildStorage
(
k
,
step
,
context
)
}
}
callback
(
null
,
true
)
callback
(
null
,
true
)
...
@@ -82,7 +83,7 @@ TraceAnalyser.prototype.buildStorage = function (index, step, context) {
...
@@ -82,7 +83,7 @@ TraceAnalyser.prototype.buildStorage = function (index, step, context) {
return
context
return
context
}
}
TraceAnalyser
.
prototype
.
buildDepth
=
function
(
index
,
step
,
tx
,
callStack
)
{
TraceAnalyser
.
prototype
.
buildDepth
=
function
(
index
,
step
,
tx
,
callStack
,
context
)
{
if
(
traceHelper
.
isCallInstruction
(
step
)
&&
!
traceHelper
.
isCallToPrecompiledContract
(
index
,
this
.
trace
))
{
if
(
traceHelper
.
isCallInstruction
(
step
)
&&
!
traceHelper
.
isCallToPrecompiledContract
(
index
,
this
.
trace
))
{
if
(
traceHelper
.
isCreateInstruction
(
step
))
{
if
(
traceHelper
.
isCreateInstruction
(
step
))
{
var
contractToken
=
traceHelper
.
contractCreationToken
(
index
)
var
contractToken
=
traceHelper
.
contractCreationToken
(
index
)
...
@@ -102,6 +103,9 @@ TraceAnalyser.prototype.buildDepth = function (index, step, tx, callStack) {
...
@@ -102,6 +103,9 @@ TraceAnalyser.prototype.buildDepth = function (index, step, tx, callStack) {
callStack
:
callStack
.
slice
(
0
)
callStack
:
callStack
.
slice
(
0
)
})
})
this
.
buildCalldata
(
index
,
step
,
tx
,
true
)
this
.
buildCalldata
(
index
,
step
,
tx
,
true
)
this
.
traceCache
.
pushSteps
(
index
,
context
.
currentCallIndex
)
context
.
lastCallIndex
=
context
.
currentCallIndex
context
.
currentCallIndex
=
0
}
else
if
(
traceHelper
.
isReturnInstruction
(
step
))
{
}
else
if
(
traceHelper
.
isReturnInstruction
(
step
))
{
if
(
index
+
1
<
this
.
trace
.
length
)
{
if
(
index
+
1
<
this
.
trace
.
length
)
{
callStack
.
pop
()
callStack
.
pop
()
...
@@ -110,8 +114,14 @@ TraceAnalyser.prototype.buildDepth = function (index, step, tx, callStack) {
...
@@ -110,8 +114,14 @@ TraceAnalyser.prototype.buildDepth = function (index, step, tx, callStack) {
callStack
:
callStack
.
slice
(
0
)
callStack
:
callStack
.
slice
(
0
)
})
})
this
.
buildCalldata
(
index
,
step
,
tx
,
false
)
this
.
buildCalldata
(
index
,
step
,
tx
,
false
)
this
.
traceCache
.
pushSteps
(
index
,
context
.
currentCallIndex
)
context
.
currentCallIndex
=
context
.
lastCallIndex
+
1
}
}
}
else
{
this
.
traceCache
.
pushSteps
(
index
,
context
.
currentCallIndex
)
context
.
currentCallIndex
++
}
}
return
context
}
}
module
.
exports
=
TraceAnalyser
module
.
exports
=
TraceAnalyser
src/trace/traceCache.js
View file @
5c34c7c3
...
@@ -11,6 +11,7 @@ TraceCache.prototype.init = function () {
...
@@ -11,6 +11,7 @@ TraceCache.prototype.init = function () {
this
.
calls
=
{}
this
.
calls
=
{}
this
.
callsData
=
{}
this
.
callsData
=
{}
this
.
contractCreation
=
{}
this
.
contractCreation
=
{}
this
.
steps
=
{}
this
.
callDataChanges
=
[]
this
.
callDataChanges
=
[]
this
.
memoryChanges
=
[]
this
.
memoryChanges
=
[]
...
@@ -19,6 +20,10 @@ TraceCache.prototype.init = function () {
...
@@ -19,6 +20,10 @@ TraceCache.prototype.init = function () {
this
.
callStack
=
{}
// contains all callStack by vmtrace index (we need to rebuild it, callstack is not included in the vmtrace)
this
.
callStack
=
{}
// contains all callStack by vmtrace index (we need to rebuild it, callstack is not included in the vmtrace)
}
}
TraceCache
.
prototype
.
pushSteps
=
function
(
index
,
currentCallIndex
)
{
this
.
steps
[
index
]
=
currentCallIndex
}
TraceCache
.
prototype
.
pushCallDataChanges
=
function
(
value
,
calldata
)
{
TraceCache
.
prototype
.
pushCallDataChanges
=
function
(
value
,
calldata
)
{
this
.
callDataChanges
.
push
(
value
)
this
.
callDataChanges
.
push
(
value
)
this
.
callsData
[
value
]
=
calldata
this
.
callsData
[
value
]
=
calldata
...
...
src/trace/traceManager.js
View file @
5c34c7c3
...
@@ -208,7 +208,7 @@ TraceManager.prototype.getCurrentStep = function (stepIndex, callback) {
...
@@ -208,7 +208,7 @@ TraceManager.prototype.getCurrentStep = function (stepIndex, callback) {
if
(
check
)
{
if
(
check
)
{
return
callback
(
check
,
null
)
return
callback
(
check
,
null
)
}
}
callback
(
null
,
this
.
trace
[
stepIndex
].
steps
)
callback
(
null
,
this
.
trace
Cache
.
steps
[
stepIndex
]
)
}
}
TraceManager
.
prototype
.
getMemExpand
=
function
(
stepIndex
,
callback
)
{
TraceManager
.
prototype
.
getMemExpand
=
function
(
stepIndex
,
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