Skip to content
This repository has been archived by the owner on Sep 17, 2023. It is now read-only.

y1cunhui - Not decreasing currentMinted in TAU in some cases #144

Closed
sherlock-admin opened this issue Mar 13, 2023 · 0 comments
Closed

y1cunhui - Not decreasing currentMinted in TAU in some cases #144

sherlock-admin opened this issue Mar 13, 2023 · 0 comments
Labels
Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label Medium A valid Medium severity issue Reward A payout will be made for this issue

Comments

@sherlock-admin
Copy link
Contributor

sherlock-admin commented Mar 13, 2023

y1cunhui

medium

Not decreasing currentMinted in TAU in some cases

Summary

In TAU._decreaseCurrentMinted, when accountMinted < amount, the currentMinted is not decreased.

Vulnerability Detail

In TAU._decreaseCurrentMinted:

function _decreaseCurrentMinted(address account, uint256 amount) internal virtual {
        // If the burner is a vault, subtract burnt TAU from its currentMinted.
        // This has a few highly unimportant edge cases which can generally be rectified by increasing the relevant vault's mintLimit.
        uint256 accountMinted = currentMinted[account];
        if (accountMinted >= amount) {
            currentMinted[msg.sender] = accountMinted - amount;
        }
    }

The if statement only decrease currentMinted when accountMinted >= amount. However, if accountMinted < amount(it's possible, since who burn the TAU can be different from who mint TAU to this account), the amount is not decreased.

Impact

In some cases, this will make some vaults get unexpectedly more power to mint. Anyway, it's some unexpected behaviour, so I marked it as Medium.

Code Snippet

https://github.com/sherlock-audit/2023-03-taurus/blob/main/taurus-contracts/contracts/TAU.sol#L76-L83

Tool used

Manual Review

Recommendation

In fact, the currentMinted management in this TAU contract is somehow chaotic. The governance can give power to same vaults to mint TAU, but the power is not just as seen in the mintLimit, since the decrease management is sometimes not working as expected. Combining with abother issue that msg.sender not identical with account, I think this part's related features need to be reconsidered and refactored.

Duplicate of #149

@github-actions github-actions bot added Medium A valid Medium severity issue Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label labels Mar 21, 2023
@sherlock-admin sherlock-admin added the Reward A payout will be made for this issue label Apr 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label Medium A valid Medium severity issue Reward A payout will be made for this issue
Projects
None yet
Development

No branches or pull requests

1 participant