Fix forest-wallet set-default failing when the keystore has no default entry#7087
Fix forest-wallet set-default failing when the keystore has no default entry#7087sudo-shashank wants to merge 3 commits into
forest-wallet set-default failing when the keystore has no default entry#7087Conversation
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
✨ Simplify code
Comment |
Codecov Report❌ Patch coverage is Additional details and impacted files
... and 9 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
| } | ||
|
|
||
| /// Set the default key to the key identified by `addr`. | ||
| pub fn set_default(addr: &Address, keystore: &mut KeyStore) -> Result<(), Error> { |
There was a problem hiding this comment.
why does this need to be a free function?
There was a problem hiding this comment.
matches other methods in this module like get_default, list_addrs, remove_key etc
There was a problem hiding this comment.
This isn't a compelling argument; this is essentially a method on the keystore that requires the keystore. I think what you should consider is moving the listed methods under the aegis of keystore. Rust is a multi-paradigm language, OOP (or parts of it) being on them. Entities like keystore would benefit well from proper encapsulation.
forest-wallet set-default failing when the keystore has no default entry.forest-wallet set-default failing when the keystore has no default entry
forest-wallet set-default failing when the keystore has no default entryforest-wallet set-default failing when the keystore has no default entry
Summary of changes
Changes introduced in this pull request:
Reference issue to close (if applicable)
Closes #7018
Other information and links
Change checklist
Outside contributions
Summary by CodeRabbit
Bug Fixes
forest-wallet set-defaultcommand now handles cases where the keystore lacks a default entry, resolving issue#7018.Refactor