-
Notifications
You must be signed in to change notification settings - Fork 26
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
Delete pending cap when removing a market #348
Conversation
Co-authored-by: Romain Milon <rmilon@gmail.com> Signed-off-by: Jean-Grimal <83286814+Jean-Grimal@users.noreply.github.com>
Co-authored-by: Romain Milon <rmilon@gmail.com> Signed-off-by: Jean-Grimal <83286814+Jean-Grimal@users.noreply.github.com>
to me we should more prevent any cap setting when the market is being removed |
indeed it sounds good |
There's one thing for sure is that this PR does not 100% fix the issue raised: even if the pending cap is deleted, it can be submitted again afterwards In which case I believe reverting when |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above
which would be fixed by #353 right? |
I don't think so, |
src/MetaMorpho.sol
Outdated
@@ -355,6 +355,7 @@ contract MetaMorpho is ERC4626, ERC20Permit, Ownable2Step, Multicall, IMetaMorph | |||
} | |||
|
|||
delete config[id]; | |||
delete pendingCap[id]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[optional] I realize now that these changes (both config[id]
and pendingCap[id]
) may be difficult to follow offchain with events. This requires to do the difference of sets to know which markets were removed. Maybe emitting an event here would be nice for offchain purposes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's one thing for sure is that this PR does not 100% fix the issue raised: even if the pending cap is deleted, it can be submitted again afterwards
Am I right?
I thought it would need happen after the removal of the market (or otherwise it gets deleted), which sounds like a wanted behavior.
But actually it could happen that the pending cap is accepted first in 2 cases:
- the removal of the market is done slowly after its timelock, for example a couple of blocks slip by and the pending cap timelock is reached
- the timelock is reduced, and a new pending cap is submitted before the end of the removal of the market timelock
So in the end I agree that we should enforce stricter rules on the pending cap
Should you also delete any pending cap proposal when the market is removed from the withdrawal queue? |
I don't think so since |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good, it fixes this comment because now the pending cap prevents removal (which means there are no problem of ordering market removal and updating caps)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Fixes https://cantina.xyz/code/8409a0ce-6c21-4cc9-8ef2-bd77ce7425af/findings/ce072b25-742b-4a94-b430-4a24c445815b