|
|
@ -90,6 +90,7 @@ TraceAnalyser.prototype.buildStorage = function (index, step, context) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
TraceAnalyser.prototype.buildDepth = function (index, step, tx, callStack, context) { |
|
|
|
TraceAnalyser.prototype.buildDepth = function (index, step, tx, callStack, context) { |
|
|
|
|
|
|
|
var outOfGas = runOutOfGas(step) |
|
|
|
if (traceHelper.isCallInstruction(step) && !traceHelper.isCallToPrecompiledContract(index, this.trace)) { |
|
|
|
if (traceHelper.isCallInstruction(step) && !traceHelper.isCallToPrecompiledContract(index, this.trace)) { |
|
|
|
var newAddress |
|
|
|
var newAddress |
|
|
|
if (traceHelper.isCreateInstruction(step)) { |
|
|
|
if (traceHelper.isCreateInstruction(step)) { |
|
|
@ -110,10 +111,10 @@ TraceAnalyser.prototype.buildDepth = function (index, step, tx, callStack, conte |
|
|
|
this.traceCache.pushSteps(index, context.currentCallIndex) |
|
|
|
this.traceCache.pushSteps(index, context.currentCallIndex) |
|
|
|
context.lastCallIndex = context.currentCallIndex |
|
|
|
context.lastCallIndex = context.currentCallIndex |
|
|
|
context.currentCallIndex = 0 |
|
|
|
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) { |
|
|
|
if (index + 1 < this.trace.length) { |
|
|
|
callStack.pop() |
|
|
|
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.buildCalldata(index, step, tx, false) |
|
|
|
this.traceCache.pushSteps(index, context.currentCallIndex) |
|
|
|
this.traceCache.pushSteps(index, context.currentCallIndex) |
|
|
|
context.currentCallIndex = context.lastCallIndex + 1 |
|
|
|
context.currentCallIndex = context.lastCallIndex + 1 |
|
|
@ -125,4 +126,8 @@ TraceAnalyser.prototype.buildDepth = function (index, step, tx, callStack, conte |
|
|
|
return context |
|
|
|
return context |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function runOutOfGas (step) { |
|
|
|
|
|
|
|
return parseInt(step.gas) - parseInt(step.gasCost) < 0 |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
module.exports = TraceAnalyser |
|
|
|
module.exports = TraceAnalyser |
|
|
|