pull/3285/head^2
yann300 2 years ago committed by Aniket
parent bccbeae2c2
commit fb14e2600a
  1. 5
      libs/remix-debug/src/trace/traceManager.ts
  2. 4
      libs/remix-debug/test/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]
}

@ -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')

Loading…
Cancel
Save