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

Gauge admin can add faulty reward tokens #137

Open
nventuro opened this issue Feb 14, 2022 · 0 comments
Open

Gauge admin can add faulty reward tokens #137

nventuro opened this issue Feb 14, 2022 · 0 comments

Comments

@nventuro
Copy link

nventuro commented Feb 14, 2022

On LiquidityGaugeV5, the add_reward function does not check that _distributor is not the zero address. This is important, because the gauge assumes reward tokens with a zero distributor are uninitialized (i.e. not added to the gauge).

A zero distributor means that deposit_reward_token will not be callable, nor can this situation be fixed using set_reward_distributor. Additionally, the admin would then be able to add the same reward token again to the gauge, since add_reward only checks for the current distributor to be unset.

This is not a security concern due to the following:

  • if the reward token is only added once, no rewards will be able to be issued for it, and the gauge will behave as if the distributor never sent any tokens
  • if the reward token is added multiple times, the internal accounting will not be broken since all reward tokens are fully processed before moving on to the next one (see e.g. _checkpoint_rewards)

This does result in extra gas being used by all users, and one (or more) of the 8 reward token slots being forever burned.

The proposed fix is to simply check that _distributor is not the zero address in add_reward. From what I've seen, this issue is not present just on the V5 gauge but also all past gauges. Care should be taken to not add a reward token with a zero distributor in these.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant