From 005a37ad574f59919f816220d728d6ea4002185a Mon Sep 17 00:00:00 2001 From: nipun_p Date: Wed, 14 Feb 2024 20:17:07 +0700 Subject: [PATCH] fix(protocol): fix encode eth deposit check (#15793) --- packages/protocol/contracts/L1/libs/LibDepositing.sol | 2 +- packages/protocol/contracts/L1/libs/LibVerifying.sol | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/protocol/contracts/L1/libs/LibDepositing.sol b/packages/protocol/contracts/L1/libs/LibDepositing.sol index e7a2bfac55f..b9b48998af0 100644 --- a/packages/protocol/contracts/L1/libs/LibDepositing.sol +++ b/packages/protocol/contracts/L1/libs/LibDepositing.sol @@ -153,7 +153,7 @@ library LibDepositing { /// @param amount The amount of the deposit. /// @return The encoded deposit. function _encodeEthDeposit(address addr, uint256 amount) private pure returns (uint256) { - if (amount >= type(uint96).max) revert L1_INVALID_ETH_DEPOSIT(); + if (amount > type(uint96).max) revert L1_INVALID_ETH_DEPOSIT(); return (uint256(uint160(addr)) << 96) | amount; } } diff --git a/packages/protocol/contracts/L1/libs/LibVerifying.sol b/packages/protocol/contracts/L1/libs/LibVerifying.sol index 740f3c606b4..99f582b55de 100644 --- a/packages/protocol/contracts/L1/libs/LibVerifying.sol +++ b/packages/protocol/contracts/L1/libs/LibVerifying.sol @@ -99,9 +99,9 @@ library LibVerifying { || config.ethDepositMaxCountPerBlock < config.ethDepositMinCountPerBlock || config.ethDepositMinAmount == 0 || config.ethDepositMaxAmount <= config.ethDepositMinAmount - || config.ethDepositMaxAmount >= type(uint96).max || config.ethDepositGas == 0 + || config.ethDepositMaxAmount > type(uint96).max || config.ethDepositGas == 0 || config.ethDepositMaxFee == 0 - || config.ethDepositMaxFee >= type(uint96).max / config.ethDepositMaxCountPerBlock + || config.ethDepositMaxFee > type(uint96).max / config.ethDepositMaxCountPerBlock ) return false; return true;