fix storage

pull/7/head
yann300 9 years ago
parent 6518e8a54e
commit bc5c812433
  1. 1
      src/stepManager.js
  2. 2
      src/traceAnalyser.js
  3. 4
      src/traceManagerUtil.js
  4. 2
      src/traceRetriever.js
  5. 6
      src/txBrowser.js

@ -77,6 +77,7 @@ module.exports = React.createClass({
return
}
this.props.onStepChanged(step)
this.refs.slider.setValue(step)
this.changeState(step)
},

@ -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)
}

@ -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]
}

@ -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])

@ -12,12 +12,16 @@ 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
if (this.state.txNumber.indexOf('0x') !== -1) {

Loading…
Cancel
Save