Skip to content

Commit d9f005e

Browse files
chore: remove twelveWordMnemonicEnabled remote config (#5018)
### Description As the title ### Test plan n/a ### Related issues - Fixes RET-879 ### Backwards compatibility y ### Network scalability y
1 parent 51e1c43 commit d9f005e

18 files changed

+28
-50
lines changed

locales/base/translation.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,15 @@
6464
"protectWallet": {
6565
"title": "Protect Your Wallet",
6666
"subtitle": "Protect your wallet",
67-
"body": "If your phone is lost or stolen, your {{mnemonicLength}} word recovery phrase is the only way you can access your funds.",
67+
"body": "If your phone is lost or stolen, your 12 word recovery phrase is the only way you can access your funds.",
6868
"recoveryPhrase": {
6969
"title": "Use Recovery Phrase",
7070
"subtitle": "Write down your recovery phrase"
7171
}
7272
},
7373
"recoveryPhrase": {
7474
"title": "Your recovery phrase",
75-
"body": "Write these {{mnemonicLength}} words down somewhere safe, where it cannot be stolen or damaged.",
75+
"body": "Write these 12 words down somewhere safe, where it cannot be stolen or damaged.",
7676
"continue": "I've saved it",
7777
"copy": "Copy to clipboard",
7878
"mnemonicCopied": "Recovery phrase copied to clipboard",

src/app/saga.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,6 @@ export interface RemoteConfigValues {
239239
maxSwapSlippagePercentage: number
240240
networkTimeoutSeconds: number
241241
celoNews: CeloNewsConfig
242-
twelveWordMnemonicEnabled: boolean
243242
priceImpactWarningThreshold: number
244243
superchargeRewardContractAddress: string
245244
}

src/firebase/firebase.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,6 @@ export async function fetchRemoteConfigValues(): Promise<RemoteConfigValues | nu
341341
maxSwapSlippagePercentage: flags.maxSwapSlippagePercentage.asNumber(),
342342
networkTimeoutSeconds: flags.networkTimeoutSeconds.asNumber(),
343343
celoNews: celoNewsString ? JSON.parse(celoNewsString) : {},
344-
twelveWordMnemonicEnabled: flags.twelveWordMnemonicEnabled.asBoolean(),
345344
// Convert to percentage, so we're consistent with the price impact value returned by our swap API
346345
priceImpactWarningThreshold: flags.priceImpactWarningThreshold.asNumber() * 100,
347346
superchargeRewardContractAddress: flags.superchargeRewardContractAddress.asString(),

src/firebase/remoteConfigValuesDefaults.e2e.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ export const REMOTE_CONFIG_VALUES_DEFAULTS: Omit<
4444
maxSwapSlippagePercentage: 2,
4545
networkTimeoutSeconds: 30,
4646
celoNews: JSON.stringify({} as RemoteConfigValues['celoNews']),
47-
twelveWordMnemonicEnabled: true,
4847
priceImpactWarningThreshold: 0.04,
4948
superchargeRewardContractAddress: '',
5049
superchargeTokenConfigByToken: JSON.stringify(

src/firebase/remoteConfigValuesDefaults.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ export const REMOTE_CONFIG_VALUES_DEFAULTS: Omit<
4646
maxSwapSlippagePercentage: 2,
4747
networkTimeoutSeconds: 30,
4848
celoNews: JSON.stringify({} as RemoteConfigValues['celoNews']),
49-
twelveWordMnemonicEnabled: false,
5049
priceImpactWarningThreshold: 0.04,
5150
superchargeRewardContractAddress: '',
5251
superchargeTokenConfigByToken: JSON.stringify(

src/onboarding/registration/OnboardingRecoveryPhrase.test.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ const mockScreenProps = getMockStackScreenProps(Screens.OnboardingRecoveryPhrase
3030
describe('OnboardingRecoveryPhraseScreen', () => {
3131
const store = createMockStore({
3232
web3: {
33-
twelveWordMnemonicEnabled: true,
3433
account: '0xaccount',
3534
},
3635
})

src/onboarding/registration/OnboardingRecoveryPhrase.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import React, { useLayoutEffect, useState } from 'react'
44
import { useTranslation } from 'react-i18next'
55
import { ScrollView, StyleSheet, Text, View } from 'react-native'
66
import { SafeAreaView } from 'react-native-safe-area-context'
7-
import { useDispatch, useSelector } from 'react-redux'
7+
import { useDispatch } from 'react-redux'
88
import { recoveryPhraseInOnboardingCompleted } from 'src/account/actions'
99
import { OnboardingEvents } from 'src/analytics/Events'
1010
import ValoraAnalytics from 'src/analytics/ValoraAnalytics'
@@ -30,13 +30,10 @@ import { default as useTypedSelector } from 'src/redux/useSelector'
3030
import colors from 'src/styles/colors'
3131
import fontStyles from 'src/styles/fonts'
3232
import Logger from 'src/utils/Logger'
33-
import { twelveWordMnemonicEnabledSelector } from 'src/web3/selectors'
3433

3534
type Props = NativeStackScreenProps<StackParamList, Screens.OnboardingRecoveryPhrase>
3635

3736
function OnboardingRecoveryPhrase({ navigation }: Props) {
38-
const twelveWordMnemonicEnabled = useSelector(twelveWordMnemonicEnabledSelector)
39-
const mnemonicLength = twelveWordMnemonicEnabled ? '12' : '24'
4037
const onboardingProps = useTypedSelector(onboardingPropsSelector)
4138
const { step, totalSteps } = getOnboardingStepValues(Screens.ProtectWallet, onboardingProps)
4239
const accountKey = useAccountKey()
@@ -89,9 +86,7 @@ function OnboardingRecoveryPhrase({ navigation }: Props) {
8986
<SafeAreaView style={styles.container}>
9087
<ScrollView contentContainerStyle={styles.contentContainer}>
9188
<Text style={styles.recoveryPhraseTitle}>{t('recoveryPhrase.title')}</Text>
92-
<Text style={styles.recoveryPhraseBody}>
93-
{t('recoveryPhrase.body', { mnemonicLength })}
94-
</Text>
89+
<Text style={styles.recoveryPhraseBody}>{t('recoveryPhrase.body')}</Text>
9590
<BackupPhraseContainer
9691
readOnlyStyle={styles.backupPhrase}
9792
value={accountKey}

src/onboarding/registration/ProtectWallet.test.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ const mockScreenProps = getMockStackScreenProps(Screens.ProtectWallet)
4040
describe('ProtectWalletScreen', () => {
4141
const store = createMockStore({
4242
web3: {
43-
twelveWordMnemonicEnabled: true,
4443
account: '0xaccount',
4544
},
4645
})
@@ -62,7 +61,6 @@ describe('ProtectWalletScreen', () => {
6261
it('does not dispatch event if recoveryPhraseInOnboardingStatus is not NotStarted', async () => {
6362
const mockStore = createMockStore({
6463
web3: {
65-
twelveWordMnemonicEnabled: true,
6664
account: '0xaccount',
6765
},
6866
account: {

src/onboarding/registration/ProtectWallet.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,13 @@ import colors from 'src/styles/colors'
2121
import fontStyles from 'src/styles/fonts'
2222
import variables from 'src/styles/variables'
2323
import Logger from 'src/utils/Logger'
24-
import { twelveWordMnemonicEnabledSelector, walletAddressSelector } from 'src/web3/selectors'
24+
import { walletAddressSelector } from 'src/web3/selectors'
2525

2626
const TAG = 'ProtectWallet'
2727

2828
type Props = NativeStackScreenProps<StackParamList, Screens.ProtectWallet>
2929

3030
function ProtectWallet({ navigation }: Props) {
31-
const twelveWordMnemonicEnabled = useSelector(twelveWordMnemonicEnabledSelector)
32-
const mnemonicLength = twelveWordMnemonicEnabled ? '12' : '24'
3331
const onboardingProps = useTypedSelector(onboardingPropsSelector)
3432
const { step, totalSteps } = getOnboardingStepValues(Screens.ProtectWallet, onboardingProps)
3533
const address = useSelector(walletAddressSelector)
@@ -91,9 +89,7 @@ function ProtectWallet({ navigation }: Props) {
9189
<GuideKeyIcon />
9290
</View>
9391
<Text style={styles.protectWalletTitle}>{t('protectWallet.subtitle')}</Text>
94-
<Text style={styles.protectWalletBody}>
95-
{t('protectWallet.body', { mnemonicLength })}
96-
</Text>
92+
<Text style={styles.protectWalletBody}>{t('protectWallet.body')}</Text>
9793
</View>
9894
<View style={styles.cardSection}>
9995
<OnboardingCard

src/redux/migrations.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1601,4 +1601,8 @@ export const migrations = {
16011601
claimStatus: 'idle',
16021602
},
16031603
}),
1604+
197: (state: any) => ({
1605+
...state,
1606+
web3: _.omit(state.web3, 'twelveWordMnemonicEnabled'),
1607+
}),
16041608
}

src/redux/store.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ describe('store state', () => {
9898
{
9999
"_persist": {
100100
"rehydrated": true,
101-
"version": 196,
101+
"version": 197,
102102
},
103103
"account": {
104104
"acceptedTerms": false,
@@ -353,7 +353,6 @@ describe('store state', () => {
353353
"dataEncryptionKey": "0x0000000000000000000000000000000000008F68",
354354
"isDekRegistered": false,
355355
"mtwAddress": null,
356-
"twelveWordMnemonicEnabled": false,
357356
},
358357
}
359358
`)

src/redux/store.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const persistConfig: PersistConfig<RootState> = {
2323
key: 'root',
2424
// default is -1, increment as we make migrations
2525
// See https://github.com/valora-inc/wallet/tree/main/WALLET.md#redux-state-migration
26-
version: 196,
26+
version: 197,
2727
keyPrefix: `reduxStore-`, // the redux-persist default is `persist:` which doesn't work with some file systems.
2828
storage: FSStorage(),
2929
blacklist: ['networkInfo', 'alert', 'imports', 'keylessBackup', 'jumpstart'],

src/web3/reducer.ts

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import { Actions as AppActions, UpdateConfigValuesAction } from 'src/app/actions'
2-
import { REMOTE_CONFIG_VALUES_DEFAULTS } from 'src/firebase/remoteConfigValuesDefaults'
3-
import { getRehydratePayload, REHYDRATE, RehydrateAction } from 'src/redux/persist-helper'
4-
import { Actions, ActionTypes } from 'src/web3/actions'
1+
import { UpdateConfigValuesAction } from 'src/app/actions'
2+
import { REHYDRATE, RehydrateAction, getRehydratePayload } from 'src/redux/persist-helper'
3+
import { ActionTypes, Actions } from 'src/web3/actions'
54

65
export interface State {
76
account: string | null // this is the wallet address (EOA)
@@ -11,7 +10,6 @@ export interface State {
1110
dataEncryptionKey: string | null
1211
// Has the data encryption key been registered in the Accounts contract
1312
isDekRegistered: boolean | undefined
14-
twelveWordMnemonicEnabled: boolean
1513
}
1614

1715
const initialState: State = {
@@ -20,7 +18,6 @@ const initialState: State = {
2018
accountInWeb3Keystore: null,
2119
dataEncryptionKey: null,
2220
isDekRegistered: false,
23-
twelveWordMnemonicEnabled: REMOTE_CONFIG_VALUES_DEFAULTS.twelveWordMnemonicEnabled,
2421
}
2522

2623
export const reducer = (
@@ -60,11 +57,6 @@ export const reducer = (
6057
...state,
6158
isDekRegistered: true,
6259
}
63-
case AppActions.UPDATE_REMOTE_CONFIG_VALUES:
64-
return {
65-
...state,
66-
twelveWordMnemonicEnabled: action.configValues.twelveWordMnemonicEnabled,
67-
}
6860
default:
6961
return state
7062
}

src/web3/saga.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ describe(getOrCreateAccount, () => {
100100
])
101101
.call(
102102
generateMnemonic,
103-
MnemonicStrength.s256_24words,
103+
MnemonicStrength.s128_12words,
104104
MnemonicLanguages[expectedMnemonicLang] as unknown as MnemonicLanguages,
105105
bip39
106106
)

src/web3/saga.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import { createAccountDek } from 'src/web3/dataEncryptionKey'
2323
import {
2424
currentAccountSelector,
2525
mtwAddressSelector,
26-
twelveWordMnemonicEnabledSelector,
2726
walletAddressSelector,
2827
} from 'src/web3/selectors'
2928
import { call, delay, put, select, spawn, take } from 'typed-redux-saga'
@@ -61,10 +60,7 @@ export function* getOrCreateAccount() {
6160
try {
6261
Logger.debug(TAG + '@getOrCreateAccount', 'Creating a new account')
6362

64-
const twelveWordMnemonicEnabled = yield* select(twelveWordMnemonicEnabledSelector)
65-
const mnemonicBitLength = twelveWordMnemonicEnabled
66-
? MnemonicStrength.s128_12words
67-
: MnemonicStrength.s256_24words
63+
const mnemonicBitLength = MnemonicStrength.s128_12words
6864
const mnemonicLanguage = getMnemonicLanguage(yield* select(currentLanguageSelector))
6965
let mnemonic: string = yield* call(generateMnemonic, mnemonicBitLength, mnemonicLanguage, bip39)
7066

src/web3/selectors.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,3 @@ export const currentAccountInWeb3KeystoreSelector = (state: RootState) =>
2020
state.web3.accountInWeb3Keystore
2121
export const dataEncryptionKeySelector = (state: RootState) => state.web3.dataEncryptionKey
2222
export const isDekRegisteredSelector = (state: RootState) => state.web3.isDekRegistered
23-
export const twelveWordMnemonicEnabledSelector = (state: RootState) =>
24-
state.web3.twelveWordMnemonicEnabled

test/RootStateSchema.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4394,18 +4394,14 @@
43944394
"null",
43954395
"string"
43964396
]
4397-
},
4398-
"twelveWordMnemonicEnabled": {
4399-
"type": "boolean"
44004397
}
44014398
},
44024399
"required": [
44034400
"account",
44044401
"accountInWeb3Keystore",
44054402
"dataEncryptionKey",
44064403
"isDekRegistered",
4407-
"mtwAddress",
4408-
"twelveWordMnemonicEnabled"
4404+
"mtwAddress"
44094405
],
44104406
"type": "object"
44114407
},

test/schemas.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3121,6 +3121,15 @@ export const v196Schema = {
31213121
},
31223122
}
31233123

3124+
export const v197Schema = {
3125+
...v196Schema,
3126+
_persist: {
3127+
...v196Schema._persist,
3128+
version: 197,
3129+
},
3130+
web3: _.omit(v196Schema.web3, 'twelveWordMnemonicEnabled'),
3131+
}
3132+
31243133
export function getLatestSchema(): Partial<RootState> {
3125-
return v196Schema as Partial<RootState>
3134+
return v197Schema as Partial<RootState>
31263135
}

0 commit comments

Comments
 (0)