Merged
Conversation
Co-authored-by: EndymionJkb <EndymionJkb@gmail.com>
EndymionJkb
approved these changes
Mar 2, 2026
Collaborator
EndymionJkb
left a comment
There was a problem hiding this comment.
Looks good; just some minor comments. Also have a follow-on
| } | ||
|
|
||
| // This hook makes sure that the virtual balances are decreased in the same proportion as the real balances | ||
| // after removing liquidity. This is needed to keep the pool centeredness and price ratio constant. |
Collaborator
There was a problem hiding this comment.
Not in diff, but we'd discussed adding modifiers to start/stop ratio updates, and decided against it, mainly because of the low impact and potential griefing vector. Requiring the lock would make governance operations fragile in a way that has no offsetting security benefit.
We should document that decision, though. Could add this comment to both functions:
/**
* @inheritdoc IReClammPool
*
* @dev Note: this function does not require `onlyWhenVaultIsLocked`, unlike other functions that update virtual
* balances. The price ratio update is gradual, with a minimum duration, and bounded in rate, so any imprecision
* in the virtual balance snapshot taken here is temporary and corrected on the next swap. Requiring the vault
* to be locked would introduce a griefing vector: a watcher could front-run a governance call by unlocking the
* vault, causing the transaction to revert.
*/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Add protections for non-view hooks (
onBefore...) so that they cannot be called by attackers using fake pools pointing to legit pools as hooks.Type of change
Checklist:
main, or there's a description of how to mergeIssue Resolution
N/A