Mint initial tokens for genesis validators via coinbase transactions #230
+92
−1
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
This PR fixes the issue where genesis validators had 0 MXD stake despite the
initial_stakeconfig being set to 100.0 MXD. The root cause was that the genesis block creation code was settingtotal_supply = 0without actually minting any tokens.Changes:
serialize_coinbase_for_block()helper function to serialize coinbase transactions for block storagemxd_try_coordinate_genesis_block()to create coinbase transactions for each of the 3 genesis validators using theinitial_stakeconfig valuegenesis_block.total_supplyto reflect the total minted tokens (3 × initial_stake)The coinbase transactions are added to the genesis block before the transaction set is frozen, ensuring they are included in the block's merkle root calculation.
Review & Testing Checklist for Human
serialize_coinbase_for_block()with the existingserialize_transaction_for_block()inmxd_block_proposer.cto ensure the format matches what the deserialization code expectstotal_supply = 30000000000(300 MXD in base units for 3 validators × 100 MXD each)addresses[]array: Confirm that at line 2264, theaddresses[]array contains the correct sorted genesis validator addressesRecommended test plan:
./build/mxd_test_suite test --project mxd-network --nodes 10 --startup-mode letsgo-testnet --network-type testnetNotes
Link to Devin run: https://app.devin.ai/sessions/4f2bfeca9bee46ca90ac744cb8b94bf8
Requested by: @AlanRuno