Commit e40d76ef authored by yann300's avatar yann300

do not reextract state vars if context is the same

parent e3a8710d
......@@ -18,6 +18,7 @@ function SolidityState (_parent, _traceManager, _codeManager, _solidityProxy) {
})
this.init()
this.view
this.stateVariablesByAddresses = {}
}
SolidityState.prototype.render = function () {
......@@ -54,26 +55,35 @@ SolidityState.prototype.init = function () {
self.basicPanel.update({})
console.log(error)
} else {
self.solidityProxy.extractStateVariablesAt(index, function (error, stateVars) {
if (error) {
self.basicPanel.update({})
console.log(error)
} else {
var storageViewer = new StorageViewer({
stepIndex: self.parent.currentStepIndex,
tx: self.parent.tx,
address: address
}, self.storageResolver, self.traceManager)
stateDecoder.decodeState(stateVars, storageViewer).then((result) => {
if (!result.error) {
self.basicPanel.update(result)
}
})
}
})
if (self.stateVariablesByAddresses[address]) {
extractStateVariables(self, self.stateVariablesByAddresses[address], address)
} else {
self.solidityProxy.extractStateVariablesAt(index, function (error, stateVars) {
if (error) {
self.basicPanel.update({})
console.log(error)
} else {
self.stateVariablesByAddresses[address] = stateVars
extractStateVariables(self, stateVars)
}
})
}
}
})
})
}
function extractStateVariables (self, stateVars, address) {
var storageViewer = new StorageViewer({
stepIndex: self.parent.currentStepIndex,
tx: self.parent.tx,
address: address
}, self.storageResolver, self.traceManager)
stateDecoder.decodeState(stateVars, storageViewer).then((result) => {
if (!result.error) {
self.basicPanel.update(result)
}
})
}
module.exports = SolidityState
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