Skip to content

Conversation

@nicholaspai
Copy link
Member

@nicholaspai nicholaspai commented Nov 25, 2025

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.

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
@nicholaspai nicholaspai changed the title feat: Create ZkGateway_SpokePool feat: Update ZkSync_SpokePool to support new L2 ZkStack L2AssetRouter Nov 25, 2025
@nicholaspai
Copy link
Member Author

nicholaspai commented Dec 1, 2025

@nicholaspai nicholaspai marked this pull request as ready for review December 1, 2025 21:10
fusmanii
fusmanii previously approved these changes Dec 1, 2025
Copy link
Contributor

@fusmanii fusmanii left a 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;
Copy link
Contributor

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?

Copy link
Member Author

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

nicholaspai added a commit to across-protocol/relayer that referenced this pull request Dec 4, 2025
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);
Copy link
Contributor

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?

Copy link
Member Author

Choose a reason for hiding this comment

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

/**
* @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`.
Copy link
Contributor

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?

Copy link
Member Author

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.

@nicholaspai nicholaspai added the need to audit This PR needs to be audited externally before deploying label Dec 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

need to audit This PR needs to be audited externally before deploying

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants