-
Notifications
You must be signed in to change notification settings - Fork 504
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
OZ-L06: try-catch permit2Forwarder to avoid exposing DOS on multicall #309
Conversation
src/base/Permit2Forwarder.sol
Outdated
@@ -27,6 +27,6 @@ contract Permit2Forwarder { | |||
external | |||
payable | |||
{ | |||
permit2.permit(owner, _permitBatch, signature); | |||
try permit2.permit(owner, _permitBatch, signature) {} catch {} |
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.
maybe a quick comment that explains why its in a try catch?
calls[2] = abi.encodeWithSelector(IPositionManager.modifyLiquidities.selector, mintCall, _deadline); | ||
|
||
uint256 tokenId = lpm.nextTokenId(); | ||
lpm.multicall(calls); |
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.
ideally this test would check
bytes[] memory results = lpm.multicall(calls);
assert(results[0] is correct revert reason)
assert(results[1] is correct revert reason)
i guess that revert reason is that the nonce is taken
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.
can you take a look now? im trying to do the Wrap__ error handling
cc @snreynolds
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.
hmm to me I feel like we should allow the caller to specify whether or not they want to continue the multicall if there is an error
also if permit errors (even for a different reason) the rest of the code will still execute in this case
the idea being we expose another generic |
Related Issue
OZ-L06: allow permit2Forwarder's
permit
/permitBatch
to fail via try-catch.Prevents DOS'ing multicalls containing
permit
/permitBatch
where an external party front runs the permit2Forwarder callDescription of changes
try-catch'd permit2Forwarder's
permit
/permitBatch