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

Credit accrual is done twice in award #96

Open
code423n4 opened this issue Jun 23, 2021 · 1 comment
Open

Credit accrual is done twice in award #96

code423n4 opened this issue Jun 23, 2021 · 1 comment
Assignees

Comments

@code423n4
Copy link
Contributor

Handle

cmichel

Vulnerability details

The credit is accrued twice in award.
The first accrual happens implicitly when calling _mint through the ControlledToken(controlledToken).controllerMint call which then performs the PrizePool.beforeTokenTransfer hook which accrues credit.
Then the explicit accrual is done again. It should be enough to only add the extraCredit without doing another accrual (calling _updateCreditBalance(..., newBalance= _applyCreditLimit(controlledToken, controlledTokenBalance, uint256(creditBalance.balance).add(credit).add(extra))) instead).

@asselstine
Copy link
Collaborator

We could:

  • remove the credit accrual from the beforeTokenTransfer for minting
  • Call _accrueCredit everywhere that _mint is called, and for award ensure that we call it before mint and with the extra credit

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

No branches or pull requests

3 participants