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: improve UX of findCheckpointHints #750

Prev Previous commit
Next Next commit
💅: better readability for the checks
  • Loading branch information
folkyatina committed Apr 12, 2023
commit 88d477057d02e6e2fb357ad7dc10842ab1dd2cd5
3 changes: 1 addition & 2 deletions contracts/0.8.9/WithdrawalQueueBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -431,10 +431,9 @@ abstract contract WithdrawalQueueBase {
/// or 0 if hint not found in the range
function _findCheckpointHint(uint256 _requestId, uint256 _start, uint256 _end) internal view returns (uint256) {
if (_requestId == 0 || _requestId > getLastRequestId()) revert InvalidRequestId(_requestId);
if (_start == 0) revert InvalidRequestIdRange(_start, _end);

uint256 lastCheckpointIndex = getLastCheckpointIndex();
if (_end > lastCheckpointIndex) revert InvalidRequestIdRange(_start, _end);
if (_start == 0 || _end > lastCheckpointIndex) revert InvalidRequestIdRange(_start, _end);

if (lastCheckpointIndex == 0 || _requestId > getLastFinalizedRequestId() || _start > _end) return NOT_FOUND;

Expand Down