aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/idStore-test.js
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2016-10-18 05:48:25 +0800
committerDan Finlay <dan@danfinlay.com>2016-10-18 05:48:25 +0800
commit049705004f306bb83ad1bc0b7315d322becf8263 (patch)
tree49c732a4b8369209ef15a07b03ec9757e311752b /test/unit/idStore-test.js
parent0f0951ba549c294222421ef8508294165e9b5fdd (diff)
downloadtangerine-wallet-browser-049705004f306bb83ad1bc0b7315d322becf8263.tar
tangerine-wallet-browser-049705004f306bb83ad1bc0b7315d322becf8263.tar.gz
tangerine-wallet-browser-049705004f306bb83ad1bc0b7315d322becf8263.tar.bz2
tangerine-wallet-browser-049705004f306bb83ad1bc0b7315d322becf8263.tar.lz
tangerine-wallet-browser-049705004f306bb83ad1bc0b7315d322becf8263.tar.xz
tangerine-wallet-browser-049705004f306bb83ad1bc0b7315d322becf8263.tar.zst
tangerine-wallet-browser-049705004f306bb83ad1bc0b7315d322becf8263.zip
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
Diffstat (limited to 'test/unit/idStore-test.js')
-rw-r--r--test/unit/idStore-test.js23
1 files changed, 20 insertions, 3 deletions
diff --git a/test/unit/idStore-test.js b/test/unit/idStore-test.js
index 0a57d2121..c3f79b088 100644
--- a/test/unit/idStore-test.js
+++ b/test/unit/idStore-test.js
@@ -1,10 +1,15 @@
-var assert = require('assert')
-var IdentityStore = require('../../app/scripts/lib/idStore')
-var configManagerGen = require('../lib/mock-config-manager')
+const assert = require('assert')
+const IdentityStore = require('../../app/scripts/lib/idStore')
+const configManagerGen = require('../lib/mock-config-manager')
+const fs = require('fs')
+const path = require('path')
const ethUtil = require('ethereumjs-util')
const BN = ethUtil.BN
const async = require('async')
+const nonDelegatePath = path.join(__dirname, '..', 'lib', 'non-delegate-code.txt')
+const nonDelegateCode = fs.readFileSync(nonDelegatePath).toString()
+
describe('IdentityStore', function() {
describe('#createNewVault', function () {
@@ -156,4 +161,16 @@ describe('IdentityStore', function() {
assert.ok(bnResult.gt(gas), 'added more gas as buffer.')
assert.equal(result.indexOf('0x'), 0, 'include hex prefix')
})
+
+ describe('#checkForDelegateCall', function() {
+ const idStore = new IdentityStore({
+ configManager: configManagerGen(),
+ ethStore: {
+ addAccount(acct) { accounts.push(ethUtil.addHexPrefix(acct)) },
+ },
+ })
+
+ var result = idStore.checkForDelegateCall(nonDelegateCode)
+ assert.equal(result, false, 'no delegate call in provided code')
+ })
})