From 9305829ab085695b5c051a65e4ba8ae8880d89c6 Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 12 Jul 2016 12:32:19 +0200 Subject: [PATCH] display full storages changes --- src/BasicPanel.js | 17 ++++++++++++++--- src/StoragePanel.js | 7 +++++-- src/TxBrowser.js | 2 +- src/VmDebugger.js | 36 +++++++++++++++++++++++++++++++++++- src/helpers/ui.js | 4 +++- src/trace/traceAnalyser.js | 21 ++++++++++++++++----- src/trace/traceCache.js | 16 +++++++++------- src/trace/traceManager.js | 22 ++++++++++++++++++++-- 8 files changed, 103 insertions(+), 22 deletions(-) diff --git a/src/BasicPanel.js b/src/BasicPanel.js index 2edbba3eb7..ad181b04c1 100644 --- a/src/BasicPanel.js +++ b/src/BasicPanel.js @@ -3,9 +3,12 @@ var style = require('./styles/basicStyles') var yo = require('yo-yo') var ui = require('./helpers/ui') -function BasicPanel (_name) { +function BasicPanel (_name, _id, _width, _height) { this.data this.name = _name + this.id = _id + this.width = _width + this.height = _height this.view } @@ -13,12 +16,20 @@ BasicPanel.prototype.update = function () { yo.update(this.view, this.render()) } +BasicPanel.prototype.hide = function () { + document.getElementById(this.id + 'container').style.display = 'none' +} + +BasicPanel.prototype.show = function () { + document.getElementById(this.id + 'container').style.display = 'block' +} + BasicPanel.prototype.render = function () { - var view = yo`
+ var view = yo`
${this.name}
-
+
${this.data}
` diff --git a/src/StoragePanel.js b/src/StoragePanel.js index fe9160524d..abe41e5b73 100644 --- a/src/StoragePanel.js +++ b/src/StoragePanel.js @@ -2,11 +2,13 @@ var BasicPanel = require('./BasicPanel') var yo = require('yo-yo') -function StoragePanel (_parent, _traceManager) { +function StoragePanel (_parent, _traceManager, _address) { this.parent = _parent this.traceManager = _traceManager this.basicPanel = new BasicPanel('Storage Changes') + this.address = _address this.init() + this.disabled = false } StoragePanel.prototype.render = function () { @@ -16,6 +18,7 @@ StoragePanel.prototype.render = function () { StoragePanel.prototype.init = function () { var self = this this.parent.register('indexChanged', this, function (index) { + if (self.disabled) return if (index < 0) return if (self.parent.currentStepIndex !== index) return @@ -27,7 +30,7 @@ StoragePanel.prototype.init = function () { self.basicPanel.data = self.formatStorage(storage) } self.basicPanel.update() - }) + }, self.address) }) } diff --git a/src/TxBrowser.js b/src/TxBrowser.js index b623b3dc9c..d9c23f3e92 100644 --- a/src/TxBrowser.js +++ b/src/TxBrowser.js @@ -31,7 +31,7 @@ TxBrowser.prototype.setDefaultValues = function () { this.to = ' - ' this.hash = ' - ' this.blockNumber = null - this.txNumber = '0xcda2b2835add61af54cf83bd076664d98d7908c6cd98d86423b3b48d8b8e51ff' + this.txNumber = '0x20ef65b8b186ca942fcccd634f37074dde49b541c27994fc7596740ef44cfd51' this.connectInfo = '' this.updateWeb3Url(this.web3.currentProvider.host) } diff --git a/src/VmDebugger.js b/src/VmDebugger.js index 8bee4dd72a..49b9f4055e 100644 --- a/src/VmDebugger.js +++ b/src/VmDebugger.js @@ -6,6 +6,8 @@ var MemoryPanel = require('./MemoryPanel') var CallstackPanel = require('./CallstackPanel') var StackPanel = require('./StackPanel') var StoragePanel = require('./StoragePanel') +var BasicPanel = require('./BasicPanel') +var FullStoragesChangesPanel = require('./FullStoragesChanges') var yo = require('yo-yo') var ui = require('./helpers/ui') @@ -16,6 +18,28 @@ function VmDebugger (_parent, _traceManager, _web3) { this.memoryPanel = new MemoryPanel(_parent, _traceManager) this.calldataPanel = new CalldataPanel(_parent, _traceManager) this.callstackPanel = new CallstackPanel(_parent, _traceManager) + + /* Return values - */ + this.returnValuesPanel = new BasicPanel('Return Values', 'returnvalues', 'auto', '100px') + _parent.register('indexChanged', this.returnValuesPanel, function (index) { + var self = this + _traceManager.getReturnValue(index, function (error, returnValue) { + if (error) { + console.log(error) + self.data = '' + } else if (_parent.currentStepIndex === index) { + self.data = returnValue + } + self.update() + if (!returnValue) { + self.hide() + } + }) + }) + /* Return values - */ + + this.fullStoragesChangesPanel = new FullStoragesChangesPanel(_parent, _traceManager) + this.view var self = this _parent.register('newTraceLoaded', this, function () { @@ -30,7 +54,7 @@ VmDebugger.prototype.render = function () { var view = yo`