Fix initial_stake config parsing to convert MXD to base units #231
+5
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a bug where the
initial_stakeconfig value was being assigned directly as a raw double (100.0) tomxd_amount_twithout converting to base units. This caused genesis validators to receive only 100 base units instead of 100 MXD (10,000,000,000 base units).The fix:
mxd_types.hto accessMXD_AMOUNT_MULTIPLIER(100,000,000)mxd_set_default_config()to use proper base unit calculationmxd_load_config()to convert JSON double values to base units with roundingReview & Testing Checklist for Human
MXD_AMOUNT_MULTIPLIERis correctly defined as100000000ULLininclude/mxd_types.htotal_supply set to 30000000000 base units(300 MXD for 3 validators)Recommended test plan:
Notes
This is a follow-up fix to PR #230 which added genesis coinbase transactions. The coinbase fix was working correctly, but the config parsing was not converting the stake amount properly.
Link to Devin run: https://app.devin.ai/sessions/4f2bfeca9bee46ca90ac744cb8b94bf8
Requested by: @AlanRuno