Conversation
|
@metamaskbot publish-preview |
|
Preview builds have been published. See these instructions (from the Expand for full list of packages and versions. |
Co-authored-by: Charly Chevalier <charly.chevalier@consensys.net>
|
@metamaskbot publish-preview |
|
Preview builds have been published. See these instructions (from the Expand for full list of packages and versions. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
| return handleTrezorTransportError( | ||
| error, | ||
| 'Failed to sign typed data with Trezor device', | ||
| ); |
There was a problem hiding this comment.
Broad try-catch wraps non-hardware errors as HardwareWalletError
Medium Severity
In signTypedData, the try-catch block wraps transformTypedData() which throws local validation errors (e.g., "Only version 4 of typed data signing is supported"). Previously this call was outside any try-catch, so validation errors propagated as plain Error instances. Now they're caught and converted to HardwareWalletError with ErrorCode.Unknown, incorrectly classifying software validation errors as hardware wallet errors. Consumers distinguishing error types may be affected.


This PR updates the trezor keyring to use the hardware error management
Examples
Note
Medium Risk
Medium risk because it refactors Trezor signing/unlock error paths to throw typed
HardwareWalletErrors, which can change error types/messages surfaced to clients and affect hardware-wallet UX flows.Overview
Standardizes Trezor error handling across the monorepo. The Trezor keyring now depends on
@metamask/hw-wallet-sdkand converts bridge/transport failures inunlock,signTransaction,signPersonalMessage, andsignTypedDatainto typedHardwareWalletErrors via a newhandleTrezorTransportErrorhelper, while preserving address-mismatch validation as plainErrors.Adds reusable static
TREZOR_ERROR_MAPPINGStohw-wallet-sdk(with tests) and new Trezor error utilities/exports ineth-trezor-keyring, plus expanded test coverage and updated Jest coverage thresholds/build references to reflect the new modules.Written by Cursor Bugbot for commit e069e4c. This will update automatically on new commits. Configure here.