-
Notifications
You must be signed in to change notification settings - Fork 50
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: hook allowlist #951
feat: hook allowlist #951
Conversation
refactor: delete renounce hook test: improve test function names test: update renounce and withdraw hook tests
refactor: rename "SablierV2Recipient" to "SablierRecipient"
feat: isAllowedToHook feat: allowToHook test: rename recipient hooks mocks
refactor: remove try/ catch in hooks refactor: rename "_allowed" to "_allowedToHook" test: update cancel and withdraw tests
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.
My preliminary review.
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.
Great work PRB, and thank you for moving so fast.
I have reviewed only src
so far, I've not looked at tests.
I have some questions regarding the decisions made on the implementation (maybe they will be answered in the upcoming discussion you'll open):
- Since the contracts which the hook is called on must be allowed by Sablier, why not generalize it and allow both sender/recipient calls. Thus, instead of
ISablierRecipient
to have aISablierLockupHookImplementer
interface?- If we keep the current name, why not rename it to
ISablierLockupRecipient
? we might have a different recipient interface for future contracts
- If we keep the current name, why not rename it to
- Merge
Adminable
and allow hook logic into a single contract, so thatAdminable
contract can be used accros all Sablier future contracts.- If we do this, it would be better to have in
allowToHook
function an address param instead of an interface
- If we do this, it would be better to have in
- Why not return a bool in hook functions and check it?
Thanks for the kind words, @andreivladbrg. I will respond to your questions in the separate discussion thread. |
@andreivladbrg about your question: Why not return a bool in hook functions and check it? This answer from stack overflow put it really well |
fair enough, thanks for sharing |
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.
@andreivladbrg @PaulRBerg I left some comments. LMK if all looks good (you can reach with emoji). If yes I will make those changes.
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.
Reviewed tests. Left feedback below. Addressed them in 02fcc7e.
test/integration/concrete/nft-descriptor/generateAccentColor.t.sol
Outdated
Show resolved
Hide resolved
test/integration/concrete/lockup/allow-to-hook/allowToHook.t.sol
Outdated
Show resolved
Hide resolved
Can we all please give it a final review and approve the PR so that it can be merged? cc @PaulRBerg @andreivladbrg |
The PR looks good to me now. Thanks both for your contributions. Let's squash and merge! |
* refactor: delete sender withdraw hooks refactor: delete renounce hook test: improve test function names test: update renounce and withdraw hook tests * refactor: rename hooks * refactor: get rid of "hooks" directory * feat: add marker "IS_SABLIER_RECIPIENT" refactor: rename "SablierV2Recipient" to "SablierRecipient" * feat: hook allowlist feat: isAllowedToHook feat: allowToHook test: rename recipient hooks mocks * feat: check allowlist when running hooks refactor: remove try/ catch in hooks refactor: rename "_allowed" to "_allowedToHook" test: update cancel and withdraw tests * build: update precompiles * fix: remove stale dir in prepare-artifacts script * docs: update withdraw natspec * chore: address PR feedback * feat: include function selector in the return value of hook calls * fix: redundant dev notes, use interface selector * test: fix bugs * feat: replace IS_SABLIER_RECIPIENT with IERC165-supportsInterface * refactor: remove local import from Errors * docs: polish natspec * refactor: rename recipient interface * refactor: change param type to "address" * build: update precompiles * refactor: remove unneeded address casting * docs: polish natspec * chore: update count map in Base script * chore: update benchmarks * docs: mention allowlist contract in Security doc * docs: update wording --------- Co-authored-by: andreivladbrg <[email protected]> Co-authored-by: smol-ninja <[email protected]>
* refactor: delete sender withdraw hooks refactor: delete renounce hook test: improve test function names test: update renounce and withdraw hook tests * refactor: rename hooks * refactor: get rid of "hooks" directory * feat: add marker "IS_SABLIER_RECIPIENT" refactor: rename "SablierV2Recipient" to "SablierRecipient" * feat: hook allowlist feat: isAllowedToHook feat: allowToHook test: rename recipient hooks mocks * feat: check allowlist when running hooks refactor: remove try/ catch in hooks refactor: rename "_allowed" to "_allowedToHook" test: update cancel and withdraw tests * build: update precompiles * fix: remove stale dir in prepare-artifacts script * docs: update withdraw natspec * chore: address PR feedback * feat: include function selector in the return value of hook calls * fix: redundant dev notes, use interface selector * test: fix bugs * feat: replace IS_SABLIER_RECIPIENT with IERC165-supportsInterface * refactor: remove local import from Errors * docs: polish natspec * refactor: rename recipient interface * refactor: change param type to "address" * build: update precompiles * refactor: remove unneeded address casting * docs: polish natspec * chore: update count map in Base script * chore: update benchmarks * docs: mention allowlist contract in Security doc * docs: update wording --------- Co-authored-by: andreivladbrg <[email protected]> Co-authored-by: smol-ninja <[email protected]>
Addresses M-03: The caller of withdraw and renounce can skip callbacks, by sending less gas.
See related discussion: #952