use of org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.tracing.vm.VmTraceGenerator in project besu by hyperledger.
the class TraceReplayBlockTransactions method handleTransactionTrace.
private void handleTransactionTrace(final TransactionTrace transactionTrace, final Block block, final Set<TraceTypeParameter.TraceType> traceTypes, final ObjectMapper mapper, final ArrayNode resultArrayNode, final AtomicInteger traceCounter) {
final ObjectNode resultNode = mapper.createObjectNode();
TransactionProcessingResult result = transactionTrace.getResult();
resultNode.put("output", result.getOutput().toString());
result.getRevertReason().ifPresent(r -> resultNode.put("revertReason", r.toHexString()));
if (traceTypes.contains(TraceType.STATE_DIFF)) {
generateTracesFromTransactionTrace(trace -> resultNode.putPOJO("stateDiff", trace), protocolSchedule, transactionTrace, block, (__, txTrace, currentBlock, ignored) -> stateDiffGenerator.get().generateStateDiff(txTrace), traceCounter);
}
setNullNodesIfNotPresent(resultNode, "stateDiff");
if (traceTypes.contains(TraceTypeParameter.TraceType.TRACE)) {
generateTracesFromTransactionTrace(resultNode.putArray("trace")::addPOJO, protocolSchedule, transactionTrace, block, FlatTraceGenerator::generateFromTransactionTrace, traceCounter);
}
setEmptyArrayIfNotPresent(resultNode, "trace");
resultNode.put("transactionHash", transactionTrace.getTransaction().getHash().toHexString());
if (traceTypes.contains(VM_TRACE)) {
generateTracesFromTransactionTrace(trace -> resultNode.putPOJO("vmTrace", trace), protocolSchedule, transactionTrace, block, (protocolSchedule, txTrace, currentBlock, ignored) -> new VmTraceGenerator(transactionTrace).generateTraceStream(), traceCounter);
}
setNullNodesIfNotPresent(resultNode, "vmTrace");
resultArrayNode.add(resultNode);
}
Aggregations