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
6a02df53
Commit
6a02df53
authored
Jan 03, 2017
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
check if run out of gas
parent
e8d628f9
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
5 deletions
+11
-5
traceAnalyser.js
src/trace/traceAnalyser.js
+7
-2
traceCache.js
src/trace/traceCache.js
+4
-3
No files found.
src/trace/traceAnalyser.js
View file @
6a02df53
...
...
@@ -90,6 +90,7 @@ TraceAnalyser.prototype.buildStorage = function (index, step, context) {
}
TraceAnalyser
.
prototype
.
buildDepth
=
function
(
index
,
step
,
tx
,
callStack
,
context
)
{
var
outOfGas
=
runOutOfGas
(
step
)
if
(
traceHelper
.
isCallInstruction
(
step
)
&&
!
traceHelper
.
isCallToPrecompiledContract
(
index
,
this
.
trace
))
{
var
newAddress
if
(
traceHelper
.
isCreateInstruction
(
step
))
{
...
...
@@ -110,10 +111,10 @@ TraceAnalyser.prototype.buildDepth = function (index, step, tx, callStack, conte
this
.
traceCache
.
pushSteps
(
index
,
context
.
currentCallIndex
)
context
.
lastCallIndex
=
context
.
currentCallIndex
context
.
currentCallIndex
=
0
}
else
if
(
traceHelper
.
isReturnInstruction
(
step
)
||
traceHelper
.
isStopInstruction
(
step
))
{
}
else
if
(
traceHelper
.
isReturnInstruction
(
step
)
||
traceHelper
.
isStopInstruction
(
step
)
||
outOfGas
)
{
if
(
index
+
1
<
this
.
trace
.
length
)
{
callStack
.
pop
()
this
.
traceCache
.
pushCall
(
step
,
index
+
1
,
null
,
callStack
.
slice
(
0
))
this
.
traceCache
.
pushCall
(
step
,
index
+
1
,
null
,
callStack
.
slice
(
0
)
,
outOfGas
)
this
.
buildCalldata
(
index
,
step
,
tx
,
false
)
this
.
traceCache
.
pushSteps
(
index
,
context
.
currentCallIndex
)
context
.
currentCallIndex
=
context
.
lastCallIndex
+
1
...
...
@@ -125,4 +126,8 @@ TraceAnalyser.prototype.buildDepth = function (index, step, tx, callStack, conte
return
context
}
function
runOutOfGas
(
step
)
{
return
parseInt
(
step
.
gas
)
-
parseInt
(
step
.
gasCost
)
<
0
}
module
.
exports
=
TraceAnalyser
src/trace/traceCache.js
View file @
6a02df53
...
...
@@ -34,14 +34,15 @@ TraceCache.prototype.pushMemoryChanges = function (value) {
this
.
memoryChanges
.
push
(
value
)
}
TraceCache
.
prototype
.
pushCall
=
function
(
step
,
index
,
address
,
callStack
)
{
TraceCache
.
prototype
.
pushCall
=
function
(
step
,
index
,
address
,
callStack
,
outofGas
)
{
this
.
callChanges
.
push
(
index
)
this
.
calls
[
index
]
=
{
op
:
step
.
op
,
address
:
address
,
callStack
:
callStack
callStack
:
callStack
,
outofGas
:
outofGas
}
if
(
step
.
op
===
'RETURN'
||
step
.
op
===
'STOP'
)
{
if
(
step
.
op
===
'RETURN'
||
step
.
op
===
'STOP'
||
outofGas
)
{
var
call
=
this
.
callsRef
.
pop
()
this
.
calls
[
index
].
call
=
call
this
.
calls
[
call
].
return
=
index
...
...
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