{"action":"created","issue":{"url":"https://api.github.com/repos/paritytech/parity-signer/issues/419","repository_url":"https://api.github.com/repos/paritytech/parity-signer","labels_url":"https://api.github.com/repos/paritytech/parity-signer/issues/419/labels{/name}","comments_url":"https://api.github.com/repos/paritytech/parity-signer/issues/419/comments","events_url":"https://api.github.com/repos/paritytech/parity-signer/issues/419/events","html_url":"https://github.com/paritytech/parity-signer/issues/419","id":507183384,"node_id":"MDU6SXNzdWU1MDcxODMzODQ=","number":419,"title":"Account data structure refactoring for HDKD support","user":{"login":"Tbaut","id":33178835,"node_id":"MDQ6VXNlcjMzMTc4ODM1","avatar_url":"https://avatars2.githubusercontent.com/u/33178835?v=4","gravatar_id":"","url":"https://api.github.com/users/Tbaut","html_url":"https://github.com/Tbaut","followers_url":"https://api.github.com/users/Tbaut/followers","following_url":"https://api.github.com/users/Tbaut/following{/other_user}","gists_url":"https://api.github.com/users/Tbaut/gists{/gist_id}","starred_url":"https://api.github.com/users/Tbaut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tbaut/subscriptions","organizations_url":"https://api.github.com/users/Tbaut/orgs","repos_url":"https://api.github.com/users/Tbaut/repos","events_url":"https://api.github.com/users/Tbaut/events{/privacy}","received_events_url":"https://api.github.com/users/Tbaut/received_events","type":"User","site_admin":false},"labels":[{"id":954989576,"node_id":"MDU6TGFiZWw5NTQ5ODk1NzY=","url":"https://api.github.com/repos/paritytech/parity-signer/labels/F6-refactor","name":"F6-refactor","color":"dbea04","default":false},{"id":954989583,"node_id":"MDU6TGFiZWw5NTQ5ODk1ODM=","url":"https://api.github.com/repos/paritytech/parity-signer/labels/M4-core","name":"M4-core","color":"F5FCE6","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/paritytech/parity-signer/milestones/5","html_url":"https://github.com/paritytech/parity-signer/milestone/5","labels_url":"https://api.github.com/repos/paritytech/parity-signer/milestones/5/labels","id":3892300,"node_id":"MDk6TWlsZXN0b25lMzg5MjMwMA==","number":5,"title":"v4 HDKD","description":"Move to Hierarchical Deterministic Key Derivation","creator":{"login":"Tbaut","id":33178835,"node_id":"MDQ6VXNlcjMzMTc4ODM1","avatar_url":"https://avatars2.githubusercontent.com/u/33178835?v=4","gravatar_id":"","url":"https://api.github.com/users/Tbaut","html_url":"https://github.com/Tbaut","followers_url":"https://api.github.com/users/Tbaut/followers","following_url":"https://api.github.com/users/Tbaut/following{/other_user}","gists_url":"https://api.github.com/users/Tbaut/gists{/gist_id}","starred_url":"https://api.github.com/users/Tbaut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tbaut/subscriptions","organizations_url":"https://api.github.com/users/Tbaut/orgs","repos_url":"https://api.github.com/users/Tbaut/repos","events_url":"https://api.github.com/users/Tbaut/events{/privacy}","received_events_url":"https://api.github.com/users/Tbaut/received_events","type":"User","site_admin":false},"open_issues":4,"closed_issues":4,"state":"open","created_at":"2018-12-12T10:26:48Z","updated_at":"2019-10-15T11:29:55Z","due_on":null,"closed_at":null},"comments":1,"created_at":"2019-10-15T11:29:55Z","updated_at":"2019-10-15T13:50:18Z","closed_at":null,"author_association":"COLLABORATOR","body":"`AccountStore` should have the following elements:\r\n\r\n- a map of rootAccounts (indexed by `seedIndex`) containing \r\n  - the encrypted seed\r\n  - the decrypted seed\r\n  - a map of accounts (indexed by `accountIndex`) containing:\r\n    - derivation path\r\n    - derivation password\r\n    - address\r\n    - networkKey\r\n\r\nShould look like the following:\r\n```js\r\n{\r\n    [0] : {\r\n        'seed' : 'report eager tribe catalog abandon giggle brain glide prefer gossip fury',\r\n        'accounts' : {\r\n            [0] : {\r\n                'derivationPath' : '//Kusama//funding/0',\r\n                'derivationPassword' : 'myP4ssw0rd'\r\n                'networkKey' : '0xb28bd355a4cd1df46bc56a2949bce8feb84eebc864f1c3f1f77668bd3b6559b3', // this is the genesis hash\r\n                'address' : 'GnuqPFhJsvv2NDHqoZeGPPFS8yxTmMzZYKTuc1vCFYYT9fu'\r\n                'name ' : 'My funding account'\r\n            },\r\n            [1] : {\r\n                'derivationPath' : '//Polkadot//stash/0',\r\n                'derivationPassword' : ''\r\n                'networkKey' : '0x7898796767f46bc56a2949bce8feb84eebc864f1c3f1f77668bd3b6559b3', // this is the genesis hash\r\n                'address' : '5FsBU7BjUmxMMCC1nvwkeKMnzKuDbgEvo1LtmHqpfzFTGsnX'\r\n                'name ' : 'Alexander stash'\r\n            },\r\n        }\r\n    },\r\n    [1] : {\r\n        'seed' : ...\r\n        'accounts' : ...\r\n    },\r\n    ...\r\n}\r\n```\r\n\r\nA mapping between what the QR reading gives us, and an account should be created when the app launches. It will help find the seed and the account needed to sign a Tx with a constant time:\r\n```js\r\n{\r\n    // the key is protocol:address:genesis\r\n    ['substrate:GnuqPFhJsvv2NDHqoZeGPPFS8yxTmMzZYKTuc1vCFYYT9fu:0xb28bd355a4cd1df46bc56a2949bce8feb84eebc864f1c3f1f77668bd3b6559b3'] : {\r\n        'seedIndex' : 0,\r\n        'accountIndex' : 0\r\n    },\r\n     ['substrate:5FsBU7BjUmxMMCC1nvwkeKMnzKuDbgEvo1LtmHqpfzFTGsnX:0x7898796767f46bc56a2949bce8feb84eebc864f1c3f1f77668bd3b6559b3'] : {\r\n        'seedIndex' : 0,\r\n        'accountIndex' : 1\r\n    },\r\n    ...\r\n}\r\n```\r\n\r\n- The network mapping should remain the same as it currently is.\r\n- We need to make sure there's a migration from the old data structure to the new one.\r\n- We need to keep track of the last `seedIndex` and `accountIndex` that have been used to keep incrementing those so that account deletion doesn't create shifts."},"comment":{"url":"https://api.github.com/repos/paritytech/parity-signer/issues/comments/542221878","html_url":"https://github.com/paritytech/parity-signer/issues/419#issuecomment-542221878","issue_url":"https://api.github.com/repos/paritytech/parity-signer/issues/419","id":542221878,"node_id":"MDEyOklzc3VlQ29tbWVudDU0MjIyMTg3OA==","user":{"login":"Tbaut","id":33178835,"node_id":"MDQ6VXNlcjMzMTc4ODM1","avatar_url":"https://avatars2.githubusercontent.com/u/33178835?v=4","gravatar_id":"","url":"https://api.github.com/users/Tbaut","html_url":"https://github.com/Tbaut","followers_url":"https://api.github.com/users/Tbaut/followers","following_url":"https://api.github.com/users/Tbaut/following{/other_user}","gists_url":"https://api.github.com/users/Tbaut/gists{/gist_id}","starred_url":"https://api.github.com/users/Tbaut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tbaut/subscriptions","organizations_url":"https://api.github.com/users/Tbaut/orgs","repos_url":"https://api.github.com/users/Tbaut/repos","events_url":"https://api.github.com/users/Tbaut/events{/privacy}","received_events_url":"https://api.github.com/users/Tbaut/received_events","type":"User","site_admin":false},"created_at":"2019-10-15T13:50:18Z","updated_at":"2019-10-15T13:50:18Z","author_association":"COLLABORATOR","body":"I think the idea from @maciejhirsz was that if you delete an account, the indexing will not change,\r\n `[0]: {},[1]: {},[2]: {}` and you delete 1, you end up with `[0]: {},[2]: {}` and your indexing doesn't change. get(2) will still give you the 3rd account, although it's in second position now.\r\n\r\nIf you had an array, and say a mapping between an account id and its index, deleting things would shift things around and you'd have to recreated your indexes."}}
{"actor":{"display_login":"Tbaut"}}