commit
fa3e708f34
@ -0,0 +1,91 @@ |
|||||||
|
{ |
||||||
|
"metamask": { |
||||||
|
"currentFiat": "USD", |
||||||
|
"lostAccounts": [ |
||||||
|
"0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc", |
||||||
|
"0xec1adf982415d2ef5ec55899b9bfb8bc0f29251b" |
||||||
|
], |
||||||
|
"conversionRate": 11.06608791, |
||||||
|
"conversionDate": 1470421024, |
||||||
|
"isInitialized": true, |
||||||
|
"isUnlocked": true, |
||||||
|
"currentDomain": "example.com", |
||||||
|
"rpcTarget": "https://rawtestrpc.metamask.io/", |
||||||
|
"identities": { |
||||||
|
"0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc": { |
||||||
|
"name": "Wallet 1", |
||||||
|
"address": "0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc", |
||||||
|
"mayBeFauceting": false |
||||||
|
}, |
||||||
|
"0xec1adf982415d2ef5ec55899b9bfb8bc0f29251b": { |
||||||
|
"name": "Wallet 2", |
||||||
|
"address": "0xec1adf982415d2ef5ec55899b9bfb8bc0f29251b", |
||||||
|
"mayBeFauceting": false |
||||||
|
}, |
||||||
|
"0xeb9e64b93097bc15f01f13eae97015c57ab64823": { |
||||||
|
"name": "Wallet 3", |
||||||
|
"address": "0xeb9e64b93097bc15f01f13eae97015c57ab64823", |
||||||
|
"mayBeFauceting": false |
||||||
|
}, |
||||||
|
"0x704107d04affddd9b66ab9de3dd7b095852e9b69": { |
||||||
|
"name": "Wallet 4", |
||||||
|
"address": "0x704107d04affddd9b66ab9de3dd7b095852e9b69", |
||||||
|
"mayBeFauceting": false |
||||||
|
} |
||||||
|
}, |
||||||
|
"unconfTxs": {}, |
||||||
|
"accounts": { |
||||||
|
"0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc": { |
||||||
|
"code": "0x", |
||||||
|
"balance": "0x100000000000", |
||||||
|
"nonce": "0x0", |
||||||
|
"address": "0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc" |
||||||
|
}, |
||||||
|
"0xec1adf982415d2ef5ec55899b9bfb8bc0f29251b": { |
||||||
|
"code": "0x", |
||||||
|
"nonce": "0x0", |
||||||
|
"balance": "0x100000000000", |
||||||
|
"address": "0xec1adf982415d2ef5ec55899b9bfb8bc0f29251b" |
||||||
|
}, |
||||||
|
"0xeb9e64b93097bc15f01f13eae97015c57ab64823": { |
||||||
|
"code": "0x", |
||||||
|
"nonce": "0x0", |
||||||
|
"balance": "0x100000000000", |
||||||
|
"address": "0xeb9e64b93097bc15f01f13eae97015c57ab64823" |
||||||
|
}, |
||||||
|
"0x704107d04affddd9b66ab9de3dd7b095852e9b69": { |
||||||
|
"code": "0x", |
||||||
|
"balance": "0x0", |
||||||
|
"nonce": "0x0", |
||||||
|
"address": "0x704107d04affddd9b66ab9de3dd7b095852e9b69" |
||||||
|
} |
||||||
|
}, |
||||||
|
"transactions": [], |
||||||
|
"selectedAccount": "0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc", |
||||||
|
"network": "2", |
||||||
|
"seedWords": null, |
||||||
|
"isDisclaimerConfirmed": true, |
||||||
|
"unconfMsgs": {}, |
||||||
|
"messages": [], |
||||||
|
"provider": { |
||||||
|
"type": "testnet" |
||||||
|
}, |
||||||
|
"selectedAccount": "0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc" |
||||||
|
}, |
||||||
|
"appState": { |
||||||
|
"menuOpen": false, |
||||||
|
"currentView": { |
||||||
|
"name": "accountDetail", |
||||||
|
"detailView": null, |
||||||
|
"context": "0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc" |
||||||
|
}, |
||||||
|
"accountDetail": { |
||||||
|
"subview": "transactions" |
||||||
|
}, |
||||||
|
"currentDomain": "127.0.0.1:9966", |
||||||
|
"transForward": true, |
||||||
|
"isLoading": false, |
||||||
|
"warning": null |
||||||
|
}, |
||||||
|
"identities": {} |
||||||
|
} |
@ -0,0 +1,74 @@ |
|||||||
|
var KeyringController = require('../../../app/scripts/keyring-controller') |
||||||
|
var ConfigManager = require('../../../app/scripts/lib/config-manager') |
||||||
|
var IdStoreMigrator = require('../../../app/scripts/lib/idStore-migrator') |
||||||
|
|
||||||
|
var oldStyleVault = require('../mocks/oldVault.json') |
||||||
|
var badStyleVault = require('../mocks/badVault.json') |
||||||
|
|
||||||
|
var STORAGE_KEY = 'metamask-config' |
||||||
|
var PASSWORD = '12345678' |
||||||
|
var FIRST_ADDRESS = '0x4dd5d356c5A016A220bCD69e82e5AF680a430d00'.toLowerCase() |
||||||
|
var SEED = 'fringe damage bounce extend tunnel afraid alert sound all soldier all dinner' |
||||||
|
|
||||||
|
var BAD_STYLE_FIRST_ADDRESS = '0xac39b311dceb2a4b2f5d8461c1cdaf756f4f7ae9' |
||||||
|
|
||||||
|
QUnit.module('Old Style Vaults', { |
||||||
|
beforeEach: function () { |
||||||
|
window.localStorage[STORAGE_KEY] = JSON.stringify(oldStyleVault) |
||||||
|
|
||||||
|
this.configManager = new ConfigManager({ |
||||||
|
loadData: () => { return JSON.parse(window.localStorage[STORAGE_KEY]) }, |
||||||
|
setData: (data) => { window.localStorage[STORAGE_KEY] = JSON.stringify(data) }, |
||||||
|
}) |
||||||
|
|
||||||
|
this.migrator = new IdStoreMigrator({ |
||||||
|
configManager: this.configManager, |
||||||
|
}) |
||||||
|
} |
||||||
|
}) |
||||||
|
|
||||||
|
QUnit.test('migrator:isInitialized', function (assert) { |
||||||
|
assert.ok(this.migrator) |
||||||
|
}) |
||||||
|
|
||||||
|
QUnit.test('migrator:migratedVaultForPassword', function (assert) { |
||||||
|
var done = assert.async() |
||||||
|
|
||||||
|
this.migrator.migratedVaultForPassword(PASSWORD) |
||||||
|
.then((result) => { |
||||||
|
const { serialized, lostAccounts } = result |
||||||
|
assert.equal(serialized.data.mnemonic, SEED, 'seed phrase recovered') |
||||||
|
assert.equal(lostAccounts.length, 0, 'no lost accounts') |
||||||
|
done() |
||||||
|
}) |
||||||
|
}) |
||||||
|
|
||||||
|
QUnit.module('Old Style Vaults with bad HD seed', { |
||||||
|
beforeEach: function () { |
||||||
|
window.localStorage[STORAGE_KEY] = JSON.stringify(badStyleVault) |
||||||
|
|
||||||
|
this.configManager = new ConfigManager({ |
||||||
|
loadData: () => { return JSON.parse(window.localStorage[STORAGE_KEY]) }, |
||||||
|
setData: (data) => { window.localStorage[STORAGE_KEY] = JSON.stringify(data) }, |
||||||
|
}) |
||||||
|
|
||||||
|
this.migrator = new IdStoreMigrator({ |
||||||
|
configManager: this.configManager, |
||||||
|
}) |
||||||
|
} |
||||||
|
}) |
||||||
|
|
||||||
|
QUnit.test('migrator:migratedVaultForPassword', function (assert) { |
||||||
|
var done = assert.async() |
||||||
|
|
||||||
|
this.migrator.migratedVaultForPassword(PASSWORD) |
||||||
|
.then((result) => { |
||||||
|
const { serialized, lostAccounts } = result |
||||||
|
|
||||||
|
assert.equal(lostAccounts.length, 1, 'one lost account') |
||||||
|
assert.equal(lostAccounts[0].address, '0xe15D894BeCB0354c501AE69429B05143679F39e0'.toLowerCase()) |
||||||
|
assert.ok(lostAccounts[0].privateKey, 'private key exported') |
||||||
|
done() |
||||||
|
}) |
||||||
|
}) |
||||||
|
|
@ -1,126 +0,0 @@ |
|||||||
var KeyringController = require('../../../app/scripts/keyring-controller') |
|
||||||
var ConfigManager = require('../../../app/scripts/lib/config-manager') |
|
||||||
|
|
||||||
var oldStyleVault = require('../mocks/oldVault.json') |
|
||||||
var badStyleVault = require('../mocks/badVault.json') |
|
||||||
|
|
||||||
var STORAGE_KEY = 'metamask-config' |
|
||||||
var PASSWORD = '12345678' |
|
||||||
var FIRST_ADDRESS = '0x4dd5d356c5A016A220bCD69e82e5AF680a430d00'.toLowerCase() |
|
||||||
|
|
||||||
var BAD_STYLE_FIRST_ADDRESS = '0xac39b311dceb2a4b2f5d8461c1cdaf756f4f7ae9' |
|
||||||
|
|
||||||
|
|
||||||
QUnit.module('Old Style Vaults', { |
|
||||||
beforeEach: function () { |
|
||||||
window.localStorage[STORAGE_KEY] = JSON.stringify(oldStyleVault) |
|
||||||
|
|
||||||
this.configManager = new ConfigManager({ |
|
||||||
loadData: () => { return JSON.parse(window.localStorage[STORAGE_KEY]) }, |
|
||||||
setData: (data) => { window.localStorage[STORAGE_KEY] = JSON.stringify(data) }, |
|
||||||
}) |
|
||||||
|
|
||||||
this.keyringController = new KeyringController({ |
|
||||||
configManager: this.configManager, |
|
||||||
getNetwork: () => { return '2' }, |
|
||||||
txManager: { |
|
||||||
getTxList: () => [], |
|
||||||
getUnapprovedTxList: () => [] |
|
||||||
}, |
|
||||||
}) |
|
||||||
|
|
||||||
this.ethStore = { |
|
||||||
addAccount: () => {}, |
|
||||||
removeAccount: () => {}, |
|
||||||
} |
|
||||||
|
|
||||||
this.keyringController.setStore(this.ethStore) |
|
||||||
} |
|
||||||
}) |
|
||||||
|
|
||||||
QUnit.test('keyringController:isInitialized', function (assert) { |
|
||||||
assert.ok(this.keyringController.getState().isInitialized) |
|
||||||
}) |
|
||||||
|
|
||||||
QUnit.test('keyringController:submitPassword', function (assert) { |
|
||||||
var done = assert.async() |
|
||||||
|
|
||||||
this.keyringController.submitPassword(PASSWORD) |
|
||||||
.then((state) => { |
|
||||||
assert.ok(state.identities[FIRST_ADDRESS]) |
|
||||||
assert.equal(state.lostAccounts.length, 0, 'no lost accounts') |
|
||||||
done() |
|
||||||
}) |
|
||||||
}) |
|
||||||
|
|
||||||
QUnit.test('keyringController:setLocked', function (assert) { |
|
||||||
var done = assert.async() |
|
||||||
var self = this |
|
||||||
|
|
||||||
this.keyringController.setLocked() |
|
||||||
.then(function() { |
|
||||||
assert.notOk(self.keyringController.password, 'password should be deallocated') |
|
||||||
assert.deepEqual(self.keyringController.keyrings, [], 'keyrings should be deallocated') |
|
||||||
done() |
|
||||||
}) |
|
||||||
.catch((reason) => { |
|
||||||
assert.ifError(reason) |
|
||||||
done() |
|
||||||
}) |
|
||||||
}) |
|
||||||
|
|
||||||
QUnit.module('Old Style Vaults with bad HD seed', { |
|
||||||
beforeEach: function () { |
|
||||||
window.localStorage[STORAGE_KEY] = JSON.stringify(badStyleVault) |
|
||||||
|
|
||||||
this.configManager = new ConfigManager({ |
|
||||||
loadData: () => { return JSON.parse(window.localStorage[STORAGE_KEY]) }, |
|
||||||
setData: (data) => { window.localStorage[STORAGE_KEY] = JSON.stringify(data) }, |
|
||||||
}) |
|
||||||
|
|
||||||
this.keyringController = new KeyringController({ |
|
||||||
configManager: this.configManager, |
|
||||||
getNetwork: () => { return '2' }, |
|
||||||
}) |
|
||||||
|
|
||||||
this.ethStore = { |
|
||||||
addAccount: () => {}, |
|
||||||
removeAccount: () => {}, |
|
||||||
} |
|
||||||
|
|
||||||
this.keyringController.setStore(this.ethStore) |
|
||||||
} |
|
||||||
}) |
|
||||||
|
|
||||||
QUnit.test('keyringController:isInitialized', function (assert) { |
|
||||||
assert.ok(this.keyringController.getState().isInitialized, 'vault is initialized') |
|
||||||
}) |
|
||||||
|
|
||||||
QUnit.test('keyringController:submitPassword', function (assert) { |
|
||||||
var done = assert.async() |
|
||||||
|
|
||||||
this.keyringController.submitPassword(PASSWORD) |
|
||||||
.then((state) => { |
|
||||||
assert.ok(state.identities[BAD_STYLE_FIRST_ADDRESS]) |
|
||||||
assert.equal(state.lostAccounts.length, 1, 'one lost account') |
|
||||||
assert.equal(state.lostAccounts[0], '0xe15D894BeCB0354c501AE69429B05143679F39e0'.toLowerCase()) |
|
||||||
assert.deepEqual(this.configManager.getLostAccounts(), state.lostAccounts, 'persisted') |
|
||||||
done() |
|
||||||
}) |
|
||||||
}) |
|
||||||
|
|
||||||
QUnit.test('keyringController:setLocked', function (assert) { |
|
||||||
var done = assert.async() |
|
||||||
var self = this |
|
||||||
|
|
||||||
this.keyringController.setLocked() |
|
||||||
.then(function() { |
|
||||||
assert.notOk(self.keyringController.password, 'password should be deallocated') |
|
||||||
assert.deepEqual(self.keyringController.keyrings, [], 'keyrings should be deallocated') |
|
||||||
done() |
|
||||||
}) |
|
||||||
.catch((reason) => { |
|
||||||
assert.ifError(reason) |
|
||||||
done() |
|
||||||
}) |
|
||||||
}) |
|
@ -0,0 +1,23 @@ |
|||||||
|
const summary = require('../app/util').addressSummary |
||||||
|
|
||||||
|
module.exports = function (lostAccounts) { |
||||||
|
return { |
||||||
|
date: new Date().toDateString(), |
||||||
|
title: 'Account Problem Caught', |
||||||
|
body: `MetaMask has fixed a bug where some accounts were previously mis-generated. This was a rare issue, but you were affected!
|
||||||
|
|
||||||
|
We have successfully imported the accounts that were mis-generated, but they will no longer be recovered with your normal seed phrase. |
||||||
|
|
||||||
|
We have marked the affected accounts as "Loose", and recommend you transfer ether and tokens away from those accounts, or export & back them up elsewhere. |
||||||
|
|
||||||
|
Your affected accounts are: |
||||||
|
${lostAccounts.map(acct => ` - ${summary(acct)}`).join('\n')} |
||||||
|
|
||||||
|
These accounts have been marked as "Loose" so they will be easy to recognize in the account list. |
||||||
|
|
||||||
|
For more information, please read [our blog post.][1] |
||||||
|
|
||||||
|
[1]: https://medium.com/metamask/metamask-3-migration-guide-914b79533cdd#.7d8ktj4h3
|
||||||
|
`,
|
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue