Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Puny Tan Millipede - Incorrect validation check for tipping amount #81

Open
sherlock-admin3 opened this issue Dec 22, 2024 · 0 comments
Labels
Won't Fix The sponsor confirmed this issue will not be fixed

Comments

@sherlock-admin3
Copy link

Puny Tan Millipede

Medium

Incorrect validation check for tipping amount

Summary

The bumpEarningPower function contains an incorrect validation check for tip amounts against unclaimed rewards, potentially causing valid transactions to fail due to a flawed comparison with maxBumpTip.

Vulnerability Detail

The current validation logic is flawed in its implementation:

  • The function uses (_unclaimedRewards - _requestedTip) < maxBumpTip to validate tips
  • This check compares the remaining rewards against maxBumpTip instead of directly validating if _requestedTip exceeds _unclaimedRewards
  • The condition could cause transactions to fail even when there are sufficient unclaimed rewards to cover the requested tip
  • The issue occurs specifically when _newEarningPower < deposit.earningPower

Impact

  • Valid transactions may be incorrectly reverted
  • Bumpers might be unable to claim legitimate tips even when sufficient unclaimed rewards exist
  • Function behavior does not align with its intended purpose of ensuring tips don't exceed available rewards
  • Could discourage legitimate bumpers from participating in the system

Code Snippet

https://github.com/sherlock-audit/2024-11-tally/blob/main/staker/src/GovernanceStaker.sol#L496-L500

Tool used

Manual Review

Recommendation

Replace the current condition with a direct comparison between _requestedTip and _unclaimedRewards:

if (_newEarningPower < deposit.earningPower && _requestedTip > _unclaimedRewards) {
    revert GovernanceStaker__InsufficientUnclaimedRewards();
}

This will properly validate that requested tips don`t exceed available rewards, to prevent incorrect transactions reversions.

@sherlock-admin3 sherlock-admin3 added the Won't Fix The sponsor confirmed this issue will not be fixed label Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Won't Fix The sponsor confirmed this issue will not be fixed
Projects
None yet
Development

No branches or pull requests

1 participant