-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
feat: Feat/introduce native utils margelo #20778
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
## **Description** Replace JS `getPublicKey` function with our new C++ implementation. As you can see in videos it made login ~4s faster but I would take that with grain of salt as login time is quite variable due to other variables, it would require multiple measurements and averages and that would require quite some time and I plan to do it once we have all C++ function implemented in the app. According to code profiling I expect it to be around ~2s for SRP with 100+ accounts. <img width="293" height="209" alt="Screenshot 2025-09-25 at 23 40 16" src="https://github.com/user-attachments/assets/875d43a1-3265-4435-9c43-abe060cf3e4f" /> <img width="271" height="197" alt="Screenshot 2025-09-25 at 23 40 23" src="https://github.com/user-attachments/assets/0088b7ee-0b97-4544-ab92-aec7af77181a" /> CHANGELOG entry: ## **Related issues** Fixes: ## **Manual testing steps** 1. Just general smoke test, login, account import, SRP import... ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** https://github.com/user-attachments/assets/7250fee7-b111-4b46-87a5-e5638606a7b2 ### **After** https://github.com/user-attachments/assets/d8071433-5392-467a-ac97-e63ce8fe39aa ## **Pre-merge author checklist** - [ ] I’ve followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.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-mobile/blob/main/.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. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Replaces JS secp256k1 getPublicKey with a native C++ polyfill and refactors Ramp payment method selection into a new bottom-sheet modal with routing/tests, plus required iOS/dep updates. > > - **Native/Crypto**: > - Polyfill `@noble/curves` `secp256k1.getPublicKey` with native `@metamask/native-utils` in `shim.js`. > - Add deps: `@metamask/native-utils`, `react-native-nitro-modules`, pin `@noble/curves@1.9.6`, `@scure/bip32@1.7.0`; update `yarn.lock`. > - iOS: add pods `NitroModules`, `NativeUtils`; update `ffi` in `Gemfile.lock`. > - **Ramp UI (Buy/Sell)**: > - Replace `PaymentMethodModal` with new bottom-sheet `PaymentMethodSelectorModal` (styles, tests, snapshots). > - Update `BuildQuote` to navigate to `RampPaymentMethodSelectorModal` instead of inline modal; adjust handlers. > - Add route `Routes.RAMP.MODALS.PAYMENT_METHOD_SELECTOR` and register in `routes/index.tsx`. > - **Tests**: > - Update `BuildQuote.test.tsx` to assert navigation to selector modal; add dedicated tests for the new modal. > - **Tooling**: > - Add `react-native-nitro-modules` to `.depcheckrc.yml` ignores. > - Minor formatting changes in analytics/events and network banner tracking. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit b946d08. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
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. |
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Warning MetaMask internal reviewing guidelines:
|
|
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
Description
Re-introduce native utils package from Margelo. Previously, this broke builds in systems using Xcode 16.2, which had a swift compilation issue.
expo_main_pipeline
trigger - https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/a509e96b-1fa1-4baf-8879-2e237b72b3ebChangelog
CHANGELOG entry:
Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Adds @metamask/native-utils with Nitro Modules and overrides secp256k1 getPublicKey for native performance; updates iOS stacks/tooling to Xcode 16.3 and bumps CI action refs.
@metamask/native-utils
andreact-native-nitro-modules
; polyfillsecp256k1.getPublicKey
inshim.js
usinggetPublicKey
from@metamask/native-utils
.@scure/bip32@1.7.0
,@noble/curves@1.9.6
); updateyarn.lock
accordingly and ignorereact-native-nitro-modules
in.depcheckrc.yml
.NativeUtils
andNitroModules
pods inPodfile.lock
; minorffi
bump inios/Gemfile.lock
.MetaMask/github-tools
setup-e2e-env
action SHA across workflows.run-e2e-api-specs
, Bitrisemeta.stack
, etc.); adjust machine types where specified.Written by Cursor Bugbot for commit a0d67f1. This will update automatically on new commits. Configure here.