During the L2 genesis upgrade process, the _getForceDeploymentsData function from the L2GatewayUpgradeHelper.sol contract contains a semantic mismatch in how it handles the deployment of the L2 Native Token Vault.
When constructing the force deployment data for L2_NATIVE_TOKEN_VAULT_ADDR, the helper function checks if a token beacon does not exist through the legacy bridge with bool shouldDeployBeacon = deployedTokenBeacon == address(0);, and forwards both arguments to the ForceDeployment input.
The problem is that the constructor of L2NativeTokenVault expects a bool _contractsDeployedAlready at the position passed by shouldDeployBeacon, which has the opposite meaning as the value passed by the L2GenesisUpgrade contract.
In the logic of the L2NativeTokenVault, if _contractsDeployedAlready is True and _bridgedTokenBeacon is address(0) the deployment will revert with EmptyAddress(). This will be the case if shouldDeployBeacon is passed as True.
The semantic mismatch occurs in the following sequence:
In L2GatewayUpgradeHelper._getForceDeploymentsData:
shouldDeployBeacon = deployedTokenBeacon == address(0) - True if no beacon exists
This value is passed as _contractsDeployedAlready to the constructor
In L2NativeTokenVault constructor:
If _contractsDeployedAlready is True, it expects _bridgedTokenBeacon to be non-zero
However, shouldDeployBeacon being True means deployedTokenBeacon is zero
This causes the constructor to revert with EmptyAddress()
Change the L2GatewayUpgradeHelper to return additional information and run the L2GenesisUpgrade.spec.ts test. It should pass, but because of the wrong implementation, it will fail, showing the logic issue.
High severity as it prevents successful deployment of the L2NativeTokenVault during genesis upgrade when no legacy beacon exists (Step 9-10 here will revert)
This could block the entire upgrade process and system initialization
Would require redeployment with corrected parameters
Manual code review
Invert the boolean logic in L2GatewayUpgradeHelper._getForceDeploymentsData or in the L2NativeTokenVault constructor.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.