Skip to content

Commit

Permalink
temp+fix: Reapply migration 52 to fix undefined selectedAccount (#12115)
Browse files Browse the repository at this point in the history
<!--
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?
-->

This PR fixes #11866
where it ensures that selectedAccount in the AccountsController is
defined.

## **Related issues**

Fixes: #11866

## **Manual testing steps**

1. Run `main` and create a wallet with 3 accounts, select account 1
2. Kill the app and apply a migration that sets `selectedAccount` in the
AccountsController to undefined, re-run yarn watch and re-open app
3. Notice that the app is stuck on the splash screen
4. Kill the app and run this branch, which applies the migration that
fixes the issue. Notice that the app is now accessible again

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings]  -->
<img width="900" alt="Screenshot 2024-10-30 at 4 42 44 PM"
src="https://github.com/user-attachments/assets/394f1b4c-741c-4c7f-993e-b0120e16588e">

<img width="961" alt="Screenshot 2024-10-30 at 4 43 07 PM"
src="https://github.com/user-attachments/assets/37c685b2-925a-45c5-a7c4-7fadec8cba6f">

### **After**

<!-- [screenshots/recordings] -->
App is accessible again
<img width="444" alt="Screenshot 2024-10-30 at 10 11 24 PM"
src="https://github.com/user-attachments/assets/cc0cb9ef-2a5b-4804-a9e8-eac93cc4212d">


## **Pre-merge author checklist**

- [x] 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).
- [x] I've completed the PR template to the best of my ability
- [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.

## **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.
  • Loading branch information
runway-github[bot] authored Nov 1, 2024
1 parent 23d311c commit 5a4e78e
Show file tree
Hide file tree
Showing 965 changed files with 44,891 additions and 72,650 deletions.
2 changes: 1 addition & 1 deletion .android.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export FCM_CONFIG_PROJECT_ID=
export FCM_CONFIG_STORAGE_BUCKET=
export FCM_CONFIG_MESSAGING_SENDER_ID=
export FCM_CONFIG_APP_ID=
export GOOGLE_SERVICES_B64_ANDROID=
export GOOGLE_SERVICES_B64=
#Notifications Feature Announcements
export FEATURES_ANNOUNCEMENTS_ACCESS_TOKEN=
export FEATURES_ANNOUNCEMENTS_SPACE_ID=
Expand Down
8 changes: 7 additions & 1 deletion .depcheckrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ ignores:
- '@react-native-community/slider'
- 'patch-package'
- '@lavamoat/allow-scripts'
- 'babel-plugin-inline-import'
# This is used on the patch for TokenRatesController of Assets controllers, for we to be able to use the last version of it
- cockatiel

Expand Down Expand Up @@ -49,17 +48,22 @@ ignores:
- 'rn-nodeify'

## Unused devDependencies to investigate
- '@ethersproject/abi'
- '@metamask/swappable-obj-proxy'
- '@react-native-picker/picker'
- '@rnhooks/keyboard'
- '@segment/sovran-react-native'
- '@tradle/react-native-http'
- 'asyncstorage-down'
- 'buffer'
- 'd3-shape'
- 'dnode'
- 'eciesjs'
- 'eth-block-tracker'
- 'eth-json-rpc-infura'
- 'events'
- 'https-browserify'
- 'obs-store'
- 'path'
- 'pbkdf2'
- 'pify'
Expand All @@ -68,9 +72,11 @@ ignores:
- 'react-native-aes-crypto'
- 'react-native-aes-crypto-forked'
- 'react-native-crypto'
- 'react-native-flash-message'
- 'react-native-level-fs'
- 'react-native-os'
- 'react-native-randombytes'
- 'react-native-redash'
- 'react-native-swipe-gestures'
- 'react-native-tcp'
- 'socket.io-client'
Expand Down
37 changes: 22 additions & 15 deletions .detoxrc.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
/** @type {Detox.DetoxConfig} */
module.exports = {
artifacts: {
rootDir: "./artifacts",
rootDir: "./artifacts/screenshots",
plugins: {
screenshot: {
shouldTakeAutomaticSnapshots: true,
keepOnlyFailedTestsArtifacts: true,
takeWhen: {
testStart: false,
testDone: false,
},
},
video: {
enabled: true, // Enable video recording
keepOnlyFailedTestsArtifacts: true, // Keep only failed tests' videos
}
},
},
},

testRunner: {
args: {
$0: 'jest',
Expand All @@ -31,7 +26,7 @@ module.exports = {
configurations: {
'ios.sim.apiSpecs': {
device: 'ios.simulator',
app: process.env.CI ? 'ios.qa' :'ios.debug',
app: 'ios.debug',
testRunner: {
args: {
"$0": "node e2e/api-specs/run-api-spec-tests.js",
Expand All @@ -46,9 +41,10 @@ module.exports = {
device: 'ios.simulator',
app: 'ios.release',
},
'ios.sim.qa': {
device: 'ios.simulator',
app: 'ios.qa',
// because e2e run on debug mode in bitrise
'android.emu.bitrise.debug': {
device: 'android.bitrise.emulator',
app: 'android.bitrise.debug',
},

'android.emu.debug': {
Expand Down Expand Up @@ -90,21 +86,32 @@ module.exports = {
binaryPath: 'ios/build/Build/Products/Debug-iphonesimulator/MetaMask.app',
build: 'yarn start:ios:e2e',
},
'ios.qa': {
'ios.release': {
type: 'ios.app',
binaryPath:
'ios/build/Build/Products/Release-iphonesimulator/MetaMask-QA.app',
build: "METAMASK_BUILD_TYPE='main' METAMASK_ENVIRONMENT='qa' yarn build:ios:qa",
'ios/build/Build/Products/Release-iphonesimulator/MetaMask.app',
build: "METAMASK_BUILD_TYPE='main' METAMASK_ENVIRONMENT='production' yarn build:ios:release:e2e",
},
'android.bitrise.debug': {
type: 'android.apk',
binaryPath: 'android/app/build/outputs/apk/prod/debug/app-prod-debug.apk',
build: 'yarn start:android:e2e',
},
'android.debug': {
type: 'android.apk',
binaryPath: 'android/app/build/outputs/apk/prod/debug/app-prod-debug.apk',
build: 'yarn start:android:e2e',
},
'android.release': {
type: 'android.apk',
binaryPath:
'android/app/build/outputs/apk/prod/release/app-prod-release.apk',
build: "METAMASK_BUILD_TYPE='main' METAMASK_ENVIRONMENT='production' yarn build:android:release:e2e",
},
'android.qa': {
type: 'android.apk',
binaryPath: 'android/app/build/outputs/apk/qa/release/app-qa-release.apk',
build: "METAMASK_BUILD_TYPE='main' METAMASK_ENVIRONMENT='qa' yarn build:android:qa",
build: "METAMASK_BUILD_TYPE='main' METAMASK_ENVIRONMENT='qa' yarn build:android:qa:e2e",
},
},
};
6 changes: 0 additions & 6 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,6 @@ module.exports = {
rules: {
// under discussion
'no-unused-vars': 'off',
'react/no-unstable-nested-components': [
'warn',
{
allowAsProps: true,
},
],
},
},
{
Expand Down
2 changes: 0 additions & 2 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,3 @@
57afe4ca921d85a51a923470239ca977fccbd1ae
# Standardize prettier configuration https://github.com/MetaMask/metamask-mobile/pull/4182
bdb7f37c90e4fc923881a07fca38d4e77c73a579
# Fix mixed tabs and spaces https://github.com/MetaMask/metamask-mobile/pull/1379
9f9a1121c6899e06d4aeef29017bb479df142adb
34 changes: 8 additions & 26 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,12 @@
* @MetaMask/mobile-devs

# Design System Team
app/component-library/ @MetaMask/design-system-engineers
app/component-library/ @MetaMask/design-system-engineers @MetaMask/mobile-platform

# Platform Team
patches/ @MetaMask/mobile-platform
app/core/Engine.ts @MetaMask/mobile-platform
app/core/Engine.test.js @MetaMask/mobile-platform
app/core/Analytics/ @MetaMask/mobile-platform
app/util/metrics/ @MetaMask/mobile-platform
app/components/hooks/useMetrics/ @MetaMask/mobile-platform

# Supply Chain Team
bitrise.yml @MetaMask/supply-chain @MetaMask/mobile-platform
Expand Down Expand Up @@ -97,25 +94,10 @@ app/components/Views/NftDetails @MetaMask/metamask-assets
app/reducers/collectibles @MetaMask/metamask-assets

# UX Team
app/components/Views/AccountActions @MetaMask/wallet-ux
app/components/Views/AccountSelector @MetaMask/wallet-ux
app/components/Views/AddressQRCode @MetaMask/wallet-ux
app/components/Views/EditAccountName @MetaMask/wallet-ux
app/components/Views/LockScreen @MetaMask/wallet-ux
app/components/Views/Login @MetaMask/wallet-ux
app/components/Views/NetworkConnect @MetaMask/wallet-ux
app/components/Views/NetworkSelector @MetaMask/wallet-ux
app/components/Views/Onboarding @MetaMask/wallet-ux
app/components/Views/OnboardingCarousel @MetaMask/wallet-ux
app/components/Views/OnboardingSuccess @MetaMask/wallet-ux
app/components/Views/QRAccountDisplay @MetaMask/wallet-ux
app/components/Views/QRScanner @MetaMask/wallet-ux
app/components/Views/Settings @MetaMask/wallet-ux
app/components/Views/TermsAndConditions @MetaMask/wallet-ux

app/reducers/experimentalSettings @MetaMask/wallet-ux
app/reducers/modals @MetaMask/wallet-ux
app/reducers/navigation @MetaMask/wallet-ux
app/reducers/onboarding @MetaMask/wallet-ux
app/reducers/privacy @MetaMask/wallet-ux
app/reducers/settings @MetaMask/wallet-ux
app/components @MetaMask/wallet-ux
app/reducers/experimentalSettings @MetaMask/wallet-ux
app/reducers/modals @MetaMask/wallet-ux
app/reducers/navigation @MetaMask/wallet-ux
app/reducers/onboarding @MetaMask/wallet-ux
app/reducers/privacy @MetaMask/wallet-ux
app/reducers/settings @MetaMask/wallet-ux
2 changes: 1 addition & 1 deletion .github/workflows/add-release-label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
id: get-next-semver-version
env:
FORCE_NEXT_SEMVER_VERSION: ${{ vars.FORCE_NEXT_SEMVER_VERSION }}
run: ./get-next-semver-version.sh "$FORCE_NEXT_SEMVER_VERSION"
run: ./scripts/get-next-semver-version.sh "$FORCE_NEXT_SEMVER_VERSION"
working-directory: '.github/scripts'

- name: Add release label to PR and linked issues
Expand Down
16 changes: 14 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,18 @@ jobs:
bundler-cache: true
env:
BUNDLE_GEMFILE: ios/Gemfile
- name: Determine whether the current PR is a draft
id: set-is-draft
if: github.event_name == 'pull_request' && github.event.pull_request.number
run: echo "IS_DRAFT=$(gh pr view --json isDraft --jq '.isDraft' "${PR_NUMBER}")" >> "$GITHUB_OUTPUT"
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Setup registry config for using package previews on draft PRs
if: github.event_name == 'pull_request' && steps.set-is-draft.outputs.IS_DRAFT == 'true'
run: printf '%s\n\n%s' '@metamask:registry=https://npm.pkg.github.com' "//npm.pkg.github.com/:_authToken=${PACKAGE_READ_TOKEN}" > .npmrc
env:
PACKAGE_READ_TOKEN: ${{ secrets.PACKAGE_READ_TOKEN }}
- run: yarn setup
- name: Require clean working directory
shell: bash
Expand Down Expand Up @@ -167,14 +179,14 @@ jobs:
with:
name: ios-bundle
path: ios/main.jsbundle

ship-js-bundle-size-check:
runs-on: ubuntu-latest
needs: [js-bundle-size-check]
if: ${{ github.ref == 'refs/heads/main' }}
steps:
- uses: actions/checkout@v4

- name: Download iOS bundle
uses: actions/download-artifact@v4
with:
Expand Down
29 changes: 0 additions & 29 deletions .github/workflows/create-release-draft.yml

This file was deleted.

10 changes: 7 additions & 3 deletions .github/workflows/create-release-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,14 @@ jobs:
cache: yarn
- name: Install dependencies
run: yarn --immutable
- name: Create Release & Changelog PR
id: create-release-changelog-pr
- name: Set Versions
id: set-versions
shell: bash
run: SEMVER_VERSION=${{ github.event.inputs.semver-version }} VERSION_NUMBER=${{ github.event.inputs.version-number }} yarn set-version
- name: Create Release PR
id: create-release-pr
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
./scripts/create-release-pr.sh ${{ github.event.inputs.previous-version-tag }} ${{ github.event.inputs.semver-version }} ${{ github.event.inputs.version-number }}
./scripts/create-release-pr.sh ${{ github.event.inputs.previous-version-tag }} ${{ github.event.inputs.semver-version }}
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ android/app/_build*

# if we ever want to add google services
android/app/google-services.json
ios/GoogleService-Info.plist

# node.js
node_modules/
Expand Down Expand Up @@ -125,6 +124,3 @@ app/util/termsOfUse/termsOfUseContent.ts
docs/assets/termsOfUse.html

/app/images/branding

# build metadata
android/app/src/main/assets/modules.json
2 changes: 1 addition & 1 deletion .ios.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ FCM_CONFIG_PROJECT_ID=
FCM_CONFIG_STORAGE_BUCKET=
FCM_CONFIG_MESSAGING_SENDER_ID=
FCM_CONFIG_APP_ID=
GOOGLE_SERVICES_B64_IOS=
GOOGLE_SERVICES_B64=
#Notifications Feature Announcements
FEATURES_ANNOUNCEMENTS_ACCESS_TOKEN=
FEATURES_ANNOUNCEMENTS_SPACE_ID=
7 changes: 7 additions & 0 deletions .iyarc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# ReDoS vulnerability, no impact to this application, and fix not backported yet to the versions we use

GHSA-c2qf-rxjj-qqgw

# Sentry SDK Prototype Pollution gadget in JavaScript SDKs

GHSA-593m-55hh-j8gv
14 changes: 5 additions & 9 deletions .js.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,18 @@ export SEGMENT_FLUSH_INTERVAL="1"
export SEGMENT_FLUSH_EVENT_LIMIT="1"

# URL of security alerts API used to validate dApp requests.
export SECURITY_ALERTS_API_URL="https://security-alerts.api.cx.metamask.io"
export SECURITY_ALERTS_API_URL="http://localhost:3000"

# Temporary mechanism to enable security alerts API prior to release.
export MM_SECURITY_ALERTS_API_ENABLED="true"
export SECURITY_ALERTS_API_ENABLED="true"
# Firebase
export FCM_CONFIG_API_KEY=""
export FCM_CONFIG_AUTH_DOMAIN=""
export FCM_CONFIG_PROJECT_ID=""
export FCM_CONFIG_STORAGE_BUCKET=""
export FCM_CONFIG_MESSAGING_SENDER_ID=""
export FCM_CONFIG_APP_ID=""
export GOOGLE_SERVICES_B64_ANDROID=""
export GOOGLE_SERVICES_B64_IOS=""
export GOOGLE_SERVICES_B64=""
#Notifications Feature Announcements
export FEATURES_ANNOUNCEMENTS_ACCESS_TOKEN=
export FEATURES_ANNOUNCEMENTS_SPACE_ID=
Expand All @@ -91,10 +90,7 @@ export MM_ENABLE_SETTINGS_PAGE_DEV_OPTIONS="true"
# The endpoint used to submit errors and tracing data to Sentry for dev environment.
# export MM_SENTRY_DSN_DEV=

# Per dapp selected network (Amon Hen) feature flag
export MM_PER_DAPP_SELECTED_NETWORK=""

export MM_CHAIN_PERMISSIONS=""

# Multichain Feature flag
export MULTICHAIN_V1=""
#Multichain feature flag specific to UI changes
export MM_MULTICHAIN_V1_ENABLED=""
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20.17.0
20.12.2
5 changes: 1 addition & 4 deletions .storybook/storybook.requires.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,7 @@ const getStories = () => {
"./app/component-library/base-components/TagBase/TagBase.stories.tsx": require("../app/component-library/base-components/TagBase/TagBase.stories.tsx"),
"./app/component-library/components-temp/TagColored/TagColored.stories.tsx": require("../app/component-library/components-temp/TagColored/TagColored.stories.tsx"),
"./app/component-library/components-temp/KeyValueRow/KeyValueRow.stories.tsx": require("../app/component-library/components-temp/KeyValueRow/KeyValueRow.stories.tsx"),
"./app/components/Views/confirmations/components/UI/InfoRow/InfoRow.stories.tsx": require("../app/components/Views/confirmations/components/UI/InfoRow/InfoRow.stories.tsx"),
"./app/components/Views/confirmations/components/UI/ExpandableSection/ExpandableSection.stories.tsx": require("../app/components/Views/confirmations/components/UI/ExpandableSection/ExpandableSection.stories.tsx"),
"./app/components/Views/confirmations/components/UI/Tooltip/Tooltip.stories.tsx": require("../app/components/Views/confirmations/components/UI/Tooltip/Tooltip.stories.tsx"),
"./app/component-library/components/Texts/SensitiveText/SensitiveText.stories.tsx": require("../app/component-library/components/Texts/SensitiveText/SensitiveText.stories.tsx"),
"./app/components/UI/InfoRow/InfoRow.stories.tsx": require("../app/components/UI/InfoRow/InfoRow.stories.tsx"),
};
};

Expand Down
4 changes: 1 addition & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,5 @@
"cucumberautocomplete.steps": ["wdio/step-definitions/**/*.js"],
"cucumberautocomplete.syncfeatures": "wdio/to/features/*.feature",
"cucumberautocomplete.strictGherkinCompletion": true,
"typescript.tsdk": "node_modules/typescript/lib",
"javascript.preferences.importModuleSpecifier": "relative",
"typescript.preferences.importModuleSpecifier": "relative"
"typescript.tsdk": "node_modules/typescript/lib"
}
Loading

0 comments on commit 5a4e78e

Please sign in to comment.