eth/tracers: revert reason in call_tracer + error for failed internal calls (#21387)

* tests: add testdata of call tracer

* eth/tracers: return revert reason in call_tracer

* eth/tracers: regenerate assets

* eth/tracers: add error message even if no exec occurrs, fixes #21438

Co-authored-by: Martin Holst Swende <martin@swende.se>
This commit is contained in:
libotony
2020-08-27 11:33:45 +02:00
committed by GitHub
co-authored by Martin Holst Swende
parent d97e0063d5
commit 05280a7ae3
5 changed files with 172 additions and 15 deletions
File diff suppressed because one or more lines are too long
+7 -8
View File
@@ -132,13 +132,12 @@
// If the call was a contract call, retrieve the gas usage and output
if (call.gas !== undefined) {
call.gasUsed = '0x' + bigInt(call.gasIn - call.gasCost + call.gas - log.getGas()).toString(16);
var ret = log.stack.peek(0);
if (!ret.equals(0)) {
call.output = toHex(log.memory.slice(call.outOff, call.outOff + call.outLen));
} else if (call.error === undefined) {
call.error = "internal failure"; // TODO(karalabe): surface these faults somehow
}
}
var ret = log.stack.peek(0);
if (!ret.equals(0)) {
call.output = toHex(log.memory.slice(call.outOff, call.outOff + call.outLen));
} else if (call.error === undefined) {
call.error = "internal failure"; // TODO(karalabe): surface these faults somehow
}
delete call.gasIn; delete call.gasCost;
delete call.outOff; delete call.outLen;
@@ -208,7 +207,7 @@
} else if (ctx.error !== undefined) {
result.error = ctx.error;
}
if (result.error !== undefined) {
if (result.error !== undefined && (result.error !== "execution reverted" || result.output ==="0x")) {
delete result.output;
}
return this.finalize(result);