This repository has been archived by the owner on Jan 19, 2025. It is now read-only.
Kow - GetAllReputersOutput
: If listenedStakeFraction < minStakeFraction
, the differential will not be properly interpolated to ensure listenedStakeFraction = minStakeFraction
#72
Labels
Duplicate
A valid issue that is a duplicate of an issue with `Has Duplicates` label
Medium
A Medium severity issue.
Reward
A payout will be made for this issue
Sponsor Confirmed
The sponsor acknowledged this issue is valid
Will Fix
The sponsor confirmed this issue will be fixed
Kow
Medium
GetAllReputersOutput
: IflistenedStakeFraction < minStakeFraction
, the differential will not be properly interpolated to ensurelistenedStakeFraction = minStakeFraction
Summary
If
listenedStakeFraction < minStakeFraction
, the differential will not be properly interpolated to ensurelistenedStakeFraction = minStakeFraction
.Vulnerability Detail
https://github.com/sherlock-audit/2024-06-allora/blob/4e1bc73db32873476f8b0a88945815d3978d931c/allora-chain/x/emissions/module/rewards/rewards_internal.go#L546-L574
In the whitepaper under equation 34, it is mentioned that whenever the fraction of the stake listened to falls below a minimum, the differential is interpolated so that the fraction is equal to the minimum. The corresponding logic is in the above snippet. The issue is
coeffDiff
calculatescoefficients[i] - oldCoefficients[i]
, but at this pointcoefficients
always contains the same values asoldCoefficients
(sincecoefficients
is copied intooldCoefficients
at the start of the outer loop and neither is changed up to this point). Consequently,coeffDiff
will always be0
for all coefficients andcoefficients
will not change.Impact
Fraction of stake listened to will not be corrected to the minimum if below the minimum, such that the adjusted stake(s) calculated will not be as intended resulting in incorrect distribution of rewards.
Code Snippet
https://github.com/sherlock-audit/2024-06-allora/blob/4e1bc73db32873476f8b0a88945815d3978d931c/allora-chain/x/emissions/module/rewards/rewards_internal.go#L546-L574
Tool used
Manual Review
Recommendation
Calculate
coeffDiff = newCoefficients[i] - oldCoefficients[i]
instead.Duplicate of #93
The text was updated successfully, but these errors were encountered: