DripTopicFeeRevenue drips the internal topicFeeRevenue and not the one provided by GetCurrentTopicWeight
Summary
DripTopicFeeRevenue drips the topicFeeRevenue storage value instead of the value provided by the calculations inside GetCurrentTopicWeight. This can lead to different drip amounts than the ones calculated.
Vulnerability Detail
When GetAndUpdateActiveTopicWeights calls DripTopicFeeRevenue, it doesn't take the previously calculated topicFeeRevenue from GetCurrentTopicWeight.
However, if GetCurrentTopicWeight calculates a larger revenue because it includes a bonus, that bonus will never be dripped. The bonus is calculated here inside GetCurrentTopicWeight:
0x3b
Medium
DripTopicFeeRevenue
drips the internaltopicFeeRevenue
and not the one provided byGetCurrentTopicWeight
Summary
DripTopicFeeRevenue
drips thetopicFeeRevenue
storage value instead of the value provided by the calculations insideGetCurrentTopicWeight
. This can lead to different drip amounts than the ones calculated.Vulnerability Detail
When GetAndUpdateActiveTopicWeights calls
DripTopicFeeRevenue
, it doesn't take the previously calculatedtopicFeeRevenue
fromGetCurrentTopicWeight
.https://github.com/sherlock-audit/2024-06-allora/blob/main/allora-chain/x/emissions/module/rewards/topic_rewards.go#L165-L173
Instead,
DripTopicFeeRevenue
extracts the revenue from storage and drips that.https://github.com/sherlock-audit/2024-06-allora/blob/main/allora-chain/x/emissions/keeper/keeper.go#L1692-L1696
However, if
GetCurrentTopicWeight
calculates a larger revenue because it includes a bonus, that bonus will never be dripped. The bonus is calculated here inside GetCurrentTopicWeight:https://github.com/sherlock-audit/2024-06-allora/blob/main/allora-chain/x/emissions/keeper/topic_weight.go#L67-L71
Impact
DripTopicFeeRevenue may drip less than what is reported in
totalRevenue
.Code Snippet
Tool Used
Manual Review
Recommendation
Make
DripTopicFeeRevenue
take a parametertopicFeeRevenue
and drip that amount.