[codex] Show VM mining rewards with six decimals#7764
Conversation
|
Welcome to RustChain! Thanks for your first pull request. Before we review, please make sure:
Bounty tiers: Micro (1-10 RTC) | Standard (20-50) | Major (75-100) | Critical (100-150) A maintainer will review your PR soon. Thanks for contributing! |
jaxint
left a comment
There was a problem hiding this comment.
PR Review
Thank you for this contribution! Here's my review:
Summary
This PR improves the wallet tracker and mining calculator functionality.
Code Quality
- ✅ Clean implementation of number formatting
- ✅ Proper decimal precision handling
- ✅ Good use of existing utility functions
Observations
✅ Calculator logic updated in mining-simulator.html - useful metric
Testing
The changes appear to be focused on display/UX improvements. Consider:
- Adding unit tests for formatting functions
- Testing edge cases with very large/small numbers
Verdict
APPROVE ✅ - Changes are beneficial and low-risk.
Review by @jaxint | Wallet: AhqbFaPBPLMMiaLDzA9WhQcyvv4hMxiteLhPk3NhG1iG
|
Thanks for the review. This is a non-doc PR and should be BCOS-L1, but I don't have permission to add labels. Could a maintainer please add the BCOS-L1 label? |
jujujuda
left a comment
There was a problem hiding this comment.
Review: LGTM ✅
Show VM rewards with 6 decimals instead of 2. VM earns 0.000001 RTC, so shows 0.00 — misleading. is correct. Clean XS fix.
Recommendation: APPROVE.
FakerHideInBush
left a comment
There was a problem hiding this comment.
Two concerns before merging:
1. .toFixed(6) always emits trailing zeros — rewards like 1.5 RTC now display as 1.500000 RTC, which is visually cluttered
.toFixed(N) pads to exactly N decimal places regardless of magnitude. After this change:
- A reward of
1.5displays as1.500000 RTC(4 unnecessary trailing zeros) - A reward of
2.0displays as2.000000 RTC(6 unnecessary trailing zeros) - A reward of
0.000001displays as0.000001 RTC(correct — this is presumably the case this PR was trying to fix)
If the goal is to show precision only when it matters (i.e. avoid 0.00 RTC for very small rewards), consider a conditional formatter:
function formatReward(rtc) {
if (rtc === 0) return '0 RTC';
if (rtc >= 0.01) return rtc.toFixed(2) + ' RTC';
return rtc.toFixed(6).replace(/\.?0+$/, '') + ' RTC';
}This shows 2 decimals for normal rewards and up to 6 significant decimals for micro-rewards, without trailing zeros in either case.
2. The PR description does not explain why 6 decimals are needed — this makes it impossible to verify the fix is correctly scoped
The title says Show VM mining rewards with six decimals but gives no context for:
- What
baseRewardvalues are expected (are sub-cent rewards actually produced by VM tiers, or is this speculative?). - Whether any other earnings displays in
mining-simulator.htmlormining-calculator/index.htmlalso showbaseReward * multiplierwith.toFixed(2)— if so, changing only this one display creates an inconsistency where the same quantity appears with different precision in different parts of the UI.
Please add a brief PR description explaining the use case (e.g. baseReward for VM tiers can be as small as 0.000001 RTC and was showing as 0.00) and confirm whether other reward displays need the same update.
Summary
Why
The main reward display already uses six decimals, but the comparison table used two decimals. That made very small VM rewards appear as zero in one part of the UI while still showing a non-zero reward elsewhere.
Fixes #7732.
Validation