Fix migration 048 chainId conversion (#9567)

feature/default_network_editable
Erik Marks 4 years ago committed by GitHub
parent 31d373e62c
commit f9e0c64abe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      app/scripts/migrations/048.js
  2. 16
      test/unit/migrations/048-test.js

@ -92,7 +92,7 @@ function transformState (state = {}) {
const addressBook = state.AddressBookController?.addressBook || {}
Object.keys(addressBook).forEach((networkKey) => {
if ((/^\d+$/ui).test(networkKey)) {
const chainId = `0x${networkKey.toString(16)}`
const chainId = `0x${parseInt(networkKey, 10).toString(16)}`
updateChainIds(addressBook[networkKey], chainId)
if (addressBook[chainId]) {

@ -237,8 +237,8 @@ describe('migration #48', function () {
const newStorage = await migration48.migrate(oldStorage)
assert.deepEqual(
{ ...oldStorage.data, ...expectedPreferencesState },
{ ...newStorage.data, ...expectedPreferencesState },
{ ...expectedPreferencesState, ...oldStorage.data },
{ ...expectedPreferencesState, ...newStorage.data },
)
})
@ -361,6 +361,12 @@ describe('migration #48', function () {
foo: 'bar',
},
},
'100': {
'address1': {
chainId: '100',
foo: 'bar',
},
},
'0x2': {
'address2': {
chainId: '0x2',
@ -387,6 +393,12 @@ describe('migration #48', function () {
foo: 'bar',
},
},
'0x64': {
'address1': {
chainId: '0x64',
foo: 'bar',
},
},
'0x2': {
'address2': {
chainId: '0x2',

Loading…
Cancel
Save