From f17742b0f4d02bccdf4eb54f7725b8ead8ef9b26 Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 9 Feb 2017 17:17:48 +0100 Subject: [PATCH 1/6] fix contract type --- src/solidity/decodeInfo.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/solidity/decodeInfo.js b/src/solidity/decodeInfo.js index e85611e008..aaee05cd76 100644 --- a/src/solidity/decodeInfo.js +++ b/src/solidity/decodeInfo.js @@ -279,6 +279,7 @@ function typeClass (fullType) { */ function parseType (type, stateDefinitions, contractName, location) { var decodeInfos = { + 'contract': address, 'address': address, 'array': array, 'bool': bool, From 935cef38099072c5f1a2d4aefd534da8cb377ae1 Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 9 Feb 2017 17:17:57 +0100 Subject: [PATCH 2/6] fix storage panel --- src/ui/SolidityState.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ui/SolidityState.js b/src/ui/SolidityState.js index c79e5f261f..71c8ffb8fe 100644 --- a/src/ui/SolidityState.js +++ b/src/ui/SolidityState.js @@ -44,11 +44,13 @@ SolidityState.prototype.init = function () { self.traceManager.getStorageAt(index, this.parent.tx, function (error, storage) { if (error) { - self.basicPanel.update({ info: error }) + self.basicPanel.update({}) + console.log(error) } else { self.solidityProxy.extractStateVariablesAt(index, function (error, stateVars) { if (error) { - self.basicPanel.update({ info: error }) + self.basicPanel.update({}) + console.log(error) } else { self.basicPanel.update(stateDecoder.decodeState(stateVars, storage)) } From 3c0339bdc2080a02af557a90486b6d7aa1a7e15f Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 9 Feb 2017 17:30:27 +0100 Subject: [PATCH 3/6] bug fix --- src/util/internalCallTree.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/internalCallTree.js b/src/util/internalCallTree.js index 03782482eb..1e8d074ffd 100644 --- a/src/util/internalCallTree.js +++ b/src/util/internalCallTree.js @@ -73,7 +73,7 @@ class InternalCallTree { var scopeId = util.findLowerBoundValue(vmtraceIndex, scopes) scopeId = this.scopeStarts[scopeId] var scope = this.scopes[scopeId] - while (scope.lastStep && scope.lastStep < vmtraceIndex) { + while (scope.lastStep && scope.lastStep < vmtraceIndex && scope.firstStep > 0) { var matched = scopeId.match(/(.\d|\d)$/) scopeId = scopeId.replace(matched[1], '') scope = this.scopes[scopeId] From fe7a9a1eae3eb401f3bf1bf7968c2379ddda2cb8 Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 9 Feb 2017 17:52:59 +0100 Subject: [PATCH 4/6] external call --- src/util/internalCallTree.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/util/internalCallTree.js b/src/util/internalCallTree.js index 1e8d074ffd..351ce8f0d1 100644 --- a/src/util/internalCallTree.js +++ b/src/util/internalCallTree.js @@ -4,6 +4,7 @@ var AstWalker = require('./astWalker') var EventManager = require('../lib/eventManager') var decodeInfo = require('../solidity/decodeInfo') var util = require('../helpers/util') +var traceHelper = require('../helpers/traceHelper') /** * Tree representing internal jump into function. @@ -96,7 +97,7 @@ async function buildTree (tree, step, scopeId) { if (!sourceLocation) { return { outStep: step, error: 'InternalCallTree - No source Location. ' + step } } - if (sourceLocation.jump === 'i') { + if (sourceLocation.jump === 'i' || traceHelper.isCallInstruction(tree.traceManager.trace[step])) { try { var result = await buildTree(tree, step + 1, scopeId === '' ? subScope.toString() : scopeId + '.' + subScope) if (result.error) { @@ -108,7 +109,8 @@ async function buildTree (tree, step, scopeId) { } catch (e) { return { outStep: step, error: 'InternalCallTree - ' + e.message } } - } else if (sourceLocation.jump === 'o') { + } else if (sourceLocation.jump === 'o' || traceHelper.isReturnInstruction(tree.traceManager.trace[step]) || traceHelper.isStopInstruction(tree.traceManager.trace[step])) { + // traceHelper.isReturnInstruction should be replaced by a more complex structure so it can handle out of gas tree.scopes[scopeId].lastStep = step return { outStep: step + 1 } } else { From d464153cb5d9d6c189466fd318d4b78ad835840e Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 9 Feb 2017 17:53:07 +0100 Subject: [PATCH 5/6] bug fix --- src/web3Provider/web3VmProvider.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/web3Provider/web3VmProvider.js b/src/web3Provider/web3VmProvider.js index 7825b2ea69..41746918c2 100644 --- a/src/web3Provider/web3VmProvider.js +++ b/src/web3Provider/web3VmProvider.js @@ -123,7 +123,7 @@ web3VmProvider.prototype.pushTrace = function (self, data) { this.processingAddress = uiutil.normalizeHex(step.stack[step.stack.length - 2]) if (!self.storageCache[self.processingHash][this.processingAddress]) { self.vm.stateManager.dumpStorage(this.processingAddress, function (storage) { - self.storageCache[self.processingHash][this.processingAddress] = storage + self.storageCache[self.processingHash][self.processingAddress] = storage }) } } From 9b86659ff548097006afacf55a16da8df8db28d1 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 13 Feb 2017 10:31:14 +0100 Subject: [PATCH 6/6] will fix in other pr --- src/util/internalCallTree.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/util/internalCallTree.js b/src/util/internalCallTree.js index 351ce8f0d1..5f8b2d6daa 100644 --- a/src/util/internalCallTree.js +++ b/src/util/internalCallTree.js @@ -97,7 +97,7 @@ async function buildTree (tree, step, scopeId) { if (!sourceLocation) { return { outStep: step, error: 'InternalCallTree - No source Location. ' + step } } - if (sourceLocation.jump === 'i' || traceHelper.isCallInstruction(tree.traceManager.trace[step])) { + if (sourceLocation.jump === 'i') { try { var result = await buildTree(tree, step + 1, scopeId === '' ? subScope.toString() : scopeId + '.' + subScope) if (result.error) { @@ -109,8 +109,7 @@ async function buildTree (tree, step, scopeId) { } catch (e) { return { outStep: step, error: 'InternalCallTree - ' + e.message } } - } else if (sourceLocation.jump === 'o' || traceHelper.isReturnInstruction(tree.traceManager.trace[step]) || traceHelper.isStopInstruction(tree.traceManager.trace[step])) { - // traceHelper.isReturnInstruction should be replaced by a more complex structure so it can handle out of gas + } else if (sourceLocation.jump === 'o') { tree.scopes[scopeId].lastStep = step return { outStep: step + 1 } } else {