{"action":"created","issue":{"url":"https://api.github.com/repos/input-output-hk/cardano-sl/issues/3786","repository_url":"https://api.github.com/repos/input-output-hk/cardano-sl","labels_url":"https://api.github.com/repos/input-output-hk/cardano-sl/issues/3786/labels{/name}","comments_url":"https://api.github.com/repos/input-output-hk/cardano-sl/issues/3786/comments","events_url":"https://api.github.com/repos/input-output-hk/cardano-sl/issues/3786/events","html_url":"https://github.com/input-output-hk/cardano-sl/pull/3786","id":373610791,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI1NTAwMzc5","number":3786,"title":"[CBR-471] Fix Restoration Performance Regression","user":{"login":"KtorZ","id":5680256,"node_id":"MDQ6VXNlcjU2ODAyNTY=","avatar_url":"https://avatars0.githubusercontent.com/u/5680256?v=4","gravatar_id":"","url":"https://api.github.com/users/KtorZ","html_url":"https://github.com/KtorZ","followers_url":"https://api.github.com/users/KtorZ/followers","following_url":"https://api.github.com/users/KtorZ/following{/other_user}","gists_url":"https://api.github.com/users/KtorZ/gists{/gist_id}","starred_url":"https://api.github.com/users/KtorZ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KtorZ/subscriptions","organizations_url":"https://api.github.com/users/KtorZ/orgs","repos_url":"https://api.github.com/users/KtorZ/repos","events_url":"https://api.github.com/users/KtorZ/events{/privacy}","received_events_url":"https://api.github.com/users/KtorZ/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-10-24T18:11:58Z","updated_at":"2018-10-25T07:07:22Z","closed_at":null,"author_association":"MEMBER","pull_request":{"url":"https://api.github.com/repos/input-output-hk/cardano-sl/pulls/3786","html_url":"https://github.com/input-output-hk/cardano-sl/pull/3786","diff_url":"https://github.com/input-output-hk/cardano-sl/pull/3786.diff","patch_url":"https://github.com/input-output-hk/cardano-sl/pull/3786.patch"},"body":"## Description\r\n\r\n~~I am still testing this (I had an issue with the very last block application causing the checkpoints to diverge in a non expected way). I believe it's now fixed but I have to wait full restoration.~~\r\n**edit**: Now tested, everything seems fine (see comment below)\r\n\r\n\r\nWe use to perform a db transaction per block which turns out to slow down the process quite a lot.  Instead, we can apply k (.e.g 1000) updates inside one transaction and move on to the next batch. There's a bit of fiddling to do to get things working, but it turns out to be pretty efficient (~600 block/s on my setup, vs 80 block/s without the patch).\r\n\r\nThe main trick is located in the new `applyHistoricalBlocks` which applies update in sequence, stopping at the first error encountered.\r\n\r\nBesides, we should have cought the performance regression earlier. We can't realistically perform restoration as part of our unit or main integration tests because of the time it takes. However, it is perfectly realistic to have it ran nightly, and monitor its output to be inside accepted boundaries.\r\n\r\n\r\n## Linked issue\r\n\r\n[[CBR-471]](https://iohk.myjetbrains.com/youtrack/issue/CBR-471)\r\n\r\n## Type of change\r\n<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply and `~` in the ones that do not: -->\r\n- [x] 🐞 Bug fix (non-breaking change which fixes an issue)\r\n- [ ] 🛠 New feature (non-breaking change which adds functionality)\r\n- [ ] ⚠️ Breaking change (fix or feature that would cause existing functionality to change)\r\n- [ ] 🏭 Refactoring that does not change existing functionality but does improve things like code readability, structure etc\r\n- [ ] 🔨 New or improved tests for existing code\r\n- [ ] ⛑ git-flow chore (backport, hotfix, etc)\r\n\r\n## Developer checklist\r\n<!--- A mental checklist for the developer submitting the PR. Put an `x` in all the boxes that apply and `~` in the ones that do not: --->\r\n- [x] I have read the [style guide](https://github.com/input-output-hk/cardano-sl/blob/develop/docs/style-guide.md) document, and my code follows the code style of this project.\r\n- [x] If my code deals with exceptions, it follows the [guidelines](https://github.com/input-output-hk/cardano-sl/blob/develop/docs/exceptions.md).\r\n- [x] I have updated any documentation accordingly, if needed. Documentation changes can be reflected in opening a PR on [cardanodocs.com](https://github.com/input-output-hk/cardanodocs.com), amending the inline [Haddock](https://www.haskell.org/haddock/) comments, any relevant README file or one of the document listed in the [docs](https://github.com/input-output-hk/cardano-sl/tree/develop/docs) directory.\r\n- [ ] CHANGELOG entry has been added and is linked to the correct PR on GitHub.\r\n\r\n## Testing checklist\r\n<!-- If you aren't providing any tests as part of this PR, use this section to state clearly why. It needs to be a strong motivation and definitely the exception, not the rule. -->\r\n- [x] I have added tests to cover my changes.\r\n- [x] All new and existing tests passed.\r\n\r\n## QA Steps\r\n\r\n```\r\nnix-build -A acceptanceTests.mainnet.full -o acceptance-tests && ./acceptance-tests\r\n```\r\n\r\n... then go for a long coffee :coffee: \r\n\r\n## Screenshots (if available)\r\n\r\n```\r\nLaunching wallet node: /nix/store/19ls1ww691cq0z32196alq82js761pj4-wallet-connect-to-mainnet\r\n22:05:09 Blockchain syncing...\r\n22:05:19 Blockchain syncing: 81%  1399744/1709971 blocks\r\n22:05:32 Blockchain syncing: 82%  1403775/1709971 blocks\r\n22:05:43 Blockchain syncing: 82%  1409791/1709972 blocks\r\n22:05:53 Blockchain syncing: 82%  1416063/1709972 blocks\r\n22:06:03 Blockchain syncing: 82%  1417471/1709972 blocks\r\n22:06:13 Blockchain syncing: 83%  1419583/1709973 blocks\r\n22:06:23 Blockchain syncing: 83%  1423743/1709974 blocks\r\n22:06:33 Blockchain syncing: 83%  1426686/1709974 blocks\r\n22:06:43 Blockchain syncing: 83%  1428606/1709974 blocks\r\n22:06:53 Blockchain syncing: 83%  1430974/1709975 blocks\r\n22:07:03 Blockchain syncing: 83%  1433726/1709975 blocks\r\n22:07:13 Blockchain syncing: 84%  1436478/1709976 blocks\r\n22:07:23 Blockchain syncing: 84%  1441982/1709977 blocks\r\n22:07:33 Blockchain syncing: 84%  1446718/1709977 blocks\r\n22:07:43 Blockchain syncing: 84%  1448573/1709978 blocks\r\n22:07:54 Blockchain syncing: 85%  1454973/1709978 blocks\r\n22:08:04 Blockchain syncing: 85%  1460925/1709979 blocks\r\n22:08:14 Blockchain syncing: 85%  1465853/1709979 blocks\r\n22:08:24 Blockchain syncing: 85%  1466557/1709980 blocks\r\n22:08:35 Blockchain syncing: 85%  1468540/1709980 blocks\r\n22:08:46 Blockchain syncing: 86%  1476092/1709981 blocks\r\n22:08:56 Blockchain syncing: 86%  1481468/1709981 blocks\r\n22:09:06 Blockchain syncing: 86%  1487228/1709982 blocks\r\n22:09:16 Blockchain syncing: 87%  1490235/1709982 blocks\r\n22:09:26 Blockchain syncing: 87%  1497019/1709983 blocks\r\n22:09:36 Blockchain syncing: 87%  1502907/1709983 blocks\r\n22:09:46 Blockchain syncing: 88%  1506747/1709984 blocks\r\n22:09:56 Blockchain syncing: 88%  1511675/1709984 blocks\r\n22:10:07 Blockchain syncing: 88%  1515578/1709985 blocks\r\n22:10:17 Blockchain syncing: 88%  1521530/1709985 blocks\r\n22:10:27 Blockchain syncing: 89%  1527290/1709986 blocks\r\n22:10:37 Blockchain syncing: 89%  1532474/1709987 blocks\r\n22:10:47 Blockchain syncing: 89%  1536441/1709987 blocks\r\n22:10:57 Blockchain syncing: 90%  1542585/1709987 blocks\r\n22:11:07 Blockchain syncing: 90%  1547961/1709988 blocks\r\n22:11:17 Blockchain syncing: 90%  1553401/1709988 blocks\r\n22:11:27 Blockchain syncing: 91%  1556728/1709989 blocks\r\n22:11:37 Blockchain syncing: 91%  1562616/1709990 blocks\r\n22:11:47 Blockchain syncing: 91%  1568440/1709990 blocks\r\n22:11:57 Blockchain syncing: 92%  1574008/1709991 blocks\r\n22:12:07 Blockchain syncing: 92%  1576695/1709991 blocks\r\n22:12:17 Blockchain syncing: 92%  1583351/1709991 blocks\r\n22:12:27 Blockchain syncing: 92%  1588151/1709992 blocks\r\n22:12:37 Blockchain syncing: 93%  1593783/1709993 blocks\r\n22:12:51 Blockchain syncing: 93%  1598070/1709993 blocks\r\n22:13:01 Blockchain syncing: 93%  1605430/1709994 blocks\r\n22:13:11 Blockchain syncing: 94%  1610934/1709994 blocks\r\n22:13:21 Blockchain syncing: 94%  1616438/1709995 blocks\r\n22:13:32 Blockchain syncing: 94%  1619637/1709995 blocks\r\n22:13:42 Blockchain syncing: 95%  1625909/1709996 blocks\r\n22:13:52 Blockchain syncing: 95%  1630389/1709996 blocks\r\n22:14:02 Blockchain syncing: 95%  1636149/1709997 blocks\r\n22:14:13 Blockchain syncing: 95%  1641141/1709997 blocks\r\n22:14:23 Blockchain syncing: 96%  1644788/1709998 blocks\r\n22:14:33 Blockchain syncing: 96%  1651252/1709998 blocks\r\n22:14:43 Blockchain syncing: 96%  1657204/1709999 blocks\r\n22:14:53 Blockchain syncing: 97%  1662644/1709999 blocks\r\n22:15:03 Blockchain syncing: 97%  1667123/1710000 blocks\r\n22:15:13 Blockchain syncing: 97%  1671795/1710000 blocks\r\n22:15:23 Blockchain syncing: 98%  1676531/1710001 blocks\r\n22:15:33 Blockchain syncing: 98%  1681651/1710001 blocks\r\n22:15:45 Blockchain syncing: 98%  1684402/1710002 blocks\r\n22:15:55 Blockchain syncing: 98%  1691570/1710002 blocks\r\n22:16:05 Blockchain syncing: 99%  1697522/1710003 blocks\r\n22:16:15 Blockchain syncing: 99%  1703218/1710003 blocks\r\n22:16:25 Blockchain syncing: 99%  1705969/1710004 blocks\r\nBlockchain synced: 100%  1710004 blocks\r\n\r\nBlockchain sync complete!\r\nBlockchain height: 1710004 blocks\r\nElapsed time: 686 seconds\r\n\r\nGoing to restore a wallet\r\n[[{\"data\":{\"id\":\"Ae2tdPwUPEZ1UMga1bnFFD7FoFN9ZFoPLCWLaGcqNnfovcrcT3oMSuAz8DD\",\"name\":\"Acceptance Wallet\",\"balance\":0,\"hasSpendingPassword\":false,\"spendingPasswordLastUpdate\":\"2018-10-24T20:16:35.570007\",\"createdAt\":\"2018-10-24T20:16:50.106258\",\"assuranceLevel\":\"normal\",\"syncState\":{\"tag\":\"restoring\",\"data\":{\"throughput\":{\"quantity\":0,\"unit\":\"blocksPerSecond\"},\"percentage\":{\"quantity\":0,\"unit\":\"percent\"},\"estimatedCompletionTime\":{\"quantity\":1710454000,\"unit\":\"milliseconds\"}}},\"type\":\"regular\"},\"status\":\"success\",\"meta\":{\"pagination\":{\"totalPages\":1,\"page\":1,\"perPage\":1,\"totalEntries\":1}}}\r\n\r\n22:16:50 Wallet restoring: 0% (0 blocks/s)\r\n22:17:00 Wallet restoring: 0% (415 blocks/s)\r\n22:17:10 Wallet restoring: 1% (622 blocks/s)\r\n22:17:20 Wallet restoring: 1% (627.4 blocks/s)\r\n22:17:30 Wallet restoring: 2% (615.333 blocks/s)\r\n22:17:40 Wallet restoring: 2% (656.571 blocks/s)\r\n22:17:50 Wallet restoring: 3% (712.25 blocks/s)\r\n22:18:00 Wallet restoring: 3% (742.444 blocks/s)\r\n22:18:10 Wallet restoring: 4% (772.5 blocks/s)\r\n22:18:20 Wallet restoring: 4% (803.636 blocks/s)\r\n22:18:30 Wallet restoring: 5% (805.333 blocks/s)\r\n22:18:40 Wallet restoring: 5% (815 blocks/s)\r\n22:18:50 Wallet restoring: 6% (834.714 blocks/s)\r\n22:19:00 Wallet restoring: 6% (836.333 blocks/s)\r\n22:19:10 Wallet restoring: 7% (854.125 blocks/s)\r\n22:19:20 Wallet restoring: 7% (843.765 blocks/s)\r\n22:19:30 Wallet restoring: 8% (852.389 blocks/s)\r\n22:19:40 Wallet restoring: 9% (853.632 blocks/s)\r\n22:19:50 Wallet restoring: 9% (832.2 blocks/s)\r\n22:20:00 Wallet restoring: 10% (843.19 blocks/s)\r\n22:20:10 Wallet restoring: 10% (852.5 blocks/s)\r\n22:20:20 Wallet restoring: 11% (862.174 blocks/s)\r\n22:20:30 Wallet restoring: 11% (871.875 blocks/s)\r\n22:20:40 Wallet restoring: 12% (877.6 blocks/s)\r\n22:20:50 Wallet restoring: 13% (891.5 blocks/s)\r\n22:21:00 Wallet restoring: 13% (899.815 blocks/s)\r\n22:21:11 Wallet restoring: 14% (904.321 blocks/s)\r\n22:21:21 Wallet restoring: 14% (910.103 blocks/s)\r\n22:21:31 Wallet restoring: 15% (915.367 blocks/s)\r\n22:21:41 Wallet restoring: 16% (915.419 blocks/s)\r\n22:21:51 Wallet restoring: 16% (914.188 blocks/s)\r\n22:22:01 Wallet restoring: 16% (899.818 blocks/s)\r\n22:22:11 Wallet restoring: 17% (892.676 blocks/s)\r\n22:22:21 Wallet restoring: 17% (879.714 blocks/s)\r\n22:22:31 Wallet restoring: 18% (874.194 blocks/s)\r\n22:22:41 Wallet restoring: 18% (866.243 blocks/s)\r\n22:22:51 Wallet restoring: 18% (859.711 blocks/s)\r\n22:23:01 Wallet restoring: 19% (852.974 blocks/s)\r\n22:23:11 Wallet restoring: 19% (847 blocks/s)\r\n22:23:21 Wallet restoring: 19% (842.463 blocks/s)\r\n22:23:31 Wallet restoring: 20% (837.119 blocks/s)\r\n22:23:41 Wallet restoring: 20% (830.628 blocks/s)\r\n22:23:51 Wallet restoring: 20% (822.909 blocks/s)\r\n22:24:01 Wallet restoring: 20% (814.978 blocks/s)\r\n22:24:11 Wallet restoring: 21% (806.739 blocks/s)\r\n22:24:21 Wallet restoring: 21% (798.872 blocks/s)\r\n22:24:31 Wallet restoring: 21% (792.146 blocks/s)\r\n22:24:41 Wallet restoring: 21% (784.633 blocks/s)\r\n22:24:51 Wallet restoring: 22% (777.96 blocks/s)\r\n22:25:01 Wallet restoring: 22% (771.255 blocks/s)\r\n22:25:11 Wallet restoring: 22% (766.192 blocks/s)\r\n22:25:21 Wallet restoring: 23% (762.226 blocks/s)\r\n22:25:31 Wallet restoring: 23% (758.667 blocks/s)\r\n22:25:41 Wallet restoring: 23% (754.109 blocks/s)\r\n22:25:51 Wallet restoring: 23% (749.393 blocks/s)\r\n22:26:01 Wallet restoring: 24% (745.211 blocks/s)\r\n22:26:11 Wallet restoring: 24% (739.828 blocks/s)\r\n22:26:21 Wallet restoring: 24% (735.237 blocks/s)\r\n22:26:31 Wallet restoring: 25% (732.467 blocks/s)\r\n22:26:41 Wallet restoring: 25% (728.197 blocks/s)\r\n22:26:51 Wallet restoring: 25% (729.113 blocks/s)\r\n22:27:01 Wallet restoring: 26% (726.032 blocks/s)\r\n22:27:11 Wallet restoring: 26% (726.766 blocks/s)\r\n22:27:21 Wallet restoring: 26% (728.046 blocks/s)\r\n22:27:31 Wallet restoring: 27% (724.273 blocks/s)\r\n22:27:42 Wallet restoring: 27% (722 blocks/s)\r\n22:27:52 Wallet restoring: 27% (720.779 blocks/s)\r\n22:28:02 Wallet restoring: 28% (718.638 blocks/s)\r\n22:28:12 Wallet restoring: 28% (714.057 blocks/s)\r\n22:28:22 Wallet restoring: 28% (710.775 blocks/s)\r\n22:28:32 Wallet restoring: 28% (707.403 blocks/s)\r\n22:28:42 Wallet restoring: 29% (704.137 blocks/s)\r\n22:28:52 Wallet restoring: 29% (700.635 blocks/s)\r\n22:29:02 Wallet restoring: 29% (697.24 blocks/s)\r\n22:29:12 Wallet restoring: 30% (694.763 blocks/s)\r\n22:29:22 Wallet restoring: 30% (692.727 blocks/s)\r\n22:29:32 Wallet restoring: 30% (691.744 blocks/s)\r\n22:29:42 Wallet restoring: 31% (691.038 blocks/s)\r\n22:29:52 Wallet restoring: 31% (687.962 blocks/s)\r\n22:30:02 Wallet restoring: 31% (688.099 blocks/s)\r\n22:30:12 Wallet restoring: 32% (687.098 blocks/s)\r\n22:30:22 Wallet restoring: 32% (686.988 blocks/s)\r\n22:30:32 Wallet restoring: 32% (686.607 blocks/s)\r\n22:30:42 Wallet restoring: 33% (685.812 blocks/s)\r\n22:30:52 Wallet restoring: 33% (685.279 blocks/s)\r\n22:31:02 Wallet restoring: 34% (685.184 blocks/s)\r\n22:31:12 Wallet restoring: 34% (684.023 blocks/s)\r\n22:31:22 Wallet restoring: 34% (685.719 blocks/s)\r\n22:31:32 Wallet restoring: 35% (685.756 blocks/s)\r\n22:31:42 Wallet restoring: 35% (685.703 blocks/s)\r\n22:31:52 Wallet restoring: 35% (684.989 blocks/s)\r\n22:32:02 Wallet restoring: 36% (684.871 blocks/s)\r\n22:32:12 Wallet restoring: 36% (684.266 blocks/s)\r\n22:32:22 Wallet restoring: 36% (684.547 blocks/s)\r\n22:32:32 Wallet restoring: 37% (684.677 blocks/s)\r\n22:32:42 Wallet restoring: 37% (684.825 blocks/s)\r\n22:32:52 Wallet restoring: 37% (684.888 blocks/s)\r\n22:33:02 Wallet restoring: 38% (685.646 blocks/s)\r\n22:33:12 Wallet restoring: 38% (686.78 blocks/s)\r\n22:33:22 Wallet restoring: 39% (686.099 blocks/s)\r\n22:33:32 Wallet restoring: 39% (686.284 blocks/s)\r\n22:33:42 Wallet restoring: 39% (684.476 blocks/s)\r\n22:33:52 Wallet restoring: 40% (684.971 blocks/s)\r\n22:34:03 Wallet restoring: 40% (684.324 blocks/s)\r\n22:34:13 Wallet restoring: 40% (684.198 blocks/s)\r\n22:34:23 Wallet restoring: 41% (684.103 blocks/s)\r\n22:34:33 Wallet restoring: 41% (684.176 blocks/s)\r\n22:34:43 Wallet restoring: 42% (682.716 blocks/s)\r\n22:34:53 Wallet restoring: 42% (682.891 blocks/s)\r\n22:35:03 Wallet restoring: 42% (682.91 blocks/s)\r\n22:35:13 Wallet restoring: 43% (682.429 blocks/s)\r\n22:35:23 Wallet restoring: 43% (678.92 blocks/s)\r\n22:35:33 Wallet restoring: 43% (678.307 blocks/s)\r\n22:35:43 Wallet restoring: 44% (678.026 blocks/s)\r\n22:35:53 Wallet restoring: 44% (677.078 blocks/s)\r\n22:36:03 Wallet restoring: 45% (677.026 blocks/s)\r\n22:36:13 Wallet restoring: 45% (675.847 blocks/s)\r\n22:36:23 Wallet restoring: 45% (676.008 blocks/s)\r\n22:36:33 Wallet restoring: 46% (676.433 blocks/s)\r\n22:36:43 Wallet restoring: 46% (677.628 blocks/s)\r\n22:36:53 Wallet restoring: 47% (679.664 blocks/s)\r\n22:37:03 Wallet restoring: 47% (679.724 blocks/s)\r\n22:37:13 Wallet restoring: 47% (680.645 blocks/s)\r\n22:37:23 Wallet restoring: 48% (678.88 blocks/s)\r\n22:37:33 Wallet restoring: 48% (677.675 blocks/s)\r\n22:37:43 Wallet restoring: 48% (676.449 blocks/s)\r\n22:37:53 Wallet restoring: 49% (677.133 blocks/s)\r\n22:38:03 Wallet restoring: 49% (677.597 blocks/s)\r\n22:38:13 Wallet restoring: 50% (677.346 blocks/s)\r\n22:38:23 Wallet restoring: 50% (677.45 blocks/s)\r\n22:38:33 Wallet restoring: 50% (677.258 blocks/s)\r\n22:38:43 Wallet restoring: 51% (678.737 blocks/s)\r\n22:38:53 Wallet restoring: 51% (678.493 blocks/s)\r\n22:39:03 Wallet restoring: 51% (677.133 blocks/s)\r\n22:39:13 Wallet restoring: 52% (677.199 blocks/s)\r\n22:39:23 Wallet restoring: 52% (676.533 blocks/s)\r\n22:39:33 Wallet restoring: 52% (676.087 blocks/s)\r\n22:39:43 Wallet restoring: 53% (677.173 blocks/s)\r\n22:39:53 Wallet restoring: 53% (676.743 blocks/s)\r\n22:40:03 Wallet restoring: 53% (676.255 blocks/s)\r\n22:40:13 Wallet restoring: 54% (676.493 blocks/s)\r\n22:40:24 Wallet restoring: 54% (675.58 blocks/s)\r\n22:40:34 Wallet restoring: 54% (674.132 blocks/s)\r\n22:40:44 Wallet restoring: 55% (673.393 blocks/s)\r\n22:40:54 Wallet restoring: 55% (673.096 blocks/s)\r\n22:41:04 Wallet restoring: 55% (673.197 blocks/s)\r\n22:41:14 Wallet restoring: 56% (673.858 blocks/s)\r\n22:41:24 Wallet restoring: 56% (674.732 blocks/s)\r\n22:41:34 Wallet restoring: 57% (674.46 blocks/s)\r\n22:41:44 Wallet restoring: 57% (674.49 blocks/s)\r\n22:41:54 Wallet restoring: 57% (674.829 blocks/s)\r\n22:42:04 Wallet restoring: 58% (674.484 blocks/s)\r\n22:42:14 Wallet restoring: 58% (674.792 blocks/s)\r\n22:42:24 Wallet restoring: 59% (676.032 blocks/s)\r\n22:42:34 Wallet restoring: 59% (676.295 blocks/s)\r\n22:42:44 Wallet restoring: 59% (677.064 blocks/s)\r\n22:42:54 Wallet restoring: 60% (677.627 blocks/s)\r\n22:43:04 Wallet restoring: 60% (678.182 blocks/s)\r\n22:43:14 Wallet restoring: 61% (678.475 blocks/s)\r\n22:43:24 Wallet restoring: 61% (676.081 blocks/s)\r\n22:43:34 Wallet restoring: 62% (676.438 blocks/s)\r\n22:43:44 Wallet restoring: 62% (677.043 blocks/s)\r\n22:43:54 Wallet restoring: 62% (677.598 blocks/s)\r\n22:44:04 Wallet restoring: 63% (677 blocks/s)\r\n22:44:14 Wallet restoring: 63% (677.211 blocks/s)\r\n22:44:24 Wallet restoring: 63% (677.695 blocks/s)\r\n22:44:34 Wallet restoring: 64% (678.06 blocks/s)\r\n22:44:44 Wallet restoring: 64% (678.68 blocks/s)\r\n22:44:54 Wallet restoring: 65% (680.788 blocks/s)\r\n22:45:04 Wallet restoring: 65% (679.351 blocks/s)\r\n22:45:14 Wallet restoring: 66% (679.576 blocks/s)\r\n22:45:24 Wallet restoring: 66% (680.087 blocks/s)\r\n22:45:34 Wallet restoring: 66% (682.264 blocks/s)\r\n22:45:44 Wallet restoring: 67% (682.366 blocks/s)\r\n22:45:54 Wallet restoring: 67% (683.023 blocks/s)\r\n22:46:04 Wallet restoring: 68% (683.61 blocks/s)\r\n22:46:14 Wallet restoring: 68% (684.337 blocks/s)\r\n22:46:24 Wallet restoring: 69% (685.078 blocks/s)\r\n22:46:35 Wallet restoring: 69% (686.289 blocks/s)\r\n22:46:45 Wallet restoring: 70% (686.994 blocks/s)\r\n22:46:55 Wallet restoring: 70% (687.445 blocks/s)\r\n22:47:05 Wallet restoring: 70% (688.65 blocks/s)\r\n22:47:15 Wallet restoring: 71% (689.152 blocks/s)\r\n22:47:25 Wallet restoring: 71% (689.703 blocks/s)\r\n22:47:35 Wallet restoring: 72% (691.059 blocks/s)\r\n22:47:45 Wallet restoring: 72% (691.877 blocks/s)\r\n22:47:55 Wallet restoring: 73% (692.665 blocks/s)\r\n22:48:05 Wallet restoring: 73% (693.598 blocks/s)\r\n22:48:15 Wallet restoring: 74% (694.732 blocks/s)\r\n22:48:25 Wallet restoring: 74% (695.539 blocks/s)\r\n22:48:35 Wallet restoring: 75% (695.766 blocks/s)\r\n22:48:45 Wallet restoring: 75% (695.679 blocks/s)\r\n22:48:55 Wallet restoring: 76% (696.407 blocks/s)\r\n22:49:05 Wallet restoring: 76% (696.759 blocks/s)\r\n22:49:15 Wallet restoring: 77% (696.974 blocks/s)\r\n22:49:25 Wallet restoring: 77% (697.538 blocks/s)\r\n22:49:35 Wallet restoring: 77% (698.121 blocks/s)\r\n22:49:45 Wallet restoring: 78% (698.704 blocks/s)\r\n22:49:55 Wallet restoring: 78% (698.895 blocks/s)\r\n22:50:05 Wallet restoring: 79% (699.935 blocks/s)\r\n22:50:15 Wallet restoring: 79% (700.678 blocks/s)\r\n22:50:25 Wallet restoring: 80% (701.236 blocks/s)\r\n22:50:35 Wallet restoring: 80% (701.833 blocks/s)\r\n22:50:45 Wallet restoring: 81% (702.351 blocks/s)\r\n22:50:55 Wallet restoring: 81% (702.83 blocks/s)\r\n22:51:05 Wallet restoring: 82% (703.309 blocks/s)\r\n22:51:15 Wallet restoring: 82% (703.774 blocks/s)\r\n22:51:25 Wallet restoring: 83% (704.612 blocks/s)\r\n22:51:35 Wallet restoring: 83% (705.305 blocks/s)\r\n22:51:45 Wallet restoring: 83% (705.791 blocks/s)\r\n22:51:55 Wallet restoring: 84% (706.698 blocks/s)\r\n22:52:05 Wallet restoring: 84% (707.681 blocks/s)\r\n22:52:15 Wallet restoring: 85% (707.701 blocks/s)\r\n22:52:25 Wallet restoring: 85% (708.102 blocks/s)\r\n22:52:35 Wallet restoring: 86% (707.472 blocks/s)\r\n22:52:46 Wallet restoring: 86% (708.212 blocks/s)\r\n22:52:56 Wallet restoring: 87% (708.734 blocks/s)\r\n22:53:06 Wallet restoring: 87% (708.781 blocks/s)\r\n22:53:16 Wallet restoring: 88% (709.495 blocks/s)\r\n22:53:26 Wallet restoring: 88% (710.262 blocks/s)\r\n22:53:36 Wallet restoring: 89% (710.311 blocks/s)\r\n22:53:46 Wallet restoring: 89% (710.547 blocks/s)\r\n22:53:56 Wallet restoring: 89% (709.362 blocks/s)\r\n22:54:06 Wallet restoring: 90% (709.484 blocks/s)\r\n22:54:16 Wallet restoring: 90% (710.119 blocks/s)\r\n22:54:26 Wallet restoring: 91% (710.511 blocks/s)\r\n22:54:36 Wallet restoring: 91% (711.048 blocks/s)\r\n22:54:46 Wallet restoring: 92% (711.197 blocks/s)\r\n22:54:56 Wallet restoring: 92% (711.591 blocks/s)\r\n22:55:06 Wallet restoring: 93% (712.394 blocks/s)\r\n22:55:16 Wallet restoring: 93% (713.237 blocks/s)\r\n22:55:26 Wallet restoring: 94% (714.124 blocks/s)\r\n22:55:36 Wallet restoring: 94% (712.427 blocks/s)\r\n22:55:46 Wallet restoring: 94% (712.898 blocks/s)\r\n22:55:56 Wallet restoring: 95% (713.335 blocks/s)\r\n22:56:06 Wallet restoring: 95% (713.89 blocks/s)\r\n22:56:16 Wallet restoring: 96% (714.559 blocks/s)\r\n22:56:26 Wallet restoring: 96% (715.113 blocks/s)\r\n22:56:36 Wallet restoring: 97% (715.962 blocks/s)\r\n22:56:46 Wallet restoring: 97% (715.975 blocks/s)\r\n22:56:56 Wallet restoring: 98% (716.302 blocks/s)\r\n22:57:06 Wallet restoring: 98% (716.7 blocks/s)\r\n22:57:16 Wallet restoring: 99% (717.754 blocks/s)\r\n22:57:26 Wallet restoring: 99% (718.192 blocks/s)\r\n22:57:36 Wallet restoring: null% (715.272 blocks/s)\r\n```\r\n\r\nNote: There was a typo in the script when I ran it causing it not to terminate properly once synced. I've verified the log file and no errors related to sync (some lookup network failures but nothing unusual).\r\nPlus, checking the wallet manually at the end:\r\n\r\n```json\r\n{\r\n   \"data\" : [\r\n      {\r\n         \"id\" : \"Ae2tdPwUPEZ1UMga1bnFFD7FoFN9ZFoPLCWLaGcqNnfovcrcT3oMSuAz8DD\",\r\n         \"spendingPasswordLastUpdate\" : \"2018-10-24T20:16:50.106258\",\r\n         \"hasSpendingPassword\" : false,\r\n         \"type\" : \"regular\",\r\n         \"syncState\" : {\r\n            \"data\" : null,\r\n            \"tag\" : \"synced\"\r\n         },\r\n         \"createdAt\" : \"2018-10-24T20:16:50.106258\",\r\n         \"balance\" : 0,\r\n         \"name\" : \"Acceptance Wallet\",\r\n         \"assuranceLevel\" : \"normal\"\r\n      }\r\n   ],\r\n   \"meta\" : {\r\n      \"pagination\" : {\r\n         \"totalEntries\" : 1,\r\n         \"totalPages\" : 1,\r\n         \"page\" : 1,\r\n         \"perPage\" : 10\r\n      }\r\n   },\r\n   \"status\" : \"success\"\r\n}\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/input-output-hk/cardano-sl/issues/comments/432938729","html_url":"https://github.com/input-output-hk/cardano-sl/pull/3786#issuecomment-432938729","issue_url":"https://api.github.com/repos/input-output-hk/cardano-sl/issues/3786","id":432938729,"node_id":"MDEyOklzc3VlQ29tbWVudDQzMjkzODcyOQ==","user":{"login":"KtorZ","id":5680256,"node_id":"MDQ6VXNlcjU2ODAyNTY=","avatar_url":"https://avatars0.githubusercontent.com/u/5680256?v=4","gravatar_id":"","url":"https://api.github.com/users/KtorZ","html_url":"https://github.com/KtorZ","followers_url":"https://api.github.com/users/KtorZ/followers","following_url":"https://api.github.com/users/KtorZ/following{/other_user}","gists_url":"https://api.github.com/users/KtorZ/gists{/gist_id}","starred_url":"https://api.github.com/users/KtorZ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KtorZ/subscriptions","organizations_url":"https://api.github.com/users/KtorZ/orgs","repos_url":"https://api.github.com/users/KtorZ/repos","events_url":"https://api.github.com/users/KtorZ/events{/privacy}","received_events_url":"https://api.github.com/users/KtorZ/received_events","type":"User","site_admin":false},"created_at":"2018-10-25T07:07:22Z","updated_at":"2018-10-25T07:07:22Z","author_association":"MEMBER","body":"```hs\r\n    getBatch genesisHash hh batchSize = go [] batchSize hh\r\n        where\r\n            go !updates !n !currentHash | n <= 0 =\r\n                return (updates, currentHash)\r\n\r\n            go !updates _ !currentHash | currentHash == tgtHash =\r\n                getPrefilteredBlockOrThrow genesisHash currentHash >>= \\case\r\n                    Nothing -> go updates 0 currentHash\r\n                    Just u  -> go (updates ++ [u]) 0 currentHash\r\n\r\n            go !updates !n !currentHash = do\r\n                nextHash <- nextHistoricalHash currentHash >>= \\case\r\n                    Nothing  -> throwM (RestorationFinishUnreachable tgtHash currentHash)\r\n                    Just hh' -> return hh'\r\n\r\n                getPrefilteredBlockOrThrow genesisHash currentHash >>= \\case\r\n                    Nothing -> go updates (n - 1) nextHash\r\n                    Just u  -> go (updates ++ [u]) (n - 1) nextHash\r\n```\r\n\r\nCurrently trying out this. I found a nice way to put this. A bit afraid about the boundary case so I'll go through a full restoration once again and see :) "}}
{"actor":{"display_login":"KtorZ"}}