From b299cc3d9808e055a62f7fe8136ff54feb34d62d Mon Sep 17 00:00:00 2001 From: Reddawn <35641620+forumevi@users.noreply.github.com> Date: Fri, 28 Aug 2026 22:32:27 +0300 Subject: [PATCH] perf: optimize loop increment gas cost in GasPriceOracle --- src/L2/GasPriceOracle.sol | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/L2/GasPriceOracle.sol b/src/L2/GasPriceOracle.sol index 5fae60bba..d672a2ef3 100644 --- a/src/L2/GasPriceOracle.sol +++ b/src/L2/GasPriceOracle.sol @@ -264,12 +264,13 @@ contract GasPriceOracle is ISemver { function _getCalldataGas(bytes memory _data) internal pure returns (uint256) { uint256 total = 0; uint256 length = _data.length; - for (uint256 i = 0; i < length; i++) { + for (uint256 i = 0; i < length;) { if (_data[i] == 0) { total += 4; } else { total += 16; } + unchecked { ++i; } } return total + (68 * 16); }