1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-23 03:36:18 +02:00
Commit Graph

3580 Commits

Author SHA1 Message Date
Brad Decker
e463a47588
do not show amounts for approvals (#9032) 2020-07-21 10:45:14 -05:00
Whymarrh Whitby
2ae4720443
Fix words (#9038) 2020-07-20 14:32:49 -02:30
Mark Stacey
4d66223f5c
Initialize extra report property (#9033)
The `extra` property of errors sent to Sentry is sometimes not
initialized when we add the application state. A check has been added
to initialize it if it's missing.

I suspect that this changed with v5 of `@sentry/browser`, though I
can't find any explicit confirmation of this in their changelog.
2020-07-17 20:31:18 -03:00
Whymarrh Whitby
68a64af5b3
Fix callback-return issues (#8996)
See [`callback-return`](https://eslint.org/docs/rules/callback-return) for more information.

This change enables `callback-return` and fixes the resulting issues.
2020-07-17 20:19:52 -02:30
MetaMask Bot
fef44e2303 Version v8.0.5 2020-07-17 12:42:51 -02:30
Mark Stacey
e8b33fb7c8
Restore state snapshot for Sentry errors (#9028)
The state snapshot that was attached to Sentry errors was removed
recently in #8794 because it had become too large. The snapshot has
now been restored and reduced in size.

A utility function has been written to reduce the state object to just
the requested properties. This seemed safer than filtering out state
that is known to be large or to contain identifiable information.
This is not a great solution, as now knowledge about the state shape
resides in this large constant, but it will suffice for now. I am
hopeful that we can decorate our controllers with this metadata in the
future instead, as part of the upcoming background controller refactor.

A separate `getSentryState` global function has been added to get the
reduced state, so that the old `getCleanAppState` function that we used
to use could remain unchanged. It's still useful to get that full state
copy while debugging, and in e2e tests.
2020-07-17 12:09:38 -03:00
Thomas Huang
f02478e026
Clear AccountTracker accounts and CachedBalances on createNewVaultAndRestore (#9023) 2020-07-16 19:09:38 -07:00
Thomas Huang
7b2218ac6e
Clear unapprovedTxs on createNewVaultAndRestore (#9026)
Clear unapproved transactions from txStateManager.transactions on createNewVaultAndRestore
2020-07-16 18:37:56 -07:00
Whymarrh Whitby
c7fad8f400
Limit number of transactions passed outside of TransactionController (#9010)
Refs #8572
Refs #8991

This change limits the number of transactions (`txMeta`s) that are passed
outside of the `TransactionController`, resulting in shorter serialization and
deserialization times when state is moved between the background and UI
contexts.

`TransactionController#_updateMemstore`
---------------------------------------

The `currentNetworkTxList` state of the `TransactionController` is used
externally (i.e. outside of the controller) as the canonical source for
the full transaction history. Prior to this change, the method would iterate
the full transaction history and possibly return all of it.

This change limits it to `MAX_MEMSTORE_TX_LIST_SIZE` to make sure that:

1. Calls to `_updateMemstore` are fast(er)
2. Passing `currentNetworkTxList` around is fast(er)

(Shown in #8377, `_updateMemstore`, is called _frequently_ when a transaction
is pending.)

The list is iterated backwards because it is possible that new transactions are
at the end of the list. [1]

Results
-------

In profiles before this change, with ~3k transactions locally,
`PortDuplexStream._onMessage` took up to ~4.5s to complete when the set of
transactions is included. [2]

In profiles after this change, `PortDuplexStream._onMessage` took ~90ms to
complete. [3]

Before vs. after profile screenshots:

![Profile 1][2]
![Profile 2][3]

  [1]:5a3ae85b72/app/scripts/controllers/transactions/tx-state-manager.js (L172-L174)
  [2]:https://user-images.githubusercontent.com/1623628/87613203-36f51d80-c6e7-11ea-89bc-11a1cc2f3b1e.png
  [3]:https://user-images.githubusercontent.com/1623628/87613215-3bb9d180-c6e7-11ea-8d85-aff3acbd0374.png
  [8337]:https://github.com/MetaMask/metamask-extension/issues/8377
  [8572]:https://github.com/MetaMask/metamask-extension/issues/8572
  [8991]:https://github.com/MetaMask/metamask-extension/issues/8991
2020-07-16 17:52:41 -02:30
Mark Stacey
022ef13372
Fix migration 47 (#9014)
This migration had referred to the non-existent
`TransactionsController` instead of `TransactionController`, so it
effectively did nothing. Now it should work.

This migration hasn't been included in any release yet, so we can fix
it in-place instead of adding an additional corrected migration.

The migration comment has also been updated, as it was inaccurate.
2020-07-16 10:16:41 -03:00
Mark Stacey
01301087ea
Fix web3_clientVersion method (#8998)
This method was accidentally broken with the introduction of the
permissions controller, as this was missing from the list of safe
methods.

It is now included in the list of safe methods.

Fixes #8993
2020-07-15 15:34:10 -03:00
Whymarrh Whitby
4f0a205369
Use eslint@6.8.0 (#8978)
* Use eslint@6.8.0
* yarn lint:fix
2020-07-14 12:50:41 -02:30
Whymarrh Whitby
46a6027a4e
Remove isBrave Sentry flag (#8967) 2020-07-10 17:23:57 -02:30
Whymarrh Whitby
c6d9416944
Remove unsupport.html (#8966)
This removes the `app/unsupport.html` file as it is unused. There are no references to it.
2020-07-10 14:58:04 -02:30
Whymarrh Whitby
511cf77895
Remove unused images (#8965) 2020-07-10 14:57:48 -02:30
Brad Decker
9c54b2d8d5
remove superfulous fonts (#8954) 2020-07-10 10:42:59 -05:00
Mark Stacey
f1bfb84b4b
Throw error upon currency update failure (#8944)
The currency rate controller is updated upon each network change, as
the "native currency" is network-dependent and might have changed.
However, any thrown errors were being caught and passed to an empty
callback.

The errors are now re-thrown in the callback. As a result, the errors
will now be printed to the console and sent to Sentry.
2020-07-08 18:44:38 -03:00
Mark Stacey
8ff1d05df3
Remove recipient blocklist checker (#8943)
It seems that this blocklist checker never worked correctly. Ever since
the initial commit, it was comparing the Number `1` to the `networkId`,
which is a string. Additionally, even if it did throw, the transaction
continued unhindered. The user could still approve it, and there was no
indication shown to the user that anything went wrong. Also some of the
blocklist entries were incorrectly mixed-case, and were never hit.

We can remove this for now, and re-add it later on after we rewrite the
transaction controller.
2020-07-08 18:34:54 -03:00
Erik Marks
652db3fd36
Use string network and chain IDs (#8628)
* convert network id enums to string

* stringify appropriate chain/network ids in tests

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-07-08 14:05:09 -07:00
Mark Stacey
a71cc2b137
Fix display of incoming transactions (#8942)
The `metamaskNetworkId` property in the `txMeta` for incoming
transactions was incorrectly set as a Number instead of a String. This
change was made accidentally as part of #8627.

As a result incoming transactions were being excluded from the
transaction list, as they didn't have a matching network ID.

`metamaskNetworkId` is now set to a string, and a migration has been
added to ensure `metamaskNetworkId` is converted to a string for any
incoming transactions in state.
2020-07-08 16:48:39 -03:00
MetaMask Bot
015008c147 Version v8.0.4 2020-07-07 22:29:28 +00:00
Mark Stacey
429af23ea0
Fix account tracker optimization (#8936)
An optimization in `account-tracker.js` was being skipped consistently
due to a type error (a number was being compared to a string).

The optimization in this case was to update the balances for all
accounts with a single request, rather than one request per account.
2020-07-07 19:16:38 -03:00
MetaMask Bot
8362609b5c Version v8.0.3 2020-07-06 15:50:43 -03:00
matteopey
d7f6c26fd5
Update Italian translations (#8917) 2020-07-06 11:09:30 -02:30
Erik Marks
8bc02d4b5e
rpc-cap@3.0.0 (#8924)
* rpc-cap@3.0.0

* adapt use of rpc-cap for new major version
2020-07-05 12:49:22 -07:00
Mark Stacey
264a32d268
Merge pull request #8915 from MetaMask/master
Sync `master` with `develop`
2020-07-03 15:33:21 -03:00
Erik Marks
69fb521c7a
Begin consolidating network enums (#8914) 2020-07-03 11:10:58 -07:00
MetaMask Bot
e0c3277287 Version v8.0.2 2020-07-03 14:29:23 -03:00
Erik Marks
f97f95cc86
Fix kovan chain ID constant (#8913) 2020-07-03 10:14:43 -07:00
MetaMask Bot
03bbd400d9 Version v8.0.1 2020-07-02 21:52:50 -03:00
Mark Stacey
b25f4bbe4a
Prevent manually connecting to extension UI (#8893)
The `activeTab.id` property is relied upon in the connected sites modal
to prevent the user from manually connecting to the MetaMask extension
itself. Unfortunately the `id` property was never set.

`id` is now set on the `activeTab` state, so manually connecting to the
extension UI is now impossible.
2020-07-02 18:26:45 -03:00
Mark Stacey
a294ca7125
Set empty active tab if origin is invalid (#8890)
The `activeTab` state is now set to an empty object if the `origin` of
the active tab is missing or invalid. It can be invalid if the URL
passed to the `URL` constructor is missing a scheme (e.g.
`about: blank`).

There are currently no cases where the rest of the data in `activeTab`
is useful in the absence of an `origin`. This will make upcoming UI
logic changes a bit simpler than they would be otherwise. Now we can
assume that if any property is set on `activeTab`, it must have a valid
`origin`.
2020-07-02 18:01:04 -03:00
Thomas Huang
259d19850f
Account for a custom nonce of zero (#8883)
* Account for a custom nonce of zero
* Remove default value for customNonceValue
2020-07-02 12:58:12 -07:00
Mark Stacey
7ac0014de8 Merge remote-tracking branch 'origin/develop' into Version-v8.0.0
* origin/develop:
  feature/sync imported accounts with mobile (#8631)
  Fix account order on unconnected account alert (#8863)
2020-06-25 22:48:20 -03:00
Esteban Miño
73257b1cd1
feature/sync imported accounts with mobile (#8631)
* sync imported accounts

* Update app/scripts/metamask-controller.js

Co-authored-by: Mark Stacey <markjstacey@gmail.com>

* exportAccounts action

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-06-25 22:04:17 -03:00
Mark Stacey
b34dbe9ae1 Merge remote-tracking branch 'origin/develop' into Version-v8.0.0
* origin/develop:
  Restore list item title attributes (#8858)
  Fix mobile sync redirect (#8860)
  Align copy tooltip text and icon (#8861)
  Update inpage provider, deprecation warnings (#8854)
  Update test-dapp (#8856)
  Return after 'reject' in Promise constructor (#8857)
  Replace removed 'copy-to-clipboard' icon (#8853)
  Stop upper-casing exported private key (#8850)
2020-06-24 19:42:34 -03:00
Erik Marks
242db43700
Update inpage provider, deprecation warnings (#8854) 2020-06-24 15:21:57 -07:00
Mark Stacey
828ec0530a
Return after 'reject' in Promise constructor (#8857)
There were three cases where execution unintentionally continued after
an error was encountered. These cases likely are impossible to
encounter in practice due to recent validation improvements in the
`eth-json-rpc-middleware/wallet` module, but they were broken
nonetheless.

Execution inside the Promise constructor now halts immediately after
`reject` is called.
2020-06-24 16:38:53 -03:00
Mark Stacey
cee773e1b5 Merge remote-tracking branch 'origin/develop' into Version-v8.0.0
* origin/develop:
  Fix signing method bugs (#8833)
  replace icons with Checkbox component (#8830)
  Use gulp-cli@2.3.0 (#8845)
  Use node-sass@4.14.1 (#8844)
  Call getMethodDataAsync when knownMethodData[fourBytePrefix] object is empty (#8836)
  Update connected status popover content (#8834)
  Use @metamask/controllers@2.0.1 (#8832)
  ParseInt nextworkNextNonce correction (#8827)
  Fix first time onboarding popup position (#8829)
  fix overflowing contract names and origins (#8823)
  Hide 'Expand view' button in fullscreen (#8826)
2020-06-23 13:13:52 -03:00
Erik Marks
04de9a92c5
Fix signing method bugs (#8833)
* update signTypedData validation

* update tests for new eth-json-rpc-middleware

* remove lowercasing of tx 'from' addresses
2020-06-23 09:12:11 -07:00
Erik Marks
b090625dc1
Update connected status popover content (#8834)
* update connected status popover content

* update highlight styling
2020-06-21 14:00:06 -07:00
Thomas Huang
753a3eb4c9
ParseInt nextworkNextNonce correction (#8827)
* networkNextNonce toNumber

* nonceBN for all getTransactionCount

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-06-17 14:13:33 -07:00
Mark Stacey
d730c28cd9 Merge remote-tracking branch 'origin/develop' into Version-v8.0.0
* origin/develop:
  Use error.value.message with error.message as fallback (#8825)
  Fix dropped tx detection (#8824)
  delete targetDomainMetadata selector
  remove top/bottom margin on info icon (#8822)
  add send token button on fullscreen asset list (#8812)
  fix getTargetDomainMetadata selector
  select current address in permissions connect (#8811)
  Fix encrypt/decrypt beforeunload bugs (#8816)
2020-06-17 00:30:42 -03:00
Thomas Huang
792366a20f
Use error.value.message with error.message as fallback (#8825)
* Use  over the whole stringified error object which doesn't show the actual error message that is set as the

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
* Feedback commit
2020-06-16 16:21:56 -07:00
Mark Stacey
3b2bbe0705
Fix dropped tx detection (#8824)
The code for checking whether a transaction was dropped or not was
refactored in #8398, but in the process an off-by-one error was
introduced.

The old version of `_checkIfTxWasDropped` would query for an updated
transaction count from the network, and would consider the pending
transaction to be dropped if the count was above the nonce. However,
the version introduced in #8398 considers the transaction to be dropped
if the count is above *or equal to* the nonce.

The pending transaction nonce is expected to be equal to the
transaction count, because the nonce starts at zero. The transaction
count is equal to the expected next nonce.

The variable name has been updated to make this more clear
(`networkNextNonce` is how the `nonce-tracker` refers to this value).

`parseInt` is now called with an explicit radix of `16` as well, to
ensure both nonce strings are always parsed as hex. In all cases I am
aware of, these nonce strings were prefixed by `0x`, meaning that
`parseInt` would default to a radix of `16`, so this likely doesn't
constitute a functional change.

Fixes #8688
2020-06-16 18:05:48 -03:00
Erik Marks
0813cc5c88
Fix encrypt/decrypt beforeunload bugs (#8816) 2020-06-16 07:40:00 -07:00
Mark Stacey
584ff9ec8a Merge remote-tracking branch 'origin/develop' into Version-v8.0.0
* origin/develop: (58 commits)
  Fix site icon fallback letter (#8815)
  add hover style to list-item (#8813)
  Fix site icon size (#8814)
  Consolidate connected account alerts (#8802)
  lowercase web3
  Use markdown-to-jsx@6.11.4 (#8809)
  Update app/_locales/en/messages.json
  Update app/_locales/en/messages.json
  also remove 'dapp' from descriptions
  remove all user-facing instances of 'dapp'
  update button styling on home/asset page (#8800)
  Fix handling of permissions of removed accounts (#8803)
  Clear permssions during createNewVaultAndRestore (#8804)
  Hide token transfers on ETH asset page (#8799)
  Fix account name editing (#8801)
  Fix connect flow account list height (#8798)
  Update color of menu item icons (#8797)
  Update "Connected accounts" empty description (#8796)
  Stop reporting failed transactions to Sentry (#8795)
  Omit state snapshot from Sentry errors (#8794)
  ...
2020-06-16 10:03:14 -03:00
Erik Marks
c391291f43
Merge branch 'develop' into remove-the-word-dapp 2020-06-15 12:11:10 -07:00
Erik Marks
4dfe4e7463
Consolidate connected account alerts (#8802)
* update connected accounts appearance

* consolidate account alerts

* UnconnectedAccountAlert: use ConnectedAccountsList

* move switch account action out of menu in all views

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-06-15 12:08:53 -07:00
Erik Marks
a48ec51c36 lowercase web3 2020-06-15 11:54:51 -07:00