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
{{ message }}
This repository has been archived by the owner on Sep 17, 2023. It is now read-only.
sherlock-admin opened this issue
Mar 13, 2023
· 0 comments
Labels
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelMediumA valid Medium severity issueRewardA payout will be made for this issue
However, the modification only occurs when accountMinted >= amount, which means, if accountMinted < amount, accountMinted will not be modified while TAU tokens are burned. This leads to inconsistency. As a result, when mint() is called to mint more TAU tokens by the vault, it might be reverted due to a false violation of mint limit.
Here is an example:
Suppose Vault A has a mint limit of 2000, and Vault A has already minted 2000 TAU.
Another user sent 100 TAU to Vault A.
Vault A calls burn() to burn 2100, however, since 2100 > accountMinted[VaultA], accountMinted[VaultA] will not be modified, although in this case, accountMinted[VaultA] should be set to zero.
Now if Vault A calls "mint()to mint 2000 TAU, it will be rejected due to accountMinted[VaultA] = 2000``. It will falsely report that Vault A already reaches the limit even though it has just burned 2100 TAU.
Impact
The accounting of accountMinted is incorrect for function _decreaseCurrentMinted(). As a result, a vault might not be able to mint more TAU even though it has not reached the limit - the system will falsely report that it has already reached the mint limit
Code Snippet
See above
Tool used
VScode
Manual Review
Recommendation
We will set accountMinted = 0 when accountMinted >= amount.
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;
}
+ else{+ currentMinted[msg.sender] = 0;+ }
}
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelMediumA valid Medium severity issueRewardA payout will be made for this issue
chaduke
medium
_decreaseCurrentMinted() does not revise currentMinted() correctly, as a result, a wrong mint limit might be enforced on a vault.
Summary
_decreaseCurrentMinted()
does not revisecurrentMinted
correctly, as a result, a wrong mint limit might be enforced on a vault.Vulnerability Detail
The
_decreaseCurrentMinted()
function was used inburn()
andburnFrom()
functions to decrease the accounting ofcurrentMinted
.https://github.com/sherlock-audit/2023-03-taurus/blob/main/taurus-contracts/contracts/TAU.sol#L76-L83
However, the modification only occurs when
accountMinted >= amount
, which means, ifaccountMinted < amount
,accountMinted
will not be modified while TAU tokens are burned. This leads to inconsistency. As a result, whenmint()
is called to mint more TAU tokens by the vault, it might be reverted due to a false violation of mint limit.Here is an example:
Suppose Vault A has a mint limit of 2000, and Vault A has already minted 2000 TAU.
Another user sent 100 TAU to Vault A.
Vault A calls
burn()
to burn 2100, however, since2100 > accountMinted[VaultA]
,accountMinted[VaultA]
will not be modified, although in this case,accountMinted[VaultA]
should be set to zero.Now if Vault A calls "mint()
to mint 2000 TAU, it will be rejected due to
accountMinted[VaultA] = 2000``. It will falsely report that Vault A already reaches the limit even though it has just burned 2100 TAU.Impact
The accounting of
accountMinted
is incorrect for function_decreaseCurrentMinted()
. As a result, a vault might not be able to mint more TAU even though it has not reached the limit - the system will falsely report that it has already reached the mint limitCode Snippet
See above
Tool used
VScode
Manual Review
Recommendation
We will set
accountMinted
= 0 whenaccountMinted >= amount
.Duplicate of #149
The text was updated successfully, but these errors were encountered: