The issue was that the rounding losses from partitioning msg.value in stake() and rebalanceToWeights() was left irretrievably in the contract.
Mitigation review
Previously rebalanceToWeights() withdrew all staked funds and redeposited only the ether that the contract received. Now, it redeposits its entire balance. As such, the rounding losses still remain in the contract after a call to rebalanceToWeights(), but the next time it is called this dust will be redeposited. Thus, at least rebalanceToWeights() doesn't gather dust (even though it's "not going to be used often, if at all").
The issue in stake() remains unmitigated per se. The dust generated there would of course also be picked up by rebalanceToWeights(), but since rebalanceToWeights() is "not going to be used often, if at all", and causes a significant loss for the protocol (M-07), this issue cannot be considered mitigated.
Suggestion
Sweep the dust in stake() instead by adding the balance to msg.value. Or use the entire balance in unstake(). These functions will be called frequently and it doesn't hurt to reward users with some dust.
Note that this would entail that this check in unstake() would have to be removed:
require(address(this).balance - ethBefore != 0, "Receive zero Ether");
See also the new issue titled "Reappearance of M-02 in SafEth.unstake()" for another reason this check should be removed.
Mitigated issue
M-11: Residual ETH unreachable and unuitilized in SafEth.sol
The issue was that the rounding losses from partitioning
msg.value
instake()
andrebalanceToWeights()
was left irretrievably in the contract.Mitigation review
Previously
rebalanceToWeights()
withdrew all staked funds and redeposited only the ether that the contract received. Now, it redeposits its entire balance. As such, the rounding losses still remain in the contract after a call torebalanceToWeights()
, but the next time it is called this dust will be redeposited. Thus, at leastrebalanceToWeights()
doesn't gather dust (even though it's "not going to be used often, if at all").The issue in
stake()
remains unmitigated per se. The dust generated there would of course also be picked up byrebalanceToWeights()
, but sincerebalanceToWeights()
is "not going to be used often, if at all", and causes a significant loss for the protocol (M-07), this issue cannot be considered mitigated.Suggestion
Sweep the dust in
stake()
instead by adding the balance tomsg.value
. Or use the entire balance inunstake()
. These functions will be called frequently and it doesn't hurt to reward users with some dust. Note that this would entail that this check inunstake()
would have to be removed:See also the new issue titled "Reappearance of M-02 in SafEth.unstake()" for another reason this check should be removed.