1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 11:22:43 +02:00

Remove unused lostAccounts state (#6979)

This commit is contained in:
Whymarrh Whitby 2019-08-08 17:03:10 -02:30 committed by GitHub
parent d4db2c3de3
commit ceace71bf5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
30 changed files with 9 additions and 181 deletions

View File

@ -142,7 +142,6 @@ setupMetamaskMeshMetrics()
* @property {Object} infuraNetworkStatus - An object of infura network status checks.
* @property {Block[]} recentBlocks - An array of recent blocks, used to calculate an effective but cheap gas price.
* @property {Array} shapeShiftTxList - An array of objects describing shapeshift exchange attempts.
* @property {Array} lostAccounts - TODO: Remove this feature. A leftover from the version-3 migration where our seed-phrase library changed to fix a bug where some accounts were mis-generated, but we recovered the old accounts as "lost" instead of losing them.
* @property {boolean} forgottenPassword - Returns true if the user has initiated the password recovery screen, is recovering from seed phrase.
*/

View File

@ -385,10 +385,6 @@ module.exports = class MetamaskController extends EventEmitter {
return {
...{ isInitialized },
...this.memStore.getFlatState(),
...{
// TODO: Remove usages of lost accounts
lostAccounts: [],
},
}
}
@ -1177,27 +1173,6 @@ module.exports = class MetamaskController extends EventEmitter {
* @property string privateKey - The private key of the account.
*/
/**
* Probably no longer needed, related to the Version 3 migration.
* Imports a hash of accounts to private keys into the vault.
*
* Described in:
* https://medium.com/metamask/metamask-3-migration-guide-914b79533cdd
*
* Uses the array's private keys to create a new Simple Key Pair keychain
* and add it to the keyring controller.
* @deprecated
* @param {Account[]} lostAccounts -
* @returns {Keyring[]} An array of the restored keyrings.
*/
importLostAccounts ({ lostAccounts }) {
const privKeys = lostAccounts.map(acct => acct.privateKey)
return this.keyringController.restoreKeyring({
type: 'Simple Key Pair',
data: privKeys,
})
}
//=============================================================================
// END (VAULT / KEYRING RELATED METHODS)
//=============================================================================

View File

@ -60,7 +60,6 @@
]
}
],
"lostAccounts": [],
"seedWords": null
},
"appState": {

View File

@ -102,8 +102,7 @@
"aa25854c0379e53c957ac9382e720c577fa31fd5"
]
}
],
"lostAccounts": []
]
},
"appState": {
"menuOpen": false,

View File

@ -93,7 +93,6 @@
"type": "testnet"
},
"shapeShiftTxList": [],
"lostAccounts": [],
"send": {
"gasLimit": null,
"gasPrice": null,
@ -104,7 +103,7 @@
"amount": "0x0",
"memo": "",
"errors": {},
"warnings": {},
"warnings": {},
"maxModeOn": false,
"editingTransactionId": null
},

View File

