-
Notifications
You must be signed in to change notification settings - Fork 1k
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
feat: hooks refactor POC #411
Conversation
The per-hook block is increasing in size over time and now is roughly 8 lines of code duplicated 8 times after #404 and #324. This commit attempts to refactor some of this copied logic into the Hooks library to improve readability of the core PoolManager code while also removing duplicated code This is a proof of concept, I'll wait until the above PRs are merged to include them in this model and can improve testing a lot with this new approach as well
oof gas quite a bit worse due to extra jumps, will think about how to improve that |
function validateHooksResponse(bytes4 selector, bytes4 expectedSelector) internal pure { | ||
if (selector != expectedSelector) { | ||
revert InvalidHookResponse(); | ||
} |
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.
to add: noop handling here
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.
this refactor will be strange with NoOp because we have to run the clear currentHook logic before returning
IPoolManager.ModifyPositionParams memory params, | ||
bytes memory hookData | ||
) internal { | ||
if (!key.hooks.shouldCall(BEFORE_MODIFY_POSITION_FLAG)) return; |
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.
to add: CA handling
One comment.. if we can find a nice way to use a helper for the callsite calls, I think it would be neater to do the |
The per-hook block is increasing in size over time and now is roughly
8 lines of code duplicated 8 times after #404 and #324. This commit
attempts to refactor some of this copied logic into the Hooks library
to improve readability of the core PoolManager code while also
removing duplicated code
This is a proof of concept, I'll wait until the above PRs are merged to
include them in this model and can improve testing a lot with this new
approach as well
Related Issue
Which issue does this pull request resolve?
Description of changes