Thomas Huang
3ba91df387
Unifies unit tests filename suffix to .test.js ( #10607 )
...
* Unifies the filename suffix to .test.js
* Display @babel/no-invalid-this rule for tx-controller.test.js
* Add test file extension to test:unit:global
2021-03-09 11:08:06 -08:00
Brad Decker
616b71271a
add chainId to all new transaction metadata ( #10528 )
2021-03-01 09:15:42 -06:00
Brad Decker
19fa2f5962
cancel unapproved confirmations on network change ( #10357 )
2021-02-08 17:22:30 -06:00
Erik Marks
76a2a9bb8b
@metamask/eslint config@5.0.0 ( #10358 )
...
* @metamask/eslint-config@5.0.0
* Update eslintrc and prettierrc
* yarn lint:fix
2021-02-04 10:15:23 -08:00
Erik Marks
e05be40d92
@metamask/obs-store@5.0.0 ( #10092 )
2020-12-16 13:14:49 -08:00
Erik Marks
baea1b57fb
Update transaction params validation ( #9992 )
...
* Update transaction params validation
* fixup! Update transaction params validation
* Update to/data error message
* fixup! Update to/data error message
2020-12-03 18:15:59 -08:00
Brad Decker
a49a4a066c
expand transaction constants coverage ( #9790 )
...
* expand transaction constants coverage
* touchups
* dont import inside of e2e
* Update app/scripts/controllers/transactions/tx-state-manager.js
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
* Update test/unit/app/controllers/transactions/tx-controller-test.js
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-11-07 01:38:12 -06:00
Brad Decker
026a06b39d
add shared transaction constants ( #9459 )
...
Co-authored-by: Erik Marks <25517051+rekmarks@users.noreply.github.com>
2020-11-03 16:57:51 -06:00
Brad Decker
2ebf8756a4
[RFC] add prettier to eslint ( #8595 )
2020-11-02 17:41:28 -06:00
Erik Marks
30d6ad83f7
Refactor background Segment usage ( #9509 )
...
* Create wrapper function for segment events
* Extract transaction controller metrics calls into own function
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-10-08 09:41:23 -07:00
Erik Marks
6a6600c730
Use networkVersion for network state; chainId for signing transactions ( #9487 )
2020-10-06 17:48:24 -02:30
Whymarrh Whitby
b6ccd22d6c
Update ESLint shared config to v3 ( #9274 )
...
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-08-19 13:57:05 -02:30
Whymarrh Whitby
c1e3c229bc
Fix import/order issues ( #9239 )
...
See [`import/order`](https://eslint.org/docs/rules/import/order ) for more information.
This change enables `import/order` and fixes the issues raised by the rule.
2020-08-18 16:48:25 -02:30
Whymarrh Whitby
b7259e5d6a
Fix radix issues ( #9247 )
...
See [`radix`](https://eslint.org/docs/rules/radix ) for more information.
This change enables `radix` and fixes the issues raised by the rule.
2020-08-18 16:38:22 -02:30
Whymarrh Whitby
4357cda7b8
Fix no-shadow issues ( #9246 )
...
See [`no-shadow`](https://eslint.org/docs/rules/no-shadow ) for more information.
This change enables `no-shadow` and fixes the issues raised by the rule.
2020-08-18 14:06:45 -02:30
Whymarrh Whitby
c11888f287
Fix no-empty-function issues ( #9216 )
...
See [`no-empty-function`](https://eslint.org/docs/rules/no-empty-function ) for more information.
This change enables `no-empty-function` and fixes the issues raised by the rule.
2020-08-14 09:17:02 -02:30
Whymarrh Whitby
9b78d3ab07
Fix import/extensions issues ( #9217 )
...
See [`import/extensions`](https://eslint.org/docs/rules/import/extensions ) for more information.
This change enables `import/extensions` and fixes the issues raised by the rule.
2020-08-14 09:16:45 -02:30
Whymarrh Whitby
bf6578c6b8
Enable guard-for-in rule ( #9000 )
2020-07-21 18:40:45 -02:30
Whymarrh Whitby
2ae4720443
Fix words ( #9038 )
2020-07-20 14:32:49 -02:30
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
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
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
Erik Marks
56004db8bf
blocklisted -> blocked
2020-06-08 17:57:59 -07:00
Jenny Pollack
7a4bb7f73a
replace blacklist with blocklist
2020-06-08 17:49:23 -07:00
Erik Marks
fdb3070fce
Delete unused transaction history test state ( #8769 )
2020-06-08 17:48:28 -07:00
Erik Marks
f748664638
Cleanup network enums ( #8627 )
...
* cleanup & consolidate network enums
2020-05-20 08:57:45 -07:00
Erik Marks
24cbb6fc66
Delete retryTransaction action and background ( #8576 )
...
* delete retryTransaction action and background
2020-05-12 16:19:33 -07:00
Whymarrh Whitby
85453a2588
Rework pending tx logic ( #8398 )
2020-05-01 15:19:29 -02:30
Mark Stacey
5b5b67a985
Fix default gas race condition ( #8490 )
...
A race condition exists where after adding an unapproved transaction,
it could be mutated and then replaced when the default gas parameters
are set. This happens because the transaction is added to state and
broadcast before the default gas parameters are set, because
calculating the default gas parameters to use takes some time.
Once they've been calculated, the false assumption was made that the
transaction hadn't changed.
The method responsible for setting the default gas now retrieves an
up-to-date copy of `txMeta`, and conditionally sets the defaults only
if they haven't yet been set.
This race condition was introduced in #2962 , though that PR also added
a loading screen that avoided this issue by preventing the user from
interacting with the transaction until after the gas had been
estimated. Unfortunately this loading screen was not carried forward to
the new UI.
2020-05-01 12:25:45 -03:00
Mark Stacey
92592fc905
Ensure tx has value before it's added ( #8486 )
...
Previously a transaction would get assigned a default value during the
`addTxGasDefaults` function, after the transaction was added and sent
to the UI.
Instead the transaction is assigned a default value before it gets
added. This flow is simpler to follow, and it avoids the race condition
where the transaction is assigned a value from the UI before this
default is set. In that situation, the UI-assigned value would be
overridden, which is obviously not desired.
2020-04-30 21:50:44 -03:00
Whymarrh Whitby
7439cd1662
Mark PendingTransactionTracker#resubmitPendingTxs as async ( #8399 )
2020-04-27 13:24:39 -02:30
Whymarrh Whitby
91a75b2417
Add new PendingTransactionTracker tests ( #8384 )
...
Co-authored-by: Jenny Pollack <jennypollack3@gmail.com>
2020-04-23 13:19:04 -02:30
Whymarrh Whitby
deacde615f
Rename _checkIfTxWasDropped ( #8378 )
2020-04-22 17:03:59 -02:30
Whymarrh Whitby
f2f70342e2
Skip adding history entry for empty txMeta diffs ( #8379 )
2020-04-22 11:09:16 +08:00
Whymarrh Whitby
9d535b949f
Rename recipientBlacklistChecker function ( #8365 )
2020-04-20 16:29:41 -02:30
Whymarrh Whitby
18eaae2721
Update tx status tests to assert cb called ( #8371 )
2020-04-20 13:26:50 -02:30
Whymarrh Whitby
164923acd1
Export individual fns from tx-state-history-helpers ( #8370 )
2020-04-20 13:00:51 -02:30
Whymarrh Whitby
e05db747f5
Tidy up transaction-related unit tests ( #8362 )
...
Co-Authored-By: Erik Marks <25517051+rekmarks@users.noreply.github.com>
2020-04-20 12:31:00 -02:30
Erik Marks
2df8b85c5f
LoginPerSite: Support multiple accounts without automatic switching ( #8079 )
...
* transaction editing: use txParams 'from' account
* signature-request: use txParams 'from' account
* signature-request-original: use txParams 'from' account
* encryption/decryption: use txParams 'from' account
* update tests
* set 'send' state 'from' address in confirm containers
2020-03-06 13:34:56 -08:00
Whymarrh Whitby
a78cf0ef3a
Enable arrow-parens ESLint rule
2020-02-15 17:04:21 -03:30
Dan Finlay
9c8fd38db4
Merge pull request #8048 from MetaMask/null-check
...
Fix faulty null checks
2020-02-12 12:03:28 -08:00
Erik Marks
0103bf8b29
fix faulty null checks
2020-02-12 08:17:13 -08:00
Whymarrh Whitby
4f3fc95d50
Update ESLint rules for test suite ( #8023 )
...
* Use @metamask/eslint-config@1.1.0
* Use eslint-plugin-mocha@6.2.2
* Mark root ESLint config as root
* Update Mocha ESLint rules with shared ESLint config
2020-02-11 13:21:13 -03:30
Whymarrh Whitby
1728d9a5aa
Inline networkStore to avoid having too many event listeners ( #7854 )
2020-01-17 18:28:27 -03:30
Whymarrh Whitby
4257858fb5
Remove extraneous console output from TransactionStateManager tests ( #7838 )
2020-01-16 08:32:02 -08:00
Whymarrh Whitby
92971d3c87
Migrate codebase to use ESM ( #7730 )
...
* Update eslint-plugin-import version
* Convert JS files to use ESM
* Update ESLint rules to check imports
* Fix test:unit:global command env
* Cleanup mock-dev script
2020-01-09 00:04:58 -03:30
Frankie
71a89df8ee
transactions/pending - buffer 3 blocks before dropping a tx ( #7483 )
...
* transactions/pending - buffer 3 blocks before dropping a tx
* transactions/pending - only increment for dropped txs
2019-12-05 09:34:10 -10:00
Whymarrh Whitby
274a9ecf53
yarn lint --fix
2019-12-03 17:20:55 -03:30