Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -802,6 +802,7 @@ contract PredepositGuarantee is IPredepositGuarantee, CLProofVerifier, PausableU
}

function _topUpNodeOperatorBalance(address _nodeOperator) internal onlyGuarantorOf(_nodeOperator) {
if (msg.value > type(uint128).max) revert ValueTooLarge(msg.value);
uint128 amount = uint128(msg.value);

// _nodeOperator != address(0) is enforced by onlyGuarantorOf()
Expand Down Expand Up @@ -951,4 +952,5 @@ contract PredepositGuarantee is IPredepositGuarantee, CLProofVerifier, PausableU
// general
error ZeroArgument(string argument);
error ArrayLengthsNotMatch();
error ValueTooLarge(uint256 value);
}
9 changes: 8 additions & 1 deletion contracts/0.8.9/WithdrawalQueue.sol
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ abstract contract WithdrawalQueue is AccessControlEnumerable, PausableUntil, Wit
error RequestIdsNotSorted();
error ZeroRecipient();
error ArraysLengthMismatch(uint256 _firstArrayLength, uint256 _secondArrayLength);
error AmountTooLarge(uint256 _amount);

/// @param _wstETH address of WstETH contract
constructor(IWstETH _wstETH) {
Expand Down Expand Up @@ -305,7 +306,9 @@ abstract contract WithdrawalQueue is AccessControlEnumerable, PausableUntil, Wit
for (uint256 i = 0; i < _requestIds.length; ++i) {
if (_requestIds[i] < prevRequestId) revert RequestIdsNotSorted();
hintIds[i] = _findCheckpointHint(_requestIds[i], _firstIndex, _lastIndex);
_firstIndex = hintIds[i];
if (hintIds[i] != 0) {
_firstIndex = hintIds[i];
}
prevRequestId = _requestIds[i];
}
}
Expand Down Expand Up @@ -374,6 +377,8 @@ abstract contract WithdrawalQueue is AccessControlEnumerable, PausableUntil, Wit
STETH.transferFrom(msg.sender, address(this), _amountOfStETH);

uint256 amountOfShares = STETH.getSharesByPooledEth(_amountOfStETH);
if (_amountOfStETH > type(uint128).max) revert AmountTooLarge(_amountOfStETH);
if (amountOfShares > type(uint128).max) revert AmountTooLarge(amountOfShares);

requestId = _enqueue(uint128(_amountOfStETH), uint128(amountOfShares), _owner);

Expand All @@ -386,6 +391,8 @@ abstract contract WithdrawalQueue is AccessControlEnumerable, PausableUntil, Wit
_checkWithdrawalRequestAmount(amountOfStETH);

uint256 amountOfShares = STETH.getSharesByPooledEth(amountOfStETH);
if (amountOfStETH > type(uint128).max) revert AmountTooLarge(amountOfStETH);
if (amountOfShares > type(uint128).max) revert AmountTooLarge(amountOfShares);

requestId = _enqueue(uint128(amountOfStETH), uint128(amountOfShares), _owner);

Expand Down
2 changes: 1 addition & 1 deletion contracts/tooling/sepolia/SepoliaDepositAdapter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ contract SepoliaDepositAdapter is IDepositContract, Ownable, Versioned {
ORIGINAL_CONTRACT = ISepoliaDepositContract(_deposit_contract);
}

function initialize(address _owner) external {
function initialize(address _owner) external onlyOwner {
if (_owner == address(0)) revert ZeroAddress("_owner");

_initializeContractVersionTo(1);
Expand Down