Closed p-offtermatt closed 3 months ago
The updates introduce a new test function to validate the minimum power in the top N providers, modify the logic for computing and caching this minimum power in the QueueVSCPackets
function, and add a migration function to set these values during migrations. These changes aim to improve efficiency by caching the computed values instead of recalculating them on-the-fly.
Files | Change Summary |
---|---|
x/ccv/provider/keeper/keeper_test.go |
Added TestMinimumPowerInTopN to validate setting, updating, and retrieving minimum power in top N providers. |
x/ccv/provider/keeper/relay.go |
Modified ComputeMinPowerToOptIn to ComputeMinPowerInTopN and added SetMinimumPowerInTopN method. |
x/ccv/provider/migrations/v6/migrations.go |
Introduced MigrateMinPowerInTopN to calculate and set minimum power values for top N validators during migration. |
sequenceDiagram
participant User
participant Keeper
participant Store
User ->> Keeper: Call QueueVSCPackets
Keeper ->> Store: Compute and Set MinPowerInTopN
Store -->> Keeper: Acknowledge MinPowerInTopN Set
Keeper ->> User: Return Result
Objective | Addressed | Explanation |
---|---|---|
Compute MinPowerToOptIn in EndBlock and cache, instead of computing on-the-fly (#1842) | ✅ | |
Initialize during migration as it might be needed in BeginBlock for proposals (#1842) | ✅ |
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Replaces #1840 because I created a new branch from main via cherry-picking to avoid merging/rebasing as much
Description
Closes: #1842
Compute the minimal power in the top N on EndBlock, when we compute it anyways for sending VSCPackets.
This should, at worst, delay the ability to opt out by an epoch (intuitively, when someone is allowed to opt out not because their own power decreases, but because others powers increase, they would still compare against the old, stored MinPowerInTopN and not be allowed to opt out. This would be solved after the epoch ends and the MinPowerInTopN is updated, however.)
We could change this to be computed on every EndBlock instead of only once every epoch.
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...
!
to the type prefix if the change is state-machine breakingCHANGELOG.md
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add your handle next to the items reviewed if you only reviewed selected items.
I have...
!
the type prefix if the change is state-machine breakingSummary by CodeRabbit
New Features
Tests