-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
feat: Delay network controller provider initialization #23005
Closed
Closed
Conversation
This file contains 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
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. |
pedronfigueiredo
changed the title
Delay network controller initialization
Delay network controller provider initialization
Feb 19, 2024
pedronfigueiredo
force-pushed
the
feat-2114
branch
from
February 21, 2024 10:12
12f73a6
to
05f9027
Compare
pedronfigueiredo
force-pushed
the
feat-2114
branch
from
February 21, 2024 17:31
ccbe2a3
to
203961c
Compare
gauthierpetetin
added
the
needs-dev-review
PR needs reviews from other engineers (in order to receive required approvals)
label
Feb 22, 2024
pedronfigueiredo
force-pushed
the
feat-881
branch
from
February 26, 2024 14:39
85a0a1d
to
496ea7d
Compare
pedronfigueiredo
force-pushed
the
feat-2114
branch
from
February 27, 2024 15:49
fb71ef7
to
6007184
Compare
pedronfigueiredo
force-pushed
the
feat-2114
branch
from
March 5, 2024 11:41
fe8d13f
to
fe07bd3
Compare
pedronfigueiredo
force-pushed
the
feat-2114
branch
from
March 7, 2024 18:28
6877682
to
474edc6
Compare
pedronfigueiredo
changed the title
Delay network controller provider initialization
feat: Delay network controller provider initialization
Mar 8, 2024
13 tasks
pedronfigueiredo
added a commit
that referenced
this pull request
Mar 26, 2024
## **Description** The temporary solution is to: - Prevent two network controller requests by: - Patch the network controller so that the lookup on initializeProvidercan be avoided. - Call that initializeProvider with the lookup: false argument right after the network controller is constructed - Call await this.networkController.lookupNetwork(); at the end of the metamask controller if the onboarding has been completed - Call await this.networkController.lookupNetwork(); once the onboarding complete state changes - Prevent one accounts tracker request by: - Moving the blockTracker event listener from the constructor of the controller to the start function The long term solution will be [#23005](#23005) (currently blocked by [#4004 on core](MetaMask/core#4004). ## **Related issues** Fixes: MetaMask/MetaMask-planning#881 ## **Manual testing steps** 1. Add `await new Promise((resolve) => setTimeout(resolve, 10000));` to the top of initialize on the background.js file 2. Build the app 3. Load extension and immediately open the network tab on the background console before the app initializes 4. No requests should happen ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** https://github.com/MetaMask/metamask-extension/assets/7499938/73513327-90fb-4e9f-8af2-aa41c731b647 ### **After** https://github.com/MetaMask/metamask-extension/assets/7499938/d6dee1c6-fa13-48c8-9fe2-520e3d43d0b3 ## **Pre-merge author checklist** - [ ] I’ve followed [MetaMask Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've clearly explained what problem this PR is solving and how it is solved. - [ ] I've linked related issues - [ ] I've included manual testing steps - [ ] I've included screenshots/recordings if applicable - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. - [ ] I’ve properly set the pull request status: - [ ] In case it's not yet "ready for review", I've set it to "draft". - [ ] In case it's "ready for review", I've changed it from "draft" to "non-draft". ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. --------- Co-authored-by: Dan J Miller <danjm.com@gmail.com>
pedronfigueiredo
added a commit
that referenced
this pull request
Mar 26, 2024
## **Description** The temporary solution is to: - Prevent two network controller requests by: - Patch the network controller so that the lookup on initializeProvidercan be avoided. - Call that initializeProvider with the lookup: false argument right after the network controller is constructed - Call await this.networkController.lookupNetwork(); at the end of the metamask controller if the onboarding has been completed - Call await this.networkController.lookupNetwork(); once the onboarding complete state changes - Prevent one accounts tracker request by: - Moving the blockTracker event listener from the constructor of the controller to the start function The long term solution will be [#23005](#23005) (currently blocked by [#4004 on core](MetaMask/core#4004). ## **Related issues** Fixes: MetaMask/MetaMask-planning#881 ## **Manual testing steps** 1. Add `await new Promise((resolve) => setTimeout(resolve, 10000));` to the top of initialize on the background.js file 2. Build the app 3. Load extension and immediately open the network tab on the background console before the app initializes 4. No requests should happen ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** https://github.com/MetaMask/metamask-extension/assets/7499938/73513327-90fb-4e9f-8af2-aa41c731b647 ### **After** https://github.com/MetaMask/metamask-extension/assets/7499938/d6dee1c6-fa13-48c8-9fe2-520e3d43d0b3 ## **Pre-merge author checklist** - [ ] I’ve followed [MetaMask Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've clearly explained what problem this PR is solving and how it is solved. - [ ] I've linked related issues - [ ] I've included manual testing steps - [ ] I've included screenshots/recordings if applicable - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. - [ ] I’ve properly set the pull request status: - [ ] In case it's not yet "ready for review", I've set it to "draft". - [ ] In case it's "ready for review", I've changed it from "draft" to "non-draft". ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. --------- Co-authored-by: Dan J Miller <danjm.com@gmail.com>
20 tasks
pedronfigueiredo
added a commit
that referenced
this pull request
Mar 26, 2024
…) (#23730) ## **Description** The temporary solution is to: - Prevent two network controller requests by: - Patch the network controller so that the lookup on initializeProvidercan be avoided. - Call that initializeProvider with the lookup: false argument right after the network controller is constructed - Call await this.networkController.lookupNetwork(); at the end of the metamask controller if the onboarding has been completed - Call await this.networkController.lookupNetwork(); once the onboarding complete state changes - Prevent one accounts tracker request by: - Moving the blockTracker event listener from the constructor of the controller to the start function The long term solution will be [#23005](#23005) (currently blocked by [#4004 on core](MetaMask/core#4004). ## **Related issues** Fixes: MetaMask/MetaMask-planning#881 ## **Manual testing steps** 1. Add `await new Promise((resolve) => setTimeout(resolve, 10000));` to the top of initialize on the background.js file 2. Build the app 3. Load extension and immediately open the network tab on the background console before the app initializes 4. No requests should happen ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** https://github.com/MetaMask/metamask-extension/assets/7499938/73513327-90fb-4e9f-8af2-aa41c731b647 ### **After** https://github.com/MetaMask/metamask-extension/assets/7499938/d6dee1c6-fa13-48c8-9fe2-520e3d43d0b3 ## **Pre-merge author checklist** - [ ] I’ve followed [MetaMask Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've clearly explained what problem this PR is solving and how it is solved. - [ ] I've linked related issues - [ ] I've included manual testing steps - [ ] I've included screenshots/recordings if applicable - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. - [ ] I’ve properly set the pull request status: - [ ] In case it's not yet "ready for review", I've set it to "draft". - [ ] In case it's "ready for review", I've changed it from "draft" to "non-draft". ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. --------- <!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/23730?quickstart=1) ## **Related issues** Fixes: ## **Manual testing steps** 1. Go to this page... 2. 3. ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [ ] I’ve followed [MetaMask Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. Co-authored-by: Dan J Miller <danjm.com@gmail.com>
This PR has been automatically marked as stale because it has not had recent activity in the last 60 days. It will be closed in 14 days. Thank you for your contributions. |
Closing this PR as the work has been handed over to the Extension Platform team. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
DO-NOT-MERGE
Pull requests that should not be merged
needs-dev-review
PR needs reviews from other engineers (in order to receive required approvals)
team-extension-platform
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
We want to have finer control over the initialization of the network controller inside the metamask controller. For additional background and reasoning, see the tickets linked below.
This PR also depends on 2 PRs (#274 on the smart transactions controller repo and #4004 on the core repo) being merged and the corresponding packages released first. Once that is done, I will update the dependencies on this PR.
Related issues
Fixes: #2114 on the planning repo (For more details see also #881)
See: PR #274 on the smart transactions controller repo and PR #4004 on the core repo.
Manual testing steps
develop
.yarn && yarn dist
.resolutions
section of thepackage.json
.yarn && yarn lavamoat:auto
.yarn && yarn dist
.Screenshots/Recordings
N/A
Pre-merge author checklist
Pre-merge reviewer checklist