From 222e62d7f10ffe22dd606aea9c15e1547986c4ab Mon Sep 17 00:00:00 2001 From: Howard Braham Date: Mon, 17 Sep 2018 20:04:10 -0700 Subject: Bug Fix: #1789 and #4525 eth.getCode() with no contract --- old-ui/app/components/pending-tx.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'old-ui/app/components/pending-tx.js') diff --git a/old-ui/app/components/pending-tx.js b/old-ui/app/components/pending-tx.js index c8132539c..7d8c94699 100644 --- a/old-ui/app/components/pending-tx.js +++ b/old-ui/app/components/pending-tx.js @@ -489,7 +489,7 @@ PendingTx.prototype.verifyGasParams = function () { } PendingTx.prototype._notZeroOrEmptyString = function (obj) { - return obj !== '' && obj !== '0x0' + return obj !== '' && obj !== '0x0' && obj !== '0x' // The '0x' case might not ever happen, but it seems safest to protect against it } PendingTx.prototype.bnMultiplyByFraction = function (targetBN, numerator, denominator) { -- cgit v1.2.3 From 4cc0b1ef01573e1541d18bdcd89650e1db32ae9a Mon Sep 17 00:00:00 2001 From: Howard Braham Date: Fri, 28 Sep 2018 11:01:34 -0700 Subject: ganache-core merged my PR, so I changed some comments to clarify that ganache-core v2.2.1 and below will return the non-standard '0x0' --- old-ui/app/components/pending-tx.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'old-ui/app/components/pending-tx.js') diff --git a/old-ui/app/components/pending-tx.js b/old-ui/app/components/pending-tx.js index 7d8c94699..d8d2334a4 100644 --- a/old-ui/app/components/pending-tx.js +++ b/old-ui/app/components/pending-tx.js @@ -489,7 +489,7 @@ PendingTx.prototype.verifyGasParams = function () { } PendingTx.prototype._notZeroOrEmptyString = function (obj) { - return obj !== '' && obj !== '0x0' && obj !== '0x' // The '0x' case might not ever happen, but it seems safest to protect against it + return obj !== '' && obj !== '0x0' && obj !== '0x' // '0x' means null } PendingTx.prototype.bnMultiplyByFraction = function (targetBN, numerator, denominator) { -- cgit v1.2.3 From fda101912bbb99f7f1adbac9856d34105390c408 Mon Sep 17 00:00:00 2001 From: kumavis Date: Sun, 21 Oct 2018 00:52:41 -0400 Subject: ui - use variable to clarify result of emptiness check --- old-ui/app/components/pending-tx.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'old-ui/app/components/pending-tx.js') diff --git a/old-ui/app/components/pending-tx.js b/old-ui/app/components/pending-tx.js index d8d2334a4..b02476f46 100644 --- a/old-ui/app/components/pending-tx.js +++ b/old-ui/app/components/pending-tx.js @@ -488,8 +488,10 @@ PendingTx.prototype.verifyGasParams = function () { ) } -PendingTx.prototype._notZeroOrEmptyString = function (obj) { - return obj !== '' && obj !== '0x0' && obj !== '0x' // '0x' means null +PendingTx.prototype._notZeroOrEmptyString = function (value) { + // Geth will return '0x', and ganache-core v2.2.1 will return '0x0' + const valueIsEmpty = !value || value === '0x' || value === '0x0' + return !valueIsEmpty } PendingTx.prototype.bnMultiplyByFraction = function (targetBN, numerator, denominator) { -- cgit v1.2.3 From 9b501b7c42ebebb61ac3130d1e84d36efcac9b7e Mon Sep 17 00:00:00 2001 From: kumavis Date: Thu, 25 Oct 2018 22:24:08 -0400 Subject: old-ui - pending tx - allow undefined values for gas + gasPrice --- old-ui/app/components/pending-tx.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'old-ui/app/components/pending-tx.js') diff --git a/old-ui/app/components/pending-tx.js b/old-ui/app/components/pending-tx.js index b02476f46..35e81210e 100644 --- a/old-ui/app/components/pending-tx.js +++ b/old-ui/app/components/pending-tx.js @@ -1,4 +1,5 @@ const Component = require('react').Component +const connect = require('react-redux').connect const h = require('react-hyperscript') const inherits = require('util').inherits const actions = require('../../../ui/app/actions') @@ -19,7 +20,9 @@ const BNInput = require('./bn-as-decimal-input') const MIN_GAS_PRICE_BN = new BN('0') const MIN_GAS_LIMIT_BN = new BN('21000') -module.exports = PendingTx +module.exports = connect()(PendingTx) + + inherits(PendingTx, Component) function PendingTx () { Component.call(this) @@ -445,7 +448,8 @@ PendingTx.prototype.onSubmit = function (event) { const txMeta = this.gatherTxMeta() const valid = this.checkValidity() this.setState({ valid, submitting: true }) - if (valid && this.verifyGasParams()) { + const validGasParams = this.verifyGasParams() + if (valid && validGasParams) { this.props.sendTransaction(txMeta, event) } else { this.props.dispatch(actions.displayWarning('Invalid Gas Parameters')) @@ -489,6 +493,8 @@ PendingTx.prototype.verifyGasParams = function () { } PendingTx.prototype._notZeroOrEmptyString = function (value) { + // allow undefined values + if (value === undefined) return true // Geth will return '0x', and ganache-core v2.2.1 will return '0x0' const valueIsEmpty = !value || value === '0x' || value === '0x0' return !valueIsEmpty -- cgit v1.2.3