The depositTokens
function in Bridge.sol, which takes care for L1 to L2 token deposits, lacks a proper fee mechanism to handle the message sending between Layer 1 (Ethereum) and Layer 2 (Starknet). According to Starknet's documentation, the sendMessageToL2 function should ensure accurate fee estimation and collection for L1 → L2 messages.
However, the current implementation does not follow the recommended fee-handling mechanism.
The depositTokens
function in Bridge.sol
sends a message to L2 using the sendMessageToL2
function, which collects a fee for processing the L1 → L2 transaction. However, the implementation does not adequately handle the fee mechanism as recommended by Starknet:
The function does not dynamically calculate or estimate the required fee for L1 → L2 transactions, which is critical in ensuring the message is processed by the sequencer. Instead, it only checks whether the fee (msg.value
) is greater than zero and does not exceed the maximum allowed (getMaxL1MsgFee()
).
Without dynamically calculating the fee, there is no guarantee that the user pays enough to incentivize the sequencer to include the transaction. This could result in the L1 → L2 message being rejected due to underpayment, leaving the transaction unprocessed.
Conversely, if the user overestimates the required fee, there is no refund mechanism in place, leading to excess ETH being locked.
The absence of a proper fee mechanism can lead to underpayment or overpayment respectively to message being rejected or locked funds.
Manual review
Consider implementing a fee mechanism for L1->L2 messages.
Impact: Medium/High. Need an admin to start a cancellation and wait for 5 days once done. DoS > 5 days. Likelyhood: Low. Everytime a wallet/or a user do not send enough gas
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.