Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const memoryLocationsAccessed = _.map(memoryLogs, structLog => {
if (_.includes(CALL_DATA_OPCODES, structLog.op)) {
const memoryOffsetStackOffset = constants.opCodeToParamToStackOffset[structLog.op as any].memoryOffset;
const lengthStackOffset = constants.opCodeToParamToStackOffset[structLog.op as any].length;
const memOffset = parseInt(
structLog.stack[structLog.stack.length - memoryOffsetStackOffset - 1],
HEX_BASE,
);
const length = parseInt(structLog.stack[structLog.stack.length - lengthStackOffset - 1], HEX_BASE);
return memOffset + length;
} else {
const memoryLocationStackOffset = constants.opCodeToParamToStackOffset[structLog.op].offset;
return parseInt(structLog.stack[structLog.stack.length - memoryLocationStackOffset - 1], HEX_BASE);
}
});
const highestMemoryLocationAccessed = _.max(memoryLocationsAccessed);
const memoryLocationsAccessed = _.map(memoryLogs, structLog => {
if (_.includes(CALL_DATA_OPCODES, structLog.op)) {
const memoryOffsetStackOffset = constants.opCodeToParamToStackOffset[structLog.op as any].memoryOffset;
const lengthStackOffset = constants.opCodeToParamToStackOffset[structLog.op as any].length;
const memOffset = parseInt(
structLog.stack[structLog.stack.length - memoryOffsetStackOffset - 1],
HEX_BASE,
);
const length = parseInt(structLog.stack[structLog.stack.length - lengthStackOffset - 1], HEX_BASE);
return memOffset + length;
} else {
const memoryLocationStackOffset = constants.opCodeToParamToStackOffset[structLog.op].offset;
return parseInt(structLog.stack[structLog.stack.length - memoryLocationStackOffset - 1], HEX_BASE);
}
});
const highestMemoryLocationAccessed = _.max(memoryLocationsAccessed);