Skip to content
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

Bump MetaMask core packages #1818

Merged
merged 33 commits into from
Oct 11, 2023

Conversation

FrederikBolding
Copy link
Member

@FrederikBolding FrederikBolding commented Oct 5, 2023

Rebased and updated version of #1728

  • Updates and uses @metamask/rpc-errors everywhere
  • Updates and uses @metamask/json-rpc-engine everywhere
  • Updates the following packages to latest: @metamask/permission-controller, @metamask/approval-controller, @metamask/providers, @metamask/eth-json-rpc-middleware

Huge thank you to @legobeat for all of the help landing this ❤️

Blocked by #1823

@socket-security
Copy link

socket-security bot commented Oct 5, 2023

New, updated, and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Packages Version New capabilities Transitives Size Publisher
json-rpc-middleware-stream 5.0.1 None +0 20.5 kB gudahtt
@metamask/eth-json-rpc-middleware 11.0.2...12.0.0 None +20/-8 2.06 MB metamaskbot
@metamask/approval-controller 3.5.2...4.0.0 None +2/-2 280 kB metamaskbot
@metamask/permission-controller 4.1.2...5.0.0 None +15/-15 1.93 MB metamaskbot
@metamask/providers 11.1.1...13.0.0 None +4/-0 540 kB metamaskbot
@metamask/rpc-errors 5.1.1...6.1.0 None +0/-0 85.8 kB metamaskbot

🚮 Removed packages: @metamask/utils@3.6.0

@@ -68,7 +68,7 @@ export const getLocaleBuilder = Object.freeze({
*/
export function getImplementation({ getLocale }: GetLocaleMethodHooks) {
return async function implementation(
_args: RestrictedMethodOptions<void>,
_args: RestrictedMethodOptions<any>,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👀

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is a bit difficult, I'm not sure what we we should type this as since we don't use the arguments at all. Any was the best I could come up with, but I don't think it should matter much since the arguments are discarded.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Json?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't work, but RestrictedMethodParameters does.

@@ -399,7 +397,7 @@ export abstract class AbstractExecutionService<WorkerType>
handler,
request,
target: snapId,
},
} as Record<string, Json>,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing params is causing grief here? if so, could we move the type assertion to params?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is in fact request that is typed as Record<string, Json> but should be a JsonRpcRequest by the time we get here. I have moved the cast.

@Mrtenz Mrtenz changed the base branch from main to feat/error-handling October 10, 2023 13:52
Mrtenz added a commit that referenced this pull request Oct 11, 2023
This fixes the Snaps controllers and execution environments tests on
#1818.
@codecov
Copy link

codecov bot commented Oct 11, 2023

Codecov Report

Attention: 14 lines in your changes are missing coverage. Please review.

Comparison is base (552c1cc) 95.98% compared to head (5323126) 95.97%.

Additional details and impacted files
@@                   Coverage Diff                   @@
##           feat/error-handling    #1818      +/-   ##
=======================================================
- Coverage                95.98%   95.97%   -0.02%     
=======================================================
  Files                      241      241              
  Lines                     5586     5592       +6     
  Branches                   877      881       +4     
=======================================================
+ Hits                      5362     5367       +5     
- Misses                     224      225       +1     
Files Coverage Δ
...ackages/rpc-methods/src/permitted/invokeKeyring.ts 100.00% <100.00%> (ø)
...kages/rpc-methods/src/permitted/invokeSnapSugar.ts 100.00% <100.00%> (ø)
packages/rpc-methods/src/permitted/requestSnaps.ts 96.22% <100.00%> (ø)
...thods/src/restricted/caveats/permittedCoinTypes.ts 100.00% <100.00%> (ø)
...src/restricted/caveats/permittedDerivationPaths.ts 96.15% <100.00%> (ø)
...ages/rpc-methods/src/restricted/caveats/snapIds.ts 100.00% <100.00%> (ø)
packages/rpc-methods/src/restricted/dialog.ts 100.00% <100.00%> (ø)
...ages/rpc-methods/src/restricted/getBip32Entropy.ts 100.00% <100.00%> (ø)
...es/rpc-methods/src/restricted/getBip32PublicKey.ts 100.00% <100.00%> (ø)
...ages/rpc-methods/src/restricted/getBip44Entropy.ts 100.00% <100.00%> (ø)
... and 24 more

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@FrederikBolding FrederikBolding marked this pull request as ready for review October 11, 2023 10:45
@FrederikBolding FrederikBolding requested a review from a team as a code owner October 11, 2023 10:45
@FrederikBolding FrederikBolding merged commit cbf0102 into feat/error-handling Oct 11, 2023
132 of 134 checks passed
@FrederikBolding FrederikBolding deleted the fb/bump-json-rpc-engine-et-all branch October 11, 2023 11:03
Mrtenz added a commit that referenced this pull request Oct 17, 2023
Rebased and updated version of
#1728

- Updates and uses `@metamask/rpc-errors` everywhere
- Updates and uses `@metamask/json-rpc-engine` everywhere
- Updates the following packages to latest:
`@metamask/permission-controller`, `@metamask/approval-controller`,
`@metamask/providers`, `@metamask/eth-json-rpc-middleware`

Huge thank you to @legobeat for all of the help landing this ❤️ 

Blocked by #1823

---------

Co-authored-by: legobt <6wbvkn0j@anonaddy.me>
Co-authored-by: Maarten Zuidhoorn <maarten@zuidhoorn.com>
Mrtenz added a commit that referenced this pull request Oct 19, 2023
Rebased and updated version of
#1728

- Updates and uses `@metamask/rpc-errors` everywhere
- Updates and uses `@metamask/json-rpc-engine` everywhere
- Updates the following packages to latest:
`@metamask/permission-controller`, `@metamask/approval-controller`,
`@metamask/providers`, `@metamask/eth-json-rpc-middleware`

Huge thank you to @legobeat for all of the help landing this ❤️

Blocked by #1823

---------

Co-authored-by: legobt <6wbvkn0j@anonaddy.me>
Co-authored-by: Maarten Zuidhoorn <maarten@zuidhoorn.com>
Mrtenz added a commit that referenced this pull request Oct 20, 2023
Rebased and updated version of
#1728

- Updates and uses `@metamask/rpc-errors` everywhere
- Updates and uses `@metamask/json-rpc-engine` everywhere
- Updates the following packages to latest:
`@metamask/permission-controller`, `@metamask/approval-controller`,
`@metamask/providers`, `@metamask/eth-json-rpc-middleware`

Huge thank you to @legobeat for all of the help landing this ❤️

Blocked by #1823

---------

Co-authored-by: legobt <6wbvkn0j@anonaddy.me>
Co-authored-by: Maarten Zuidhoorn <maarten@zuidhoorn.com>
Mrtenz added a commit that referenced this pull request Oct 20, 2023
This improves error handling by:

- Using `@metamask/rpc-errors` instead of `eth-rpc-errors` throughout
the entire stack.
- Introducing a new `SnapError`, which will not cause the Snap to crash
when thrown.
- Unwrapping errors where possible.
- Also bumps a ton of MetaMask dependencies, see
#1818

---------

Co-authored-by: Frederik Bolding <frederik.bolding@gmail.com>
Co-authored-by: legobt <6wbvkn0j@anonaddy.me>
benefacto pushed a commit to zenchain-protocol/zazen that referenced this pull request Jul 3, 2024
This improves error handling by:

- Using `@metamask/rpc-errors` instead of `eth-rpc-errors` throughout
the entire stack.
- Introducing a new `SnapError`, which will not cause the Snap to crash
when thrown.
- Unwrapping errors where possible.
- Also bumps a ton of MetaMask dependencies, see
MetaMask/snaps#1818

---------

Co-authored-by: Frederik Bolding <frederik.bolding@gmail.com>
Co-authored-by: legobt <6wbvkn0j@anonaddy.me>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants