-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix: don't assume that successful weightFromArg links to valid index
#7084
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
Conversation
✅ No Merge Conflicts DetectedThis PR currently has no conflicts with other open PRs. |
WalkthroughThe Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
📜 Recent review detailsConfiguration used: Repository UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (2)src/**/*.{cpp,h,hpp,cc}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
src/qt/**/*.{cpp,h}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
🧠 Learnings (3)📓 Common learnings📚 Learning: 2025-12-22T15:42:51.679ZApplied to files:
📚 Learning: 2025-12-17T13:58:19.813ZApplied to files:
🧬 Code graph analysis (1)src/qt/optionsmodel.cpp (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
🔇 Additional comments (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
UdjinM6
left a comment
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.
utACK 8bba1d2
PastaPastaPasta
left a comment
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.
utACK 8bba1d2
…nt font for overview page balances) 636e7a6 refactor: remove redundant preview and simplify font handling (UdjinM6) b59b0f7 feat(qt): add live preview for monospace font in appearance settings (UdjinM6) 83af951 fix: set money font when setting wallet model instead of ctor (Kittywhiskers Van Gogh) 658905b qt: add non-monospace option and use it as default (Kittywhiskers Van Gogh) e0513ff qt: add horizontal spacer for visual consistency (Kittywhiskers Van Gogh) e5a8d05 refactor: move monospace font selector to appearance widget (Kittywhiskers Van Gogh) 41c69e9 merge bitcoin-core/gui#497: Enable users to configure their monospace font specifically (Kittywhiskers Van Gogh) da5804e merge bitcoin-core/gui#79: Embed monospaced font (Kittywhiskers Van Gogh) eac4f52 qt: adjust padding and font size of monospace font selector (Kittywhiskers Van Gogh) 9c315c3 qt: add monospaced font settings (Kittywhiskers Van Gogh) 34211b6 qt: apply monospace font to overview page balances and CoinJoin elements (Kittywhiskers Van Gogh) 6ed53d6 qt: allow overriding font registry for specific widgets (Kittywhiskers Van Gogh) 800cf66 qt: recognize system monospace font as non-selectable font (Kittywhiskers Van Gogh) 85b49b9 qt: add "Roboto Mono" as non-selectable font (Kittywhiskers Van Gogh) Pull request description: ## Additional Information * Depends on #7068 * Depends on #7084 * Dependency for #6833 | [dash#7084](#7084) (8bba1d2) | This PR (636e7a6) | | ------------------- | ------------------- | |  |  | |  |  | |  |  | * Based on review suggestions given ([comment](#6831 (comment))), [bitcoin-core/gui#497](bitcoin-core/gui#497) was also backported to allow arbitrary font specification. This also allowed us to offer a "Use existing font" option that _doesn't_ use any monospace font but instead inherits whatever font is used in the rest of the application. This is set as the default ([source](https://github.com/kwvg/dash/blob/89aa2c4b2390ada504fd5b45e16d2cd379074138/src/qt/optionsmodel.cpp#L73)), rendering monospace balance counters opt-in. * Unlike Bitcoin, Dash has a dedicated appearance widget for managing font settings specifically. We have opted to deviate from upstream by moving the money font control from "Display" to "Appearance" for the sake of consistency. * We set the money font when setting the wallet model as client model updates happen after the UI is visible to the user while wallet model updates happen _before_, there is little point in setting them to any values in the constructor as during construction, we don't have access to the options model and thus don't know _what_ font is supposed to be used to begin with. * If a font is passed through the command line, it is considered "selectable" ([source](https://github.com/kwvg/dash/blob/89aa2c4b2390ada504fd5b45e16d2cd379074138/src/qt/bitcoin.cpp#L676-L679)) because we still need to populate that font in the drop-down menu so that we don't report stale data. Though, the font cannot be _set_ to that overridden value because command-line overridden controls are auto-disabled to prevent settings corruption (see 2f30002), which makes the "selectable" state more-or-less an internal detail. An example is that the user tries to run Dash Core, the embedded monospace font, Roboto Mono, is _not_ a selectable font (i.e. you cannot ordinarily set your client to use Roboto Mono, see below). <details> <summary>Screenshot:</summary>  </details> But if an override is done, it will be respected, the client will start with Roboto Mono and the selectable status will be overwritten so that it is presented in the drop-down menu, albeit, with the menu disabled so it doesn't contaminate UI settings. <details> <summary>Screenshot:</summary>  </details> ## Breaking Changes None expected. ## Checklist - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [x] I have added or updated relevant unit/integration/functional/e2e tests **(note: N/A)** - [x] I have made corresponding changes to the documentation **(note: N/A)** - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_ ACKs for top commit: UdjinM6: ACK 636e7a6 Tree-SHA512: a8b23c14aec0ccac126bdc7a6db0a4583da3bda52e02f72d213431bbaa80c633a432ed02c4a33d71e3e4d2503d076624196c3e6e50c9bb7fd8e3b50ae4e9ec35
Additional Information
dash#7068 introduced a regression where Qt clients with no GUI settings are unable to run at all due to failed weight to index conversion. This was covered in 9cd9d44 but made an incorrect assumption that earlier iterations of the fix (see ef34868) did not make.
The assumption made that resulted in this regression was that if the argument to weight conversion is successful, then the weight to index conversion will also be successful.
The earlier iteration of the fix checked the return value of the index conversion and set a sane default if it was invalid. The final iteration set the default weight value to the sane weight, expecting
weightFromArg()to fail (hence using the sane weight), notsupportedWeightToIndex()(which might not be able to process even a valid weight from argument).This was not caught in testing as over the course of working on dash#6833, my GUI settings were migrated to
settings.json, which has precedence overQSettingsand therefore, the client always ran with known good Montserrat parameters.Fix can be verified by deleting your QSettings parameters and running the client anew.
Breaking Changes
None expected.
Checklist