aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Finlay <flyswatter@users.noreply.github.com>2017-06-13 01:32:54 +0800
committerGitHub <noreply@github.com>2017-06-13 01:32:54 +0800
commitba254d9041aa2cd656ff313547e890fa40917425 (patch)
tree9f26e01eb4262473ff19933a2b49152f74c47447
parentf788ba7244d78a60233b9516423524ebd931fbb6 (diff)
parent2e6e6e41250011b451412608e455fe6402634729 (diff)
downloadtangerine-wallet-browser-ba254d9041aa2cd656ff313547e890fa40917425.tar
tangerine-wallet-browser-ba254d9041aa2cd656ff313547e890fa40917425.tar.gz
tangerine-wallet-browser-ba254d9041aa2cd656ff313547e890fa40917425.tar.bz2
tangerine-wallet-browser-ba254d9041aa2cd656ff313547e890fa40917425.tar.lz
tangerine-wallet-browser-ba254d9041aa2cd656ff313547e890fa40917425.tar.xz
tangerine-wallet-browser-ba254d9041aa2cd656ff313547e890fa40917425.tar.zst
tangerine-wallet-browser-ba254d9041aa2cd656ff313547e890fa40917425.zip
Merge branch 'master' into currency-fix
-rw-r--r--CHANGELOG.md5
-rw-r--r--app/manifest.json2
-rw-r--r--app/scripts/lib/eth-store.js2
-rw-r--r--app/scripts/lib/tx-utils.js9
-rw-r--r--package.json2
-rw-r--r--ui/app/components/pending-tx.js11
-rw-r--r--ui/app/conf-tx.js4
7 files changed, 21 insertions, 14 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7bfa441b1..9a0d0a579 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,11 @@
## Current Master
- Fix currency API URL from cryptonator.
+- Update gasLimit params with every new block seen.
+
+## 3.7.7 2017-6-8
+
+- Fix bug where metamask would show old data after computer being asleep or disconnected from the internet.
## 3.7.6 2017-6-5
diff --git a/app/manifest.json b/app/manifest.json
index 06f9b48a0..a610d9e75 100644
--- a/app/manifest.json
+++ b/app/manifest.json
@@ -1,7 +1,7 @@
{
"name": "MetaMask",
"short_name": "Metamask",
- "version": "3.7.6",
+ "version": "3.7.7",
"manifest_version": 2,
"author": "https://metamask.io",
"description": "Ethereum Browser Extension",
diff --git a/app/scripts/lib/eth-store.js b/app/scripts/lib/eth-store.js
index 6f04a9dd6..ebba98f5c 100644
--- a/app/scripts/lib/eth-store.js
+++ b/app/scripts/lib/eth-store.js
@@ -21,6 +21,7 @@ class EthereumStore extends ObservableStore {
transactions: {},
currentBlockNumber: '0',
currentBlockHash: '',
+ currentBlockGasLimit: '',
})
this._provider = opts.provider
this._query = new EthQuery(this._provider)
@@ -73,6 +74,7 @@ class EthereumStore extends ObservableStore {
this._currentBlockNumber = blockNumber
this.updateState({ currentBlockNumber: parseInt(blockNumber) })
this.updateState({ currentBlockHash: `0x${block.hash.toString('hex')}`})
+ this.updateState({ currentBlockGasLimit: `0x${block.gasLimit.toString('hex')}` })
async.parallel([
this._updateAccounts.bind(this),
this._updateTransactions.bind(this, blockNumber),
diff --git a/app/scripts/lib/tx-utils.js b/app/scripts/lib/tx-utils.js
index 658f3bedc..149d93102 100644
--- a/app/scripts/lib/tx-utils.js
+++ b/app/scripts/lib/tx-utils.js
@@ -21,21 +21,12 @@ module.exports = class txProviderUtils {
this.query.getBlockByNumber('latest', true, (err, block) => {
if (err) return cb(err)
async.waterfall([
- self.setBlockGasLimit.bind(self, txMeta, block.gasLimit),
self.estimateTxGas.bind(self, txMeta, block.gasLimit),
self.setTxGas.bind(self, txMeta, block.gasLimit),
], cb)
})
}
- setBlockGasLimit (txMeta, blockGasLimitHex, cb) {
- const blockGasLimitBN = hexToBn(blockGasLimitHex)
- const saferGasLimitBN = BnMultiplyByFraction(blockGasLimitBN, 19, 20)
- txMeta.blockGasLimit = bnToHex(saferGasLimitBN)
- cb()
- return
- }
-
estimateTxGas (txMeta, blockGasLimitHex, cb) {
const txParams = txMeta.txParams
// check if gasLimit is already specified
diff --git a/package.json b/package.json
index 9efba3866..c6c3add8e 100644
--- a/package.json
+++ b/package.json
@@ -123,7 +123,7 @@
"valid-url": "^1.0.9",
"vreme": "^3.0.2",
"web3": "0.18.2",
- "web3-provider-engine": "^12.1.0",
+ "web3-provider-engine": "^12.2.3",
"web3-stream-provider": "^2.0.6",
"xtend": "^4.0.1"
},
diff --git a/ui/app/components/pending-tx.js b/ui/app/components/pending-tx.js
index e3b307b0b..4b1a00eca 100644
--- a/ui/app/components/pending-tx.js
+++ b/ui/app/components/pending-tx.js
@@ -32,7 +32,7 @@ function PendingTx () {
PendingTx.prototype.render = function () {
const props = this.props
- const { currentCurrency } = props
+ const { currentCurrency, blockGasLimit } = props
const conversionRate = props.conversionRate
const txMeta = this.gatherTxMeta()
@@ -50,7 +50,8 @@ PendingTx.prototype.render = function () {
// Gas
const gas = txParams.gas
const gasBn = hexToBn(gas)
- const safeGasLimit = parseInt(txMeta.blockGasLimit)
+ const gasLimit = new BN(parseInt(blockGasLimit))
+ const safeGasLimit = this.bnMultiplyByFraction(gasLimit, 19, 20).toString(10)
// Gas Price
const gasPrice = txParams.gasPrice || MIN_GAS_PRICE_BN.toString(16)
@@ -458,6 +459,12 @@ PendingTx.prototype._notZeroOrEmptyString = function (obj) {
return obj !== '' && obj !== '0x0'
}
+PendingTx.prototype.bnMultiplyByFraction = function (targetBN, numerator, denominator) {
+ const numBN = new BN(numerator)
+ const denomBN = new BN(denominator)
+ return targetBN.mul(numBN).div(denomBN)
+}
+
function forwardCarrat () {
return (
h('img', {
diff --git a/ui/app/conf-tx.js b/ui/app/conf-tx.js
index 4ae81f35f..747d3ce2b 100644
--- a/ui/app/conf-tx.js
+++ b/ui/app/conf-tx.js
@@ -29,6 +29,7 @@ function mapStateToProps (state) {
provider: state.metamask.provider,
conversionRate: state.metamask.conversionRate,
currentCurrency: state.metamask.currentCurrency,
+ blockGasLimit: state.metamask.currentBlockGasLimit,
}
}
@@ -40,7 +41,7 @@ function ConfirmTxScreen () {
ConfirmTxScreen.prototype.render = function () {
const props = this.props
const { network, provider, unapprovedTxs, currentCurrency,
- unapprovedMsgs, unapprovedPersonalMsgs, conversionRate } = props
+ unapprovedMsgs, unapprovedPersonalMsgs, conversionRate, blockGasLimit } = props
var unconfTxList = txHelper(unapprovedTxs, unapprovedMsgs, unapprovedPersonalMsgs, network)
@@ -107,6 +108,7 @@ ConfirmTxScreen.prototype.render = function () {
identities: props.identities,
conversionRate,
currentCurrency,
+ blockGasLimit,
// Actions
buyEth: this.buyEth.bind(this, txParams.from || props.selectedAddress),
sendTransaction: this.sendTransaction.bind(this),