Submitted by hyh
Reward tokens that do not allow for zero amount transfers can prevent user pool exit.
Now it is required that all reward amounts be successfully transferred to a receipt owner and the reward token amount isnt checked in the process.
If withdraw was called at the moment when some reward amount is zero (because either zero time passed or zero slope is set), the withdraw() will revert.
Say once such reward token is there (say with no malicious intent, as its just a specifics of some valid tokens), user cannot withdraw immediately after deposit as no rewards accrued yet and this token transfer will revert the whole call even if it is one of the many.
As withdraw() the only way for a user to exit pool, her funds will be frozen within.
If slope is set to zero for such a token, either maliciously or mistakenly, the withdrawals are impossible for all the users.
As this is user fund freeze case with external assumptions, setting the severity to medium.
Some ERC20 tokens do not allow for zero amount transfers:
https://github.com/d-xo/weird-erc20#revert-on-zero-value-transfers
withdraw() iterates across the set of reward tokens, and requires all transfers to go through:
https://github.com/code-423n4/2022-05-factorydao/blob/db415804c06143d8af6880bc4cda7222e5463c0e/contracts/PermissionlessBasicPoolFactory.sol#L230-L230
Once some is not ok, the whole call reverts. As its the only way for a user to exit the pool, her funds are frozen until non-zero reward is obtained.
It might never happen as rewardsWeiPerSecondPerToken is allowed to be zero:
https://github.com/code-423n4/2022-05-factorydao/blob/db415804c06143d8af6880bc4cda7222e5463c0e/contracts/PermissionlessBasicPoolFactory.sol#L92-L112
This way, when one of the reward tokens doesnt allow for zero transfers:
Consider controlling for zero amounts in reward transfer cycle:
https://github.com/code-423n4/2022-05-factorydao/blob/db415804c06143d8af6880bc4cda7222e5463c0e/contracts/PermissionlessBasicPoolFactory.sol#L224-L231
illuzen (FactoryDAO) marked as duplicate and commented:
Justin Goro (judge) commented:
