fix: ignore legacy publicConfig stream in createExternalExtensionProvider - #429
Open
ZayanKhan-12 wants to merge 2 commits into
Open
fix: ignore legacy publicConfig stream in createExternalExtensionProvider#429ZayanKhan-12 wants to merge 2 commits into
ZayanKhan-12 wants to merge 2 commits into
Conversation
…ider The MetaMask extension still writes state updates to the legacy `publicConfig` substream of its multiplexed connection. The provider created by `createExternalExtensionProvider` never registers a substream for it, so every message triggers an 'ObjectMultiplex - orphaned data for stream "publicConfig"' warning in the consuming extension's console. The MetaMask extension's own contentscript already handles this by calling `ignoreStream` on its multiplexer for the legacy stream name, so pages using the injected provider never see the warning. Apply the same pattern to the external extension provider path: register the `publicConfig` substream as ignored on the `ObjectMultiplex` instance before wiring up the pipeline. Fixes MetaMask#294 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Description
When connecting to MetaMask via
createExternalExtensionProvider(), the wallet still writes state updates to the legacypublicConfigsubstream of the multiplexed port connection. The provider side never registers a substream for that name, soObjectMultiplexlogs anObjectMultiplex - orphaned data for stream "publicConfig"warning to the consuming extension's console for every message.The MetaMask extension's own contentscript already solves this for the injected in-page provider by calling
ignoreStream(LEGACY_PUBLIC_CONFIG)on its multiplexer (contentscript source), which is why web pages don't see these warnings. This PR applies the same pattern to the external extension provider path: theObjectMultiplexinstance created increateExternalExtensionProvidernow registerspublicConfigas an ignored substream (mux.ignoreStream('publicConfig')) before the pipeline is wired up, so legacy messages are silently dropped instead of warned about.Fixes #294
Testing
src/extension-provider/createExternalExtensionProvider.test.tsthat sends a message on thepublicConfigsubstream via the existingMockPorthelper and asserts no orphaned-data warning is logged. Verified the test fails without the fix and passes with it.yarn test: 8 suites / 131 tests passed.yarn lint(eslint, constraints, prettier, depcheck/dedupe, changelog validate): clean.yarn build: verifieddist/extension-provider/createExternalExtensionProvider.{mjs,cjs}contain theignoreStreamcall.🤖 Generated with Claude Code
Note
Low Risk
Narrow change to stream multiplex handling for a legacy substream; no RPC or auth behavior changes.
Overview
Third-party extensions using
createExternalExtensionProviderno longer getObjectMultiplex - orphaned data for stream "publicConfig"warnings when MetaMask still pushes updates on the legacypublicConfigsubstream.The multiplexer now calls
ignoreStream('publicConfig')before the port pipeline is wired (same idea as the MetaMask contentscript). A unit test asserts that apublicConfignotification does not trigger that warning. CHANGELOG documents the fix under [Unreleased].Reviewed by Cursor Bugbot for commit 23a05e8. Bugbot is set up for automated code reviews on this repo. Configure here.