-
Notifications
You must be signed in to change notification settings - Fork 131
ENGN-4969 x/scheduler integration - tokenomics recalculation #881
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
base: dev
Are you sure you want to change the base?
Conversation
|
The latest Buf updates on your PR. Results from workflow Buf Linter / buf (pull_request).
|
c5936b1 to
c487365
Compare
771e522 to
eec79a6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @guilherme-brandao Here's some remarks mainly regarding on the articulation with the x/scheduler.
Btw maybe you should open a new PR, I can't request changes as this one is in my name, and I see some commit from dev in that one so maybe the occasion to clean that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be removed
| // Initialize recurring tasks after state is loaded | ||
| if loadLatest { | ||
| app.InitializeRecurringTasks() | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // Initialize recurring tasks after state is loaded | |
| if loadLatest { | |
| app.InitializeRecurringTasks() | |
| } |
That shouldn't be managed here, the x/mint tasks must be managed by the x/mint module
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to create a task type if there's no arguments
| // TaskHandlers returns the task handlers for the mint module | ||
| func (k *Keeper) TaskHandlers() schedulertypes.TaskHandlers { | ||
| return schedulertypes.TaskHandlers{ | ||
| schedulertypes.NewTaskHandler( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| schedulertypes.NewTaskHandler( | |
| schedulertypes.NewNoArgsTaskHandler( |
Let's declare it as a no args task
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The scheduler keeper should be added as module input and put in the mint's keeper
| return vm, err | ||
| } | ||
|
|
||
| if appKeepers != nil && appKeepers.SchedulerKeeper != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All this migration should be achieved in the x/mint module migration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the initial registering of the recalculation task when starting a brand new chain should occur in the begin blocker at the first block
| return schedulerKeeper.ScheduleTask( | ||
| ctx, | ||
| types.TaskEmissionRecalculation, | ||
| schedulertypes.TaskID("emission_recalculation"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| schedulertypes.TaskID("emission_recalculation"), | |
| types.TaskEmissionRecalculation, |
| @@ -9,7 +9,7 @@ import ( | |||
| upgradekeeper "cosmossdk.io/x/upgrade/keeper" | |||
| emissionsKeeper "github.com/allora-network/allora-chain/x/emissions/keeper" | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good alignment - however we can align the emissionsKeeper too for completeness :P
Purpose of Changes and their Description
This PR integrates the
x/mintmodule with thex/schedulermodule to enable periodic emission recalculation via scheduled tasks instead of the previous block-by-block approach in BeginBlocker.BeginBlockerand moved it to a scheduler-based task that runs approximately every 30 daysRecalculateEmissionkeeper method: Extracted the emission recalculation logic into a standalone method that can be invoked by the schedulerLink(s) to Ticket(s) or Issue(s) resolved by this PR
https://linear.app/alloralabs/issue/ENGN-4969/tokenomics-recalculation-with-xscheduler-integration
Are these changes tested and documented?
Unreleasedsection ofCHANGELOG.md?