diff options
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | app/_locales/de/messages.json | 63 | ||||
-rw-r--r-- | app/_locales/nl/messages.json | 16 | ||||
-rw-r--r-- | app/scripts/controllers/currency.js | 2 | ||||
-rw-r--r-- | app/scripts/controllers/transactions.js | 10 | ||||
-rw-r--r-- | app/scripts/lib/nonce-tracker.js | 5 | ||||
-rw-r--r-- | app/scripts/lib/setupRaven.js | 14 | ||||
-rw-r--r-- | app/scripts/lib/tx-state-manager.js | 16 | ||||
-rw-r--r-- | old-ui/app/components/pending-tx.js | 6 | ||||
-rw-r--r-- | package-lock.json | 86 | ||||
-rw-r--r-- | package.json | 4 | ||||
-rw-r--r-- | test/e2e/metamask.spec.js | 7 | ||||
-rw-r--r-- | test/unit/nonce-tracker-test.js | 36 |
13 files changed, 177 insertions, 89 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 06cf51c14..bb9554a87 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## Current Master - Fix bug where the "Reset account" feature would not clear the network cache. +- Increase maximum gas limit, to allow very gas heavy transactions, since block gas limits have been stable. ## 4.4.0 Mon Mar 26 2018 diff --git a/app/_locales/de/messages.json b/app/_locales/de/messages.json index 0bdce516c..5116764d1 100644 --- a/app/_locales/de/messages.json +++ b/app/_locales/de/messages.json @@ -14,9 +14,15 @@ "address": { "message": "Adresse" }, + "addCustomToken": { + "message": "Eigenen Token hinzufügen" + }, "addToken": { "message": "Token hinzufügen" }, + "addTokens": { + "message": "Token hinzufügen" + }, "amount": { "message": "Betrag" }, @@ -31,9 +37,15 @@ "message": "MetaMask", "description": "Der Name der Erweiterung" }, + "approved": { + "message": "Genehmigt" + }, "attemptingConnect": { "message": "Versuch mit der Blockchain zu verbinden." }, + "attributions": { + "message": "Was wir verwenden" + }, "available": { "message": "Verfügbar" }, @@ -43,6 +55,9 @@ "balance": { "message": "Guthaben:" }, + "balances": { + "message": "Deine Guthaben" + }, "balanceIsInsufficientGas": { "message": "Guthaben unzureichend für den aktuellen gesamten Gasbetrag" }, @@ -69,7 +84,7 @@ "message": "Auf Coinbase kaufen" }, "buyCoinbaseExplainer": { - "message": "Coinbase ist die weltweit bekannteste Möglichkeit bitcoin, ethereum und litecoin zu kaufen und verkaufen." + "message": "Coinbase ist die weltweit bekannteste Art und Weise um bitcoin, ethereum und litecoin zu kaufen und verkaufen." }, "ok": { "message": "Ok" @@ -105,7 +120,7 @@ "message": "Zu Coinbase fortfahren" }, "contractDeployment": { - "message": "Smart Contract ausführen" + "message": "Smart Contract Ausführung" }, "conversionProgress": { "message": "Umtausch in Arbeit" @@ -148,7 +163,7 @@ "description": "Börsentyp (Kryptowährungen)" }, "currentConversion": { - "message": "Aktueller Umtausch" + "message": "Aktuelle Tauschwährung" }, "currentNetwork": { "message": "Aktuelles Netzwerk" @@ -185,7 +200,7 @@ "description": "Teilt dem Benutzer mit welchen Token er beim Einzahlen mit Shapeshift ausgewählt hat" }, "depositEth": { - "message": "Eth einzahlen" + "message": "Eth kaufen" }, "depositEther": { "message": "Ether einzahlen" @@ -274,7 +289,7 @@ "message": "Folge uns auf Twitter" }, "from": { - "message": "von" + "message": "Von" }, "fromToSame": { "message": "Ziel- und Ursprungsadresse dürfen nicht identisch sein" @@ -347,14 +362,14 @@ "message": "Es erlaubt dir ether & Token zu halten und dient dir als Verbindung zu dezentralisierten Applikationen." }, "import": { - "message": "Import", + "message": "Importieren", "description": "Button um den Account aus einer ausgewählten Datei zu importieren" }, "importAccount": { "message": "Account importieren" }, "importAccountMsg": { - "message":" Importierte Accounts werden nicht mit der Seed Wörterfolge deines ursprünglichen MetaMask Accounts verknüpft. Erfahre mehr über importierte Accounts." + "message":" Importierte Accounts werden nicht mit der Seed-Wörterfolge deines ursprünglichen MetaMask Accounts verknüpft. Erfahre mehr über importierte Accounts." }, "importAnAccount": { "message": "Einen Account importieren" @@ -369,7 +384,7 @@ "infoHelp": { "message": "Info & Hilfe" }, - "insufficientFunds": { + "insufficientFunds": { "message": "Nicht genügend Guthaben." }, "insufficientTokens": { @@ -441,10 +456,10 @@ "message": "Frei" }, "loweCaseWords": { - "message": "Die Wörter der Seed Wörterfolgen sind alle kleingeschrieben" + "message": "Die Wörter der Seed-Wörterfolgen sind alle kleingeschrieben" }, "mainnet": { - "message": "Ethereum Hauptnetzwerk (Main Net)" + "message": "Ethereum Main Net" }, "message": { "message": "Nachricht" @@ -541,7 +556,7 @@ "description": "Für den Import eine Accounts mit Hilfe eines Private Keys" }, "pasteSeed": { - "message": "Füge deine Seed Wörterfolge hier ein!" + "message": "Füge deine Seed-Wörterfolge hier ein!" }, "personalAddressDetected": { "message": "Personalisierte Adresse identifiziert. Bitte füge die Token Contract Adresse ein." @@ -557,7 +572,7 @@ "description": "Wähle diesen Dateityp um damit einen Account zu importieren" }, "privateKeyWarning": { - "message": "Warnung: Niemals jemanden deinen Private Key mitteilen. Jeder der im Besitz deines Private Keys ist, kann jegliches Guthaben deines Accounts stehlen." + "message": "Warnung: Niemals jemanden deinen Private Key mitteilen. Jeder der im Besitz deines Private Keys ist, kann jegliches Guthaben deines Accounts stehlen." }, "privateNetwork": { "message": "Privates Netzwerk" @@ -566,7 +581,7 @@ "message": "QR Code anzeigen" }, "readdToken": { - "message": "Du kannst diesen Token zukünftig wieder hinzufügen indem du in den Menüpunkt \"Token hinzufügen\" in den Einstellungen deines Accounts gehst." + "message": "Du kannst diesen Token immer erneut hinzufügen, indem du in den Menüpunkt \"Token hinzufügen\" in den Einstellungen deines Accounts gehst." }, "readMore": { "message": "Hier mehr erfahren." @@ -590,7 +605,7 @@ "message": "Account zurücksetzten" }, "restoreFromSeed": { - "message": "Mit Hilfe der Seed Wörterfolge wiederherstellen." + "message": "Mit Hilfe der Seed-Wörterfolge wiederherstellen." }, "restoreVault": { "message": "Vault wiederherstellen" @@ -605,13 +620,13 @@ "message": "Wallet Seed" }, "revealSeedWords": { - "message": "Seed Wörterfolge anzeigen" + "message": "Seed-Wörterfolge anzeigen" }, "revealSeedWordsWarning": { - "message": "Bitte niemals deine Seed Wörterfolge an einem öffentlichen Ort kenntlich machen. Mit diesen Wörtern können alle deine Accounts gestohlen werden." + "message": "Bitte niemals deine Seed-Wörterfolge an einem öffentlichen Ort kenntlich machen. Mit diesen Wörtern können alle deine Accounts gestohlen werden." }, "revert": { - "message": "Zurück gehen" + "message": "Rückgängig machen" }, "rinkeby": { "message": "Rinkeby Testnetzwerk" @@ -623,7 +638,7 @@ "message": "Aktueller RPC" }, "connectingToMainnet": { - "message": "Verbinde zum Ethereum Hauptnetzwerk (Main Net)" + "message": "Verbinde zum Ethereum Main Net" }, "connectingToRopsten": { "message": " Verbinde zum Ropsten Testnetzwerk" @@ -649,7 +664,7 @@ "description": "Prozess des Exportieren eines Accounts" }, "saveSeedAsFile": { - "message": "Seed Wörterfolge als Datei speichern" + "message": "Seed-Wörterfolge als Datei speichern" }, "search": { "message": "Suche" @@ -661,7 +676,7 @@ "message": "Neues Passwort (min. 8 Zeichen)" }, "seedPhraseReq": { - "message": "Seed Wörterfolgen bestehen aus 12 Wörtern" + "message": "Seed-Wörterfolgen bestehen aus 12 Wörtern" }, "select": { "message": "Auswählen" @@ -685,7 +700,7 @@ "message": "Token senden" }, "onlySendToEtherAddress": { - "message": "ETH nur zu einer Ethereum Adresse senden." + "message": "ETH unbedingt nur zu einer Ethereum Adresse senden." }, "sendTokensAnywhere": { "message": "Token zu einer beliebigen Person mit einem Ethereumaccount senden" @@ -742,7 +757,7 @@ "message": "Einreichen" }, "submitted": { - "message": "Eingereicht" + "message": "Abgeschickt" }, "supportCenter": { "message": "Gehe zu unserem Support Center" @@ -782,7 +797,7 @@ "message": "Tokensymbol" }, "tokenWarning1": { - "message": "Behalte die Token die du mit deinem MetaMask Account gekauft hast im Auge. Wenn du Token mit einem anderen Account gekauft hast, werden diese hier nicht angezeigt." + "message": "Behalte die Token die du mit deinem MetaMask Account gekauft hast im Blick. Wenn du Token mit einem anderen Account gekauft hast, werden diese hier nicht angezeigt." }, "total": { "message": "Gesamt" @@ -853,7 +868,7 @@ "message": " Account einsehen" }, "visitWebSite": { - "message": "Gehe zu unsere Webseite" + "message": "Gehe zu unserer Webseite" }, "warning": { "message": "Warnung" diff --git a/app/_locales/nl/messages.json b/app/_locales/nl/messages.json index aacb81fee..487002add 100644 --- a/app/_locales/nl/messages.json +++ b/app/_locales/nl/messages.json @@ -299,7 +299,7 @@ "message": "De gaslimiet moet minstens 21000 zijn" }, "generatingSeed": { - "message": "Zaad produceren ..." + "message": "Back-up woorden produceren ..." }, "gasPrice": { "message": "Gasprijs (GWEI)" @@ -432,7 +432,7 @@ "message": "Los" }, "loweCaseWords": { - "message": "zaadwoorden hebben alleen kleine letters" + "message": "back-up woorden hebben alleen kleine letters" }, "mainnet": { "message": "belangrijkste ethereum-netwerk" @@ -532,7 +532,7 @@ "description": "Voor het importeren van een account vanaf een privésleutel" }, "pasteSeed": { - "message": "Plak je zaadzin hier!" + "message": "Plak je back-up woorden hier!" }, "personalAddressDetected": { "message": "Persoonlijk adres gedetecteerd. Voer het tokencontractadres in." @@ -581,7 +581,7 @@ "message": "Account opnieuw instellen" }, "restoreFromSeed": { - "message": "Herstel van zaaduitdrukking" + "message": "Herstel vanuit back-up woorden" }, "required": { "message": "Verplicht" @@ -590,10 +590,10 @@ "message": "Probeer hier opnieuw met een hogere gasprijs" }, "revealSeedWords": { - "message": "Onthul zaadwoorden" + "message": "Onthul back-up woorden" }, "revealSeedWordsWarning": { - "message": "Herstel je zaadwoorden niet op een openbare plaats! Deze woorden kunnen worden gebruikt om al uw accounts te stelen." + "message": "Zorg dat je back-up woorden niet op een openbare plaats bekijkt! Deze woorden kunnen worden gebruikt om al uw accounts opnieuw te genereren (en dus uw account te stelen)." }, "revert": { "message": "terugkeren" @@ -616,7 +616,7 @@ "description": "Account export proces" }, "saveSeedAsFile": { - "message": "Bewaar zaadwoorden als bestand" + "message": "Bewaar back-up woorden als bestand" }, "search": { "message": "Zoeken" @@ -625,7 +625,7 @@ "message": "Voer hier je geheime twaalfwoordfrase in om je kluis te herstellen." }, "seedPhraseReq": { - "message": "zaadzinnen zijn 12 woorden lang" + "message": "Back-up woorden zijn 12 woorden lang" }, "select": { "message": "kiezen" diff --git a/app/scripts/controllers/currency.js b/app/scripts/controllers/currency.js index 25a7a942e..930fc52e8 100644 --- a/app/scripts/controllers/currency.js +++ b/app/scripts/controllers/currency.js @@ -52,7 +52,7 @@ class CurrencyController { this.setConversionDate(Number(parsedResponse.timestamp)) }).catch((err) => { if (err) { - console.warn('MetaMask - Failed to query currency conversion.') + console.warn(`MetaMask - Failed to query currency conversion:`, currentCurrency, err) this.setConversionRate(0) this.setConversionDate('N/A') } diff --git a/app/scripts/controllers/transactions.js b/app/scripts/controllers/transactions.js index 3e3909361..7e2cc15da 100644 --- a/app/scripts/controllers/transactions.js +++ b/app/scripts/controllers/transactions.js @@ -250,7 +250,7 @@ module.exports = class TransactionController extends EventEmitter { // wait for a nonce nonceLock = await this.nonceTracker.getNonceLock(fromAddress) // add nonce to txParams - // if txMeta has lastGasPrice then it is a retry at same nonce with higher + // if txMeta has lastGasPrice then it is a retry at same nonce with higher // gas price transaction and their for the nonce should not be calculated const nonce = txMeta.lastGasPrice ? txMeta.txParams.nonce : nonceLock.nextNonce txMeta.txParams.nonce = ethUtil.addHexPrefix(nonce.toString(16)) @@ -273,12 +273,14 @@ module.exports = class TransactionController extends EventEmitter { async signTransaction (txId) { const txMeta = this.txStateManager.getTx(txId) - const txParams = txMeta.txParams - const fromAddress = txParams.from // add network/chain id - txParams.chainId = ethUtil.addHexPrefix(this.getChainId().toString(16)) + const chainId = this.getChainId() + const txParams = Object.assign({}, txMeta.txParams, { chainId }) + // sign tx + const fromAddress = txParams.from const ethTx = new Transaction(txParams) await this.signEthTx(ethTx, fromAddress) + // set state to signed this.txStateManager.setTxStatusSigned(txMeta.id) const rawTx = ethUtil.bufferToHex(ethTx.serialize()) return rawTx diff --git a/app/scripts/lib/nonce-tracker.js b/app/scripts/lib/nonce-tracker.js index ed9dd3f11..5b1cd7f43 100644 --- a/app/scripts/lib/nonce-tracker.js +++ b/app/scripts/lib/nonce-tracker.js @@ -31,14 +31,13 @@ class NonceTracker { const networkNonceResult = await this._getNetworkNextNonce(address) const highestLocallyConfirmed = this._getHighestLocallyConfirmed(address) const nextNetworkNonce = networkNonceResult.nonce - const highestLocalNonce = highestLocallyConfirmed - const highestSuggested = Math.max(nextNetworkNonce, highestLocalNonce) + const highestSuggested = Math.max(nextNetworkNonce, highestLocallyConfirmed) const pendingTxs = this.getPendingTransactions(address) const localNonceResult = this._getHighestContinuousFrom(pendingTxs, highestSuggested) || 0 nonceDetails.params = { - highestLocalNonce, + highestLocallyConfirmed, highestSuggested, nextNetworkNonce, } diff --git a/app/scripts/lib/setupRaven.js b/app/scripts/lib/setupRaven.js index a869588d0..b93591e65 100644 --- a/app/scripts/lib/setupRaven.js +++ b/app/scripts/lib/setupRaven.js @@ -23,10 +23,20 @@ function setupRaven(opts) { release, transport: function(opts) { const report = opts.data - // simplify ethjs error messages + // simplify certain complex error messages report.exception.values.forEach(item => { - item.value = extractEthjsErrorMessage(item.value) + let errorMessage = item.value + // simplify ethjs error messages + errorMessage = extractEthjsErrorMessage(errorMessage) + // simplify 'Transaction Failed: known transaction' + if (errorMessage.indexOf('Transaction Failed: known transaction') === 0) { + // cut the hash from the error message + errorMessage = 'Transaction Failed: known transaction' + } + // finalize + item.value = errorMessage }) + // modify report urls rewriteReportUrls(report) // make request normally diff --git a/app/scripts/lib/tx-state-manager.js b/app/scripts/lib/tx-state-manager.js index ab344ae9b..23c915a61 100644 --- a/app/scripts/lib/tx-state-manager.js +++ b/app/scripts/lib/tx-state-manager.js @@ -106,12 +106,9 @@ module.exports = class TransactionStateManager extends EventEmitter { } updateTx (txMeta, note) { + // validate txParams if (txMeta.txParams) { - Object.keys(txMeta.txParams).forEach((key) => { - const value = txMeta.txParams[key] - if (typeof value !== 'string') console.error(`${key}: ${value} in txParams is not a string`) - if (!ethUtil.isHexPrefixed(value)) console.error('is not hex prefixed, anything on txParams must be hex prefixed') - }) + this.validateTxParams(txMeta.txParams) } // create txMeta snapshot for history @@ -139,6 +136,15 @@ module.exports = class TransactionStateManager extends EventEmitter { this.updateTx(txMeta, `txStateManager#updateTxParams`) } + // validates txParams members by type + validateTxParams(txParams) { + Object.keys(txParams).forEach((key) => { + const value = txParams[key] + if (typeof value !== 'string') throw new Error(`${key}: ${value} in txParams is not a string`) + if (!ethUtil.isHexPrefixed(value)) throw new Error('is not hex prefixed, everything on txParams must be hex prefixed') + }) + } + /* Takes an object of fields to search for eg: let thingsToLookFor = { diff --git a/old-ui/app/components/pending-tx.js b/old-ui/app/components/pending-tx.js index 720df2243..7f63d9fdf 100644 --- a/old-ui/app/components/pending-tx.js +++ b/old-ui/app/components/pending-tx.js @@ -62,8 +62,8 @@ PendingTx.prototype.render = function () { const gasBn = hexToBn(gas) // default to 8MM gas limit const gasLimit = new BN(parseInt(blockGasLimit) || '8000000') - const safeGasLimitBN = this.bnMultiplyByFraction(gasLimit, 19, 20) - const saferGasLimitBN = this.bnMultiplyByFraction(gasLimit, 18, 20) + const safeGasLimitBN = this.bnMultiplyByFraction(gasLimit, 99, 100) + const saferGasLimitBN = this.bnMultiplyByFraction(gasLimit, 98, 100) const safeGasLimit = safeGasLimitBN.toString(10) // Gas Price @@ -311,7 +311,7 @@ PendingTx.prototype.render = function () { style: { fontSize: '0.9em', }, - }, 'Gas limit set dangerously high. Approving this transaction is likely to fail.') + }, 'Gas limit set dangerously high. Approving this transaction is liable to fail.') : null, ]), diff --git a/package-lock.json b/package-lock.json index 015828549..f0f76919a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -224,6 +224,15 @@ } } }, + "@sinonjs/formatio": { + "version": "2.0.0", + "resolved": "http://registry.npmjs.org/@sinonjs/formatio/-/formatio-2.0.0.tgz", + "integrity": "sha512-ls6CAMA6/5gG+O/IdsBcblvnd8qcO/l1TYoNeAzp3wcISOxlPXQEus0mLcdwazEkWjaBdaJ3TaxmNgCLWwvWzg==", + "dev": true, + "requires": { + "samsam": "1.3.0" + } + }, "@types/node": { "version": "8.5.5", "resolved": "https://registry.npmjs.org/@types/node/-/node-8.5.5.tgz", @@ -5202,12 +5211,20 @@ "dev": true }, "eslint-plugin-mocha": { - "version": "4.11.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-mocha/-/eslint-plugin-mocha-4.11.0.tgz", - "integrity": "sha1-kRk6L1XiCl41l0BUoAidMBmO5Xg=", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-mocha/-/eslint-plugin-mocha-5.0.0.tgz", + "integrity": "sha512-mpRWWsjxRco2bY4qE5DL8SmGoVF0Onb6DZrbgOjFoNo1YNN299K2voIozd8Kce3qC/neWNr2XF27E1ZDMl1yZg==", "dev": true, "requires": { - "ramda": "0.24.1" + "ramda": "0.25.0" + }, + "dependencies": { + "ramda": { + "version": "0.25.0", + "resolved": "https://registry.npmjs.org/ramda/-/ramda-0.25.0.tgz", + "integrity": "sha512-GXpfrYVPwx3K7RQ6aYT8KPS8XViSXUVJT1ONhoKPE9VAleW42YE+U+8VEyGWt41EnEQW7gwecYJriTI0pKoecQ==", + "dev": true + } } }, "eslint-plugin-react": { @@ -6090,12 +6107,12 @@ } }, "ethjs-query": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/ethjs-query/-/ethjs-query-0.3.2.tgz", - "integrity": "sha1-9IikjOGZTNTHfsy3tSkCxvKc/YU=", + "version": "0.3.4", + "resolved": "https://registry.npmjs.org/ethjs-query/-/ethjs-query-0.3.4.tgz", + "integrity": "sha512-RkeLtBwuXJkBIf/U+Az0GOT203UiBLmN7WA6WZIwSTbmhH2yNicggwaWKvN3TOtpErOsXnzYTZp82mElHdORUQ==", "requires": { - "ethjs-format": "0.2.4", - "ethjs-rpc": "0.1.8" + "ethjs-format": "0.2.5", + "ethjs-rpc": "0.1.9" }, "dependencies": { "bn.js": { @@ -6104,12 +6121,12 @@ "integrity": "sha1-UzRK2xRhehP26N0s4okF0cC6MhU=" }, "ethjs-format": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/ethjs-format/-/ethjs-format-0.2.4.tgz", - "integrity": "sha1-W7vESlrSTmirOTMS/5A5pztlv4E=", + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/ethjs-format/-/ethjs-format-0.2.5.tgz", + "integrity": "sha1-RPMKvuF7B01xYtLIhqv/0GWCiSU=", "requires": { "bn.js": "4.11.6", - "ethjs-schema": "0.1.9", + "ethjs-schema": "0.2.0", "ethjs-util": "0.1.3", "is-hex-prefixed": "1.0.0", "number-to-bn": "1.7.0", @@ -6117,9 +6134,14 @@ } }, "ethjs-rpc": { - "version": "0.1.8", - "resolved": "https://registry.npmjs.org/ethjs-rpc/-/ethjs-rpc-0.1.8.tgz", - "integrity": "sha1-FnZ0DkHHIoGWpxGJ0z8VychbWZ0=" + "version": "0.1.9", + "resolved": "https://registry.npmjs.org/ethjs-rpc/-/ethjs-rpc-0.1.9.tgz", + "integrity": "sha512-KJqT7cgTeCJQ2RY1AlVmTZVnKIUXMPg+niPN5VJKwRSzpjgfr3LTVHlGbkRCqZtOMDi0ogB2vHZaRQiZBXZTUg==" + }, + "ethjs-schema": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/ethjs-schema/-/ethjs-schema-0.2.0.tgz", + "integrity": "sha1-B7RtT1W3kqhGyQp58zDTHREsyjg=" }, "ethjs-util": { "version": "0.1.3", @@ -12459,9 +12481,9 @@ "integrity": "sha1-rgyqVhERSYxboTcj1vtjHSQAOTQ=" }, "lolex": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/lolex/-/lolex-2.3.1.tgz", - "integrity": "sha512-mQuW55GhduF3ppo+ZRUTz1PRjEh1hS5BbqU7d8D0ez2OKxHDod7StPPeAVKisZR5aLkHZjdGWSL42LSONUJsZw==", + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/lolex/-/lolex-2.3.2.tgz", + "integrity": "sha512-A5pN2tkFj7H0dGIAM6MFvHKMJcPnjZsOMvR7ujCjfgW5TbV6H9vb1PgxLtHvjqNZTHsUolz+6/WEO0N1xNx2ng==", "dev": true }, "longest": { @@ -13646,14 +13668,14 @@ "dev": true }, "nise": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/nise/-/nise-1.2.0.tgz", - "integrity": "sha512-q9jXh3UNsMV28KeqI43ILz5+c3l+RiNW8mhurEwCKckuHQbL+hTJIKKTiUlCPKlgQ/OukFvSnKB/Jk3+sFbkGA==", + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/nise/-/nise-1.3.2.tgz", + "integrity": "sha512-KPKb+wvETBiwb4eTwtR/OsA2+iijXP+VnlSFYJo3EHjm2yjek1NWxHOUQat3i7xNLm1Bm18UA5j5Wor0yO2GtA==", "dev": true, "requires": { - "formatio": "1.2.0", + "@sinonjs/formatio": "2.0.0", "just-extend": "1.1.27", - "lolex": "1.6.0", + "lolex": "2.3.2", "path-to-regexp": "1.7.0", "text-encoding": "0.6.4" }, @@ -13664,12 +13686,6 @@ "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", "dev": true }, - "lolex": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/lolex/-/lolex-1.6.0.tgz", - "integrity": "sha1-OpoCg0UqR9dDnnJzG54H1zhuSfY=", - "dev": true - }, "path-to-regexp": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.7.0.tgz", @@ -18695,16 +18711,16 @@ "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=" }, "sinon": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/sinon/-/sinon-4.1.3.tgz", - "integrity": "sha512-c7u0ZuvBRX1eXuB4jN3BRCAOGiUTlM8SE3TxbJHrNiHUKL7wonujMOB6Fi1gQc00U91IscFORQHDga/eccqpbw==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/sinon/-/sinon-5.0.0.tgz", + "integrity": "sha512-dMX7ZB2E1iQ5DOEOePoNJQp03uyhdMfb+kLXlNPbquv2FwfezD+0GbbHSgCw4MFhpSSS9NMoYJfOPMjCMJtXWA==", "dev": true, "requires": { "diff": "3.3.1", "formatio": "1.2.0", "lodash.get": "4.4.2", - "lolex": "2.3.1", - "nise": "1.2.0", + "lolex": "2.3.2", + "nise": "1.3.2", "supports-color": "4.5.0", "type-detect": "4.0.5" }, diff --git a/package.json b/package.json index b53daeb83..6cd8f7f4e 100644 --- a/package.json +++ b/package.json @@ -109,7 +109,7 @@ "ethjs": "^0.2.8", "ethjs-contract": "^0.1.9", "ethjs-ens": "^2.0.0", - "ethjs-query": "^0.3.1", + "ethjs-query": "^0.3.4", "express": "^4.15.5", "extension-link-enabler": "^1.0.0", "extensionizer": "^1.0.0", @@ -144,6 +144,7 @@ "obs-store": "^3.0.0", "once": "^1.3.3", "percentile": "^1.2.0", + "pify": "^3.0.0", "ping-pong-stream": "^1.0.0", "pojo-migrator": "^2.1.0", "polyfill-crypto.getrandomvalues": "^1.0.0", @@ -151,7 +152,6 @@ "promise-filter": "^1.1.0", "promise-to-callback": "^1.0.0", "pump": "^3.0.0", - "pify": "^3.0.0", "pumpify": "^1.3.4", "qrcode-npm": "0.0.3", "ramda": "^0.24.1", diff --git a/test/e2e/metamask.spec.js b/test/e2e/metamask.spec.js index 1ea8ffdf3..ff5bdb51b 100644 --- a/test/e2e/metamask.spec.js +++ b/test/e2e/metamask.spec.js @@ -49,12 +49,14 @@ describe('Metamask popup page', function () { const privacy = await driver.findElement(By.css('.terms-header')).getText() assert.equal(privacy, 'PRIVACY NOTICE', 'shows privacy notice') driver.findElement(By.css('button')).click() + await delay(300) }) it('should show terms of use', async () => { await delay(300) const terms = await driver.findElement(By.css('.terms-header')).getText() assert.equal(terms, 'TERMS OF USE', 'shows terms of use') + await delay(300) }) it('should be unable to continue without scolling throught the terms of use', async () => { @@ -64,6 +66,7 @@ describe('Metamask popup page', function () { 'Attributions' )) await driver.executeScript('arguments[0].scrollIntoView(true)', element) + await delay(300) }) it('should be able to continue when scrolled to the bottom of terms of use', async () => { @@ -72,10 +75,10 @@ describe('Metamask popup page', function () { await delay(500) assert.equal(buttonEnabled, true, 'enabled continue button') await button.click() + await delay(300) }) it('should accept password with length of eight', async () => { - await delay(300) const passwordBox = await driver.findElement(By.id('password-box')) const passwordBoxConfirm = await driver.findElement(By.id('password-box-confirm')) const button = driver.findElement(By.css('button')) @@ -91,10 +94,10 @@ describe('Metamask popup page', function () { this.seedPhase = await driver.findElement(By.css('.twelve-word-phrase')).getText() const continueAfterSeedPhrase = await driver.findElement(By.css('button')) await continueAfterSeedPhrase.click() + await delay(300) }) it('should show lock account', async () => { - await delay(300) await driver.findElement(By.css('.sandwich-expando')).click() await delay(500) await driver.findElement(By.css('#app-content > div > div:nth-child(3) > span > div > li:nth-child(3)')).click() diff --git a/test/unit/nonce-tracker-test.js b/test/unit/nonce-tracker-test.js index 8970cf84d..5a27882ef 100644 --- a/test/unit/nonce-tracker-test.js +++ b/test/unit/nonce-tracker-test.js @@ -33,6 +33,42 @@ describe('Nonce Tracker', function () { }) }) + describe('sentry issue 476304902', function () { + beforeEach(function () { + const txGen = new MockTxGen() + pendingTxs = txGen.generate({ status: 'submitted' }, { + fromNonce: 3, + count: 29, + }) + nonceTracker = generateNonceTrackerWith(pendingTxs, [], '0x3') + }) + + it('should return 9', async function () { + this.timeout(15000) + const nonceLock = await nonceTracker.getNonceLock('0x7d3517b0d011698406d6e0aed8453f0be2697926') + assert.equal(nonceLock.nextNonce, '32', `nonce should be 32 got ${nonceLock.nextNonce}`) + await nonceLock.releaseLock() + }) + }) + + describe('issue 3670', function () { + beforeEach(function () { + const txGen = new MockTxGen() + pendingTxs = txGen.generate({ status: 'submitted' }, { + fromNonce: 6, + count: 3, + }) + nonceTracker = generateNonceTrackerWith(pendingTxs, [], '0x6') + }) + + it('should return 9', async function () { + this.timeout(15000) + const nonceLock = await nonceTracker.getNonceLock('0x7d3517b0d011698406d6e0aed8453f0be2697926') + assert.equal(nonceLock.nextNonce, '9', `nonce should be 9 got ${nonceLock.nextNonce}`) + await nonceLock.releaseLock() + }) + }) + describe('with no previous txs', function () { beforeEach(function () { nonceTracker = generateNonceTrackerWith([], []) |