@ -103,8 +103,7 @@
"keyringTypes": [
"Simple Key Pair",
"HD Key Tree"
],
"lostAccounts": []
]
},
"appState": {
"menuOpen": false,

View File

@ -191,7 +191,6 @@
"type": "testnet"
},
"shapeShiftTxList": [],
"lostAccounts": [],
"frequentRpcListDetail": []
},
"appState": {

View File

@ -110,7 +110,6 @@
"type": "testnet"
},
"shapeShiftTxList": [],
"lostAccounts": [],
"send": {
"gasLimit": "0xea60",
"gasPrice": "0xba43b7400",

View File

@ -133,7 +133,6 @@
"type": "testnet"
},
"shapeShiftTxList": [],
"lostAccounts": [],
"send": {
"gasLimit": "0xea60",
"gasPrice": "0xba43b7400",

View File

@ -95,7 +95,6 @@
"type": "testnet"
},
"shapeShiftTxList": [],
"lostAccounts": [],
"send": {
"gasLimit": null,
"gasPrice": null,

View File

@ -34,7 +34,6 @@
"type": "testnet"
},
"shapeShiftTxList": [],
"lostAccounts": [],
"tokens": [],
"currentLocale": "en",
"preferences": {

View File

@ -72,8 +72,7 @@
"01208723ba84e15da2e71656544a2963b0c06d40"
]
}
],
"lostAccounts": []
]
},
"appState": {
"menuOpen": false,

View File

@ -44,8 +44,7 @@
"01208723ba84e15da2e71656544a2963b0c06d40"
]
}
],
"lostAccounts": []
]
},
"appState": {
"menuOpen": false,

View File

@ -1,89 +0,0 @@
{
"metamask": {
"currentCurrency": "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": [],
"network": "2",
"seedWords": null,
"unconfMsgs": {},
"messages": [],
"provider": {
"type": "testnet"
},
"selectedAddress": "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": {}
}

View File

@ -232,8 +232,7 @@
"rinkeby": "ok",
"ropsten": "ok",
"goerli": "ok"
},
"lostAccounts": []
}
},
"appState": {
"shouldClose": false,

View File

@ -86,7 +86,6 @@
"type": "testnet"
},
"shapeShiftTxList": [],
"lostAccounts": [],
"seedWords": null
},
"appState": {

View File

@ -707,8 +707,7 @@
"rinkeby": "ok",
"goerli": "ok"
},
"shapeShiftTxList": [],
"lostAccounts": []
"shapeShiftTxList": []
},
"appState": {
"shouldClose": true,

View File

@ -78,8 +78,7 @@
"provider": {
"type": "testnet"
},
"shapeShiftTxList": [],
"lostAccounts": []
"shapeShiftTxList": []
},
"appState": {
"menuOpen": false,

View File

@ -48,7 +48,6 @@
"type": "testnet"
},
"shapeShiftTxList": [],
"lostAccounts": [],
"seedWords": null
},
"appState": {

View File

@ -48,7 +48,6 @@
"type": "testnet"
},
"shapeShiftTxList": [],
"lostAccounts": [],
"seedWords": null
},
"appState": {

View File

@ -128,7 +128,6 @@
"type": "testnet"
},
"shapeShiftTxList": [],
"lostAccounts": [],
"send": {
"gasLimit": "0xea60",
"gasPrice": "0xba43b7400",

View File

@ -96,7 +96,6 @@
"type": "testnet"
},
"shapeShiftTxList": [],
"lostAccounts": [],
"send": {
"gasLimit": null,
"gasPrice": null,

View File

@ -86,7 +86,6 @@
"type": "testnet"
},
"shapeShiftTxList": [],
"lostAccounts": [],
"frequentRpcListDetail": []
},
"appState": {

View File

@ -1053,7 +1053,6 @@
{"depositAddress":"34vJ3AfmNcLiziA4VFgEVcQTwxVLD1qkke","depositType":"BTC","key":"shapeshift","response":{"status":"no_deposits","address":"34vJ3AfmNcLiziA4VFgEVcQTwxVLD1qkke"},"time":1522347459106},
{"depositAddress":"34vJ3AfmNcLiziA4VFgEVcQTwxVLD1qkkq","depositType":"BTC","key":"shapeshift","response":{"status":"no_deposits","address":"34vJ3AfmNcLiziA4VFgEVcQTwxVLD1qkkq"},"time":1522345459106}
],
"lostAccounts": [],
"send": {},
"currentLocale": "en",
"preferences": {

View File

@ -64,7 +64,6 @@
"noActiveNotices": true,
"shapeShiftTxList": [],
"infuraNetworkStatus": {},
"lostAccounts": [],
"seedWords": "debris dizzy just program just float decrease vacant alarm reduce speak stadium",
"forgottenPassword": null
}
}

View File

@ -758,14 +758,6 @@ describe('MetaMaskController', function () {
})
})
describe('#markAccountsFound', function () {
it('adds lost accounts to config manager data', function () {
metamaskController.markAccountsFound(noop)
const state = metamaskController.getState()
assert.deepEqual(state.lostAccounts, [])
})
})
describe('#markPasswordForgotten', function () {
it('adds and sets forgottenPassword to config data to true', function () {
metamaskController.markPasswordForgotten(noop)

View File

@ -19,7 +19,6 @@ const mapStateToProps = state => {
const {
approvedOrigins,
dismissedOrigins,
lostAccounts,
suggestedTokens,
providerRequests,
migratedPrivacyMode,
@ -42,7 +41,6 @@ const mapStateToProps = state => {
const isPopup = getEnvironmentType(window.location.href) === ENVIRONMENT_TYPE_POPUP
return {
lostAccounts,
forgottenPassword,
suggestedTokens,
unconfirmedTransactionsCount: unconfirmedTransactionsCountSelector(state),

View File

@ -157,7 +157,6 @@ module.exports = {
{ id: 'shapeShiftTx2', 'time': 1575000000000 },
{ id: 'shapeShiftTx3', 'time': 1475000000000 },
],
'lostAccounts': [],
'send': {
'gasLimit': '0xFFFF',
'gasPrice': '0xaa',

View File

@ -157,7 +157,6 @@ module.exports = {
{ id: 'shapeShiftTx2', 'time': 1575000000000 },
{ id: 'shapeShiftTx3', 'time': 1475000000000 },
],
'lostAccounts': [],
'send': {
'gasLimit': '0xFFFF',
'gasPrice': '0xaa',

View File

@ -1,23 +0,0 @@
const summary = require('../app/helpers/utils/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
`,
}
}