Closed c4-bot-6 closed 4 months ago
saxenism (sponsor) disputed
We consider this invalid
because this is irrelevant. We use a different gas model.
The Warden specifies that users on zkSync Era will pay different gas costs than on Ethereum; this is expected, extensively documented, and in reality it is impossible to pay the same gas cost as in Ethereum due to the zero-knowledge nuisances involved with zkSync Era transactions.
alex-ppg marked the issue as unsatisfactory: Invalid
Lines of code
https://github.com/code-423n4/2024-03-zksync/blob/4f0ba34f34a864c354c7e8c47643ed8f4a250e13/code/system-contracts/bootloader/bootloader.yul#L101-L107
Vulnerability details
Impact
The Ethereum Yellow Paper defines two types of
G_txdata
:As we see, non-zero byte of data costs more (16) than a zero byte (4).
However,
L1_GAS_PER_PUBDATA_BYTE()
implemented in thebootloader.yul
does not distinguish between zero byte of data or code for a transaction and non-zero byte of data or code for a transaction. Every operation costs 17. This behavior implies user loss - because the user will always pay the constant amount of gas, even for non-zero byte of data or code for a transaction (which should costs less than a non-zero byte).Proof of Concept
File: bootloader.yul
As demonstrated above, the number of L1 gas needed to be spend for L1 byte is always constant and it's hardcoded to 17. User will pay 17 gas no matter if it's the zero or non-zero byte of data or code for a transaction.
According to Ethereum Yellow Paper, zero bytes costs less (4) than non-zero ones (16). This requirement is, however, not fulfilled in the
bootloader.yul
, because both zero and non-zero L1 byte costs 17.Tools Used
Manual code review
Recommended Mitigation Steps
Separate costs for zero and non-zero byte of data or code for a transaction. The zero byte of data or code for a transaction should cost less.
Assessed type
Other