DO NOT MERGE until maturity modulation validated in mainnet feat(governance): switch spawning and disbursement to locally computed maturity modulation#9848
Conversation
There was a problem hiding this comment.
Pull request overview
This PR aims to switch governance maturity-modulation consumers (neuron spawning + maturity disbursement finalization) to read the locally computed maturity modulation value, and updates TLA export + tests accordingly.
Changes:
- Update
maybe_spawn_neuronsandtry_finalize_maturity_disbursementto read maturity modulation from a new heap-data source. - Update TLA global export to reflect the new maturity-modulation source.
- Update disburse-maturity tests to set up the new maturity-modulation source.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| rs/nns/governance/src/timer_tasks/mod.rs | Adds imports intended for XRC-related logic (currently unused in this module). |
| rs/nns/governance/src/governance/tla/mod.rs | Switches TLA export of cached maturity modulation to the new source. |
| rs/nns/governance/src/governance/disburse_maturity_tests.rs | Updates test setup to populate the new maturity-modulation source. |
| rs/nns/governance/src/governance/disburse_maturity.rs | Switches maturity disbursement finalization to read modulation from the new source. |
| rs/nns/governance/src/governance.rs | Switches neuron spawning to read modulation from the new source. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
0724790 to
9a31ba9
Compare
2263afa to
f607ce6
Compare
9a31ba9 to
a7108f0
Compare
f607ce6 to
9da51a1
Compare
…name to duration_until_next_midnight_utc
9da51a1 to
8577ae1
Compare
There was a problem hiding this comment.
This pull request changes code owned by the Governance team. Therefore, make sure that
you have considered the following (for Governance-owned code):
-
Update
unreleased_changelog.md(if there are behavior changes, even if they are
non-breaking). -
Are there BREAKING changes?
-
Is a data migration needed?
-
Security review?
How to Satisfy This Automatic Review
-
Go to the bottom of the pull request page.
-
Look for where it says this bot is requesting changes.
-
Click the three dots to the right.
-
Select "Dismiss review".
-
In the text entry box, respond to each of the numbered items in the previous
section, declare one of the following:
-
Done.
-
$REASON_WHY_NO_NEED. E.g. for
unreleased_changelog.md, "No
canister behavior changes.", or for item 2, "Existing APIs
behave as before.".
Brief Guide to "Externally Visible" Changes
"Externally visible behavior change" is very often due to some NEW canister API.
Changes to EXISTING APIs are more likely to be "breaking".
If these changes are breaking, make sure that clients know how to migrate, how to
maintain their continuity of operations.
If your changes are behind a feature flag, then, do NOT add entrie(s) to
unreleased_changelog.md in this PR! But rather, add entrie(s) later, in the PR
that enables these changes in production.
Reference(s)
For a more comprehensive checklist, see here.
GOVERNANCE_CHECKLIST_REMINDER_DEDUP
…d maturity modulation
…ory, remove unused imports
8577ae1 to
bc807c4
Compare
daniel-wong-dfinity-org
left a comment
There was a problem hiding this comment.
I would put this behind a flag.
| }; | ||
|
|
||
| // Sanity check that the maturity modulation returned is within bounds. | ||
| if !VALID_MATURITY_MODULATION_BASIS_POINTS_RANGE.contains(&maturity_modulation) { |
There was a problem hiding this comment.
Range still has the old values
|
|
||
| let now_seconds = self.env.now(); | ||
| let maturity_modulation = match self.heap_data.cached_daily_maturity_modulation_basis_points | ||
| let maturity_modulation = match self |
There was a problem hiding this comment.
Maybe we should add another sanity check that makes sure that the maturity modulation value is the one for the current day (also in the disburse maturity case)?
1455d28 to
876292a
Compare
…e history (dfinity#9847) ## Why Previously, Governance relied on CMC (Cycles Minting Canister) as a middleman for ICP price data used in maturity modulation. This PR cuts out the middleman by having Governance fetch ICP/XDR rates directly from the Exchange Rate Canister (XRC) and derive Mission 70 maturity modulation locally. https://dfinity.atlassian.net/browse/NNS1-4319 ## What - `IcpPriceHistory`: bounded sorted vector of up to 365 daily ICP/XDR rates in Governance state (new proto field 33) - `UpdateIcpXdrRateRelatedData`: timer task that fetches rates directly from XRC, backfills the last 365 days on first upgrade (~30 min at 5-second intervals), then switches to daily fetches aligned to UTC midnight; recomputes Mission 70 maturity modulation after each update - The existing CMC-polled maturity modulation remains active for spawning/disbursement (switchover is in a later PR) ### PR Chain - ⬅️ Previous: dfinity#9846 - ➡️ Next: dfinity#9848, dfinity#9879 ## Testing Unit tests for the price history buffer, maturity modulation computation, and UTC midnight timer logic.
Why
The previous PR added local maturity modulation computation. This PR switches the actual consumers to use it.
https://dfinity.atlassian.net/browse/NNS1-4319
What
The old CMC-polled fields are not yet removed; that happens in the next PR.
PR Chain
Testing
Existing disburse_maturity and maybe_spawn_neurons tests updated and passing.