The comparison here https://github.com/code-423n4/2023-01-astaria/blob/main/src/PublicVault.sol#L586 will consider totalAssets() = v.depositCap
as a valid condition and it would revert , but totalAssets() = v.depositCap should not revert as in this condition the value of totalAssets is still inbound the depositCap and this can happen alot(totalAssets reaching depositCap). Making this revert would let valid transactions(mint and deposit ) revert.
Lines of code
https://github.com/code-423n4/2023-01-astaria/blob/main/src/PublicVault.sol#L586
Vulnerability details
Impact
The function afterDeposit (https://github.com/code-423n4/2023-01-astaria/blob/main/src/PublicVault.sol#L586) will revert for valid value of totalAssets.
Proof of Concept
The comparison here https://github.com/code-423n4/2023-01-astaria/blob/main/src/PublicVault.sol#L586 will consider
totalAssets() = v.depositCap
as a valid condition and it would revert , buttotalAssets() = v.depositCap
should not revert as in this condition the value of totalAssets is still inbound the depositCap and this can happen alot(totalAssets reaching depositCap). Making this revert would let valid transactions(mint and deposit ) revert.Tools Used
Manual Analysis
Recommended Mitigation Steps
Use
totalAssets() > v.depositCap
instead