From 049705004f306bb83ad1bc0b7315d322becf8263 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Mon, 17 Oct 2016 14:48:25 -0700 Subject: Reproduced issue 743 in test case This contract hex does include the value `f4`, but it was compiled from a contract with no instance of `.delegatecall`. I believe `f4` in this case is part of some other value or contract address, and `ethBinToOps` has some error in how it skips pushed data. @kumavis --- app/scripts/lib/idStore.js | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'app/scripts/lib') diff --git a/app/scripts/lib/idStore.js b/app/scripts/lib/idStore.js index 9d0ca7f19..402a5e612 100644 --- a/app/scripts/lib/idStore.js +++ b/app/scripts/lib/idStore.js @@ -249,15 +249,9 @@ IdentityStore.prototype.addUnconfirmedTransaction = function (txParams, onTxDone if (txParams.to) { query.getCode(txParams.to, function (err, result) { if (err) return cb(err) - var code = ethUtil.toBuffer(result) - if (code !== '0x') { - var ops = ethBinToOps(code) - var containsDelegateCall = ops.some((op) => op.name === 'DELEGATECALL') - txData.containsDelegateCall = containsDelegateCall - cb() - } else { - cb() - } + var containsDelegateCall = this.checkForDelegateCall(result) + txData.containsDelegateCall = containsDelegateCall + cb() }) } else { cb() @@ -282,6 +276,17 @@ IdentityStore.prototype.addUnconfirmedTransaction = function (txParams, onTxDone } } +IdentityStore.prototype.checkForDelegateCall = function (codeHex) { + const code = ethUtil.toBuffer(codeHex) + if (code !== '0x') { + const ops = ethBinToOps(code) + const containsDelegateCall = ops.some((op) => op.name === 'DELEGATECALL') + return containsDelegateCall + } else { + return false + } +} + IdentityStore.prototype.addGasBuffer = function (gasHex) { var gas = new BN(gasHex, 16) var buffer = new BN('100000', 10) -- cgit From bda64ab132e87d4f717f257935a842f7368f0776 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Tue, 25 Oct 2016 14:58:04 -0700 Subject: Fix delegate call analysis Fixed reference allowing transactions to be analyzed for delegate call again. --- app/scripts/lib/idStore.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/scripts/lib') diff --git a/app/scripts/lib/idStore.js b/app/scripts/lib/idStore.js index 402a5e612..cb14a5145 100644 --- a/app/scripts/lib/idStore.js +++ b/app/scripts/lib/idStore.js @@ -247,7 +247,7 @@ IdentityStore.prototype.addUnconfirmedTransaction = function (txParams, onTxDone // perform static analyis on the target contract code function analyzeForDelegateCall(cb){ if (txParams.to) { - query.getCode(txParams.to, function (err, result) { + query.getCode(txParams.to, (err, result) => { if (err) return cb(err) var containsDelegateCall = this.checkForDelegateCall(result) txData.containsDelegateCall = containsDelegateCall -- cgit From b3613232a2817ac32d624950164d6269a7ce16e7 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Tue, 25 Oct 2016 16:54:43 -0700 Subject: Rename wallet to account Fixes #762 --- app/scripts/lib/idStore.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/scripts/lib') diff --git a/app/scripts/lib/idStore.js b/app/scripts/lib/idStore.js index 402a5e612..6b492e040 100644 --- a/app/scripts/lib/idStore.js +++ b/app/scripts/lib/idStore.js @@ -426,7 +426,7 @@ IdentityStore.prototype._loadIdentities = function () { // // add to ethStore this._ethStore.addAccount(ethUtil.addHexPrefix(address)) // add to identities - const defaultLabel = 'Wallet ' + (i + 1) + const defaultLabel = 'Account ' + (i + 1) const nickname = configManager.nicknameForWallet(address) var identity = { name: nickname || defaultLabel, -- cgit From 21e73311115504aebb206a24f3084ee304157647 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Tue, 25 Oct 2016 17:41:50 -0700 Subject: Fix delegate call function reference 2 --- app/scripts/lib/idStore.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/scripts/lib') diff --git a/app/scripts/lib/idStore.js b/app/scripts/lib/idStore.js index cb14a5145..27372b3e9 100644 --- a/app/scripts/lib/idStore.js +++ b/app/scripts/lib/idStore.js @@ -249,7 +249,7 @@ IdentityStore.prototype.addUnconfirmedTransaction = function (txParams, onTxDone if (txParams.to) { query.getCode(txParams.to, (err, result) => { if (err) return cb(err) - var containsDelegateCall = this.checkForDelegateCall(result) + var containsDelegateCall = self.checkForDelegateCall(result) txData.containsDelegateCall = containsDelegateCall cb() }) -- cgit