Skip to content

Bump MetaMask core packages - #1818

Merged
FrederikBolding merged 33 commits into
feat/error-handlingfrom
fb/bump-json-rpc-engine-et-all
Oct 11, 2023
Merged

Bump MetaMask core packages#1818
FrederikBolding merged 33 commits into
feat/error-handlingfrom
fb/bump-json-rpc-engine-et-all

Conversation

@FrederikBolding

@FrederikBoldingFrederikBolding commented Oct 5, 2023

Copy link
Copy Markdown
Member

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

socket-securityBot commented Oct 5, 2023

Copy link
Copy Markdown

export function getImplementation({ getLocale }: GetLocaleMethodHooks) {
return async function implementation(
_args: RestrictedMethodOptions<void>,
_args: RestrictedMethodOptions<any>,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

👀

Copy link
Copy Markdown
MemberAuthor

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
Copy Markdown
Member

Choose a reason for hiding this comment

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

Json?

Copy link
Copy Markdown
MemberAuthor

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.

request,
target: snapId,
},
} as Record<string, Json>,

Copy link
Copy Markdown
Member

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
Copy Markdown
MemberAuthor

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.

Comment threadpackages/snaps-controllers/src/snaps/registry/json.ts Outdated
@FrederikBolding
FrederikBoldingforce-pushed the fb/bump-json-rpc-engine-et-all branch from 9f2ef29 to bb2dcbdCompareOctober 9, 2023 11:46
@Mrtenz
Mrtenz changed the base branch from main to feat/error-handlingOctober 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.
@FrederikBolding
FrederikBoldingforce-pushed the fb/bump-json-rpc-engine-et-all branch from 8c9ba92 to 8b0ed91CompareOctober 11, 2023 09:51
@codecov

codecovBot commented Oct 11, 2023

Copy link
Copy Markdown

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 
FilesCoverage Δ
...ackages/rpc-methods/src/permitted/invokeKeyring.ts100.00% <100.00%> (ø)
...kages/rpc-methods/src/permitted/invokeSnapSugar.ts100.00% <100.00%> (ø)
packages/rpc-methods/src/permitted/requestSnaps.ts96.22% <100.00%> (ø)
...thods/src/restricted/caveats/permittedCoinTypes.ts100.00% <100.00%> (ø)
...src/restricted/caveats/permittedDerivationPaths.ts96.15% <100.00%> (ø)
...ages/rpc-methods/src/restricted/caveats/snapIds.ts100.00% <100.00%> (ø)
packages/rpc-methods/src/restricted/dialog.ts100.00% <100.00%> (ø)
...ages/rpc-methods/src/restricted/getBip32Entropy.ts100.00% <100.00%> (ø)
...es/rpc-methods/src/restricted/getBip32PublicKey.ts100.00% <100.00%> (ø)
...ages/rpc-methods/src/restricted/getBip44Entropy.ts100.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 ownerOctober 11, 2023 10:45
@FrederikBolding
FrederikBolding merged commit cbf0102 into feat/error-handlingOct 11, 2023
@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 freeto 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

@FrederikBolding@jiexi@Mrtenz@legobeat