chore: Removes clone from Wallet struct#1762
Conversation
|
Turns out I don't know how react native works and they somehow pull in the cdk bindings so as long as our bindings work its okay. |
5fa935d to
e5d4993
Compare
clone from Wallet struct
thesimplekid
left a comment
There was a problem hiding this comment.
This looks pretty good I think we just need to resolve #1762 (comment)
e5d4993 to
bf38f92
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1762 +/- ##
==========================================
- Coverage 71.48% 71.46% -0.02%
==========================================
Files 356 356
Lines 73857 73862 +5
==========================================
- Hits 52798 52787 -11
- Misses 21059 21075 +16 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
bf38f92 to
51d9ddb
Compare
| .get_wallet(&sub_command_args.old_mint_url, unit) | ||
| .await?, | ||
| ) | ||
| .expect("Unable to unwrap wallet"), |
There was a problem hiding this comment.
This message is going to get bubbled to the user of the CLI. Probably something more descriptive would help in case of debugging in the future
|
LGTM |
2e2642f to
41da877
Compare
cdk-bot
left a comment
There was a problem hiding this comment.
Verified findings approved for disclosure:
- update-mint-url panics when unwrapping repository Arc (medium) - The
cdk-cli update-mint-urlsubcommand panics instead of updating the mint URL for repository-managed wallets, making the command unusable after this PR's Arc refactor.
Unanchored locations included in summary:- crates/cdk/src/wallet/wallet_repository.rs:290
41da877 to
2860afc
Compare
cdk-bot
left a comment
There was a problem hiding this comment.
Verified findings approved for disclosure:
- Repository mint URL update does not migrate persisted wallet data (high) - Updating a mint URL through the repository/CLI leaves the wallet database under the old URL, so the newly returned wallet can no longer see existing persisted balance/quotes for the mint.
2860afc to
47eb3a1
Compare
cdk-bot
left a comment
There was a problem hiding this comment.
Verified findings approved for disclosure:
update_mint_urldrops the wallet if another Arc reference exists (medium) - If any consumer holds an Arc while updating a mint URL, the update fails and the repository drops the wallet from its in-memory map until it is recreated or the repository is reloaded.
| let mut wallets = self.wallets.write().await; | ||
|
|
||
| let key = WalletKey::new(mint_url.clone(), unit.clone()); | ||
| let mut wallet = Arc::try_unwrap( |
There was a problem hiding this comment.
update_mint_url removes the wallet from the repository before attempting Arc::try_unwrap. Since the PR now exposes repository wallets as Arc<Wallet>, any normal caller that kept the value returned by create_wallet/get_wallet holds an additional strong reference. In that case try_unwrap fails, this method returns UnknownWallet, and the old entry has already been removed from self.wallets, so subsequent repository lookups lose the in-memory wallet.
Consider avoiding try_unwrap here, or at minimum restoring the removed Arc on the error path. A design with interior mutability / recreating and replacing the map entry without requiring unique Arc ownership would also avoid invalidating active wallet handles.
Description
It's a part from #1310
Removes
clonefromWalletstructNotes to the reviewers
Suggested CHANGELOG Updates
CHANGED
ADDED
REMOVED
FIXED
Checklist
just final-checkbefore committing