Whymarrh Whitby
b6ccd22d6c
Update ESLint shared config to v3 ( #9274 )
...
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
4 years ago
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.
4 years ago
Whymarrh Whitby
bf6578c6b8
Enable guard-for-in rule ( #9000 )
4 years ago
Whymarrh Whitby
2ae4720443
Fix words ( #9038 )
4 years ago
Thomas Huang
7b2218ac6e
Clear unapprovedTxs on createNewVaultAndRestore ( #9026 )
...
Clear unapproved transactions from txStateManager.transactions on createNewVaultAndRestore
4 years ago
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
4 years ago
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>
4 years ago
Mark Stacey
8fb615c9f6
Backport "Skip adding history entry for empty txMeta diffs ( #8379 )" ( #8449 )
...
Backport #8379 to v7.7.9
5 years ago
Whymarrh Whitby
f2f70342e2
Skip adding history entry for empty txMeta diffs ( #8379 )
5 years ago
Whymarrh Whitby
18eaae2721
Update tx status tests to assert cb called ( #8371 )
5 years ago
Whymarrh Whitby
164923acd1
Export individual fns from tx-state-history-helpers ( #8370 )
5 years ago
Whymarrh Whitby
e05db747f5
Tidy up transaction-related unit tests ( #8362 )
...
Co-Authored-By: Erik Marks <25517051+rekmarks@users.noreply.github.com>
5 years ago
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
5 years ago
Whymarrh Whitby
4257858fb5
Remove extraneous console output from TransactionStateManager tests ( #7838 )
5 years ago
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
5 years ago
Whymarrh Whitby
274a9ecf53
yarn lint --fix
5 years ago
Frankie
f6d25357db
transactions:tx-state-manager - optionally take a function as a search param ( #7078 )
5 years ago
Whymarrh Whitby
4d88e1cf86
Enable indent linting via ESLint ( #6936 )
...
* Enable indent linting via ESLint
* yarn run lint:fix
5 years ago
Akshit Kr Nagpal
d16d6f483c
Validate txParams in TransactionStateManager.addTx ( #6713 )
...
* Normalize and Validate txParams in TransactionStateManager.addTx too
* Added Tests
* Updated normalizeAndValidateParams to return the new txParams
6 years ago
Whymarrh Whitby
094e4cf555
Check for unused function arguments ( #6583 )
...
* eslint: Check for unused function arguments
* eslint: Ignore unused '_' in argument list
Also allow any number of '_' e.g., '__' or '___' which is to be used sparingly
* Remove and rename unused arguments
6 years ago
frankiebee
b30499886f
test - check that #setTxStatusRejected removes transaction from history
7 years ago
brunobar79
4b398701c1
fix unit tests
7 years ago
brunobar79
c734e486a0
fix tests
7 years ago
brunobar79
0da41263ac
fix warning for unit tests
7 years ago
brunobar79
a8f745f9fe
eslint --fix .
7 years ago
frankiebee
94a4f99115
tests - fix cancle transaction test to better fit new behavior
7 years ago
frankiebee
7b1f57e05d
woops - remove .only
...
Co-authored-by: @jennypollack
7 years ago
frankiebee
9b92ba4c47
trandsactions - remove rejected transactions from history
7 years ago
tmashuang
13ebb0b455
Moved loose some loose test files to sub folders
7 years ago
Dan
6bc8cc819a
Merge branch 'develop' into i3725-refactor-send-component-
7 years ago
Csaba Solya
9026651224
add time stamps to transaction history log entries
7 years ago
frankiebee
2d7c3c2b00
meta - transactions - create a transactions dir in controller and move relevant files into it
7 years ago
frankiebee
f0f45e6fe1
migration for removing unnecessary transactions from state
7 years ago
Jeffrey Tong
cad5f5f000
fix typo in tests and tx-state-manager
7 years ago
Bruno Barbieri
94dd77d194
clean up
7 years ago
Bruno Barbieri
a70eda3651
add test for wipeTransactions
7 years ago
frankiebee
474a4e941f
fix tests
7 years ago
frankiebee
e9712a13ec
Create tests for TxStateManager
7 years ago