Skip to content

Commit

Permalink
Merge pull request #50 from 0xPolygonHermez/feature/fixMemTracer
Browse files Browse the repository at this point in the history
fix mem tracer
  • Loading branch information
krlosMata committed Sep 30, 2022
2 parents 94989a7 + cdb625f commit 5fc4a9d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/sm/sm_main/debug/full-tracer.js
Original file line number Diff line number Diff line change
Expand Up @@ -364,13 +364,14 @@ class FullTracer {
const finalMemory = [];
const lengthMemOffset = findOffsetLabel(ctx.rom.program, "memLength");
const lenMemValue = ctx.mem[offsetCtx + lengthMemOffset];
const lenMemValueFinal = typeof lenMemValue === "undefined" ? 0 : Number(fea2scalar(ctx.Fr, lenMemValue));

const lenMemValueFinal = typeof lenMemValue === "undefined" ? 0 : Math.ceil(Number(fea2scalar(ctx.Fr, lenMemValue))/32);

for (let i = 0; i < lenMemValueFinal; i++) {
const memValue = ctx.mem[addrMem + i];
if (typeof memValue === "undefined")
if (typeof memValue === "undefined") {
finalMemory.push("0".padStart(64, "0"))
continue;
}
let memScalar = fea2scalar(ctx.Fr, memValue);
let hexString = memScalar.toString(16);
hexString = hexString.length % 2 ? `0${hexString}` : hexString;
Expand Down

0 comments on commit 5fc4a9d

Please sign in to comment.