Closed sherlock-admin closed 11 months ago
Invalid, insufficient proof. Would be helpful in the future to provide some scenarios (numerical examples) on how this could possibly overflow in production, given uint80 is a huge value especially for representing vault shares. Imo, if a judge needs to explicitly do that to prove your issue, the issue does not have sufficient proof. Additionally, even if it reaches that level of vaultShares to mint, the lp can always separately mint vaultshares via different deposit transactions with no loss of funds and DoS.
shealtielanz
medium
_mintVaultShares()
inSingleSidedLPVaultBase.sol
can revert unexpectedly, causing DOS to deposits from notional.Summary
the call to
_mintVaultShares()
can revert for a certain vault share greater than type(uint80).max on the call to.toUint80
due to overflow.Vulnerability Detail
The
SingleSidedLPVaultBase
contract during the execution of_depositFromNotional()
function calls the internal function_mintVaultShares()
. Inside this function could be seen casting uint256 typed local variables to uint80 type: https://github.com/sherlock-audit/2023-10-notional/blob/main/leveraged-vaults/contracts/vaults/common/SingleSidedLPVaultBase.sol#L229C1-L240C64This casting could be considered safe only based on the assumption that value of
vaultShares
returned would always be less than uint80.maxValue. However, we could see that this assumption would be wrong in case of low enoughtotalPoolClaim
amount in the pool.With a small
state.totalPoolClaim
wherestate.totalPoolClaim != 0
, biglpTokens
andstate.totalVaultSharesGlobal
values, the calculation could result in avaultShares
that is greater thanuint80.maxValue.
This will lead to an overflow on the linestate.totalVaultSharesGlobal += vaultShares.toUint80();
causing a revert, resulting to DOS on the call to deposit from notional.Impact
This would brick deposits from notional on the call to
_depositFromNotional()
Code Snippet
Tool used
Manual Review
Recommendation
Consider changing the
state.totalVaultSharesGlobal
field type from uint80 to uint256.