Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(protocol): fix encode eth deposit check #15793

Merged
merged 2 commits into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading