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

Refactor DoubleEndedQueue #4150

Merged
merged 14 commits into from
Jul 27, 2023
Prev Previous commit
Next Next commit
Update DoubleEndedQueue.sol
  • Loading branch information
Amxx authored Jul 7, 2023
commit 1294d4bc10863ed6bcc0e3153f298883a3ced912
6 changes: 3 additions & 3 deletions contracts/utils/structs/DoubleEndedQueue.sol
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ library DoubleEndedQueue {
/**
* @dev A push operation couldn't be completed due to the queue being full.
*/
error Full();
error QueueFull();

/**
* @dev An operation (e.g. {at}) couldn't be completed due to an index being out of bounds.
Expand Down Expand Up @@ -58,7 +58,7 @@ library DoubleEndedQueue {
function pushBack(Bytes32Deque storage deque, bytes32 value) internal {
unchecked {
uint128 backIndex = deque._end;
if (backIndex + 1 == deque._begin) revert Full();
if (backIndex + 1 == deque._begin) revert QueueFull();
deque._data[backIndex] = value;
deque._end = backIndex + 1;
}
Expand Down Expand Up @@ -86,7 +86,7 @@ library DoubleEndedQueue {
function pushFront(Bytes32Deque storage deque, bytes32 value) internal {
unchecked {
uint128 frontIndex = deque._begin - 1;
if (frontIndex == deque._end) revert Full();
if (frontIndex == deque._end) revert QueueFull();
deque._data[frontIndex] = value;
deque._begin = frontIndex;
}
Expand Down