The depositTokens()
function in Bridge.sol does not check whether the users’ provided ether (msg.value
) is enough
to cover transaction costs at L1 and L2, causing user tokens to be freezed at the escrow.
From cairo book ( https://book.cairo-lang.org/ch16-04-L1-L2-messaging.html ):
"It's important to note that we have
{value: msg.value}
. In fact, the minimum value we've to send here is20k wei
, due to the fact that theStarknetMessaging
contract will register the hash of our message in the storage of Ethereum.In addition to those
20k wei
, since theL1HandlerTransaction
executed by the sequencer is not tied to any account (the message originates from L1), you must also ensure that you pay enough fees on L1 for your message to be deserialized and processed on L2.The fees of the
L1HandlerTransaction
are computed in a regular manner as it would be done for anInvoke
transaction. For this, you can profile the gas consumption usingstarkli
orsnforge
to estimate the cost of your message execution."
However, the msg.value
is not checked in depositTokens()
function in Bridge.sol before calling sendMessageToL2
. This can cause the transaction to fail at L1 or L2 sides. Additionally, If there is not enough ether provided by the user for covering the fees for message to be deserialized and processed on L2, the transaction can be failed at L2 side with tokens escrowed at L1 side. Indeed, once the message is received by destination, the message is considered delivered and user's tokens will be remained at L1 escrow, even though it threw an out-of-gas error in L2.
Bridging functionality cannot proceed if there is not enough ether provided in msg.value
. Also, user tokens can be freezed at escrow when there is not enough ether to cover transaction costs at L2.
It is worth mentionioning that this kind of issue was already considered as a high severity in another contest:
Manual Review
depositTokens()
function needs to check that enough ether is provided in msg.value
to cover all the costs at L1 and L2. Based on the documentations provided in https://book.cairo-lang.org/ch16-04-L1-L2-messaging.html , the minimum required msg.value
must always be 20k wei.
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.