-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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: snaps controllers integration (Flask Only) #7942
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. |
New and updated dependencies detected. Learn more about Socket for GitHub ↗︎
|
👍 Dependency issues cleared. Learn more about Socket for GitHub ↗︎ This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored. Ignoring: Next stepsTake a deeper look at the dependencyTake a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support [AT] socket [DOT] dev. Remove the packageIf you happen to install a dependency that Socket reports as Known Malware you should immediately remove it and select a different dependency. For other alert types, you may may wish to investigate alternative packages or consider if there are other ways to mitigate the specific risk posed by the dependency. Mark a package as acceptable riskTo ignore an alert, reply with a comment starting with |
b20703d
to
111f7dd
Compare
6f9ddff
to
204c565
Compare
## **Description** This PR adds a custom native module RNTar. This module takes a file system path to a `.tgz` (tar gzip) file. The module reads this file, decompresses it and places it in the target directory. It then returns the new location of the decompressed data. This PR is needed for the mobile snaps implementation and will be used in this following [PR](#7942). - All of the javascript code is code fenced so non of it will appear in the main MetaMask app - the native modules cannot be code fenced so they will be included in the main app. They are never called from the UI so it should not interfere. Most of the native code (java and swift) was implemented and reviewed in previous prs. This change is bringing them into main. - [Original Android PR](#6300) - [Original iOS PR](#5926) ## **Related issues** Progresses: MetaMask/accounts-planning#143 ## **Manual testing steps** - clone this branch - run `yarn setup` - open `js.env` - change `export METAMASK_BUILD_TYPE` to `export METAMASK_BUILD_TYPE="flask"` - run `source .js.env` - run `yarn watch:clean` - run the app in ios or android - navigate to settings/Snaps - click the `Test RNTar` button - it should succeed and log the output directory - if you open the output directory (logged in the console) you should see the package folder with all of the code for the [filesnap](https://github.com/filecoin-project/filsnap) - once you have confirmed that the module is properly decompressed, go back to `.js.env` - change `METAMASK_BUILD_TYPE` back to `main` - run `source .js.env` - reload watchman (`yarn watch:clean`) - navigate back to settings - the `Snaps` section should no longer be present - repeat these steps with the opposite operating system ### Running android unit tests - open this branch in Android studio - open the `RNTarTest.java` - run the test suite - it should pass <img width="1728" alt="Screenshot 2023-11-29 at 11 45 27 PM" src="https://github.com/MetaMask/metamask-mobile/assets/22918444/982b899e-fc9c-46ed-9ffe-84af5e9c3f89"> ## **Screenshots/Recordings** ### **After** https://github.com/MetaMask/metamask-mobile/assets/22918444/2b95b1c1-54d7-4060-8f95-3d8d565b0203 https://github.com/MetaMask/metamask-mobile/assets/22918444/273be30e-c39d-4906-8828-04b8e93ca2af ## **Pre-merge author checklist** - [x] I’ve followed [MetaMask Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've clearly explained what problem this PR is solving and how it is solved. - [x] I've linked related issues - [x] I've included manual testing steps - [x] I've included screenshots/recordings if applicable - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. - [x] I’ve properly set the pull request status: - [x] 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** - [x] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [x] 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.
e2b8774
to
8e46e4a
Compare
app/components/Views/Snaps/components/SnapPermissions/SnapPermissions.tsx
Outdated
Show resolved
Hide resolved
a6499c5
to
eb97784
Compare
fd75952
to
d354a18
Compare
E2E test started on Bitrise: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/077d55c7-03bd-4338-bff4-272f5cd151f2 |
E2E test started on Bitrise: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/48b3f443-236a-4d09-ba0d-a398f8029316 |
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! Left some comments.
c2726a0
to
ad1fa63
Compare
E2E test started on Bitrise: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/dcaaa896-5313-4c87-9f6e-bff67a06f05e |
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.
Engine, RpcMethodMiddleware, EngineService, BackgroundBridge and Engine LGTM!
Cool thing that we use code fencing only for snaps and this way we can create easily other feature to include on the diferent featureSet!
Awesome work going on 🚀
we have decided to iteratively ship improvements to this implementation after it merges.
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.
The overall code looks good to me, there are a lot of improvements to be done but we need to take into consideration that this is the first iteration of the code working and this is a great step into opening the snaps platform in the mobile app to the dev community. Since it is behind code fencing I don't have any reason to not merge it as it is and start working on smaller refactors that can be shipped faster and stop dedicating time into constant rebases.
The comments I left in the PR are suggestion I'd like to see done but I don't mind it being addressed in a follow up PR.
To do in a follow up PR:
- Address pending comments
- Add unit tests to all files in
core/Snaps
- The
Engine
is getting too big, this code would be a good candidate to break it down to another file
Great work @owencraston 🎉 🚢
app/components/Approvals/InstallSnapApproval/InstallSnapApproval.tsx
Outdated
Show resolved
Hide resolved
app/components/Views/Snaps/SnapsSettingsList/SnapsSettingsList.tsx
Outdated
Show resolved
Hide resolved
app/components/Views/Snaps/components/SnapPermissions/SnapPermissions.tsx
Show resolved
Hide resolved
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.
Excellent work putting all this together @owencraston ! Minor comments of mine, but approved since they can be addressed in a follow up PR.
f3903d1
Quality Gate failedFailed conditions 4.9% Duplication on New Code (required ≤ 3%) |
E2E test started on Bitrise: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/908dbf9e-632e-4d36-8059-ecbd4f3212bc |
Description
This pr enables snaps to be installed and executed on mobile. This change will be code fenced for flask only. We achieve this by doing the following..
All of these changes have been implemented and tested in this PR. This PR updates that logic and brings it into main behind a code fence.
Guide for reviewers
///: BEGIN:ONLY_INCLUDE_IF(snaps)...///: END:ONLY_INCLUDE_IF
///: BEGIN:ONLY_INCLUDE_IF(snaps)...///: END:ONLY_INCLUDE_IF
Related issues
Progresses: https://github.com/MetaMask/accounts-planning/issues/143
Manual testing steps
yarn setup
.js.env
METAMASK_BUILD_TYPE
toexport METAMASK_BUILD_TYPE="flask"
source .js.env
and then runyarn watch:clean
Get Public key
button on the snap site, you should get a resultsettings/snaps
Checking code fencing
main
snaps
section in the settings list should no longer existScreenshots/Recordings
After
Screen.Recording.2023-12-07.at.11.42.58.PM.mov
Pre-merge author checklist
Pre-merge reviewer checklist