Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
while (_.isUndefined(sourceRange) && pc > 0) {
sourceRange = pcToSourceRange[pc];
pc -= 1;
}
if (_.isUndefined(sourceRange)) {
this._logger.warn(
`could not find matching sourceRange for structLog: ${JSON.stringify(
_.omit(evmCallStackEntry.structLog, 'stack'),
)}`,
);
continue;
}
const fileNameToFileIndex = _.invert(contractData.sources);
const fileIndex = _.parseInt(fileNameToFileIndex[sourceRange.fileName]);
const sourceSnippet = getSourceRangeSnippet(sourceRange, contractData.sourceCodes[fileIndex]);
sourceSnippets.push(sourceSnippet);
}
const filteredSnippets = filterSnippets(sourceSnippets);
if (filteredSnippets.length > 0) {
this._logger.error('\n\nStack trace for REVERT:\n');
_.forEach(_.reverse(filteredSnippets), snippet => {
const traceString = getStackTraceString(snippet);
this._logger.error(traceString);
});
this._logger.error('\n');
} else {
this._logger.error('REVERT detected but could not determine stack trace');
}
}
}