-
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
Avoid duplicate calls to onLockupStreamWithdrawn()
hook when sender == recipient
#822
Comments
onLockupStreamWithdrawn()
hooks to avoid duplicate calls
I am facing with a few problems while writing test cases for this.
Any thoughts @andreivladbrg? |
@smol-ninja all this is not a matter of internal knowledge at Sablier. You should ask your questions in the Foundry community forums (GitHub discussions, issues, and their Telegram chat groups).
don't think this is possible but again, let's ask the Foundry team
By passing the |
Thank you for your reply @PaulRBerg.
Totally, I agree. I will ask there.
Oh yes! |
for 1. PRB already answered, i.e. regarding 2. i think it would be better to have these branches instead, as they are more concise, clearer and shorter:
@PaulRBerg are you sure about this statement? this might only be ok for the question "how to write a test to not expect a call?" but, the rest, what does Foundry have to do with how we write our tree structure for the |
Yes. It's always a good idea to talk to the community and correct errors in our understanding. That's the default approach we should take. https://twitter.com/PaulRBerg/status/1335282362968633344
I wasn't referring to that - I was referring to his questions about how to expect calls |
My wording was bad, though - I shouldn't have said "all this". Sorry for that. |
I like this more.
No problem. I understood your point. |
onLockupStreamWithdrawn()
hooks to avoid duplicate callsonLockupStreamWithdrawn()
hook when sender and recipient are same
onLockupStreamWithdrawn()
hook when sender and recipient are sameonLockupStreamWithdrawn()
hook when sender == recipient
As discussed in #804
Originally posted by smol-ninja January 26, 2024
A note to the reader: The following doesn't affect the deployed version of Sablier contracts.
Context
The recent PR: Make withdraw function callable by any account enables anyone to call
withdraw()
on any stream. Each withdrawal attempts to callonLockupStreamWithdrawn()
on both sender and recipient if they are contracts.Problem
We use the same function name
onLockupStreamWithdrawn()
in bothISablierV2Recipient
andISablierV2Sender
. This leads to duplicate calls on this function whenwithdraw()
is triggered by a third party and the sender and recipient are the same contract addresses.SablierV2Lockup.sol#L278C1-L297C10
Solution
Add a a check whether sender and recipient are same.
The text was updated successfully, but these errors were encountered: