You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Wrong bribeCountPerPrincipleOnEpoch index update in incentivizePair function
Summary
In the incentivizePair function, the index bribeCountPerPrincipleOnEpoch is incorrectly incremented using incentivizeToken instead of principle. This causes the index to remain unchanged for a given principle and epoch, leading to overwriting of incentives and preventing multiple tokens from being incentivized for the same principle and epoch.
The lastAmount variable retrieves the current index for the given principle and epoch.
SpecificBribePerPrincipleOnEpoch uses this index to store the incentivizeToken.
However, bribeCountPerPrincipleOnEpoch[epoch][incentivizeToken]++ increments the count for incentivizeToken instead of principle.
This means lastAmount does not change for the same principle and epoch, causing subsequent incentives to overwrite the previous one.
As a result, only one incentive token can be stored per principle and epoch, and any additional incentives overwrite existing ones.
Impact
Users querying this information will only see the last incentivized token, unaware of any previously added tokens. This can lead to users making decisions based on inaccurate data,
Mitigation
Correct the increment operation to update the index for the principle: bribeCountPerPrincipleOnEpoch[epoch][principle]++;
The text was updated successfully, but these errors were encountered:
sherlock-admin3
changed the title
Future Obsidian Puma - Wrong bribeCountPerPrincipleOnEpoch index update in incentivizePair function
Maroutis - Wrong bribeCountPerPrincipleOnEpoch index update in incentivizePair function
Dec 12, 2024
Maroutis
Medium
Wrong
bribeCountPerPrincipleOnEpoch
index update inincentivizePair
functionSummary
In the
incentivizePair
function, the indexbribeCountPerPrincipleOnEpoch
is incorrectly incremented usingincentivizeToken
instead ofprinciple
. This causes the index to remain unchanged for a given principle and epoch, leading to overwriting of incentives and preventing multiple tokens from being incentivized for the same principle and epoch.Details
In the provided code snippet:
SpecificBribePerPrincipleOnEpoch
uses this index to store theincentivizeToken
.bribeCountPerPrincipleOnEpoch[epoch][incentivizeToken]++ increments
the count forincentivizeToken
instead ofprinciple
.lastAmount
does not change for the same principle and epoch, causing subsequent incentives to overwrite the previous one.Impact
Users querying this information will only see the last incentivized token, unaware of any previously added tokens. This can lead to users making decisions based on inaccurate data,
Mitigation
Correct the increment operation to update the index for the principle:
bribeCountPerPrincipleOnEpoch[epoch][principle]++;
The text was updated successfully, but these errors were encountered: