Skip to content

fix(qt): drop zero fraction from collateral amounts in masternode wizard - #7640

Open
thephez wants to merge 1 commit into
dashpay:developfrom
thephez:style/mn-wizard-collateral-format
Open

fix(qt): drop zero fraction from collateral amounts in masternode wizard#7640
thephez wants to merge 1 commit into
dashpay:developfrom
thephez:style/mn-wizard-collateral-format

Conversation

@thephez

@thephez thephez commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

Issue being fixed or feature implemented

Collateral amounts shown in the Register Masternode wizard are always a whole number of coins (e.g. 1000 DASH for a masternode, 4000 DASH for an EvoNode), so the full-precision fraction padding ("1 000.00000000 tDASH") added noise without conveying any information.

What was done?

Renamed the wizard's local FormatAmount helper to FormatCollateralAmount and made it drop the decimal part when the amount is a whole number of the current display unit. The trim is based on BitcoinUnits::decimals()/factor(), so it works correctly for any display unit the user has selected.

  • "1 000.00000000 tDASH" now renders as "1 000 tDASH" everywhere the wizard shows a collateral amount (type selection cards, validation messages, review page, broadcast confirmation).
  • No behavior change for non-whole amounts or zero-decimal units (duffs).

How Has This Been Tested?

Verified visually by opening the Register Masternode wizard in dash-qt on testnet and checking the collateral amounts on the type-selection page.

Breaking Changes

None. Display-only change scoped to the masternode registration wizard.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation
  • I have assigned this pull request to a milestone (for repository code-owners and collaborators only)

Collateral amounts are whole coins in every display unit, so the padded fraction ("1 000.00000000 tDASH") adds noise without information. Format them without the decimal part when the amount is a whole number of the display unit.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@thepastaclaw

thepastaclaw commented Aug 26, 2026

Copy link
Copy Markdown

✅ Final review complete — no blockers (commit c6c3e28)

@coderabbitai

coderabbitai Bot commented Aug 26, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 38de856b-1f71-40f1-9695-9df8623ff63c

📥 Commits

Reviewing files that changed from the base of the PR and between d1f7ff5 and c6c3e28.

📒 Files selected for processing (1)
  • src/qt/masternodewizard.cpp

Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review.


Walkthrough

The masternode wizard adds FormatCollateralAmount. The formatter preserves the selected display unit and unit label while removing zero fractional digits from whole-coin collateral values. All collateral displays and collateral-related messages now use this formatter, including type selection, fee explanations, validation errors, review details, and broadcast confirmations.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to c6c3e

This localized change only adjusts how whole-number collateral amounts are displayed in the masternode wizard; no actionable merge-blocking risk remains after normal checks and review.

Suggested reviewers: pastapastapasta

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 22.22% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: removing zero fractional digits from collateral amounts in the Qt masternode wizard.
Description check ✅ Passed The description directly explains the collateral formatting change, its scope, affected wizard views, testing, and lack of breaking changes.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@PastaPastaPasta

Copy link
Copy Markdown
Member

Should have Ss's :D but ok

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Final validation — Codex/Sol only (Phase 2 disabled)

The formatter correctly trims only zero fractional portions for units with decimals, preserves separators and unit suffixes, and leaves duffs unchanged. The behavior is the PR's primary change but has no automated regression coverage despite existing Qt wizard tests that can exercise each display unit.
Source: codex-general (reviewer backend identifier; exact model ID was not supplied in the evidence) and grok-4.5 (final verifier backend). Orchestration-only, not reviewer evidence: openclaw-agent/cliproxy/gpt-5.6-sol.

Validated zero-blocker Codex/Sol precheck evidence was promoted to final because Phase 2 (Sonnet/Opus) is temporarily disabled. This is Codex/Sol-only final validation, not Codex + Sonnet/Opus coverage.

Review provenance

  • Codex reviewers: gpt-5.6-sol — general (completed), gpt-5.6-sol — dash-core-commit-history (completed)
  • Verifier: gpt-5.6-sol — verifier
  • Sonnet/Opus: not run (Phase 2 disabled — temporary Codex/Sol-only final)
  • Secondary pass: disabled (temporary_phase2_sonnet_disable)

🟡 1 suggestion(s)

🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.

In `src/qt/masternodewizard.cpp`:
- [SUGGESTION] src/qt/masternodewizard.cpp:113-117: Add automated coverage for collateral formatting across display units
  No automated test asserts the new trimming behavior. Extend the existing `MasternodeWidgetTests` coverage to construct the wizard with DASH, mDASH, uDASH, and duffs selected, then verify the regular and EvoNode collateral labels. This directly protects the unit-dependent `decimals()` and `factor()` logic, including the zero-decimal path, instead of relying solely on a visual check of the default testnet unit.

Comment on lines +113 to +117
QString str{BitcoinUnits::format(unit, amount, /*plussign=*/false, BitcoinUnits::SeparatorStyle::ALWAYS)};
const int decimals{BitcoinUnits::decimals(unit)};
if (decimals > 0 && amount % BitcoinUnits::factor(unit) == 0) {
str.chop(decimals + 1);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Suggestion: Add automated coverage for collateral formatting across display units

No automated test asserts the new trimming behavior. Extend the existing MasternodeWidgetTests coverage to construct the wizard with DASH, mDASH, uDASH, and duffs selected, then verify the regular and EvoNode collateral labels. This directly protects the unit-dependent decimals() and factor() logic, including the zero-decimal path, instead of relying solely on a visual check of the default testnet unit.

source: ['codex']

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PastaPastaPasta do you want tests for this?

@thephez

thephez commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator Author

After:
image

See #7618 for a before screenshot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants