chore: Use JsonRpcEngineV2 for execution services#3857
Merged
FrederikBolding merged 1 commit intomainfrom Feb 16, 2026
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3857 +/- ##
==========================================
- Coverage 98.59% 98.58% -0.01%
==========================================
Files 429 429
Lines 12416 12411 -5
Branches 1928 1927 -1
==========================================
- Hits 12241 12236 -5
Misses 175 175 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Mrtenz
reviewed
Feb 16, 2026
| // We don't need full validation of the response here because we control it. | ||
| if (hasProperty(response, 'error')) { | ||
| const error = response.error as JsonRpcErrorType; | ||
| throw new JsonRpcError(error.code, error.message, error.data); |
Member
Author
There was a problem hiding this comment.
Not as far as I know. The V2 implementation deserializes errors for us: https://github.com/MetaMask/core/blob/d8b8d5e7c3f5625b471c4b34e708dbc43aa990c6/packages/json-rpc-engine/src/asV2Middleware.ts#L113-L117
Mrtenz
approved these changes
Feb 16, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Use
JsonRpcEngineV2for execution service communication. This is one of the very few pieces of the JSON-RPC pipeline that we have full control over. The rest of the migration is nested in other libraries.Note
Medium Risk
Changes the internal Snap command RPC pipeline and error propagation semantics; regressions could impact Snap startup/termination and request handling, though the surface area is limited to execution-service communication.
Overview
Switches
AbstractExecutionService’s command-channel JSON-RPC engine from@metamask/json-rpc-enginetoJsonRpcEngineV2, constructing the engine viaJsonRpcEngine.createand wrapping the existing stream middleware withasV2Middleware.Updates the stored
rpcEnginetype to be request-typed and simplifies#commandto returnrpcEngine.handle(...)directly, removing the prior manual JSON-RPC error unwrapping/throwing logic.Written by Cursor Bugbot for commit c7c4a4b. This will update automatically on new commits. Configure here.