Skip to content

Conversation

@AlanRuno
Copy link
Owner

Summary

Fixes a bug where the initial_stake config value was being assigned directly as a raw double (100.0) to mxd_amount_t without 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:

  1. Includes mxd_types.h to access MXD_AMOUNT_MULTIPLIER (100,000,000)
  2. Updates mxd_set_default_config() to use proper base unit calculation
  3. Updates mxd_load_config() to convert JSON double values to base units with rounding

Review & Testing Checklist for Human

  • Verify MXD_AMOUNT_MULTIPLIER is correctly defined as 100000000ULL in include/mxd_types.h
  • Run a fresh 10-node test and verify genesis validators show 100.00 MXD stake (not 0.00 MXD)
  • Check genesis block logs show total_supply set to 30000000000 base units (300 MXD for 3 validators)

Recommended test plan:

  1. Reset blockchain data on test nodes
  2. Restart nodes to create fresh genesis block
  3. Check node metrics display shows "Stake: 100.00 MXD" for genesis validators

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

The initial_stake config value was being read as a raw double (100.0) and
assigned directly to mxd_amount_t without converting to base units. This
caused genesis validators to receive 100 base units instead of 100 MXD
(10,000,000,000 base units).

Fixed by:
1. Including mxd_types.h to access MXD_AMOUNT_MULTIPLIER
2. Converting the JSON double value to base units in mxd_load_config()
3. Using proper base unit calculation in mxd_set_default_config()
@devin-ai-integration
Copy link

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@AlanRuno AlanRuno merged commit 040944a into main Jan 19, 2026
9 checks passed
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.

2 participants