-
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
Certora I01 - Add recipient argument to settle... #786
Conversation
ddd34b1
to
618cf35
Compare
test/Sync.t.sol
Outdated
actions[4] = Actions.ASSERT_DELTA_EQUALS; | ||
params[4] = abi.encode(currency2, address(router), 0); | ||
|
||
actions[5] = Actions.PRANK_TAKE_FROM; |
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.
I'm a little confused what this is testing..
We are encoding here (currency2, recipient, address(this), amount)
but then inside _prankTakeFrom
we are decoding (currency, from, recipient, amount)
Can you add another assert after this call for what you expect to happen?
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.
with settleFor we are settling on behalf of a third party. In order to be able to close out the delta, I'm pranking from the address that is the recipient in the settleFor call in order to successfully close out the deltas. Thus, the functionality is also implicitly tested, because the deltas are closed
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.
yeah +1 to what sara said. The command decodes
(Currency currency, address from, address recipient, uint256 amount) =
abi.decode(params, (Currency, address, address, uint256));
But this call has the recipient second not third. Please can you check it and add checks 🙏
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.
no this is correct, the recipient is the settleFor recipient, the account that receives the positive delta during the settleFor call. So that's the account we need to prank (from). The recipient in take is the recipient of the funds
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.
I think I see whats happening and IMO its just confusing because the params are the same names for different contexts. I think what you are testing is.. apply a positive delta for recipient, then prank that recipient and send it to somewhere else.
I think what I would prefer to see tested is pranking another address such that there is a negative delta open on that address then someone else transfers their own funds, and calls settleFor on behalf of the original person with the open negative deltas ( to pay off on their behalf)
in order to pay on behalf of another address