-
Notifications
You must be signed in to change notification settings - Fork 77
feat: Update ZkSync_SpokePool to support new L2 ZkStack L2AssetRouter #1190
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
base: master
Are you sure you want to change the base?
Conversation
This contract is designed to be used with ZkStack chains that migrate to the new [ZkGateway](https://forum.zknation.io/t/zip-6-prepare-zksync-for-zk-gateway/490#p-1247-changes-to-bridging-architecture-9) system. For example, this will be required for ZkSync (chain ID 324). The reason that I'm creating a new contract rather than updating the existing ZkSync_SpokePool is that I don't know yet whether currently supported (or future ones we plan to support) will use this new architecture or the current one, which might need to keep using ZkSync_SpokePool
|
Test deployments with special |
fusmanii
left a comment
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.
looks good, just one q
| // are added, so that the total number of slots taken by this contract remains constant. Per-contract | ||
| // storage layout information can be found in storage-layouts/ | ||
| // This is at bottom of contract to make sure it's always at the end of storage. | ||
| uint256[999] private __gap; |
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.
does this need to be updated given that new vars are added?
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 because the new vars are constants or immutable so they don't add any storage slots
We need this code to finalize any withdrawals from ZkStack chains sent through the new `L2AssetRouter` contracts. See across-protocol/contracts#1190 for more details on L2 contract changes that will initiate these new withdrawals This PR is backwards compatible and can be merged today [test finalization can be seen here.](https://etherscan.io/tx/0x88f21e9730a6586155de9f8e46a8f82a78fde09193e3de3d48a783cf94c2dc41#eventlog)
| /// Contract used to withdraw ERC20's to L1. | ||
| /// Source: https://github.com/matter-labs/era-contracts/blob/48e189814aabb43964ed29817a7f05aa36f09fd6/l1-contracts/contracts/common/l2-helpers/L2ContractAddresses.sol#L68 | ||
| address public constant L2_ASSET_ROUTER_ADDR = address(USER_CONTRACTS_OFFSET + 0x03); | ||
| IL2AssetRouter public constant l2AssetRouter = IL2AssetRouter(L2_ASSET_ROUTER_ADDR); |
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.
zkErc20Bridge was mutable. Is l2AssetRouter expected to stay constant forever?
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.
That's kind of what the matter-labs code suggests: https://github.com/matter-labs/era-contracts/blob/48e189814aabb43964ed29817a7f05aa36f09fd6/l1-contracts/contracts/common/l2-helpers/L2ContractAddresses.sol#L68
| /** | ||
| * @notice Constructor. | ||
| * @notice Circle bridged & native USDC are optionally supported via configuration, but are mutually exclusive. | ||
| * @param _zkUSDCBridge Legacy bridge used to withdraw USDC to L1, for withdrawing all other ERC20's we use `l2AssetRouter`. |
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.
Will _zkUSDCBridge have to go in the near future as well? In particular, you're referring to it as "legacy": is there a reason?
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.
Its legacy because I believe from the zksync team that this will be a special case for a token where we continue to use the deprecated L2ERC20Gateway contract.
This contract is designed to be used with ZkStack chains that migrate to the new ZkGateway system. For example, this will be required for ZkSync (chain ID 324) and Lens.
I don't know yet whether currently supported ZkStack chains like Lens will use this new architecture or the current one. Therefore, to deploy hot fixes to Lens we would need to checkout an older commit and deploy that version of the ZkSync_SpokePool.The alternative is introducing a new contract, but I'd like to consolidate changes.Lens will be upgraded with ZkSync, according to the ZkSync team.