Skip to content
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

Add slippage protection to reallocate #296

Closed
Rubilmax opened this issue Nov 2, 2023 · 2 comments · Fixed by #298
Closed

Add slippage protection to reallocate #296

Rubilmax opened this issue Nov 2, 2023 · 2 comments · Fixed by #298

Comments

@Rubilmax
Copy link
Contributor

Rubilmax commented Nov 2, 2023

No description provided.

@Rubilmax Rubilmax linked a pull request Nov 2, 2023 that will close this issue
@Jean-Grimal
Copy link
Contributor

Is it really useful to protect against such attacks ? I mean what would be the incentive for an attacker to prevent vaults allocators to disable a market ?

@Rubilmax
Copy link
Contributor Author

Rubilmax commented Nov 2, 2023

I think you are referring to:

// Guarantees that unknown frontrunning donations can be withdrawn, in order to disable a market.
if (allocation.shares == type(uint256).max) {
allocation.shares = MORPHO.supplyShares(allocation.marketParams.id(), address(this));
}

Though I think it's off the topic of the issue, which is about limiting the impact of slippage on reallocate calls made from an EOA or an unprotected contract: if we allow to pass in shares to supply to Morpho or withdraw from Morpho, there can be unexpected slippage
So this issue is not about an attack that prevents disabling a market

Still we can discuss about it: let's refer to your issue as issue 1 and mine as issue 2

I think the comment for issue 1 must be updated because it's not only about frontruns anymore: if you want to ensure you withdraw all from a market, you need to make sure you redeem all shares (otherwise interest may accrue over the input assets)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants