-
Notifications
You must be signed in to change notification settings - Fork 4
maxDeposit doesn't consider global and user-specific limits #125
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
Comments
While I do agree maxDeposit is not v sophisticated, I don't think this is a rewardable submission.
Condition 1 is not a problem in practice, no need to for the extra gas cost to check that. |
All four of these functions are used majorly for integration. The whole idea of these function are reflecting global and user specific limit in the view function without initiating transaction If by extra gas cost you mean deployment cost, then yes, it is worth implementing user and global-specific limits. |
The protocol does try to follow the ERC4626 interface but it doesn't exactly implement the spec - it doesn't work follow the general logic of how such a vault is implemented. I can't defend defend or attack this fact because I didn't take that design decision myself, but it is kinda clear from the contracts. Thus I can only work towards a reasonable outcome. I think EIP4626 is an over-engineered standard and we can't have a perfect implementation of its functions according to this protocol's intended functioning. I understand the spirit of your submission follows this:
However implementing
You seem to minimize the idea of another submission which we have rewarded, then overstate yours - your submission is about |
Github username: @@Tri-pathi
Twitter username: --
Submission hash (on-chain): 0x2cee54a47c73f1f92b8e4e77e443e317eec90813c9545ab61cfda5e900d35d9b
Severity: medium
Description:
Description
The
maxDeposit()
function is required to return the maximum amount of underlying assets that can be deposited, factoring in both global and user-specific limits. According to EIP-4626 specifications, if deposits are disabled (even temporarily), the function MUST return 0.However, the current implementation fails to properly handle all deposit-blocking conditions, leading to inconsistency where
deposit()
reverts butmaxDeposit()
returns a positive value.Proof of Concept
The core invariant - "if deposit is blocked,
maxDeposit()
must return zero" - is violated in the current implementation:The
deposit()
function can revert due to several conditions that are not checked inmaxDeposit()
:BURN_ROLE
permissions on the USDE token contractIn all these cases,
maxDeposit()
incorrectly returnstype(uint256).max
instead of0
.Impact
This inconsistency between
maxDeposit()
anddeposit()
violates EIP-4626 specifications and can lead to integration issues for protocols relying onmaxDeposit()
to determine valid deposit amounts.Recommendation
Update
maxDeposit()
to account for all conditions that could causedeposit()
to revert.This is not exact solution but can give you idea how do you want to design this.
Similar updates should be made in maxMint(), maxWithdraw() and maxRedeem().
The text was updated successfully, but these errors were encountered: