Here's a potential security report for this issue:
_ensureTokenRegisteredWithNTV
FunctionHigh. The _ensureTokenRegisteredWithNTV
function declares a return value (bytes32 assetId
) but fails to assign or return any value. This causes the function to return bytes32(0)
by default, which is then used in critical withdrawal functionality through the withdrawToken
function.
The _ensureTokenRegisteredWithNTV
function is intended to ensure a token is registered with the Native Token Vault and return its corresponding assetId
. However, while the function declares it will return a bytes32 assetId
, it never actually assigns or returns a value. In Solidity, when a function declares a return value but doesn't explicitly return anything, it returns the default value for that type (in this case bytes32(0)
).
This zero value is then used in the withdrawToken
function as the assetId
parameter for _withdrawSender
, which could lead to:
Failed withdrawals
Potential loss of assets if the zero assetId
is interpreted as a valid asset identifier
Inconsistent state between L1 and L2
The function should properly return the asset ID after registering the token:
Manual review
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.