mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Add warning of higher failure risk since app proposed gasLimit.
This commit is contained in:
parent
1d3cd9768c
commit
06153dd47d
@ -52,7 +52,8 @@ PendingTx.prototype.render = function () {
|
|||||||
const gas = txParams.gas
|
const gas = txParams.gas
|
||||||
const gasBn = hexToBn(gas)
|
const gasBn = hexToBn(gas)
|
||||||
const gasLimit = new BN(parseInt(blockGasLimit))
|
const gasLimit = new BN(parseInt(blockGasLimit))
|
||||||
const safeGasLimit = this.bnMultiplyByFraction(gasLimit, 19, 20).toString(10)
|
const safeGasLimitBN = this.bnMultiplyByFraction(gasLimit, 19, 20)
|
||||||
|
const safeGasLimit = safeGasLimitBN.toString(10)
|
||||||
|
|
||||||
// Gas Price
|
// Gas Price
|
||||||
const gasPrice = txParams.gasPrice || MIN_GAS_PRICE_BN.toString(16)
|
const gasPrice = txParams.gasPrice || MIN_GAS_PRICE_BN.toString(16)
|
||||||
@ -66,6 +67,8 @@ PendingTx.prototype.render = function () {
|
|||||||
|
|
||||||
const balanceBn = hexToBn(balance)
|
const balanceBn = hexToBn(balance)
|
||||||
const insufficientBalance = balanceBn.lt(maxCost)
|
const insufficientBalance = balanceBn.lt(maxCost)
|
||||||
|
const dangerousGasLimit = gasBn.gte(safeGasLimitBN)
|
||||||
|
const gasLimitSpecified = txMeta.gasLimitSpecified
|
||||||
const buyDisabled = insufficientBalance || !this.state.valid || !isValidAddress || this.state.submitting
|
const buyDisabled = insufficientBalance || !this.state.valid || !isValidAddress || this.state.submitting
|
||||||
const showRejectAll = props.unconfTxListLength > 1
|
const showRejectAll = props.unconfTxListLength > 1
|
||||||
|
|
||||||
@ -263,11 +266,14 @@ PendingTx.prototype.render = function () {
|
|||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
}
|
}
|
||||||
`),
|
`),
|
||||||
|
h('.cell.row', {
|
||||||
|
style: {
|
||||||
|
textAlign: 'center',
|
||||||
|
},
|
||||||
|
}, [
|
||||||
txMeta.simulationFails ?
|
txMeta.simulationFails ?
|
||||||
h('.error', {
|
h('.error', {
|
||||||
style: {
|
style: {
|
||||||
marginLeft: 50,
|
|
||||||
fontSize: '0.9em',
|
fontSize: '0.9em',
|
||||||
},
|
},
|
||||||
}, 'Transaction Error. Exception thrown in contract code.')
|
}, 'Transaction Error. Exception thrown in contract code.')
|
||||||
@ -276,7 +282,6 @@ PendingTx.prototype.render = function () {
|
|||||||
!isValidAddress ?
|
!isValidAddress ?
|
||||||
h('.error', {
|
h('.error', {
|
||||||
style: {
|
style: {
|
||||||
marginLeft: 50,
|
|
||||||
fontSize: '0.9em',
|
fontSize: '0.9em',
|
||||||
},
|
},
|
||||||
}, 'Recipient address is invalid. Sending this transaction will result in a loss of ETH.')
|
}, 'Recipient address is invalid. Sending this transaction will result in a loss of ETH.')
|
||||||
@ -285,12 +290,21 @@ PendingTx.prototype.render = function () {
|
|||||||
insufficientBalance ?
|
insufficientBalance ?
|
||||||
h('span.error', {
|
h('span.error', {
|
||||||
style: {
|
style: {
|
||||||
marginLeft: 50,
|
|
||||||
fontSize: '0.9em',
|
fontSize: '0.9em',
|
||||||
},
|
},
|
||||||
}, 'Insufficient balance for transaction')
|
}, 'Insufficient balance for transaction')
|
||||||
: null,
|
: null,
|
||||||
|
|
||||||
|
(dangerousGasLimit && gasLimitSpecified) ?
|
||||||
|
h('span.error', {
|
||||||
|
style: {
|
||||||
|
fontSize: '0.9em',
|
||||||
|
},
|
||||||
|
}, 'Gas limit set dangerously high. Approving this transaction is likely to fail.')
|
||||||
|
: null,
|
||||||
|
]),
|
||||||
|
|
||||||
|
|
||||||
// send + cancel
|
// send + cancel
|
||||||
h('.flex-row.flex-space-around.conf-buttons', {
|
h('.flex-row.flex-space-around.conf-buttons', {
|
||||||
style: {
|
style: {
|
||||||
|
Loading…
Reference in New Issue
Block a user