Commit 79c516cb authored by Iuri Matias's avatar Iuri Matias Committed by aniket-engg

refactor accumulateStorageChanges

parent 076cde26
......@@ -15,13 +15,7 @@ class StorageViewer {
this.web3 = this.storageResolver.web3
this.initialMappingsLocationPromise = null
this.currentMappingsLocationPromise = null
_traceManager.accumulateStorageChanges(this.context.stepIndex, this.context.address, {}, (error, storageChanges) => {
if (!error) {
this.storageChanges = storageChanges
} else {
console.log(error)
}
})
this.storageChanges = _traceManager.accumulateStorageChanges(this.context.stepIndex, this.context.address, {})
}
/**
......
......@@ -80,9 +80,8 @@ TraceManager.prototype.getLength = function (callback) {
}
}
TraceManager.prototype.accumulateStorageChanges = function (index, address, storageOrigin, callback) {
const storage = this.traceCache.accumulateStorageChanges(index, address, storageOrigin)
callback(null, storage)
TraceManager.prototype.accumulateStorageChanges = function (index, address, storageOrigin) {
return this.traceCache.accumulateStorageChanges(index, address, storageOrigin)
}
TraceManager.prototype.getAddresses = function (callback) {
......
......@@ -55,14 +55,9 @@ tape('TraceManager', function (t) {
})
t.test('TraceManager.accumulateStorageChanges', function (st) {
traceManager.accumulateStorageChanges(110, '0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5', {}, function (error, result) {
if (error) {
st.fail(error)
} else {
st.ok(result['0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563'].value === '0x38')
st.end()
}
})
const result = traceManager.accumulateStorageChanges(110, '0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5', {})
st.ok(result['0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563'].value === '0x38')
st.end()
})
t.test('TraceManager.getCallData', function (st) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment