Refactor DoubleEndedQueue by Amxx · Pull Request #4150 · OpenZeppelin/openzeppelin-contracts (original) (raw)
The use of signed integer is confusing, the cast decrease readability, and that is not actually needed.
Using uint128 is cleaner IMO.
We can discuss narrowing down the scope of the unchecked
block. Also, we could remove possibly the Full()
check.
This not upgrade-compatible, so I'm targeting 5.0. Otherwise, the interface is backward compatible.
Note that there is currently an comment saying// We also assume there are at most int256.max items in the queue.
But since the queue is stored in a mapping(int128 → uint256)
the size limit is 2**128, which is WAY smaller than int256.max
Fixes LIB-953
PR Checklist
- Tests
- Documentation
- Changeset entry (run
npx changeset add
)