From fb14e2600aaee499fa2466d7d8f1b916659187b3 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 18 Jan 2023 12:37:12 +0100 Subject: [PATCH] fix memory --- libs/remix-debug/src/trace/traceManager.ts | 5 ++++- libs/remix-debug/test/traceManager.ts | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/libs/remix-debug/src/trace/traceManager.ts b/libs/remix-debug/src/trace/traceManager.ts index d521f580f7..82f0716b66 100644 --- a/libs/remix-debug/src/trace/traceManager.ts +++ b/libs/remix-debug/src/trace/traceManager.ts @@ -190,12 +190,15 @@ export class TraceManager { return this.traceCache.contractCreation[token] } - getMemoryAt (stepIndex) { + getMemoryAt (stepIndex, format = true) { this.checkRequestedStep(stepIndex) const lastChanges = util.findLowerBoundValue(stepIndex, this.traceCache.memoryChanges) if (lastChanges === null) { throw new Error('no memory found') } + if (!format) { + return this.trace[lastChanges].memory + } if (this.traceCache.formattedMemory[lastChanges]) { return this.traceCache.formattedMemory[lastChanges] } diff --git a/libs/remix-debug/test/traceManager.ts b/libs/remix-debug/test/traceManager.ts index 3269bceb4a..8128e21ac8 100644 --- a/libs/remix-debug/test/traceManager.ts +++ b/libs/remix-debug/test/traceManager.ts @@ -164,7 +164,7 @@ tape('TraceManager', function (t) { t.test('TraceManager.getMemoryAt', function (st) { st.plan(3) try { - const result = traceManager.getMemoryAt(0) + const result = traceManager.getMemoryAt(0, false) console.log(result) st.ok(result.length === 0) } catch (error) { @@ -172,7 +172,7 @@ tape('TraceManager', function (t) { } try { - const result = traceManager.getMemoryAt(34) + const result = traceManager.getMemoryAt(34, false) console.log(result) st.ok(result.length === 3) st.ok(result[2] === '0000000000000000000000000000000000000000000000000000000000000060')