renew the storage after each new trace

pull/7/head
yann300 8 years ago
parent 519b7d03d8
commit 097a0a4a09
  1. 5
      src/storage/storageResolver.js
  2. 5
      src/ui/FullStoragesChanges.js
  3. 8
      src/ui/SolidityLocals.js
  4. 9
      src/ui/SolidityState.js
  5. 11
      src/ui/StoragePanel.js
  6. 16
      src/ui/VmDebugger.js

@ -4,12 +4,9 @@ var helper = require('../helpers/util')
var util = require('../helpers/global')
class StorageResolver {
constructor (_debugger, _traceManager) {
constructor (_traceManager) {
this.traceManager = _traceManager
this.clear()
_debugger.event.register('newTraceLoaded', () => {
this.clear()
})
}
/**

@ -3,8 +3,8 @@ var DropdownPanel = require('./DropdownPanel')
var StorageViewer = require('../storage/storageViewer')
var yo = require('yo-yo')
function FullStoragesChanges (_parent, _traceManager, _storageResolver) {
this.storageResolver = _storageResolver
function FullStoragesChanges (_parent, _traceManager) {
this.storageResolver = null
this.parent = _parent
this.traceManager = _traceManager
this.addresses = []
@ -43,6 +43,7 @@ FullStoragesChanges.prototype.init = function () {
this.parent.event.register('indexChanged', this, function (index) {
if (index < 0) return
if (self.parent.currentStepIndex !== index) return
if (!self.storageResolver) return
if (index === self.traceLength - 1) {
var storageJSON = {}

@ -7,10 +7,10 @@ var yo = require('yo-yo')
class SolidityLocals {
constructor (_parent, _traceManager, _internalTreeCall, _storageResolver) {
constructor (_parent, _traceManager, _internalTreeCall) {
this.parent = _parent
this.internalTreeCall = _internalTreeCall
this.storageResolver = _storageResolver
this.storageResolver = null
this.traceManager = _traceManager
this.basicPanel = new DropdownPanel('Solidity Locals', {
json: true,
@ -33,6 +33,10 @@ class SolidityLocals {
this.parent.event.register('sourceLocationChanged', this, (sourceLocation) => {
var warningDiv = this.view.querySelector('#warning')
warningDiv.innerHTML = ''
if (!this.storageResolver) {
warningDiv.innerHTML = 'storage not ready'
return
}
this.traceManager.waterfall([
this.traceManager.getStackAt,
this.traceManager.getMemoryAt],

@ -5,8 +5,8 @@ var solidityTypeFormatter = require('./SolidityTypeFormatter')
var StorageViewer = require('../storage/storageViewer')
var yo = require('yo-yo')
function SolidityState (_parent, _traceManager, _codeManager, _solidityProxy, _storageResolver) {
this.storageResolver = _storageResolver
function SolidityState (_parent, _traceManager, _codeManager, _solidityProxy) {
this.storageResolver = null
this.parent = _parent
this.traceManager = _traceManager
this.codeManager = _codeManager
@ -44,6 +44,11 @@ SolidityState.prototype.init = function () {
return
}
if (!self.storageResolver) {
warningDiv.innerHTML = 'storage not ready'
return
}
self.traceManager.getCurrentCalledAddressAt(self.parent.currentStepIndex, (error, result) => {
if (error) {
self.basicPanel.update({})

@ -3,9 +3,9 @@ var DropdownPanel = require('./DropdownPanel')
var StorageViewer = require('../storage/storageViewer')
var yo = require('yo-yo')
function StoragePanel (_parent, _traceManager, _storageResolver) {
function StoragePanel (_parent, _traceManager) {
this.parent = _parent
this.storageResolver = _storageResolver
this.storageResolver = null
this.traceManager = _traceManager
this.basicPanel = new DropdownPanel('Storage', {json: true})
this.init()
@ -22,11 +22,12 @@ StoragePanel.prototype.init = function () {
if (self.disabled) return
if (index < 0) return
if (self.parent.currentStepIndex !== index) return
if (!self.storageResolver) return
var storageViewer = new StorageViewer({
stepIndex: this.parent.currentStepIndex,
tx: this.parent.tx
}, this.storageResolver)
stepIndex: self.parent.currentStepIndex,
tx: self.parent.tx
}, self.storageResolver)
storageViewer.storageRange((error, storage) => {
if (error) {

@ -13,17 +13,16 @@ var SolidityLocals = require('./SolidityLocals')
var StorageResolver = require('../storage/storageResolver.js')
var yo = require('yo-yo')
function VmDebugger (_parent, _traceManager, _codeManager, _solidityProxy, _callTree) {
var storageResolver = new StorageResolver(_parent, _traceManager)
function VmDebugger (_parent, _traceManager, _codeManager, _solidityProxy, _callTree) {
this.asmCode = new CodeListView(_parent, _codeManager)
this.stackPanel = new StackPanel(_parent, _traceManager)
this.storagePanel = new StoragePanel(_parent, _traceManager, storageResolver)
this.storagePanel = new StoragePanel(_parent, _traceManager)
this.memoryPanel = new MemoryPanel(_parent, _traceManager)
this.calldataPanel = new CalldataPanel(_parent, _traceManager)
this.callstackPanel = new CallstackPanel(_parent, _traceManager)
this.stepDetail = new StepDetail(_parent, _traceManager)
this.solidityState = new SolidityState(_parent, _traceManager, _codeManager, _solidityProxy, storageResolver)
this.solidityLocals = new SolidityLocals(_parent, _traceManager, _callTree, storageResolver)
this.solidityState = new SolidityState(_parent, _traceManager, _codeManager, _solidityProxy)
this.solidityLocals = new SolidityLocals(_parent, _traceManager, _callTree)
/* Return values - */
this.returnValuesPanel = new DropdownPanel('Return Value', {json: true})
@ -40,11 +39,16 @@ function VmDebugger (_parent, _traceManager, _codeManager, _solidityProxy, _call
})
/* Return values - */
this.fullStoragesChangesPanel = new FullStoragesChangesPanel(_parent, _traceManager, storageResolver)
this.fullStoragesChangesPanel = new FullStoragesChangesPanel(_parent, _traceManager)
this.view
var self = this
_parent.event.register('newTraceLoaded', this, function () {
var storageResolver = new StorageResolver(_traceManager)
self.storagePanel.storageResolver = storageResolver
self.solidityState.storageResolver = storageResolver
self.solidityLocals.storageResolver = storageResolver
self.fullStoragesChangesPanel.storageResolver = storageResolver
self.view.style.display = 'block'
})
_parent.event.register('traceUnloaded', this, function () {

Loading…
Cancel
Save