refactor getAddresses

pull/5370/head
Iuri Matias 4 years ago committed by aniket-engg
parent 518eaa8642
commit 4441f90eba
  1. 8
      libs/remix-debug/src/debugger/VmDebugger.js
  2. 4
      libs/remix-lib/src/trace/traceManager.js
  3. 13
      libs/remix-lib/test/traceManager.js

@ -160,11 +160,9 @@ class VmDebuggerLogic {
this.traceLength = 0 this.traceLength = 0
this.debugger.event.register('newTraceLoaded', (length) => { this.debugger.event.register('newTraceLoaded', (length) => {
this._traceManager.getAddresses((error, addresses) => { const addresses = this._traceManager.getAddresses()
if (error) return this.event.trigger('traceAddressesUpdate', [addresses])
this.event.trigger('traceAddressesUpdate', [addresses]) this.addresses = addresses
this.addresses = addresses
})
this._traceManager.getLength((error, length) => { this._traceManager.getLength((error, length) => {
if (error) return if (error) return

@ -84,8 +84,8 @@ TraceManager.prototype.accumulateStorageChanges = function (index, address, stor
return this.traceCache.accumulateStorageChanges(index, address, storageOrigin) return this.traceCache.accumulateStorageChanges(index, address, storageOrigin)
} }
TraceManager.prototype.getAddresses = function (callback) { TraceManager.prototype.getAddresses = function () {
callback(null, this.traceCache.addresses) return this.traceCache.addresses
} }
TraceManager.prototype.getCallDataAt = function (stepIndex, callback) { TraceManager.prototype.getCallDataAt = function (stepIndex, callback) {

@ -278,15 +278,10 @@ tape('TraceManager', function (t) {
}) })
t.test('TraceManager.getAddresses', function (st) { t.test('TraceManager.getAddresses', function (st) {
traceManager.getAddresses(function (error, result) { const result = traceManager.getAddresses()
if (error) { st.ok(result[0] === '0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5')
st.fail(error) st.ok(result[1] === '(Contract Creation - Step 63)')
} else { st.end()
st.ok(result[0] === '0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5')
st.ok(result[1] === '(Contract Creation - Step 63)')
st.end()
}
})
}) })
t.test('TraceManager.getReturnValue', function (st) { t.test('TraceManager.getReturnValue', function (st) {

Loading…
Cancel
Save