In bootloader, function debugLog does consume gas(), so using it inside gas calculations leads to an artificially small increase above the real gas usage. This is bad because the amount users will be refunded depends on the difference blocks and they must NOT pay for debugging functionalities. You can argue that it is the same as Ethereums events, but they are executed in the transaction context regardless of where you place them, whilst these debugLogs can be moved to be executed in the bootloader context (where they should have been since the beginning). Like it is right now, users are paying for the next additional opcodes:
I am estimating with the Ethereum ones. Just keep in mind that, as the underlying logic for these opcodes are ZK circuits, the gas cost will be higher to cover the computational overhead:
3 * mstore + 8 * add + 5 * mul + 5 * callValue + 2 * sub
3 * 3 + 3 * 8 + 5 * 5 + 2 * 5 + 2 * 3
Therefore 80.
NOTE: This is NOT a gas optimization, this is a theft of gas.
l1TxPreparation, lines 1006 to 1019
Reduction of 80 * 2 = 160 gas.
l2TxValidation, lines 1185 to 1213
Reduction of 80 * 3 = 240 gas.
