-
Notifications
You must be signed in to change notification settings - Fork 68
feat: support OFT's and SpokePoolPeriphery #993
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
Draft
nicholaspai
wants to merge
15
commits into
master
Choose a base branch
from
march-25-evm-audit
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* fix(ZkSync_SpokePool): Add __gap This contract gets extended by the Lens_SpokePool which doesn't add any storage but we should add it in case a future variable gets added to the Lens_SpokePool * Update ZkSync_SpokePool.json
…USDT0` via `OFT` messaging protocol (#902) * first draft of OFTTransportAdapter Signed-off-by: Ihor Farion <[email protected]> * update yarn.lock file Signed-off-by: Ihor Farion <[email protected]> * Revert "update yarn.lock file" This reverts commit 4c216ea. Signed-off-by: Ihor Farion <[email protected]> * add yarn.lock compatible with master Signed-off-by: Ihor Farion <[email protected]> * polish OFTTransportAdapter, add OFT support to Arbitrum_Adapter on L1, and Arbitrum_SpokePool on L2 Signed-off-by: Ihor Farion <[email protected]> * polish + fix missing approval Signed-off-by: Ihor Farion <[email protected]> * add context for dstEid Signed-off-by: Ihor Farion <[email protected]> * address most of the PR comments about contracts Signed-off-by: Ihor Farion <[email protected]> * update deploy scripts, add tests for OFT messaging, polish contracts Signed-off-by: Ihor Farion <[email protected]> * cleanup comments and extraneous log file Signed-off-by: Ihor Farion <[email protected]> * revert package.json prepublish change Signed-off-by: Ihor Farion <[email protected]> * generalize oft adapter to support multiple tokens. Introduce OFTAddressBook to support that. Update deploy / test scripts to reflect new functionality Signed-off-by: Ihor Farion <[email protected]> * add __gap to ArbitrumSpokePool, update stale comments on OFTTransportAdapter, update layouts of ArbitrumSpokePool and AlephZeroSpokePool Signed-off-by: Ihor Farion <[email protected]> * update some comments; adjust fee cap naming Signed-off-by: Ihor Farion <[email protected]> * address PR comments Signed-off-by: Ihor Farion <[email protected]> * address PR comments Signed-off-by: Ihor Farion <[email protected]> * fix deploy script, remove incorrect values from consts Signed-off-by: Ihor Farion <[email protected]> * improve comment Signed-off-by: Ihor Farion <[email protected]> * add oftFeeCap as a param to arbitrum adapter construction Signed-off-by: Ihor Farion <[email protected]> * move OFT functionality to SpokePool for easy further integration and removing boilerplate code Signed-off-by: Ihor Farion <[email protected]> * remove layerzero from foundry remappings Signed-off-by: Ihor Farion <[email protected]> * address licensing comment; add permalink to LZ OFT code on github Signed-off-by: Ihor Farion <[email protected]> * fix a couple of comment typos Signed-off-by: Ihor Farion <[email protected]> --------- Signed-off-by: Ihor Farion <[email protected]>
* feat(SpokePoolPeriphery): Support multiple exchanges 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. * rename * Update SpokeV3PoolPeriphery.sol * Update SpokeV3PoolPeriphery.sol * Update SpokeV3PoolPeriphery.sol * Add unit tests * Add whitelistExchanges only owner method * rename * Remove onlyOwner * Remove whitelist of exchanges, add proxy to bypass approval abuse Make user approve proxy contract so no one can use `exchange` + `routerCalldata` to steal their already approved funds via the `SpokePoolPeriphery` * Add some protection to callSpokePoolPeriphery * Only call swapAndBridge through proxy * move periphery funcs into proxy * Update SpokePoolV3Periphery.sol * remove depositERC20 * Update SpokePoolV3Periphery.sol * Add back safeTransferFron's to permit funcs * Add unit tests that check if calling deposit and swapAndBridge with no value fails directly * Add interfaces to make sure we don't add new functions as easily * Add Create2Factory * feat: add permit2 entrypoints to the periphery (#782) * feat: add permit2 entrypoints to the periphery Signed-off-by: Bennett <[email protected]> * Update test/evm/foundry/local/SpokePoolPeriphery.t.sol * Update SpokePoolPeriphery.t.sol * move permit2 to proxy * fix permit2 Signed-off-by: bennett <[email protected]> * wip: swap arguments refactor Signed-off-by: bennett <[email protected]> * implement isValidSignature Signed-off-by: bennett <[email protected]> * 1271 Signed-off-by: bennett <[email protected]> * simplify isValidSignature Signed-off-by: bennett <[email protected]> * rebase /programs on master Signed-off-by: nicholaspai <[email protected]> * clean up comments * rebase programs * fix: consolidate structs so that permit2 witnesses cover inputs Signed-off-by: bennett <[email protected]> * begin permit2 unit tests Signed-off-by: bennett <[email protected]> * rebase * Update SpokePoolPeriphery.t.sol * move type definitions to interface Signed-off-by: bennett <[email protected]> * fix permit2 test Signed-off-by: bennett <[email protected]> * transfer type tests Signed-off-by: bennett <[email protected]> * rename EIP1271Signature to Permi2Approval Signed-off-by: bennett <[email protected]> --------- Signed-off-by: Bennett <[email protected]> Signed-off-by: bennett <[email protected]> Signed-off-by: nicholaspai <[email protected]> Co-authored-by: nicholaspai <[email protected]> Co-authored-by: nicholaspai <[email protected]> * feat: sponsored swap and deposits (#790) * feat: add permit2 entrypoints to the periphery Signed-off-by: Bennett <[email protected]> * Update test/evm/foundry/local/SpokePoolPeriphery.t.sol * Update SpokePoolPeriphery.t.sol * move permit2 to proxy * fix permit2 Signed-off-by: bennett <[email protected]> * wip: swap arguments refactor Signed-off-by: bennett <[email protected]> * implement isValidSignature Signed-off-by: bennett <[email protected]> * 1271 Signed-off-by: bennett <[email protected]> * simplify isValidSignature Signed-off-by: bennett <[email protected]> * rebase /programs on master Signed-off-by: nicholaspai <[email protected]> * clean up comments * rebase programs * feat: sponsored swap and deposits Signed-off-by: bennett <[email protected]> * fix: consolidate structs so that permit2 witnesses cover inputs Signed-off-by: bennett <[email protected]> * begin permit2 unit tests Signed-off-by: bennett <[email protected]> * rebase * Update SpokePoolPeriphery.t.sol * move type definitions to interface Signed-off-by: bennett <[email protected]> * fix permit2 test Signed-off-by: bennett <[email protected]> * transfer type tests Signed-off-by: bennett <[email protected]> * rename EIP1271Signature to Permi2Approval Signed-off-by: bennett <[email protected]> * add mockERC20 which implements permit/receiveWithAuthorization Signed-off-by: bennett <[email protected]> * add tests for permit, permit2, and receiveWithAuth swaps/deposits Signed-off-by: bennett <[email protected]> * add tests for invalid witnesses Signed-off-by: bennett <[email protected]> * factor out signature checking Signed-off-by: bennett <[email protected]> --------- Signed-off-by: Bennett <[email protected]> Signed-off-by: bennett <[email protected]> Signed-off-by: nicholaspai <[email protected]> Co-authored-by: nicholaspai <[email protected]> Co-authored-by: nicholaspai <[email protected]> * feat: Delete SwapAndBridge and add submission fees to gasless flow (#809) * feat: add permit2 entrypoints to the periphery Signed-off-by: Bennett <[email protected]> * Update test/evm/foundry/local/SpokePoolPeriphery.t.sol * Update SpokePoolPeriphery.t.sol * move permit2 to proxy * fix permit2 Signed-off-by: bennett <[email protected]> * wip: swap arguments refactor Signed-off-by: bennett <[email protected]> * implement isValidSignature Signed-off-by: bennett <[email protected]> * 1271 Signed-off-by: bennett <[email protected]> * simplify isValidSignature Signed-off-by: bennett <[email protected]> * rebase /programs on master Signed-off-by: nicholaspai <[email protected]> * clean up comments * rebase programs * feat: sponsored swap and deposits Signed-off-by: bennett <[email protected]> * fix: consolidate structs so that permit2 witnesses cover inputs Signed-off-by: bennett <[email protected]> * begin permit2 unit tests Signed-off-by: bennett <[email protected]> * rebase * Update SpokePoolPeriphery.t.sol * move type definitions to interface Signed-off-by: bennett <[email protected]> * fix permit2 test Signed-off-by: bennett <[email protected]> * transfer type tests Signed-off-by: bennett <[email protected]> * rename EIP1271Signature to Permi2Approval Signed-off-by: bennett <[email protected]> * add mockERC20 which implements permit/receiveWithAuthorization Signed-off-by: bennett <[email protected]> * add tests for permit, permit2, and receiveWithAuth swaps/deposits Signed-off-by: bennett <[email protected]> * add tests for invalid witnesses Signed-off-by: bennett <[email protected]> * 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 <[email protected]> Signed-off-by: bennett <[email protected]> Signed-off-by: nicholaspai <[email protected]> Co-authored-by: Bennett <[email protected]> * Update SpokePoolV3Periphery.sol * Update SpokePoolPeriphery.t.sol * Move all comments to interface and use inherit doc * fix: eip712 types and hashes (#821) * refactor comments Signed-off-by: bennett <[email protected]> * Create IERC20Auth.sol * fix tests * Comments --------- Signed-off-by: Bennett <[email protected]> Signed-off-by: bennett <[email protected]> Signed-off-by: nicholaspai <[email protected]> Co-authored-by: bmzig <[email protected]> Co-authored-by: Bennett <[email protected]> Co-authored-by: Dong-Ha Kim <[email protected]>
* use a single address book instead of 1 per adapter for oft / xerc20 storage needs Signed-off-by: Ihor Farion <[email protected]> * update comments and naming Signed-off-by: Ihor Farion <[email protected]> * add a gas optimization suggested in OFT PR Signed-off-by: Ihor Farion <[email protected]> * address PR comments and minor improvements Signed-off-by: Ihor Farion <[email protected]> * fix spokePool test Signed-off-by: Ihor Farion <[email protected]> * address PR comments Signed-off-by: Ihor Farion <[email protected]> --------- Signed-off-by: Ihor Farion <[email protected]>
* first draft of OFTTransportAdapter Signed-off-by: Ihor Farion <[email protected]> * update yarn.lock file Signed-off-by: Ihor Farion <[email protected]> * Revert "update yarn.lock file" This reverts commit 4c216ea. Signed-off-by: Ihor Farion <[email protected]> * add yarn.lock compatible with master Signed-off-by: Ihor Farion <[email protected]> * polish OFTTransportAdapter, add OFT support to Arbitrum_Adapter on L1, and Arbitrum_SpokePool on L2 Signed-off-by: Ihor Farion <[email protected]> * polish + fix missing approval Signed-off-by: Ihor Farion <[email protected]> * add context for dstEid Signed-off-by: Ihor Farion <[email protected]> * address most of the PR comments about contracts Signed-off-by: Ihor Farion <[email protected]> * update deploy scripts, add tests for OFT messaging, polish contracts Signed-off-by: Ihor Farion <[email protected]> * cleanup comments and extraneous log file Signed-off-by: Ihor Farion <[email protected]> * revert package.json prepublish change Signed-off-by: Ihor Farion <[email protected]> * generalize oft adapter to support multiple tokens. Introduce OFTAddressBook to support that. Update deploy / test scripts to reflect new functionality Signed-off-by: Ihor Farion <[email protected]> * add __gap to ArbitrumSpokePool, update stale comments on OFTTransportAdapter, update layouts of ArbitrumSpokePool and AlephZeroSpokePool Signed-off-by: Ihor Farion <[email protected]> * update some comments; adjust fee cap naming Signed-off-by: Ihor Farion <[email protected]> * address PR comments Signed-off-by: Ihor Farion <[email protected]> * address PR comments Signed-off-by: Ihor Farion <[email protected]> * fix deploy script, remove incorrect values from consts Signed-off-by: Ihor Farion <[email protected]> * improve comment Signed-off-by: Ihor Farion <[email protected]> * init commit that adds xerc20 hyperlane adapter and embeds it into arbitrum adapter and spokepool Signed-off-by: Ihor Farion <[email protected]> * complete adapter / spoke modifications to support xerc20 trasnfers through hyperlane Signed-off-by: Ihor Farion <[email protected]> * updated chain adapters with XERC20 support: mode, base, unichain, blast, linea, optimism; updated spokepools: same chains; added spoke + adapter tests: arbitrum, optimism, linea Signed-off-by: Ihor Farion <[email protected]> * update arbitrum spokepool gap Signed-off-by: Ihor Farion <[email protected]> * polish code to fit blast spokepool into a bytecode size limit Signed-off-by: Ihor Farion <[email protected]> * added testing xerc20 functionality for chain adapters: base, blast, mode, unichain Signed-off-by: Ihor Farion <[email protected]> * add spoke pool tests for xerc20 transfers for: base, mode, unichain Signed-off-by: Ihor Farion <[email protected]> * add blast spoke pool tests in a separate commit for easy revert Signed-off-by: Ihor Farion <[email protected]> * add oftFeeCap as a param to arbitrum adapter construction Signed-off-by: Ihor Farion <[email protected]> * move OFT functionality to SpokePool for easy further integration and removing boilerplate code Signed-off-by: Ihor Farion <[email protected]> * remove layerzero from foundry remappings Signed-off-by: Ihor Farion <[email protected]> * remove MockBlast_SpokePool and related test, as they're of limited use Signed-off-by: Ihor Farion <[email protected]> * address licensing comment; add permalink to LZ OFT code on github Signed-off-by: Ihor Farion <[email protected]> * make AddressBook consistent between OFT and XERC20 Signed-off-by: Ihor Farion <[email protected]> * fix a couple of comment typos Signed-off-by: Ihor Farion <[email protected]> * checkpoint: deploy scripts and test modifications for adapter / spokepool constructor changes are still needed Signed-off-by: Ihor Farion <[email protected]> * fix a couple of comment typos Signed-off-by: Ihor Farion <[email protected]> * adjust xerc20 code to fit the new adapter store pattern Signed-off-by: Ihor Farion <[email protected]> * fix adapter tests with new pattern Signed-off-by: Ihor Farion <[email protected]> * fix all spokepool tests Signed-off-by: Ihor Farion <[email protected]> * update storage layouts Signed-off-by: Ihor Farion <[email protected]> * update adapter deployment scripts Signed-off-by: Ihor Farion <[email protected]> * update all deploy scripts; update compiler params so that Blast_Spoke fits in the bytecode limit Signed-off-by: Ihor Farion <[email protected]> * fix foundry tests Signed-off-by: Ihor Farion <[email protected]> * add QOL improvements to package.json , fix CI Signed-off-by: Ihor Farion <[email protected]> * small pre-review polish Signed-off-by: Ihor Farion <[email protected]> * deploy AdapterStore on sepolia, final polish Signed-off-by: Ihor Farion <[email protected]> * polish comments Signed-off-by: Ihor Farion <[email protected]> * make AdapterStore upgradeable; move AdapterStore.sol to a different folder; deploy upgradeable version Signed-off-by: Ihor Farion <[email protected]> * Revert "make AdapterStore upgradeable; move AdapterStore.sol to a different folder; deploy upgradeable version" This reverts commit 7ef6170. Signed-off-by: Ihor Farion <[email protected]> * make AdapterStore future-proof to additional storage requirements Signed-off-by: Ihor Farion <[email protected]> * remove unused imports Signed-off-by: Ihor Farion <[email protected]> * add new AdapterStore deployments, add verification to AdapterStore deploy script Signed-off-by: Ihor Farion <[email protected]> * polish: remove oft / xerc20 chain id libs, change to constants. Rename _setHypXERC20Router and add human error protection Signed-off-by: Ihor Farion <[email protected]> * OFT-specific polish: renaming Signed-off-by: Ihor Farion <[email protected]> * remove named fee cap constants from chain-specific spokepools due to name collision; substitute for a const literal with comment. Fix tests Signed-off-by: Ihor Farion <[email protected]> * add oftDstEid and hypXERC20DstDomain as constructor params wherever possible. Refactor AdapterStore functionality for chain Adapters Signed-off-by: Ihor Farion <[email protected]> * fix all tests Signed-off-by: Ihor Farion <[email protected]> * fix all deployment scripts Signed-off-by: Ihor Farion <[email protected]> * modify evm-contract-sizes.sh to use --optimizer-runs flag insted of modifying foundry.toml on the fly Signed-off-by: Ihor Farion <[email protected]> * adjust var naming and comments in AdapterStore Signed-off-by: Ihor Farion <[email protected]> * clean up deploy scripts; bump constants repo dep Signed-off-by: Ihor Farion <[email protected]> * remove deploy from include Signed-off-by: Ihor Farion <[email protected]> * cleanup hardcoded vars from tests Signed-off-by: Ihor Farion <[email protected]> * address new PR comments Signed-off-by: Ihor Farion <[email protected]> --------- Signed-off-by: Ihor Farion <[email protected]>
* remove Xerc20 code This reverts most of commit 62c4d96. * storage layouts
Signed-off-by: Reinis Martinsons <[email protected]>
Signed-off-by: Reinis Martinsons <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.