[VS Incentives]: Update AllocateAcrossGauges
to support volume splitting
#6402
Labels
F: volume-splitting
feat: Volume-splitting incentives
Background
The purpose of the
AllocateAcrossGauges
function is to iterate through all active group gauges and execute a distribution to their internal gauges based on their respective splitting policies. This function still needs to be updated (and likely mostly reimplemented) to work with volume splitting/arbitrary splitting policies. A detailed breakdown of the flow of the function is outlined below and in TODO comments in #6366.Note that the majority of the complexity relating to splitting policies is abstracted into
syncGroupGaugeWeights
which is implemented in #6366. This function should be able to abstractly deal only with gauge weights without having to deal with splitting policies beyond an initial call tosyncGroupGaugeWeights
.Suggested Design
The
AllocateAcrossGauges
function should have the following rough flow:syncGroupGaugeWeights
remaining coins
, if not thenremaining coins / num epochs
)AddToGaugeRewardsFromGauge
, which will need to be cleaned up and tested (note that total weight is a group gauge field, so each loop iteration's pro rata share should becurrentRecordWeight / totalWeight
)updateGaugePostDistribute
on group gauge afterwards to ensure distribution is tracked in the group gaugeTesting Strategy
Since this function will likely need to be implemented before or concurrently with group gauge creation logic, testing it could be slightly more difficult. If we want testing this to not be blocked on finishing
CreateGroupGauge
, we can take a similar approach to testing as was done in #6366 (with some tweaks) and do the following flow:types.KeyPrefix(types.GroupGaugePrefix)
as keySince no actual balance transfer is made (funds just stay in module account), this approach should not cause any major issues and would likely be the appropriate approach to test more custom/granular scenarios even if group gauge creation logic was already complete.
Acceptance Criteria
x/incentives/keeper/distribute_test.go
The text was updated successfully, but these errors were encountered: