Skip to content

Conversation

@MudDev
Copy link

@MudDev MudDev commented Jan 12, 2026

This pull request introduces a new upgrade (v0.5.3) to address a consensus bug in token emission calculations and refactors the emission logic to ensure deterministic, architecture-independent results. The most important changes are:

Upgrade Handling:

  • Added a new upgrade constant UpgradeName_v0_5_3 and set it as the current upgrade version in evmd/upgrades.go.
  • Registered a new upgrade handler for v0.5.3 that logs the upgrade and runs module migrations, clarifying that no state migration is needed as the fix is in the calculation logic. The upgrade handler check now includes v0.5.3.

Deterministic Emission Calculation:

  • Refactored emission rate calculations in x/epixmint/keeper/emission.go to use only deterministic sdkmath.LegacyDec arithmetic, removing all non-deterministic math and big operations to ensure consensus across all CPU architectures.
  • Implemented a new approximateDecayWithDec helper function that deterministically approximates exponentiation for emission decay, using integer arithmetic and linear interpolation for fractional exponents.
  • Updated function comments and logic to clarify the deterministic approach and its importance for consensus, and ensured all calculations are performed using the new approach. [1] [2]# Description

Closes: #XXXX


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • tackled an existing issue or discussed with a team member
  • left instructions on how to review the changes
  • targeted the main branch

@MudDev MudDev merged commit d019840 into main Jan 13, 2026
11 of 19 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