diff --git a/app/scripts/migrations/120.3.test.ts b/app/scripts/migrations/120.6.test.ts similarity index 92% rename from app/scripts/migrations/120.3.test.ts rename to app/scripts/migrations/120.6.test.ts index 11bef64a3422..1a7daa3aa225 100644 --- a/app/scripts/migrations/120.3.test.ts +++ b/app/scripts/migrations/120.6.test.ts @@ -1,5 +1,5 @@ import { cloneDeep } from 'lodash'; -import { migrate, version } from './120.3'; +import { migrate, version } from './120.6'; const sentryCaptureExceptionMock = jest.fn(); @@ -7,9 +7,9 @@ global.sentry = { captureException: sentryCaptureExceptionMock, }; -const oldVersion = 120.2; +const oldVersion = 120.5; -describe('migration #120.3', () => { +describe('migration #120.6', () => { afterEach(() => { jest.resetAllMocks(); }); @@ -72,7 +72,7 @@ describe('migration #120.3', () => { expect(newStorage.data).toStrictEqual(oldStorageDataClone); }); - it('reports error and returns state unchanged if transactions property is invalid', async () => { + it('removes transactions property if it is invalid', async () => { const oldStorage = { meta: { version: oldVersion }, data: { @@ -82,14 +82,13 @@ describe('migration #120.3', () => { }, }, }; - const oldStorageDataClone = cloneDeep(oldStorage.data); const newStorage = await migrate(oldStorage); - expect(sentryCaptureExceptionMock).toHaveBeenCalledWith( - `Migration ${version}: Invalid TransactionController transactions state of type 'string'`, - ); - expect(newStorage.data).toStrictEqual(oldStorageDataClone); + expect(newStorage.data).toStrictEqual({ + PreferencesController: {}, + TransactionController: {}, + }); }); it('reports error and returns state unchanged if there is an invalid transaction', async () => { diff --git a/app/scripts/migrations/120.3.ts b/app/scripts/migrations/120.6.ts similarity index 93% rename from app/scripts/migrations/120.3.ts rename to app/scripts/migrations/120.6.ts index 139e6f5221c2..70be368f0c98 100644 --- a/app/scripts/migrations/120.3.ts +++ b/app/scripts/migrations/120.6.ts @@ -7,7 +7,7 @@ type VersionedData = { data: Record; }; -export const version = 120.3; +export const version = 120.6; const MAX_TRANSACTION_HISTORY_LENGTH = 100; @@ -52,9 +52,12 @@ function transformState(state: Record): void { ); return; } else if (!Array.isArray(transactionControllerState.transactions)) { - global.sentry?.captureException( - `Migration ${version}: Invalid TransactionController transactions state of type '${typeof transactionControllerState.transactions}'`, + log.error( + new Error( + `Migration ${version}: Invalid TransactionController transactions state of type '${typeof transactionControllerState.transactions}'`, + ), ); + delete transactionControllerState.transactions; return; } diff --git a/app/scripts/migrations/index.js b/app/scripts/migrations/index.js index f4757c22fdf8..305343e7124f 100644 --- a/app/scripts/migrations/index.js +++ b/app/scripts/migrations/index.js @@ -133,9 +133,10 @@ const migrations = [ require('./120'), require('./120.1'), require('./120.2'), - require('./120.3'), + // require('./120.3'), Renamed to 120.6, do not re-use this number require('./120.4'), require('./120.5'), + require('./120.6'), require('./121'), require('./122'), require('./123'),