As stated in Starknet documentation:
Sending an L2 to L1 message always incurs a fixed cost of 20,000 gas, because the hash of the message being sent must be written to L1 storage in the Starknet Core Contract.
Additionally, the Cairo Book notes:
It's important to note that we have {value: msg.value}. In fact, the minimum value we've to send here is 20k wei, due to the fact that the StarknetMessaging contract will register the hash of our message in the storage of Ethereum.
In addition to those 20k wei, since the L1HandlerTransaction 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.
However, there is no check in the Bridge::depositTokens()
to ensure that the msg.value
is greater than or equal to 20_000 wei.
And StarknetMessaging::sendMessageToL2()
only ensures that msg.value
is > 0
:
Users will lose gas fees when their transactions fail due to insufficient message value, leading to loss of funds and a poor UX.
Add a check to ensure that msg.value >= 20_000 wei
in Bridge::depositTokens()
.
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.