-
-
Notifications
You must be signed in to change notification settings - Fork 255
Enhance transaction validation with standardized RPC errors #1690
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
eth-rpc-errors when validation fails adding transactioneth-rpc-errors when validation fails adding transaction
eth-rpc-errors when validation fails adding transaction|
There is an open draft PR for |
This makes sense to me assuming it's functionally identical and the resulting exception are the same? The goal here is to align with the extension so if this diverges further, it may be best to update the package down the line. |
|
@matthewwalsh0 Yes, the direction is that all active use of The changelog is here: https://github.com/MetaMask/rpc-errors/blob/main/CHANGELOG.md See esp v5.0.0 for API changes in the package. The major thing here is the version upgrade - it's an associated package rename, not a change of dependencies per se. |
Mrtenz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use @metamask/rpc-errors.
legobeat
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
v6 has compatibility fixes in types
Co-authored-by: legobeat <109787230+legobeat@users.noreply.github.com>
1c098a1 to
919d77b
Compare
|
Removed dependencies detected. Learn more about Socket for GitHub ↗︎ 🚮 Removed packages: @metamask/rpc-errors@5.1.1 |
this now uses @metamask/rpc-errors@6.0.0
legobeat
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
## Explanation This replaces obsolete `eth-rpc-errors` with `@metamask/rpc-errors` in `@metamask/approval-controller`. This should be coupled with #1639 and can be merged before or after. ## References #### Broken out from - #1731 #### Blocking - #1724 #### Related - #1690 ## Changelog ### `@metamask/approval-controller` - **Changed**: Replaced `eth-rpc-errors` with `@metamask/rpc-errors` ### `@metamask/controller-utils` - **Fixed**: Removed unused dependency `eth-rpc-errors` ## Checklist - [x] I've updated the test suite for new or updated code as appropriate - [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [x] I've highlighted breaking changes using the "BREAKING" category above as appropriate
## Explanation
This PR aims to update the `TransactionController` to throw standardised
`rpcErrors.invalidParams` errors using the `@metamask/rpc-errors`
package that will ensure they are standardised and more easily parsed
and recognised by the dApps.
**Context**
The extension `TransactionController` uses the `eth-rpc-errors` package
to throw standardised errors when validation fails. This update is a
part of the ongoing TransactionController unification effort.
Note: As the colleagues pointed out in this PR `eth-rpc-errors` is
deprecated so for equivalence the `@metamask/rpc-errors` package was
added in the `TransactionController` and usages in the code was replaced
accordingly.
Bump `@metamask/rpc-errors` to v6 in `transaction-controller` and
`assets-controller`.
### `@metamask/transaction-controller`
- **CHANGED**: update `validateTxParams` to throw standardised errors
using the `@metamask/rpc-errors` package.
- add `@metamask/rpc-errors` package.
- remove `eth-rpc-errors` and replace usage with the new package.
## Explanation This replaces obsolete `eth-rpc-errors` with `@metamask/rpc-errors` in `@metamask/approval-controller`. This should be coupled with #1639 and can be merged before or after. ## References #### Broken out from - #1731 #### Blocking - #1724 #### Related - #1690 ## Changelog ### `@metamask/approval-controller` - **Changed**: Replaced `eth-rpc-errors` with `@metamask/rpc-errors` ### `@metamask/controller-utils` - **Fixed**: Removed unused dependency `eth-rpc-errors` ## Checklist - [x] I've updated the test suite for new or updated code as appropriate - [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [x] I've highlighted breaking changes using the "BREAKING" category above as appropriate
## Explanation
This PR aims to update the `TransactionController` to throw standardised
`rpcErrors.invalidParams` errors using the `@metamask/rpc-errors`
package that will ensure they are standardised and more easily parsed
and recognised by the dApps.
**Context**
The extension `TransactionController` uses the `eth-rpc-errors` package
to throw standardised errors when validation fails. This update is a
part of the ongoing TransactionController unification effort.
Note: As the colleagues pointed out in this PR `eth-rpc-errors` is
deprecated so for equivalence the `@metamask/rpc-errors` package was
added in the `TransactionController` and usages in the code was replaced
accordingly.
Bump `@metamask/rpc-errors` to v6 in `transaction-controller` and
`assets-controller`.
### `@metamask/transaction-controller`
- **CHANGED**: update `validateTxParams` to throw standardised errors
using the `@metamask/rpc-errors` package.
- add `@metamask/rpc-errors` package.
- remove `eth-rpc-errors` and replace usage with the new package.
## Explanation This replaces obsolete `eth-rpc-errors` with `@metamask/rpc-errors` in `@metamask/approval-controller`. This should be coupled with #1639 and can be merged before or after. ## References #### Broken out from - #1731 #### Blocking - #1724 #### Related - #1690 ## Changelog ### `@metamask/approval-controller` - **Changed**: Replaced `eth-rpc-errors` with `@metamask/rpc-errors` ### `@metamask/controller-utils` - **Fixed**: Removed unused dependency `eth-rpc-errors` ## Checklist - [x] I've updated the test suite for new or updated code as appropriate - [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [x] I've highlighted breaking changes using the "BREAKING" category above as appropriate
## Explanation This replaces obsolete `eth-rpc-errors` with `@metamask/rpc-errors` in `@metamask/approval-controller`. This should be coupled with #1639 and can be merged before or after. ## References #### Broken out from - #1731 #### Blocking - #1724 #### Related - #1690 ## Changelog ### `@metamask/approval-controller` - **Changed**: Replaced `eth-rpc-errors` with `@metamask/rpc-errors` ### `@metamask/controller-utils` - **Fixed**: Removed unused dependency `eth-rpc-errors` ## Checklist - [x] I've updated the test suite for new or updated code as appropriate - [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [x] I've highlighted breaking changes using the "BREAKING" category above as appropriate
Explanation
This PR aims to update the
TransactionControllerto throw standardisedrpcErrors.invalidParamserrors using the@metamask/rpc-errorspackage that will ensure they are standardised and more easily parsed and recognised by the dApps.Context
The extension
TransactionControlleruses theeth-rpc-errorspackage to throw standardised errors when validation fails. This update is a part of the ongoing TransactionController unification effort.Note: As the colleagues pointed out in this PR
eth-rpc-errorsis deprecated so for equivalence the@metamask/rpc-errorspackage was added in theTransactionControllerand usages in the code was replaced accordingly.Bump
@metamask/rpc-errorsto v6 intransaction-controllerandassets-controller.References
Changelog
@metamask/transaction-controllervalidateTxParamsto throw standardised errors using the@metamask/rpc-errorspackage.@metamask/rpc-errorspackage.eth-rpc-errorsand replace usage with the new package.Checklist