-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Revert "Moved subscribe and filter into network controller (#16693)" #18129
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
Conversation
Builds ready [ebb6288]
Page Load Metrics (1564 ± 46 ms)
Bundle size diffs [🚀 Bundle size reduced!]
|
Codecov Report
@@ Coverage Diff @@
## develop #18129 +/- ##
===========================================
- Coverage 64.00% 64.00% -0.00%
===========================================
Files 910 910
Lines 35505 35499 -6
Branches 9002 9001 -1
===========================================
- Hits 22724 22719 -5
+ Misses 12781 12780 -1
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
We should be able to cover this with an e2e test. I'll have to give that some thought. I don't think it'd be feasible to capture this error in a unit test, since it's more of an integration problem. Edit: This is now covered by an e2e test. |
|
Looks like this fixed it. I cannot reproduce the error anymore @Gudahtt |
This reverts commit 6f6984f. That commit was an RPC middleware refactor intended to move the subscribe and filter middleware into the network controller, to simplify the process of sharing this middleware between clients. This refactor resulted in `eth_subscribe` notifications being sent on the wrong connections, causing the UI to break in some cases (the UI `provider` connection does not support notifications). This happened because the `setupProviderEngine` function runs per-connection, whereas the engine setup inside the network controller is global. The global network client cannot support notifications because it has no way to route them; they'll need to stay in the per-connection provider engine. Closes #17467
An e2e test has been added that confirms subscriptions are only broadcast to the site that registered them. This test fails on `develop`.
ebb6288 to
850b47e
Compare
|
An e2e test has been added to confirm that this is working. It doesn't test the UI breakage, but it detects the problematic behavior by ensuring subscriptions from one dapp don't leak to another. Testing the UI directly didn't seem ideal because we may want to restore UI support for RPC notifications at some point. |
test/e2e/tests/eth-subscribe.spec.js
Outdated
| }); | ||
| `); | ||
|
|
||
| // Verify that new block is seen on first dapp |
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.
We use a default block time of 2 seconds in our Ganache setup. Our findElement timeout is more than long enough to wait for this, but in the future we can improve this test by explicitly mining a block here using the evm_mine method enabled by this PR: #18149
| await driver.openNewPage('http://127.0.0.1:8080/'); | ||
|
|
||
| const setupSubscriptionListener = ` | ||
| const responseContainer = document.createElement('div'); |
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.
We can replace this with the built-in test dapp subscribe functionality after this PR is merged: MetaMask/test-dapp#202
I tried this both on this branch and on |
adonesky1
left a comment
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 verified that eth_subscribe subscription messages are no longer broadcast to all pages where we inject our provider
Builds ready [850b47e]
Page Load Metrics (1568 ± 50 ms)
Bundle size diffs [🚀 Bundle size reduced!]
|
Builds ready [850b47e]
Page Load Metrics (1568 ± 50 ms)
Bundle size diffs [🚀 Bundle size reduced!]
|
chloeYue
left a comment
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, thanks!
Builds ready [fde1a64]
Page Load Metrics (1640 ± 62 ms)
Bundle size diffs [🚀 Bundle size reduced!]
|
This reverts commit 6f6984f. That commit was an RPC middleware refactor intended to move the subscribe and filter middleware into the network controller, to simplify the process of sharing this middleware between clients.
This refactor resulted in
eth_subscribenotifications being sent on the wrong connections, causing the UI to break in some cases (the UIproviderconnection does not support notifications). This happened because thesetupProviderEnginefunction runs per-connection, whereas the engine setup inside the network controller is global. The global network client cannot support notifications because it has no way to route them; they'll need to stay in the per-connection provider engine.Closes #17467
Manual Testing Steps
StreamProvider - Unknown response id for response: [object Object]when doing *some* contract interactions #17467test-dapplocally to help with testing: Add interactions involving filters & subscriptions test-dapp#202Pre-merge author checklist
Pre-merge reviewer checklist
If further QA is required (e.g. new feature, complex testing steps, large refactor), add the
Extension QA Boardlabel.In this case, a QA Engineer approval will be be required.