-
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
Moved subscribe and filter into network controller #16693
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. |
Builds ready [6ad94ca]
Page Load Metrics (1988 ± 107 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
6ad94ca
to
4f2b0d0
Compare
4f2b0d0
to
fc3011a
Compare
Builds ready [fc3011a]
Page Load Metrics (2242 ± 138 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!
Though we should manually test that this works (I haven't done that yet). I don't think these methods are covered by any e2e tests or our test dapp, unfortunately.
We should come up with test instructions so that QA has something to go by. |
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.
Anything that we add to the network client files we need to make sure is covered in the network client integration tests.
I can work on this.
I agree that we need tests. It looks like mobile supports these methods via I don't think it needs to block this PR though. The network client tests are already not exhaustive. |
@Gudahtt Sure, as long as we don't forget about it. |
Dismissing the change requests as we can write tests later.
@BelfordZ is this ready to be merged? |
I was asked to help with manually testing this PR, and to do this, I've been adding some more buttons and things to the test dapp so we can test the filter and subscription middleware. However, I don't think all of the filter middleware works as intended. I've added a couple of issues around this: MetaMask/eth-json-rpc-filters#80, MetaMask/eth-json-rpc-filters#81. So I'm not able to test all of the functionality but only some of it. I haven't tested the subscription middleware yet, but I will do that tomorrow. |
Here are the changes for the test dapp which allow us to test filters and subscriptions: MetaMask/test-dapp#202 I used this on this branch and it seems that there are some issues:
|
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.
Marking this as changes requested. I can look into this tomorrow.
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.
It seems that the subscription middleware is failing because it used to be before the permission middleware, but now it's after, and the subscription methods are missing from the list of unrestricted methods (in app/scripts/controllers/permissions/specifications.js
, the unrestrictedMethods
variable).
In testing out this PR, even with the suggestions I made above applied locally, I'm still having trouble getting subscriptions to work. It looks like there are two distinct problems: notifications are not propagating correctly from the network client to the dapp, and we're seeing occasional empty block responses from Infura that are resulting in the request failing. For the empty block responses problem, this is happening due to a race condition between We'll need to move these middleware up a level, into the network controller, so that we can pass them a |
Builds ready [9c2b960]
Page Load Metrics (2055 ± 105 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!
Builds ready [911667c]
Page Load Metrics (2329 ± 226 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Our middleware for handling subscription and filter-related methods (
eth-json-rpc-filters
) currently lives in our RPC pipeline ahead of the network stack. This commit moves this middleware to the network client middleware instead. There are two reasons for this change. First, this middleware wraps RPC methods that are supported by the network. Second, it is necessary for this middleware to live with the network client so that it will aid us in unifying the NetworkController in this repo and the NetworkController in thecontrollers
repo.Fixes: #16573