<!-- canonical: https://0xsimao.com/findings/singularity-staking-window-times-negative -->

# StakingOperator::_setUnlockWindow() checks if the times are negative, which is impossible

Low/Info · Three Sigma · Private DeFi access · 26th February, 2024

Finding 3S-SG-N02 of the Singularity security review.

- Protocol: https://www.thesingularity.network/
- Report: /reports/singularity
- Source: https://cdn.sanity.io/files/qoqld077/production/45b8aac56a2b8e3b557df4329ac9bf8220b64012.pdf

---

### Description

In StakingOperator::_setUnlockWindow(), unlockWindowStart and
unlockWindowDuration are uint256, so they can not be negative. However, the code
checks for negative values, which is a waste of gas.

### Recommendation

Replace both checks by equalities to 0.

### Status

Addressed in [#2e77492](https://github.com/portalgateme/darkpool-v1-zk-contracts-fork/commit/2e77492002023198bc7b0be460bc7722161f0cae).

---

Related findings:

- [A malicious user may unlock instantly all the funds from the `FluidLocker` when no one is staking in the Tax pool](https://0xsimao.com/findings/superfluid-locker-system-unlock-instantly-staking-tax): Superfluid Locker System
- [It's impossible to retrieve collected fines from the yield staking contract](https://0xsimao.com/findings/benddao-collected-fines-yield-staking): BendDAO
