-
-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restore previous behavior of toChecksumHexAddress (#4046)
Prior to 40acc6c, `toChecksumHexAddress` in `@metamask/controller-utils` would not throw when given `undefined` or `null`. Now it does, because `addHexPrefix` from `ethereumjs-util` has been replaced with `add0x` from `@metamask/utils`, and the latter is more strict when it comes to input. This change is causing some tests on the extension side to fail. Granted, these tests are likely creating an incomplete state object, so they ought to be fixed so that they pass a string to `toChecksumHexAddress`. However, these test failures serve as a reminder that there may be other parts of the extension codebase not covered by tests which are using `toChecksumHexAddress` incorrectly. If the extension were using TypeScript throughout, finding these problem areas would be trivial, because we would have seen type errors already. But because the extension codebase is still primarily written in JavaScript, we cannot guarantee that `toChecksumHexAddress` won't throw for some particular use case even after we fix the obvious usages. Therefore, to prevent unexpected runtime errors, this commit restores the existing behavior of `toChecksumHexAddress`.
- Loading branch information
Showing
3 changed files
with
57 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters