Merge pull request #2476 from MetaMask/100MweiMinGasPrice

Reduce minimum gas price to 100 MWEI
feature/default_network_editable
Dan Finlay 7 years ago committed by GitHub
commit 2489caddd4
  1. 1
      CHANGELOG.md
  2. 16
      ui/app/components/bn-as-decimal-input.js
  3. 11
      ui/app/components/pending-tx.js

@ -3,6 +3,7 @@
## Current Master ## Current Master
- Add support for alternative ENS TLDs (Ethereum Name Service Top-Level Domains). - Add support for alternative ENS TLDs (Ethereum Name Service Top-Level Domains).
- Lower minimum gas price to 0.1 GWEI.
## 3.11.2 2017-10-21 ## 3.11.2 2017-10-21

@ -31,6 +31,8 @@ BnAsDecimalInput.prototype.render = function () {
const suffix = props.suffix const suffix = props.suffix
const style = props.style const style = props.style
const valueString = value.toString(10) const valueString = value.toString(10)
const newMin = min && this.downsize(min.toString(10), scale)
const newMax = max && this.downsize(max.toString(10), scale)
const newValue = this.downsize(valueString, scale) const newValue = this.downsize(valueString, scale)
return ( return (
@ -47,8 +49,8 @@ BnAsDecimalInput.prototype.render = function () {
type: 'number', type: 'number',
step: 'any', step: 'any',
required: true, required: true,
min, min: newMin,
max, max: newMax,
style: extend({ style: extend({
display: 'block', display: 'block',
textAlign: 'right', textAlign: 'right',
@ -128,15 +130,17 @@ BnAsDecimalInput.prototype.updateValidity = function (event) {
} }
BnAsDecimalInput.prototype.constructWarning = function () { BnAsDecimalInput.prototype.constructWarning = function () {
const { name, min, max } = this.props const { name, min, max, scale, suffix } = this.props
const newMin = min && this.downsize(min.toString(10), scale)
const newMax = max && this.downsize(max.toString(10), scale)
let message = name ? name + ' ' : '' let message = name ? name + ' ' : ''
if (min && max) { if (min && max) {
message += `must be greater than or equal to ${min} and less than or equal to ${max}.` message += `must be greater than or equal to ${newMin} ${suffix} and less than or equal to ${newMax} ${suffix}.`
} else if (min) { } else if (min) {
message += `must be greater than or equal to ${min}.` message += `must be greater than or equal to ${newMin} ${suffix}.`
} else if (max) { } else if (max) {
message += `must be less than or equal to ${max}.` message += `must be less than or equal to ${newMax} ${suffix}.`
} else { } else {
message += 'Invalid input.' message += 'Invalid input.'
} }

@ -15,10 +15,9 @@ const addressSummary = util.addressSummary
const nameForAddress = require('../../lib/contract-namer') const nameForAddress = require('../../lib/contract-namer')
const BNInput = require('./bn-as-decimal-input') const BNInput = require('./bn-as-decimal-input')
const MIN_GAS_PRICE_GWEI_BN = new BN(1) // corresponds with 0.1 GWEI
const GWEI_FACTOR = new BN(1e9) const MIN_GAS_PRICE_BN = new BN('100000000')
const MIN_GAS_PRICE_BN = MIN_GAS_PRICE_GWEI_BN.mul(GWEI_FACTOR) const MIN_GAS_LIMIT_BN = new BN('21000')
const MIN_GAS_LIMIT_BN = new BN(21000)
module.exports = PendingTx module.exports = PendingTx
inherits(PendingTx, Component) inherits(PendingTx, Component)
@ -175,7 +174,7 @@ PendingTx.prototype.render = function () {
precision: 0, precision: 0,
scale: 0, scale: 0,
// The hard lower limit for gas. // The hard lower limit for gas.
min: MIN_GAS_LIMIT_BN.toString(10), min: MIN_GAS_LIMIT_BN,
max: safeGasLimit, max: safeGasLimit,
suffix: 'UNITS', suffix: 'UNITS',
style: { style: {
@ -200,7 +199,7 @@ PendingTx.prototype.render = function () {
precision: 9, precision: 9,
scale: 9, scale: 9,
suffix: 'GWEI', suffix: 'GWEI',
min: MIN_GAS_PRICE_GWEI_BN.toString(10), min: MIN_GAS_PRICE_BN,
style: { style: {
position: 'relative', position: 'relative',
top: '5px', top: '5px',

Loading…
Cancel
Save