-
Notifications
You must be signed in to change notification settings - Fork 3
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
☂️ React Native Compatibility Tracker 2.0 #12
Labels
Comments
This was referenced Apr 1, 2023
6 tasks
leotm
changed the title
React Native Compatibility Tracker 2.0
☂️ React Native Compatibility Tracker 2.0
Apr 24, 2023
13 tasks
leotm
added a commit
to MetaMask/metamask-mobile
that referenced
this issue
Nov 10, 2023
## **Description** Problem being solved: prototype pollution/poisoning SES lockdown (shim v0.18.8) on iOS JSC, baked early into RN core before RN initialisation for the simplest minimal solution as opposed to previous approach of shim'ing at the beginning of our entry file requiring further complex lib patches with SES lockdown on Android Hermes (introduced earlier in our [RN v0.71.6 upgrade](#6220)) being followed up separately currently bundling successfully, but runtime not yet functional _SES lockdown on Android JSC was also passing smoke tests after some work prior to Hermes_ _so a backup engine worth keeping on ice being followed up separately_ _Previous patches no longer required: [`eth-keyring-controller`](https://github.com/MetaMask/metamask-mobile/pull/3794/files#diff-19aae36749eec9908c74557591fade5cc596e9a40422d88594c0fba456870389), `ethjs-contract` (one not [two](https://github.com/MetaMask/metamask-mobile/pull/3794/files#diff-1970015453fca9583682c37a44695a3d26645329e586bb70ff6f05b74f936802)), [`web3-core-methods`](LavaMoat/docs#8), [`metro-react-native-babel-preset`](LavaMoat/docs#4), Sentry [config](LavaMoat/docs#6) (see previous PR: #3794 _Nb: `@babel/plugin-transform-regenerator` removed from `metro-react-native-babel-preset` since initial investigation_ _Nb: `@babel/plugin-transform-runtime` config opt `regenerator: true` previously caused iOS animated node assertion failures_ _Nb: default `@babel/plugin-transform-runtime` via `metro-react-native-babel-preset` causes additional 4 SES warnings_ <details> <summary>Nb: Current behaviour (not SES)</summary> ``` main, jsc - import wallet via SRP - tap form field: disables cmd+D (app must be closed, no Metro restart) main, v8 - (fresh) import wallet via SRP - if cmd+v paste ok, bot Import btn tappable when filled, but spinner hang (no error/warn), ~20s Metro dc - restart, enter pw, tap Unlock btn, spinner hang, still ~20s Metro dc - tap Reset Wallet, hang - import (continued) - partial responsiveness - tap form field: dev menu disabled (cmd+d, app must be closed) - unresponsive: tap Back, tap Show, cannot tap Import, cmd+v disabled - responsive: cycle/input fields - still ~20s Metro dc ``` </details> <details> <summary>Previous SES warnings when locking down at entry file (not RN InitializeCore)</summary> https://www.diffchecker.com/fjj1iObp ```console # JSC (26) Removing intrinsics.Object.setPrototypeOf.default Removing intrinsics.Object.setPrototypeOf.__esModule Removing intrinsics.Object.assign.default Removing intrinsics.Object.assign.__esModule Removing intrinsics.Reflect.construct.default Removing intrinsics.Reflect.construct.__esModule Removing intrinsics.Reflect.decorate Removing intrinsics.Reflect.metadata Removing intrinsics.Reflect.defineMetadata Removing intrinsics.Reflect.hasMetadata Removing intrinsics.Reflect.hasOwnMetadata Removing intrinsics.Reflect.getMetadata Removing intrinsics.Reflect.getOwnMetadata Removing intrinsics.Reflect.getMetadataKeys Removing intrinsics.Reflect.getOwnMetadataKeys Removing intrinsics.Reflect.deleteMetadata Removing intrinsics.%ArrayPrototype%.toReversed Removing intrinsics.%ArrayPrototype%.toSorted Removing intrinsics.%ArrayPrototype%.toSpliced Removing intrinsics.%ArrayPrototype%.with Removing intrinsics.%ArrayPrototype%.@@unscopables.toReversed Removing intrinsics.%ArrayPrototype%.@@unscopables.toSorted Removing intrinsics.%ArrayPrototype%.@@unscopables.toSpliced Removing intrinsics.%TypedArrayPrototype%.toReversed Removing intrinsics.%TypedArrayPrototype%.toSorted Removing intrinsics.%TypedArrayPrototype%.with ``` ```console # V8 (33) Removing intrinsics.Object.assign.default Removing intrinsics.Object.assign.__esModule Removing intrinsics.Object.setPrototypeOf.default Removing intrinsics.Object.setPrototypeOf.__esModule Removing intrinsics.JSON.rawJSON Removing intrinsics.JSON.isRawJSON Removing intrinsics.Reflect.construct.default Removing intrinsics.Reflect.construct.__esModule Removing intrinsics.Reflect.decorate Removing intrinsics.Reflect.metadata Removing intrinsics.Reflect.defineMetadata Removing intrinsics.Reflect.hasMetadata Removing intrinsics.Reflect.hasOwnMetadata Removing intrinsics.Reflect.getMetadata Removing intrinsics.Reflect.getOwnMetadata Removing intrinsics.Reflect.getMetadataKeys Removing intrinsics.Reflect.getOwnMetadataKeys Removing intrinsics.Reflect.deleteMetadata Removing intrinsics.%ArrayPrototype%.toReversed Removing intrinsics.%ArrayPrototype%.toSorted Removing intrinsics.%ArrayPrototype%.toSpliced Removing intrinsics.%ArrayPrototype%.with Removing intrinsics.%ArrayPrototype%.@@unscopables.toReversed Removing intrinsics.%ArrayPrototype%.@@unscopables.toSorted Removing intrinsics.%ArrayPrototype%.@@unscopables.toSpliced Removing intrinsics.%ArrayBufferPrototype%.transferToFixedLength Removing intrinsics.%ArrayBufferPrototype%.detached Removing intrinsics.%StringPrototype%.isWellFormed Removing intrinsics.%StringPrototype%.toWellFormed Removing intrinsics.%RegExpPrototype%.unicodeSets Removing intrinsics.%TypedArrayPrototype%.toReversed Removing intrinsics.%TypedArrayPrototype%.toSorted Removing intrinsics.%TypedArrayPrototype%.with ``` </details> <details> <summary>Notes on patch creation</summary> - `--exclude 'nothing'` to include `package.json` changes, then trim patch - `react-native` requires trimming majority of patch after initial diffs - upon failure on symlinks, `git clean -fdx` and re-create </details> ## **Related issues** Fixes - LavaMoat/docs#1 various issues - #3794 previous pr - LavaMoat/docs#12 various issues Worthy read for everyone on adding/upgrading libraries - endojs/endo#1855 ## **Manual testing steps** App functions normally ## **Screenshots/Recordings** ### **Before** Previously failing iOS (JSC) E2E tests have now been fixed - LavaMoat/docs#9 - https://github.com/MetaMask/metamask-mobile/assets/1881059/3cac630f-6ec8-4975-a273-8a115a4e8fe9 - https://github.com/MetaMask/metamask-mobile/assets/1881059/67221672-d1a3-4346-a783-5f93b53dbbe9 - https://github.com/MetaMask/metamask-mobile/assets/1881059/baa6e512-e307-4f0f-ae2f-77bfb4a29baf - https://github.com/MetaMask/metamask-mobile/assets/1881059/c21ffb0b-c9df-4223-ba73-5383dc8627f5 And more screenshots in related issues linked above ### **After** App functions normally --------- Co-authored-by: legobeat <[email protected]>
6 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Priority matrix
moreSWC,react-codemod<=0.66.x/0.66.5* metamask-mobile/0.69.x*/0.70.x/ 0.71.x metamask-mobile / 0.72.x / 0.73.xplatform :ios, '11.0'
0.69+: 12.4Re.Pack/rn-esbuild, bundling / sourcemapsrn-web/rn-macos/rn-windowsvariant*mode: debug / releasenew*** undergoing retirement
** 3rd party libs not yet mature, but issues prioritised
Tracker
length
on AsyncGenerator and AsyncFunctionPrototype react-native-community/jsc-android-buildscripts#181 we're no longer using android-jsc but Hermes insteadlength
(number) prop to whitelist AsyncGenerator and AsyncFunctionPrototype endojs/endo#1511TypeError: Promise constructor's argument is not a function
TypeError: undefined is not an object (evaluating 'getPrototypeOf(AsyncGeneratorPrototype)')
TypeError: Promise constructor's argument is not a function
TypeError: Cannot convert undefined or null to object
debug via Chrome[SyntaxError: No identifiers allowed directly after numeric literal] x2 no stack x2
, BigInt(1) + BigInt(2)ReferenceError: Can't find variable: BigInt
big-integer
shim testing onandroid-jsc
MetaMask/metamask-mobile#6221jsc-android
from250230.2.1
to294992.0.0
(@next
) forBigInt
MetaMask/metamask-mobile#6314TypeError: Promise constructor's argument is not a function
RN 0.67 supportRN 0.71 supportTypeError: undefined is not an object (evaluating 'state.engine.backgroundState.NetworkController.network')
w/o polyfillPromise (prev: immediate error, fewer warnings) 22 warnings, 3->6 errors (and remaining libraries)TypeError: Cannot read properties of undefined (reading 'network')
), 3->5 errors, 3 Sentry warnings, SES intrinsics removed warnings below (and remaining libraries)SES_UNHANDLED_REJECTION:
missing Exception error msgnpx react-native@latest init RN0720RC0 --version 0.72.0-rc.0
now requires Node 16 to initeval
for SES (Secure EcmaScript) support facebook/hermes#957 not happening anytime soonwith
statement for SES (Secure EcmaScript) support facebook/hermes#1056 not happening anytime soonQA: [RN 0.72.x + SES/lockdown 0.18.x + Android/iOS + Hermes + debug/release + Bundling + Promises]Running under lockdownabove ^react-native-lavamoat-lockdown
repo (since this is beyond /docs now) w CI matrix? lavamoat/RN/node versESBuild support,Not flexible enough atmReact Native backward-compat pre-0.66.5endojs/Jessie for RNCross-platform supportFlutterKMMmetamask-mobile
Notes
RN 0.66.5 types (globals.d.ts) (js global objects)
android-jsc (fbarchive) (debug-mode, release-mode)
"jsc-android": "^250231.0.0" (WebKitGTK 2.26.1) pre-RN 0.72
jscFlavor = 'org.webkit:android-jsc:+'
(orjscFlavor = 'org.webkit:android-jsc-intl:+'
)pre-release: v294992.0.0 (WebKitGTK 2.36.3) (only
jscFlavor = 'org.webkit:android-jsc-intl:+'
)Moved out of package.json in 0.72-stable | RN Monorepo | Migrate to package
v8-android (debug-mode: Remote JS Debugging, opt-in: release-mode)
v11.110.1 (jit/aot, intl/nointl)
Simplified model of moving parts (todo: interactive diagram)
javascript-environment: RN JS engines (3), transforms (~37), polyfills (11)
RN JS features per engine/platform table (excluding with)
metro-react-native-babel-preset v0.76.0
facebook/metro@e5950ae: [Breaking]: Increase minimum Node version from 14 to 16
package.json: 36 plugins
main.js: 23
extraPlugins.push
babel > packages
tc39: terminology glossary
Node (debug via cli-doctor)
https://drive.google.com/file/d/1mgKxKlpgjm2_KX4TP-G7hUti-JKjR2Xv/view
https://tmikov.blogspot.com/2023/09/how-to-speed-up-micro-benchmark-300x.html
https://www.youtube.com/watch?v=q-xKYA0EO-c
Join the convo 🌍
The text was updated successfully, but these errors were encountered: