Replies: 6 comments 5 replies
-
Hey everyone, I'm deth from EgisSec, the auditing team that reported this issue in the Codehawks contest. About the changes/fix:Removing the try/catch will allow the Another potential issue with removing the try/catch is that the callback might revert due to incorrect implementation in the As you've mentioned here:
To be extra safe you could use a multisig/DAO/gnosis safe. I understand this complicates things further, but it is an option if you are concerned about this specific point. All in all, I think the changes are good. It puts the control of the callbacks in your hands and in the About some of the comments from the PR and in this discussion:
This is more of a design choice. I personally think since you are allowlisting the
I understand where you are coming from, but having that extra functionality isn't a bad idea for the future where you will have more users with different needs/ideas. |
Beta Was this translation helpful? Give feedback.
-
Answering @andreivladbrg's questions from here:
|
Beta Was this translation helpful? Give feedback.
-
This is a fantastic proposal, and I support it as a solution for Hooks' callback issue. Besides the risks you've mentioned, there's an additional risk of execution failure. If the hook call reverts, the entire execution will revert. To mitigate this, when deciding on adding a contract to the allowlist, it MUST be ensured that recipient contracts are designed to avoid revert on hook calls. |
Beta Was this translation helpful? Give feedback.
-
This is an amazing and quick proposal @PaulRBerg, we at Fjord have gone through this and it looks good to us. Thank you for a prompt resolution on this issue. |
Beta Was this translation helpful? Give feedback.
-
The proposed changes represent a significant improvement to the security and functionality of the Sablier protocol. The focus on immutability and decentralization is appreciated, and the adjustments align well with the needs of our Fjord staking contract. Thank you for your efforts. |
Beta Was this translation helpful? Give feedback.
-
Closing as everybody is aligned on the benefits of this feature, which got implemented in Lockup v1.2.0 Thanks all for your contributions! |
Beta Was this translation helpful? Give feedback.
-
Context
We've recently run a public audit context on CodeHawks, and it was very much a fruitful exercise. An important finding is M-03: The caller of withdraw and renounce can skip callbacks, by sending less gas.
@sablier-labs/solidity brainstormed how to address the issue internally for a few days.
Now, after some deliberation, I have come up with this new design for the hooks, which will address both the Gas Bomb and the Skipping Hooks problem.
Proposal
IERC165-supportsInterface
method which must be implemented.Rationale
Generally, the point is to meet users where they are. So far, only the recipient hooks have garnered interest, e.g. Fjord Foundry who is building a staking contract for Sablier NFTs. We should optimize our protocol in light of this.
The design in this proposal enables the implementation of contracts that hold stream NFTs on behalf of users, such as vaults or staking contracts.
The allowlisting is irreversible in order to provide stronger immutability and decentralization guarantees. Once a recipient contract is allowlisted, integrators should NOT have to trust us to keep their contract on the allowlist. Imagine how bad it would be if our keys are hacked - the attacker could effectively freeze all assets in the staking protocol.
Furthermore, the
supportsInterface
method is there to preclude the contract admin from accidentally allowlisting contracts that do not implement Sablier hooks.API Changes
SablierV2Lockup
Functions
isAllowedToHook
allowToHook
_cancel
andwithdraw
to query the allowlist before running themtry/catch
block to revert the entire tx when the hook reverts_cancel
,renounce
, andwithdraw
Note
As suggested by @smol-ninja here, we might have to ask the hook to return the function selector in order to guarantee that the Sablier function has sufficient gas to finish the execution of the tx. I'm currently investigating this.
Events
AllowToHook
New Behavior
ISablierLockupRecipient
Note: I removed "V2" from this interface due to the upcoming package tethering.
IERC165
interfaceRisks
It is impossible to prevent the following risks without compromising on decentralization. To mitigate them, we will be prudent about what contracts get allowlisted, and maintain an updated list of allowlisted entities in our docs.
ISablierLockupRecipient
anymore. Or they could intentionally DoS all senders.RFC
This proposal enables a safe and improved hook architecture in the Lockup protocol, all the while not compromising on immutability and decentralization.
Kindly asking @sablier-labs/everybody and the Fjord Foundry team for comments on this.
See the accompanying PR for implementation details: #951
Beta Was this translation helpful? Give feedback.
All reactions