Skip to content

feat: periphery deploy scripts and deployments #812

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

Open
wants to merge 42 commits into
base: march-25-evm-audit
Choose a base branch
from

Conversation

bmzig
Copy link
Contributor

@bmzig bmzig commented Dec 19, 2024

  • Create2Factory should be deployed on each chain which we anticipate holding a periphery. They only need to be deployed once and we can reuse the same factory from that point onward.
  • SpokePoolPeripheryProxy should then be deployed next. This cannot be done with Create2Factory since its init code requires knowledge of the SpokePoolV3Periphery deployment, which is yet to be deployed.
  • SpokePoolV3Periphery should be deployed last, which should be done with Create2Factory.
  • Finally, we can initialize SpokePoolPeripheryProxy. Note that if the initialization is done improperly on either of the two contracts, we need to redeploy both contracts, since we cannot update the contract address definitions once they are initialized.

nicholaspai and others added 30 commits November 27, 2024 08:48
Currently we can only initialize the periphery contract with a single exchange to swap with. This PR allows us to initialize it with multiple exchanges to swap with. Like before, these initial set of exchanges and function selectors cannot be changed post-initialization, which gives the user assurances.
Make user approve proxy contract so no one can use `exchange` + `routerCalldata` to steal their already approved funds via the `SpokePoolPeriphery`
* feat: add permit2 entrypoints to the periphery

Signed-off-by: Bennett <bennett@umaproject.org>

* Update test/evm/foundry/local/SpokePoolPeriphery.t.sol

* Update SpokePoolPeriphery.t.sol

* move permit2 to proxy

* fix permit2

Signed-off-by: bennett <bennett@umaproject.org>

* wip: swap arguments refactor

Signed-off-by: bennett <bennett@umaproject.org>

* implement isValidSignature

Signed-off-by: bennett <bennett@umaproject.org>

* 1271

Signed-off-by: bennett <bennett@umaproject.org>

* simplify isValidSignature

Signed-off-by: bennett <bennett@umaproject.org>

* rebase /programs on master

Signed-off-by: nicholaspai <npai.nyc@gmail.com>

* clean up comments

* rebase programs

* fix: consolidate structs so that permit2 witnesses cover inputs

Signed-off-by: bennett <bennett@umaproject.org>

* begin permit2 unit tests

Signed-off-by: bennett <bennett@umaproject.org>

* rebase

* Update SpokePoolPeriphery.t.sol

* move type definitions to interface

Signed-off-by: bennett <bennett@umaproject.org>

* fix permit2 test

Signed-off-by: bennett <bennett@umaproject.org>

* transfer type tests

Signed-off-by: bennett <bennett@umaproject.org>

* rename EIP1271Signature to Permi2Approval

Signed-off-by: bennett <bennett@umaproject.org>

---------

Signed-off-by: Bennett <bennett@umaproject.org>
Signed-off-by: bennett <bennett@umaproject.org>
Signed-off-by: nicholaspai <npai.nyc@gmail.com>
Co-authored-by: nicholaspai <9457025+nicholaspai@users.noreply.github.com>
Co-authored-by: nicholaspai <npai.nyc@gmail.com>
* feat: add permit2 entrypoints to the periphery

Signed-off-by: Bennett <bennett@umaproject.org>

* Update test/evm/foundry/local/SpokePoolPeriphery.t.sol

* Update SpokePoolPeriphery.t.sol

* move permit2 to proxy

* fix permit2

Signed-off-by: bennett <bennett@umaproject.org>

* wip: swap arguments refactor

Signed-off-by: bennett <bennett@umaproject.org>

* implement isValidSignature

Signed-off-by: bennett <bennett@umaproject.org>

* 1271

Signed-off-by: bennett <bennett@umaproject.org>

* simplify isValidSignature

Signed-off-by: bennett <bennett@umaproject.org>

* rebase /programs on master

Signed-off-by: nicholaspai <npai.nyc@gmail.com>

* clean up comments

* rebase programs

* feat: sponsored swap and deposits

Signed-off-by: bennett <bennett@umaproject.org>

* fix: consolidate structs so that permit2 witnesses cover inputs

Signed-off-by: bennett <bennett@umaproject.org>

* begin permit2 unit tests

Signed-off-by: bennett <bennett@umaproject.org>

* rebase

* Update SpokePoolPeriphery.t.sol

* move type definitions to interface

Signed-off-by: bennett <bennett@umaproject.org>

* fix permit2 test

Signed-off-by: bennett <bennett@umaproject.org>

* transfer type tests

Signed-off-by: bennett <bennett@umaproject.org>

* rename EIP1271Signature to Permi2Approval

Signed-off-by: bennett <bennett@umaproject.org>

* add mockERC20 which implements permit/receiveWithAuthorization

Signed-off-by: bennett <bennett@umaproject.org>

* add tests for permit, permit2, and receiveWithAuth swaps/deposits

Signed-off-by: bennett <bennett@umaproject.org>

* add tests for invalid witnesses

Signed-off-by: bennett <bennett@umaproject.org>

* factor out signature checking

Signed-off-by: bennett <bennett@umaproject.org>

---------

Signed-off-by: Bennett <bennett@umaproject.org>
Signed-off-by: bennett <bennett@umaproject.org>
Signed-off-by: nicholaspai <npai.nyc@gmail.com>
Co-authored-by: nicholaspai <9457025+nicholaspai@users.noreply.github.com>
Co-authored-by: nicholaspai <npai.nyc@gmail.com>
)

* feat: add permit2 entrypoints to the periphery

Signed-off-by: Bennett <bennett@umaproject.org>

* Update test/evm/foundry/local/SpokePoolPeriphery.t.sol

* Update SpokePoolPeriphery.t.sol

* move permit2 to proxy

* fix permit2

Signed-off-by: bennett <bennett@umaproject.org>

* wip: swap arguments refactor

Signed-off-by: bennett <bennett@umaproject.org>

* implement isValidSignature

Signed-off-by: bennett <bennett@umaproject.org>

* 1271

Signed-off-by: bennett <bennett@umaproject.org>

* simplify isValidSignature

Signed-off-by: bennett <bennett@umaproject.org>

* rebase /programs on master

Signed-off-by: nicholaspai <npai.nyc@gmail.com>

* clean up comments

* rebase programs

* feat: sponsored swap and deposits

Signed-off-by: bennett <bennett@umaproject.org>

* fix: consolidate structs so that permit2 witnesses cover inputs

Signed-off-by: bennett <bennett@umaproject.org>

* begin permit2 unit tests

Signed-off-by: bennett <bennett@umaproject.org>

* rebase

* Update SpokePoolPeriphery.t.sol

* move type definitions to interface

Signed-off-by: bennett <bennett@umaproject.org>

* fix permit2 test

Signed-off-by: bennett <bennett@umaproject.org>

* transfer type tests

Signed-off-by: bennett <bennett@umaproject.org>

* rename EIP1271Signature to Permi2Approval

Signed-off-by: bennett <bennett@umaproject.org>

* add mockERC20 which implements permit/receiveWithAuthorization

Signed-off-by: bennett <bennett@umaproject.org>

* add tests for permit, permit2, and receiveWithAuth swaps/deposits

Signed-off-by: bennett <bennett@umaproject.org>

* add tests for invalid witnesses

Signed-off-by: bennett <bennett@umaproject.org>

* feat: Delete SwapAndBridge and add submission fees to gasless flow

SwapAndBridge is to be replaced with SpokePoolV3Periphery

Gasless flows will require user to cover gas cost of whoever submits the transaction, but they can be set to 0 if the user wants to submit themselves.

* Internal refactor

* Update SpokePoolV3Periphery.sol

* Update PeripherySigningLib.sol

* Update SpokePoolV3Periphery.sol

* Update PeripherySigningLib.sol

---------

Signed-off-by: Bennett <bennett@umaproject.org>
Signed-off-by: bennett <bennett@umaproject.org>
Signed-off-by: nicholaspai <npai.nyc@gmail.com>
Co-authored-by: Bennett <bennett@umaproject.org>
Signed-off-by: bennett <bennett@umaproject.org>
Signed-off-by: bennett <bennett@umaproject.org>
Signed-off-by: bennett <bennett@umaproject.org>
Signed-off-by: bennett <bennett@umaproject.org>
Signed-off-by: bennett <bennett@umaproject.org>
Signed-off-by: bennett <bennett@umaproject.org>
Signed-off-by: bennett <bennett@umaproject.org>
@bmzig bmzig marked this pull request as ready for review December 23, 2024 02:19
dohaki and others added 5 commits December 24, 2024 19:12
Signed-off-by: bennett <bennett@umaproject.org>
Signed-off-by: bennett <bennett@umaproject.org>
Signed-off-by: bennett <bennett@umaproject.org>
Base automatically changed from spokepool-periphery-multiple-exchanges to march-25-evm-audit March 13, 2025 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do not merge do not merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants