Skip to content

Commit

Permalink
fix(protocol): fix encode eth deposit check (#15793)
Browse files Browse the repository at this point in the history
  • Loading branch information
n1punp committed Feb 14, 2024
1 parent cd35d69 commit 005a37a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/protocol/contracts/L1/libs/LibDepositing.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
4 changes: 2 additions & 2 deletions packages/protocol/contracts/L1/libs/LibVerifying.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 005a37a

Please sign in to comment.