-
Notifications
You must be signed in to change notification settings - Fork 5k
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
fix: cp-12.10.4 hotfix network version / unresponsive network inpage provider #30111
Conversation
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
Updated dependencies detected. Learn more about Socket for GitHub ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Builds ready [ffb5a79]
Page Load Metrics (1759 ± 72 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Tested and works as expected!
Description
Previously the inpage provider would withhold events for chainChanged events (and property value updates, i.e. window.ethereum.chainId and .networkVersion) when the dapp's network was changed to an rpc endpoint that was unresponsive or did not support net_version. The dapp would instead receive a disconnect event.
Now the inpage provider always emits chainChanged and networkChanged events (and exposes the correct values on window.ethereum.chainId and .networkVersion) when the selected network for the dapp has changed regardless of if the network being changed to is responsive or if it supports net_version requests. It does this by having the wallet send a loading for networkVersion when it cannot be resolved (same behavior as before) AND a new isConnected property in the metamask_getProviderState request and metamask_chainChanged events (these are different from the events emittted by window.ethereum). isConnected is derived from whether the NetworkController.state.networkMetadata[].status value is the Available constant.
Related issues
See: #29936
Providers patch from commit (d919ab6b): MetaMask/providers#404
Manual testing steps
chainChanged
andnetworkChanged
eventschainChanged
andnetworkChanged
eventschainChanged
emits with the correct chainId, butnetworkChanged
emits with a null value, AND there is adisconnect
event emittedchainChanged
andnetworkChanged
events, AND there is aconnect
event emitted with the new chainIdnet_version
implemented. Se that the correct values are emitted for thechainChanged
, thatnetworkChanged
emits null, and that there is nodisconnect
event emittedScreenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist