Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into HEAD
Browse files Browse the repository at this point in the history
* origin/master: (34 commits)
  Update changelog for v7.2.3
  Fix e2e tests and gas default (#7267)
  Do not transate on seed phrases
  test:integration - fix renamed test data file
  lint fix
  test:e2e - fix bail condition
  test:e2e - fix responsie argument
  test:e2e - refactor missed spec file
  test:e2e - only overwrite window.fetch once per session
  test:e2e - rework fetch-mocks
  test:e2e - add extra delay before closing popups
  test:e2e - factor out prepareExtensionForTesting
  test - e2e - dedupe fetchMocking + compose script as fn
  Ensure correct tx category when sending to contracts without tx data (#7252)
  Version v7.2.3
  Add v7.2.2 to changelog
  Update minimum Firefox verison to 56.0 (#7213)
  Version v7.2.2
  Update changelog for v7.2.1, v7.2.0, and v7.1.1
  Add `appName` message to each locale
  ...
  • Loading branch information
Gudahtt committed Oct 9, 2019
2 parents b09c1f3 + bafcbc9 commit 8ec22e9
Show file tree
Hide file tree
Showing 10 changed files with 66 additions and 15 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
## 7.3.0 Fri Sep 27 2019
- [#7168](https://github.com/MetaMask/metamask-extension/pull/7168): Add fixes for German translations

## 7.2.3 Fri Oct 04 2019
- [#7252](https://github.com/MetaMask/metamask-extension/pull/7252): Fix gas limit when sending tx without data to a contract
- [#7260](https://github.com/MetaMask/metamask-extension/pull/7260): Do not transate on seed phrases

## 7.2.2 Tue Sep 24 2019
- [#7213](https://github.com/MetaMask/metamask-extension/pull/7213): Update minimum Firefox verison to 56.0

## 7.2.1 Tue Sep 17 2019
- [#7180](https://github.com/MetaMask/metamask-extension/pull/7180): Add `appName` message to each locale

Expand Down
14 changes: 7 additions & 7 deletions app/scripts/controllers/transactions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -603,21 +603,21 @@ class TransactionController extends EventEmitter {
].find(tokenMethodName => tokenMethodName === name && name.toLowerCase())

let result
let code
if (!txParams.data) {
result = SEND_ETHER_ACTION_KEY
} else if (tokenMethodName) {
if (txParams.data && tokenMethodName) {
result = tokenMethodName
} else if (!to) {
} else if (txParams.data && !to) {
result = DEPLOY_CONTRACT_ACTION_KEY
} else {
}

let code
if (!result) {
try {
code = await this.query.getCode(to)
} catch (e) {
code = null
log.warn(e)
}
// For an address with no code, geth will return '0x', and ganache-core v2.2.1 will return '0x0'

const codeIsEmpty = !code || code === '0x' || code === '0x0'

result = codeIsEmpty ? SEND_ETHER_ACTION_KEY : CONTRACT_INTERACTION_KEY
Expand Down
9 changes: 5 additions & 4 deletions test/e2e/metamask-ui.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -563,19 +563,20 @@ describe('MetaMask', function () {
const dapp = windowHandles[1]

await driver.switchTo().window(dapp)
await delay(regularDelayMs)
await delay(largeDelayMs)

const send3eth = await findElement(driver, By.xpath(`//button[contains(text(), 'Send')]`), 10000)
await send3eth.click()
await delay(regularDelayMs)
await delay(largeDelayMs)

const contractDeployment = await findElement(driver, By.xpath(`//button[contains(text(), 'Deploy Contract')]`), 10000)
await contractDeployment.click()
await delay(regularDelayMs)
await delay(largeDelayMs)

await send3eth.click()
await delay(largeDelayMs)
await contractDeployment.click()
await delay(regularDelayMs)
await delay(largeDelayMs)

await driver.switchTo().window(extension)
await delay(regularDelayMs)
Expand Down
30 changes: 30 additions & 0 deletions test/unit/app/controllers/transactions/tx-controller-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,36 @@ describe('Transaction Controller', function () {
})
assert.deepEqual(result, { transactionCategory: CONTRACT_INTERACTION_KEY, getCodeResponse: '0x0a' })
})

it('should return a contract interaction transactionCategory with the correct getCodeResponse when to is a contract address and data is falsey', async function () {
const _providerResultStub = {
// 1 gwei
eth_gasPrice: '0x0de0b6b3a7640000',
// by default, all accounts are external accounts (not contracts)
eth_getCode: '0xa',
}
const _provider = createTestProviderTools({ scaffold: _providerResultStub }).provider
const _fromAccount = getTestAccounts()[0]
const _blockTrackerStub = new EventEmitter()
_blockTrackerStub.getCurrentBlock = noop
_blockTrackerStub.getLatestBlock = noop
const _txController = new TransactionController({
provider: _provider,
getGasPrice: function () { return '0xee6b2800' },
networkStore: new ObservableStore(currentNetworkId),
txHistoryLimit: 10,
blockTracker: _blockTrackerStub,
signTransaction: (ethTx) => new Promise((resolve) => {
ethTx.sign(_fromAccount.key)
resolve()
}),
})
const result = await _txController._determineTransactionCategory({
to: '0x9e673399f795D01116e9A8B2dD2F156705131ee9',
data: '',
})
assert.deepEqual(result, { transactionCategory: CONTRACT_INTERACTION_KEY, getCodeResponse: '0x0a' })
})
})

describe('#getPendingTransactions', function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class ExportTextContainer extends Component {
return (
h('.export-text-container', [
h('.export-text-container__text-container', [
h('.export-text-container__text', text),
h('.export-text-container__text.notranslate', text),
]),
h('.export-text-container__buttons-container', [
h('.export-text-container__button.export-text-container__button--copy', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class DraggableSeed extends Component {
return connectDropTarget(connectDragSource(
<div
key={index}
className={classnames('btn-secondary confirm-seed-phrase__seed-word', className, {
className={classnames('btn-secondary notranslate confirm-seed-phrase__seed-word', className, {
'confirm-seed-phrase__seed-word--selected btn-primary': selected,
'confirm-seed-phrase__seed-word--dragging': isDragging,
'confirm-seed-phrase__seed-word--empty': !word,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export default class RevealSeedPhrase extends PureComponent {
return (
<div className="reveal-seed-phrase__secret">
<div className={classnames(
'reveal-seed-phrase__secret-words',
'reveal-seed-phrase__secret-words notranslate',
{ 'reveal-seed-phrase__secret-words--hidden': !isShowingSeedPhrase }
)}>
{ seedPhrase }
Expand Down
2 changes: 1 addition & 1 deletion ui/app/pages/send/send.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ export default class SendTransactionScreen extends PersistentForm {
}}
onChange={this.onRecipientInputChange}
onValidAddressTyped={(address) => this.props.updateSendTo(address, '')}
onPaste={text => this.props.updateSendTo(text)}
onPaste={text => { this.props.updateSendTo(text) && this.updateGas() }}
onReset={() => this.props.updateSendTo('', '')}
updateEnsResolution={this.props.updateSendEnsResolution}
updateEnsResolutionError={this.props.updateSendEnsResolutionError}
Expand Down
5 changes: 5 additions & 0 deletions ui/app/pages/send/send.utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,12 +243,17 @@ async function estimateGas ({
}

// if not, fall back to block gasLimit
if (!blockGasLimit) {
blockGasLimit = MIN_GAS_LIMIT_HEX
}

paramsForGasEstimate.gas = ethUtil.addHexPrefix(multiplyCurrencies(blockGasLimit, 0.95, {
multiplicandBase: 16,
multiplierBase: 10,
roundDown: '0',
toNumericBase: 'hex',
}))

// run tx
return new Promise((resolve, reject) => {
return estimateGasMethod(paramsForGasEstimate, (err, estimatedGas) => {
Expand Down
8 changes: 8 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -24427,6 +24427,14 @@ source-map-support@^0.4.15:
dependencies:
source-map "^0.5.6"

source-map-support@~0.5.12:
version "0.5.13"
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.13.tgz#31b24a9c2e73c2de85066c0feb7d44767ed52932"
integrity sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w==
dependencies:
buffer-from "^1.0.0"
source-map "^0.6.0"

source-map-url@^0.4.0:
version "0.4.0"
resolved "https://registry.yarnpkg.com/source-map-url/-/source-map-url-0.4.0.tgz#3e935d7ddd73631b97659956d55128e87b5084a3"
Expand Down

0 comments on commit 8ec22e9

Please sign in to comment.