From bc5c812433c072469948d49d16fe220ed96dc649 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 30 May 2016 08:48:52 +0200 Subject: [PATCH] fix storage --- src/stepManager.js | 1 + src/traceAnalyser.js | 2 +- src/traceManagerUtil.js | 4 +++- src/traceRetriever.js | 2 +- src/txBrowser.js | 6 +++++- 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/stepManager.js b/src/stepManager.js index f2c7b03621..5529dc081f 100644 --- a/src/stepManager.js +++ b/src/stepManager.js @@ -77,6 +77,7 @@ module.exports = React.createClass({ return } this.props.onStepChanged(step) + this.refs.slider.setValue(step) this.changeState(step) }, diff --git a/src/traceAnalyser.js b/src/traceAnalyser.js index dede33cfc7..25657cd0e4 100644 --- a/src/traceAnalyser.js +++ b/src/traceAnalyser.js @@ -55,7 +55,7 @@ TraceAnalyser.prototype.buildStorage = function (index, step, context) { this.traceCache.pushStoreChanges(index + 1, context.currentStorageAddress) } else if (step.op === 'SSTORE') { this.traceCache.pushStoreChanges(index + 1, context.currentStorageAddress, step.stack[step.stack.length - 1], step.stack[step.stack.length - 2]) - } else if (!step.op === 'RETURN') { + } else if (traceManagerUtil.isReturnInstruction(step)) { context.currentStorageAddress = context.previousStorageAddress this.traceCache.pushStoreChanges(index + 1, context.currentStorageAddress) } diff --git a/src/traceManagerUtil.js b/src/traceManagerUtil.js index cd1cafbaea..673116e3d1 100644 --- a/src/traceManagerUtil.js +++ b/src/traceManagerUtil.js @@ -27,7 +27,9 @@ module.exports = { // vmTraceIndex has to point to a CALL, CODECALL, ... resolveCalledAddress: function (vmTraceIndex, trace) { var step = trace[vmTraceIndex] - if (this.isCallInstruction(step)) { + if (this.isCreateInstruction(step)) { + return '(Contract Creation Code) ' + vmTraceIndex + } else if (this.isCallInstruction(step)) { var stack = step.stack // callcode, delegatecall, ... return stack[stack.length - 2] } diff --git a/src/traceRetriever.js b/src/traceRetriever.js index 7f2343ba90..7813cca435 100644 --- a/src/traceRetriever.js +++ b/src/traceRetriever.js @@ -17,7 +17,7 @@ TraceRetriever.prototype.getTrace = function (txHash, callback) { } TraceRetriever.prototype.getStorage = function (tx, address, callback) { - if (tx.to === '(Contract Creation Code)') { + if (tx.to === '(Contract Creation Code)' || address.indexOf('(Contract Creation Code)') !== -1) { callback(null, {}) } else if (this.storages[address]) { callback(null, this.storages[address]) diff --git a/src/txBrowser.js b/src/txBrowser.js index 30242a2935..6c99d49fd9 100644 --- a/src/txBrowser.js +++ b/src/txBrowser.js @@ -12,11 +12,15 @@ module.exports = React.createClass({ }, getInitialState: function () { - return {blockNumber: '1000110', txNumber: '0x50a420e75151e7f04a014019598764102675e0c6c8979f1089690c594cbe871c', from: '', to: '', hash: ''} + return {blockNumber: '1000110', txNumber: '0x20ef65b8b186ca942fcccd634f37074dde49b541c27994fc7596740ef44cfd51', from: '', to: '', hash: ''} }, // creation 0xa9619e1d0a35b2c1d686f5b661b3abd87f998d2844e8e9cc905edb57fc9ce349 // invokation 0x71a6d583d16d142c5c3e8903060e8a4ee5a5016348a9448df6c3e63b68076ec4 + + // test: + // creation: 0x72908de76f99fca476f9e3a3b5d352f350a98cd77d09cebfc59ffe32a6ecaa0b + // invokation: 0x20ef65b8b186ca942fcccd634f37074dde49b541c27994fc7596740ef44cfd51 submit: function () { var tx