-
Notifications
You must be signed in to change notification settings - Fork 2
[AD-270] Check keyfile for unknown keys on startup #299
[AD-270] Check keyfile for unknown keys on startup #299
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise, looks sensible
I suddenly realized that this solution is dangerous. If user somehow passes wrong path to wallet-db, all secret keys will be deleted and it may cause loss of funds. I see two options:
Both options don't sound very good :/ |
Maybe we shoud just check for empty wallet-db on startup and ask user about correctness of wallet-db path in case of empty wallet-db and non-empty keyfile ? |
This is the thread where we discussed how to proceed with the issue: https://serokell.slack.com/archives/C9B1DAMDJ/p1536319212000100 |
8c37986
to
f8012ab
Compare
8aa0ca1
to
cb45051
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't reviewed whole PR yet, but there already are some things which need to be changed. Will make another round of review later.
Next time you make a PR, please check that CI passes a bit later (when it finishes), currently there are some warnings and it fails.
It is really strange (i am talking about CI), because i have "-Werror" option enabled in generated ".cabal" file an have no warnings. Will fix now. |
If you are using |
ce005c6
to
1492c22
Compare
updated PR |
1492c22
to
eb59171
Compare
ariadne/cardano/src/Ariadne/Wallet/Cardano/WalletLayer/Types.hs
Outdated
Show resolved
Hide resolved
dcdd264
to
702b754
Compare
ariadne/cardano/src/Ariadne/Wallet/Cardano/WalletLayer/Kernel.hs
Outdated
Show resolved
Hide resolved
ariadne/cardano/src/Ariadne/Wallet/Cardano/WalletLayer/Kernel.hs
Outdated
Show resolved
Hide resolved
ariadne/cardano/src/Ariadne/Wallet/Cardano/WalletLayer/Kernel.hs
Outdated
Show resolved
Hide resolved
ariadne/cardano/src/Ariadne/Wallet/Cardano/WalletLayer/Kernel.hs
Outdated
Show resolved
Hide resolved
ariadne/cardano/src/Ariadne/Wallet/Cardano/WalletLayer/Types.hs
Outdated
Show resolved
Hide resolved
3eea9c6
to
0ffdd4b
Compare
f38ebb8
to
81b4579
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll review the rest of the code a bit later. Couple of comments for now and this bug I noticed. Steps to reproduce:
- Launch Ariadne.
new-wallet name: "A" no-confirm: true
- Close Ariadne.
- Open Ariadne.
- Remove previously created wallet "A".
- Close Ariadne.
- Open Ariadne and behold some weird wallet and unknown keys dialog.
@artemohanjanyan |
@@ -192,10 +192,11 @@ deleteHdWallet pw rootId = do | |||
Keystore.delete (WalletIdHdSeq rootId) (pw ^. walletKeystore) | |||
return $ Right () | |||
|
|||
removeKeysFromKeyStore :: PassiveWallet | |||
removeKeysFromKeystore | |||
:: PassiveWallet |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now indentation looks very weird.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was it marked as resolved? It's 1-space indentation here. It's not allowed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was marked as resolved because it is resolved. I made the same indentation as in other functions in the module. Here you see the old version before the last commit. Look
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, strange, I was pretty sure I was looking at the latest version last time I saw it. Ok then.
705f519
to
dc53c2c
Compare
There's a new conflict, btw. |
dc53c2c
to
cfdf857
Compare
Resolved |
QWidget.adjustSize delete | ||
_ -> pass | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra newline.
ee01271
to
937633a
Compare
import Ariadne.Wallet.Cardano.Kernel.DB.AcidState (DB, dbHdWallets, defDB) | ||
import Ariadne.Wallet.Cardano.Kernel.DB.Resolved (ResolvedBlock) | ||
import Ariadne.Wallet.Cardano.Kernel.Keystore (Keystore) | ||
|
||
import qualified Ariadne.Wallet.Cardano.Kernel.Keystore as Keystore (lookup) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this import moved?
bd5e4c8
to
9f7d683
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. @artemohanjanyan please take a look.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also suspect that some text is not entirely correct according to English, but I'm not sure.
ariadne/core/src/Ariadne/UIConfig.hs
Outdated
|
||
rmBrokenWalletsIntroMkMessage :: Text | ||
rmBrokenWalletsIntroMkMessage = "There are wallets without corresponding secret key \ | ||
\in keyfile.\n Without secret keys you can do almost nothing with such wallets. \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that
\in keyfile.\n Without secret keys you can do almost nothing with such wallets. \ | |
\in keyfile. Without secret keys you can do almost nothing with such wallets. \ |
is better, but 🤷♂️
Problem: Keyfile may contain unknown keys (from deleted wallets for example) Also sometimes we may have wallets without corresponding keys in keyfile (user can delete keys by hands). Solution: Now keyfile is checked for unknown keys on startup and user is asked if he wants to delete them. Also wallets are checked for existence of corresponding secret keys in keyfile. User will be asked if he wants to delete broken wallets (without secret key). Also added small chages to qt and vty UI - made text on deletion widget dependent on deleting item (and delete confirmation widget is used to ask user, with changed text on widget, and added new type of deleting item - unknownKeys and brokenWallets).
9f7d683
to
6caec98
Compare
YT issue: https://issues.serokell.io/issue/AD-270
Checklist:
Description:
So - now unknown keys are deleted on startup.