diff --git a/.gitignore b/.gitignore index d64f9c06ba..856fe89d72 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ build node_modules npm-debug.log lint.xml +.vscode diff --git a/src/debugger.js b/src/debugger.js index 82dcec88a0..e67ed0243c 100644 --- a/src/debugger.js +++ b/src/debugger.js @@ -57,7 +57,6 @@ module.exports = React.createClass({ this.setState({ tx: tx }) - traceManager.setTransaction(tx) var self = this traceManager.resolveTrace(blockNumber, txIndex, function (success) { console.log('trace loaded ' + success) diff --git a/src/storagePanel.js b/src/storagePanel.js index daa63076bf..56268a271e 100644 --- a/src/storagePanel.js +++ b/src/storagePanel.js @@ -4,7 +4,8 @@ var BasicPanel = require('./basicPanel') module.exports = React.createClass({ contextTypes: { - traceManager: React.PropTypes.object + traceManager: React.PropTypes.object, + tx: React.PropTypes.object }, getDefaultProps: function () { @@ -30,7 +31,7 @@ module.exports = React.createClass({ if (window.ethDebuggerSelectedItem !== nextProps.currentStepIndex) return var self = this - this.context.traceManager.getStorageAt(nextProps.currentStepIndex, function (storage) { + this.context.traceManager.getStorageAt(nextProps.currentStepIndex, this.context.tx.blockNumber.toString(), this.context.tx.transactionIndex, function (storage) { if (window.ethDebuggerSelectedItem === nextProps.currentStepIndex) { self.setState({ data: storage diff --git a/src/traceManager.js b/src/traceManager.js index a0b2c2db81..c29c24c7f0 100644 --- a/src/traceManager.js +++ b/src/traceManager.js @@ -22,10 +22,6 @@ module.exports = { this.web3 = web3 }, - setTransaction: function (tx) { - this.transaction = tx - }, - resolveTrace: function (blockNumber, txNumber, callback) { this.isLoading = true this.init() @@ -144,7 +140,7 @@ module.exports = { callback(this.trace.length) }, - getStorageAt: function (stepIndex, callback) { + getStorageAt: function (stepIndex, blockNumber, txIndex, callback) { var stoChange = this.findLowerBound(stepIndex, this.vmTraceChangesRef) if (!stoChange) { return {} @@ -153,7 +149,7 @@ module.exports = { var changeRefs = this.vmTraceIndexByStorageChange[stoChange] var address = this.storageChanges[changeRefs.context].address var self = this - this.retrieveStorage(address, function (storage) { + this.retrieveStorage(address, blockNumber, txIndex, function (storage) { for (var k = 0; k < changeRefs.context; k++) { var context = self.storageChanges[k] if (context.address === address) { @@ -319,13 +315,13 @@ module.exports = { }, // retrieve the storage of an account just after the execution of tx - retrieveStorage: function (address, callBack) { + retrieveStorage: function (address, blockNumber, txIndex, callBack) { if (this.storages[address]) { callBack(this.storages[address]) } var self = this - if (this.transaction) { - this.web3.debug.storageAt(this.transaction.blockNumber.toString(), this.transaction.transactionIndex, address, function (error, result) { + if (blockNumber !== null && txIndex !== null) { + this.web3.debug.storageAt(blockNumber, txIndex, address, function (error, result) { if (error) { console.log(error) } else { @@ -334,7 +330,7 @@ module.exports = { } }) } else { - console.log('transaction is not defined') + console.log('blockNumber/txIndex are not defined') } } }