-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor/wallet async signing #1846
base: refactor/wallet-generic-signer
Are you sure you want to change the base?
Refactor/wallet async signing #1846
Conversation
OBorce
commented
Nov 28, 2024
- Make the Signer trait use async functions to enable future support for the Ledger wallet integration.
- Change to use a local object that stores any new changes in memory instead of a DB transaction so it can used more easily in async contexts than a reference
wallet/storage/src/lib.rs
Outdated
@@ -221,6 +223,13 @@ pub trait WalletStorageEncryptionWrite { | |||
fn encrypt_seed_phrase(&mut self, new_encryption_key: &Option<SymmetricKey>) -> Result<()>; | |||
} | |||
|
|||
pub trait WalletStorageReadWriteLocked: WalletStorageReadLocked + WalletStorageWriteLocked {} |
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.
This change to the hierarchy is confusing. If I understand correctly you needed new storage type without a reference to an actual storage. But why introducing new traits if you could implement previous for a new type?
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.
removed
wallet/src/wallet/mod.rs
Outdated
// In case of an error reload the keys in case the operation issued new ones and | ||
// are saved in the cache but not in the DB |
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.
The grammar is broken in this sentence and the meaning is not super clear.
Also, since it's a copy-paste, the original should be updated too.
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.
updated, hopefully it is more clear now
let acc = accounts | ||
.remove(&account_index) | ||
.ok_or(WalletError::NoAccountFoundWithIndex(account_index))?; | ||
|
||
let (acc, res) = f(acc).await; | ||
|
||
accounts.insert(account_index, acc); | ||
Ok(res) |
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 suppose this is a workaround for that weird lifetime-related issue you posted in the chat recently.
But I thought you've managed to solve it by boxing some futures. So it didn't work after all?
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.
The boxed future is used in the Synced Controller, this was a prior workaround for the lifetimes to not pass the account as a reference but as a value. I have not tried if a boxed future will solve this as well or not, but also not sure how expensive boxed futures are?
b3bd09f
to
fd48654
Compare
b05ce60
to
dcefb1f
Compare
fd48654
to
511bba3
Compare
f0dcbbc
to
6c8ab7c
Compare
- to make an easier integration with Ledger in the future
3b76519
to
46cf688
Compare
6c8ab7c
to
8d21f6a
Compare