-
Notifications
You must be signed in to change notification settings - Fork 48
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
Use try...catch
in cancelMultiple
and withdrawMultiple
to handle invalid stream IDs
#917
Comments
LGTM except for the error name. I would create two errors, one for withdrawals, and another for cancellations. I'd also say something like |
@smol-ninja could you please create a milestone for the next Lockup release, and include this issue in that milestone? And let's name it according to the package tethering approach. |
Will do. |
Did you mean board or milestone @PaulRBerg? We used board to track v2.2, which I have created one here: https://github.com/orgs/sablier-labs/projects/19/views/2. I am calling it Note the description: Tracking bugs, new ideas and feature requests for Sablier Lockup 1.2.1 which will succeed 1.2.0 (also known as V2.2) |
Sorry, I meant a board. The name sounds good. |
This feature would mitigate L-07. WithdrawMultiple can be DOS'ed by a random user from the CodeHawk report, wouldn't it? |
Yes. |
Unfortunately, there is a problem with this approach. Calls made through function withdrawMultiple(....) external {
for (uint256 i = 0; i < streamIdsCount; ++i) {
try this.withdraw(....) { }
catch (bytes memory errorData) {
emit InvalidStreamIdInWithdrawMultiple(streamIds[i], errorData);
}
}
} is not same as function withdrawMultiple(....) external {
for (uint256 i = 0; i < streamIdsCount; ++i) {
withdraw(....) { }
}
} The latter does not change the value of
The hook call is skipped when Having said that, I have tested Thoughts? Should I do it? Its a very small change. |
ohh, correct, it seems like a big problem to me
can't this approach (run hook on recipient when the caller is the recipient) cause reentrancy issues?🤔
given the time constraints and the edges that this PR can have, i am of the opinion to not include it in |
Thanks for looking into this, Shub! We don't allow hook calls when the recipient makes the withdrawal because they are redundant. The recipient knows that they made the withdrawal, so there's no point in notifying them about that. Performing the hook calls in Also, what Andrei said — withdrawing to a third-party address would no longer be possible. So I don't think we should include this in V2.0.0 |
Reentrancy is an issue only if CEI is not respected. |
Thank you to both of you for your comments.
Nevertheless, I spent some time to work on this: #1101. Feel free to discard the PR if both of you wants to exclude it from the next release. I would still suggest you to have a look at the PR before making the decision. I don't think there will be any problem with The use of |
Thanks Shub, good work so far. I pushed a commit to improve the writing in #1101. However, I'm against the PR as it currently stands because it introduces a new, important assumption — that the Sablier Lockup protocol itself can act as the How about delegate-calling and checking the boolean result instead of using |
agree with this
would this be different from the |
Its correct that they will be called back in this case. If thats an important assumption, I agree with discarding the PR as well. On delegate call, that can work. @andreivladbrg it would be different because in |
I have pushed a new commit using |
As discussed here, batch functions such as
cancelMultiple
andwithdrawMultiple
should be allowed to continue execution if one of the stream IDs revert.A sample implementation would look like the following:
The text was updated successfully, but these errors were encountered: