fix: Filter out duplicate JSON-RPC requests#24748
Conversation
fc91c5f to
cc434dc
Compare
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
a064c93 to
c4760a6
Compare
Co-authored-by: Maarten Zuidhoorn <maarten@zuidhoorn.com>
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsThe changes modify the BackgroundBridge, which is a critical core component that handles all RPC communication between the app and dApps/external connections. The main change adds a duplicate request filter stream ( Key impacts:
Selected tags rationale:
The changes are in critical paths (app/core/) and affect the fundamental RPC communication layer, warranting high risk assessment. |
|



Description
Copies
createDupeReqFilterStream.tsfrom the extension repo and applies it to the provider stream inBackgroundBridge. This filters out any duplicate requests received from the dapp. It is possible for the RPC requests to be duplicated due to the "replay functionality" found here: https://github.com/MetaMask/metamask-mobile/blob/main/scripts/inpage-bridge/src/provider.js#L131Feedback required.
Changelog
CHANGELOG entry: null
Note
Prevents duplicate JSON-RPC requests from reaching the engines.
createDupeReqFilterStreamwith a three-minute expiry for seen request ids; comprehensive unit tests increateDupeReqFilterStream.test.tsBackgroundBridgepump chain for bothsetupProviderConnectionEip1193andsetupProviderConnectionCaip(betweenoutStreamandproviderStream)@types/readable-streamto dependencies and update lockfile; annotate snaps execution setup with@ts-expect-errorfor stream type mismatchWritten by Cursor Bugbot for commit 31f5493. This will update automatically on new commits. Configure here.