refactor accumulateStorageChanges

pull/62/head
Iuri Matias 5 years ago committed by aniket-engg
parent 076cde263a
commit 79c516cb7c
  1. 8
      libs/remix-debug/src/storage/storageViewer.js
  2. 5
      libs/remix-lib/src/trace/traceManager.js
  3. 11
      libs/remix-lib/test/traceManager.js

@ -15,13 +15,7 @@ class StorageViewer {
this.web3 = this.storageResolver.web3 this.web3 = this.storageResolver.web3
this.initialMappingsLocationPromise = null this.initialMappingsLocationPromise = null
this.currentMappingsLocationPromise = null this.currentMappingsLocationPromise = null
_traceManager.accumulateStorageChanges(this.context.stepIndex, this.context.address, {}, (error, storageChanges) => { this.storageChanges = _traceManager.accumulateStorageChanges(this.context.stepIndex, this.context.address, {})
if (!error) {
this.storageChanges = storageChanges
} else {
console.log(error)
}
})
} }
/** /**

@ -80,9 +80,8 @@ TraceManager.prototype.getLength = function (callback) {
} }
} }
TraceManager.prototype.accumulateStorageChanges = function (index, address, storageOrigin, callback) { TraceManager.prototype.accumulateStorageChanges = function (index, address, storageOrigin) {
const storage = this.traceCache.accumulateStorageChanges(index, address, storageOrigin) return this.traceCache.accumulateStorageChanges(index, address, storageOrigin)
callback(null, storage)
} }
TraceManager.prototype.getAddresses = function (callback) { TraceManager.prototype.getAddresses = function (callback) {

@ -55,14 +55,9 @@ tape('TraceManager', function (t) {
}) })
t.test('TraceManager.accumulateStorageChanges', function (st) { t.test('TraceManager.accumulateStorageChanges', function (st) {
traceManager.accumulateStorageChanges(110, '0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5', {}, function (error, result) { const result = traceManager.accumulateStorageChanges(110, '0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5', {})
if (error) { st.ok(result['0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563'].value === '0x38')
st.fail(error) st.end()
} else {
st.ok(result['0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563'].value === '0x38')
st.end()
}
})
}) })
t.test('TraceManager.getCallData', function (st) { t.test('TraceManager.getCallData', function (st) {

Loading…
Cancel
Save