Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/mint: Migrate away from blocks influencing issuance to use epochs #19952

Open
Tracked by #19761
likhita-809 opened this issue Apr 4, 2024 · 1 comment · May be fixed by #20044
Open
Tracked by #19761

x/mint: Migrate away from blocks influencing issuance to use epochs #19952

likhita-809 opened this issue Apr 4, 2024 · 1 comment · May be fixed by #20044
Labels

Comments

@likhita-809
Copy link
Contributor

likhita-809 commented Apr 4, 2024

Summary

Currently, the x/mint module calculates the token issuance (affected by inflation) based on block times i.e., users need to calculate how many blocks they will have in a year which is influenced by block times.

Proposal

To improve consistency and predictability in token issuance, we propose migrating away from block-based issuance and adopting time-based issuance using epochs in the x/mint module.
Currently, we use BlocksPerYear param to calculate the provisions for a block and to determine the rate change for inflation. This should be adjusted to epochs time intervals rather than blocks per year. Define the duration of each epoch and adjust the issuance calculation accordingly.

Steps to follow:

  • Modify the issuance calculation logic in the x/mint module to use time-based metrics instead of block numbers.
  • Implement a mechanism to calculate issuance on a per-epoch basis, considering factors such as target inflation rate, epoch duration, and total time elapsed.
  • Define epochs on-chain timers that execute at fixed time intervals (e.g., days, weeks, months) to serve as the basis for calculating token issuance. We register the logic to be executed at the timer ticks.
  • Set module hooks: on hook receiver function, we need to filter epochIdentifier and only do executions for only specific epochIdentifier. Filtering epochIdentifier could be in Params of modules so that they can be modified by governance.
    NOTE: Every timer has a unique identifier.
    end time = start time + timer interval.
    Eg:
func (k MyModuleKeeper) AfterEpochEnd(ctx sdk.Context, epochIdentifier string, epochNumber int64) {
    params := k.GetParams(ctx)
    if epochIdentifier == params.DistrEpochIdentifier {
    // my logic
  }
}
  • we need to define appropriate duration and granularity of epochs based on network requirements and user preferences.
  • Migration ?
@github-actions github-actions bot added the needs-triage Issue that needs to be triaged label Apr 4, 2024
@likhita-809 likhita-809 changed the title migrate away from blocks influencing issuance x/mint: Migrate away from blocks influencing issuance to use epochs Apr 4, 2024
@likhita-809
Copy link
Contributor Author

ref: #19697

@tac0turtle tac0turtle added C:x/mint and removed needs-triage Issue that needs to be triaged labels Apr 5, 2024
@likhita-809 likhita-809 linked a pull request Apr 15, 2024 that will close this issue
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: 🤸‍♂️ In Progress
Development

Successfully merging a pull request may close this issue.

2 participants