Skip to content
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

feat: remove ActionData to allow arbitrary calls and test cleanups #9

Merged
merged 6 commits into from
Dec 5, 2023

Conversation

zhongeric
Copy link
Collaborator

No description provided.

@@ -63,30 +69,23 @@ contract RelayOrderReactorIntegrationTest is GasSnapshot, Test, Interop, PermitS
reactor = RelayOrderReactor(RELAY_ORDER_REACTOR);
permitExecutor = new PermitExecutor(address(filler), reactor, address(filler));

// Swapper max approves permit post
// Swapper max approves permit post for all input tokens
vm.startPrank(swapper);
DAI.approve(address(PERMIT2), type(uint256).max);
USDC.approve(address(PERMIT2), type(uint256).max);
PERMIT2.approve(address(DAI), address(reactor), type(uint160).max, type(uint48).max);
PERMIT2.approve(address(USDC), address(reactor), type(uint160).max, type(uint48).max);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the users are approving this router on permit2, can't they then hack each other?

  • Alice does PERMIT2.approve(dai, reactor, maxAmount, maxTimestamp)
  • Bob calls reactor with an action: target=permit2, call="transfer alice's tokens to bob"
  • Permit2 has approval to let the reactor access Alice's tokens, so it accepts the call and gives alice's tokens to bob?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be good to add a test to check if this is possible

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha totally, I think we don't need to approves on Permit2 because we do signature transfer so I should remove these and see if the tests pass

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ya we don't need these approves. I think in this design, you definitely cannot be approving this reactor

@zhongeric zhongeric merged commit ade91d1 into main Dec 5, 2023
4 checks passed
snreynolds added a commit that referenced this pull request Mar 5, 2024
@zhongeric zhongeric mentioned this pull request Mar 5, 2024
snreynolds added a commit that referenced this pull request Mar 11, 2024
* use local signed order, rename orderinfo, fixes #2

* add version in .toml, fixes 4

* comments, fixes #6

* remove error & import, fixes #7

* use address, fixes #8

* use ++i, fixes #9

* remove UniswapX dependency

* fix eip712 hash ordering

* final audit comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants