eth-trezor-keyring
eth-trezor-keyring copied to clipboard
Add public key check to prevent freezing.
Explanation
Fixes MetaMask/metamask-extension#12967
When the selected account on MetaMask is changed, the public key provided by MetaMask will differ from the one that the TrezorKeyring remembers. As a result, it will search for the address in the incorrect address space and eventually fall into a nearly infinite loop.
To fix this issue, I implemented a public key check. To do this, I made the following changes:
- Made the _pathFromAddress function asynchronous
- Added an assertion to ensure that the public key is not changed
- Fixed test
Pre-merge author checklist
- [x] I've clearly explained:
- [x] What problem this PR is solving
- [x] How this problem was solved
- [x] How reviewers can test my changes
- [x] Sufficient automated test coverage has been added
Pre-merge reviewer checklist
- [ ] Manual testing (e.g. pull and build branch, run in browser, test code being changed)
- [ ] PR is linked to the appropriate GitHub issue
- [ ] IF this PR fixes a bug in the release milestone, add this PR to the release milestone
If further QA is required (e.g. new feature, complex testing steps, large refactor), add the Extension QA Board label.
In this case, a QA Engineer approval will be be required.