Submitted by xYrYuYx
UpdateGlobalExchangeRate has incorrect implementation when totalGlobalShares is zero.
If any user didnt start stake, totalGlobalShares is 0, and every stake it will increase.
but there is possibility that totalGlobalShares can be 0 amount later by unstake or disable validator.
This is my test case to proof this issue: C4_issues.js L76
In my test case, I disabled validator to make totalGlobalShares to zero.
And in this case, some reward amount will be forever locked in the contract.
After disable validator, I mined 10 blocks, and 4 more blocks mined due to other function calls,
So total 14 CQT is forever locked in the contract.
Hardhat test
Please think again when totalGlobalShares is zero.
kitti-katy (Covalent) acknowledged:
kitti-katy (Covalent) commented:
GalloDaSballo (judge) commented:
