aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorDan J Miller <danjm.com@gmail.com>2019-05-23 21:56:40 +0800
committerGitHub <noreply@github.com>2019-05-23 21:56:40 +0800
commit5e2fd8ae868f1f61096b97ea72afd52651fc925d (patch)
tree078c83c9274b6891bf5a94b80325bad13868b6ea /ui
parent2b5c7b82a95dea4ddb50917daa52fae07715e210 (diff)
downloadtangerine-wallet-browser-5e2fd8ae868f1f61096b97ea72afd52651fc925d.tar
tangerine-wallet-browser-5e2fd8ae868f1f61096b97ea72afd52651fc925d.tar.gz
tangerine-wallet-browser-5e2fd8ae868f1f61096b97ea72afd52651fc925d.tar.bz2
tangerine-wallet-browser-5e2fd8ae868f1f61096b97ea72afd52651fc925d.tar.lz
tangerine-wallet-browser-5e2fd8ae868f1f61096b97ea72afd52651fc925d.tar.xz
tangerine-wallet-browser-5e2fd8ae868f1f61096b97ea72afd52651fc925d.tar.zst
tangerine-wallet-browser-5e2fd8ae868f1f61096b97ea72afd52651fc925d.zip
Ensures that transactions cannot be confirmed if gas limit is below 21000. (#6625)
Diffstat (limited to 'ui')
-rw-r--r--ui/app/components/app/gas-customization/gas-modal-page-container/gas-modal-page-container.container.js17
-rw-r--r--ui/app/pages/confirm-transaction-base/confirm-transaction-base.component.js9
2 files changed, 24 insertions, 2 deletions
diff --git a/ui/app/components/app/gas-customization/gas-modal-page-container/gas-modal-page-container.container.js b/ui/app/components/app/gas-customization/gas-modal-page-container/gas-modal-page-container.container.js
index c3fdf51e5..9da9a2ef6 100644
--- a/ui/app/components/app/gas-customization/gas-modal-page-container/gas-modal-page-container.container.js
+++ b/ui/app/components/app/gas-customization/gas-modal-page-container/gas-modal-page-container.container.js
@@ -201,7 +201,20 @@ const mapDispatchToProps = dispatch => {
}
const mergeProps = (stateProps, dispatchProps, ownProps) => {
- const { gasPriceButtonGroupProps, isConfirm, txId, isSpeedUp, insufficientBalance, maxModeOn, customGasPrice, customGasTotal, balance, selectedToken, tokenBalance} = stateProps
+ const {
+ gasPriceButtonGroupProps,
+ isConfirm,
+ txId,
+ isSpeedUp,
+ insufficientBalance,
+ maxModeOn,
+ customGasPrice,
+ customGasTotal,
+ balance,
+ selectedToken,
+ tokenBalance,
+ customGasLimit,
+ } = stateProps
const {
updateCustomGasPrice: dispatchUpdateCustomGasPrice,
hideGasButtonGroup: dispatchHideGasButtonGroup,
@@ -251,7 +264,7 @@ const mergeProps = (stateProps, dispatchProps, ownProps) => {
dispatchHideSidebar()
}
},
- disableSave: insufficientBalance || (isSpeedUp && customGasPrice === 0),
+ disableSave: insufficientBalance || (isSpeedUp && customGasPrice === 0) || customGasLimit < 21000,
}
}
diff --git a/ui/app/pages/confirm-transaction-base/confirm-transaction-base.component.js b/ui/app/pages/confirm-transaction-base/confirm-transaction-base.component.js
index 3c4e6dcac..c6a05cf0f 100644
--- a/ui/app/pages/confirm-transaction-base/confirm-transaction-base.component.js
+++ b/ui/app/pages/confirm-transaction-base/confirm-transaction-base.component.js
@@ -9,6 +9,7 @@ import { DEFAULT_ROUTE, CONFIRM_TRANSACTION_ROUTE } from '../../helpers/constant
import {
INSUFFICIENT_FUNDS_ERROR_KEY,
TRANSACTION_ERROR_KEY,
+ GAS_LIMIT_TOO_LOW_ERROR_KEY,
} from '../../helpers/constants/error-keys'
import { CONFIRMED_STATUS, DROPPED_STATUS } from '../../helpers/constants/transactions'
import UserPreferencedCurrencyDisplay from '../../components/app/user-preferenced-currency-display'
@@ -134,6 +135,7 @@ export default class ConfirmTransactionBase extends Component {
value: amount,
} = {},
} = {},
+ customGas,
} = this.props
const insufficientBalance = balance && !isBalanceSufficient({
@@ -150,6 +152,13 @@ export default class ConfirmTransactionBase extends Component {
}
}
+ if (customGas.gasLimit < 21000) {
+ return {
+ valid: false,
+ errorKey: GAS_LIMIT_TOO_LOW_ERROR_KEY,
+ }
+ }
+
if (simulationFails) {
return {
valid: true,