From 023b5c84c4d3427973770f2b7d2c18b3ac61f12d Mon Sep 17 00:00:00 2001 From: kumavis Date: Fri, 22 Dec 2017 10:15:38 -0800 Subject: [PATCH 1/8] deps - eth-json-rpc-filters@1.2.5 fix case sensitive address check in filters --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7184e3ea8..b47f45fd4 100644 --- a/package.json +++ b/package.json @@ -73,7 +73,7 @@ "eth-block-tracker": "^2.2.0", "eth-contract-metadata": "^1.1.4", "eth-hd-keyring": "^1.2.1", - "eth-json-rpc-filters": "^1.2.4", + "eth-json-rpc-filters": "^1.2.5", "eth-json-rpc-infura": "^1.0.2", "eth-keyring-controller": "^2.1.2", "eth-phishing-detect": "^1.1.4", From 5312ed9a20d06339c98a9e488cdede405f3c9c49 Mon Sep 17 00:00:00 2001 From: Anatoli Babenia Date: Thu, 4 Jan 2018 17:10:40 +0300 Subject: [PATCH 2/8] info.js Remove width element to fix email layout --- ui/app/info.js | 1 - 1 file changed, 1 deletion(-) diff --git a/ui/app/info.js b/ui/app/info.js index 24c211c1f..110678a46 100644 --- a/ui/app/info.js +++ b/ui/app/info.js @@ -138,7 +138,6 @@ InfoScreen.prototype.render = function () { h('div.fa.fa-envelope', [ h('a.info', { target: '_blank', - style: { width: '85vw' }, href: 'mailto:help@metamask.io?subject=Feedback', }, 'Email us!'), ]), From 9a8670309d2791b212d04ee795f70040cc5f40fc Mon Sep 17 00:00:00 2001 From: kumavis Date: Mon, 8 Jan 2018 13:19:18 -0800 Subject: [PATCH 3/8] bugfix - transactions controller - breakout logic and fix order of operations bug --- app/scripts/controllers/transactions.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/scripts/controllers/transactions.js b/app/scripts/controllers/transactions.js index 469deb670..ded9739a8 100644 --- a/app/scripts/controllers/transactions.js +++ b/app/scripts/controllers/transactions.js @@ -180,8 +180,10 @@ module.exports = class TransactionController extends EventEmitter { // ensure value txMeta.gasPriceSpecified = Boolean(txParams.gasPrice) txMeta.nonceSpecified = Boolean(txParams.nonce) - const gasPrice = txParams.gasPrice || this.getGasPrice ? this.getGasPrice() - : await this.query.gasPrice() + let gasPrice = txParams.gasPrice + if (!gasPrice) { + gasPrice = this.getGasPrice ? this.getGasPrice() : await this.query.gasPrice() + } txParams.gasPrice = ethUtil.addHexPrefix(gasPrice.toString(16)) txParams.value = txParams.value || '0x0' // set gasLimit From 34826d18aa0acbe06d5c27013f249fa7c664d072 Mon Sep 17 00:00:00 2001 From: Dan Finlay <542863+danfinlay@users.noreply.github.com> Date: Mon, 8 Jan 2018 14:58:38 -0800 Subject: [PATCH 4/8] Default to estimating 1 gwei for empty blocks. To avoid estimating 0 gwei on low-traffic private networks. --- app/scripts/metamask-controller.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index 66738db51..aa2dddf3d 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -492,7 +492,7 @@ module.exports = class MetamaskController extends EventEmitter { const { recentBlocks } = recentBlocksController.store.getState() const lowestPrices = recentBlocks.map((block) => { if (!block.gasPrices) { - return new BN(0) + return GWEI_BN } return block.gasPrices .map(hexPrefix => hexPrefix.substr(2)) From 0275231e13d49a9b71b85af389d2a9850229eacb Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Mon, 8 Jan 2018 15:08:05 -0800 Subject: [PATCH 5/8] Default gas estimate to 1 gwei for networks with no block activity --- app/scripts/metamask-controller.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index 66738db51..9462af494 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -490,6 +490,12 @@ module.exports = class MetamaskController extends EventEmitter { getGasPrice () { const { recentBlocksController } = this const { recentBlocks } = recentBlocksController.store.getState() + + // Return 1 gwei if no blocks have been observed: + if (recentBlocks.length === 0) { + return '0x' + GWEI_BN.toString(16) + } + const lowestPrices = recentBlocks.map((block) => { if (!block.gasPrices) { return new BN(0) From 943befef91cd725579c4bf4e7024734f02ef98f5 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Mon, 8 Jan 2018 15:16:08 -0800 Subject: [PATCH 6/8] Add test for gas estimate default --- test/unit/metamask-controller-test.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/test/unit/metamask-controller-test.js b/test/unit/metamask-controller-test.js index 9ec7cd0af..3fc7f9a98 100644 --- a/test/unit/metamask-controller-test.js +++ b/test/unit/metamask-controller-test.js @@ -72,6 +72,25 @@ describe('MetaMaskController', function () { metamaskController.recentBlocksController = realRecentBlocksController }) + + it('gives the 1 gwei price if no blocks have been seen.', async function () { + const realRecentBlocksController = metamaskController.recentBlocksController + metamaskController.recentBlocksController = { + store: { + getState: () => { + return { + recentBlocks: [] + } + } + } + } + + const gasPrice = metamaskController.getGasPrice() + assert.equal(gasPrice, '0x' + GWEI_BN.toString(16), 'defaults to 1 gwei') + + metamaskController.recentBlocksController = realRecentBlocksController + }) + }) describe('#createNewVaultAndKeychain', function () { From d829fb91b889f35a3e1043dec56d8f0ff6faa09d Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Mon, 8 Jan 2018 15:41:57 -0800 Subject: [PATCH 7/8] Default to 1 gwei for empty blocks --- app/scripts/metamask-controller.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index 9462af494..f62b5e5cd 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -497,8 +497,8 @@ module.exports = class MetamaskController extends EventEmitter { } const lowestPrices = recentBlocks.map((block) => { - if (!block.gasPrices) { - return new BN(0) + if (!block.gasPrices || block.gasPrices.length < 1) { + return GWEI_BN } return block.gasPrices .map(hexPrefix => hexPrefix.substr(2)) @@ -508,6 +508,7 @@ module.exports = class MetamaskController extends EventEmitter { })[0] }) .map(number => number.div(GWEI_BN).toNumber()) + const percentileNum = percentile(50, lowestPrices) const percentileNumBn = new BN(percentileNum) return '0x' + percentileNumBn.mul(GWEI_BN).toString(16) From 330ae020287f4178b493619ede17ee0b1b67b7af Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Tue, 9 Jan 2018 10:13:25 -0800 Subject: [PATCH 8/8] Version 3.13.4 --- CHANGELOG.md | 2 ++ app/manifest.json | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cacc4b522..4b4218210 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Current Master +## 3.13.4 2018-1-9 + - Remove recipient field if application initializes a tx with an empty string, or 0x, and tx data. Throw an error with the same condition, but without tx data. - Improve gas price suggestion to be closer to the lowest that will be accepted. - Throw an error if a application tries to submit a tx whose value is a decimal, and inform that it should be in wei. diff --git a/app/manifest.json b/app/manifest.json index d6c57d681..df7b1f1aa 100644 --- a/app/manifest.json +++ b/app/manifest.json @@ -1,7 +1,7 @@ { "name": "MetaMask", "short_name": "Metamask", - "version": "3.13.3", + "version": "3.13.4", "manifest_version": 2, "author": "https://metamask.io", "description": "Ethereum Browser Extension",