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

fix: M-07 Attempts to Bridge WETH Using ZkStack_CustomGasToken_Adapter Will Fail #743

Merged
merged 3 commits into from
Nov 14, 2024

Conversation

bmzig
Copy link
Contributor

@bmzig bmzig commented Nov 11, 2024

In order to bridge tokens from Ethereum to a ZkStack blockchain using a custom gas token, the relayTokens function of the ZkStack_CustomGasToken_Adapter contract can be used. In case the token to bridge is WETH, the token is first converted to ETH, and then that ETH is bridged using the requestL2TransactionTwoBridges function of the BridgeHub contract. The requestL2TransactionTwoBridges function then calls the bridgeHubDeposit function of the second bridge with the ETH amount specified by the caller.

However, the bridgeHubDeposit function requires that the deposit amount specified equals 0 in case when ETH is bridged, yet it is specified as a nonzero amount inside the relayTokens function of the adapter. This will cause any attempt to bridge WETH to L2 to revert.

In cases where WETH is being bridged, consider setting the amount to be used in the second bridge's calldata to 0.

This PR applies the suggestion and forces the _depositAmount field in the second bridge calldata to zero.

@bmzig bmzig marked this pull request as ready for review November 14, 2024 02:08
@bmzig bmzig merged commit 027dd3e into master Nov 14, 2024
9 checks passed
@bmzig bmzig deleted the 1124oz/m07 branch November 14, 2024 20:17
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