M-1: Prevent overflow in NAV accounting
Description:
The calculation of the NAV is given by the netAssetValue() function.
213: return equity + gain - loss - liability;
If the liabilities are eventually greater than the adjusted equity, the calculation would overflow since these are unsigned integers. This can cause a revert in the path that submits snapshots to the Hub, which are hooked to the NAVManager.
Impact:
Medium. The issue can block updates to the Hub for as long as the calculation overflows.
Recommendation:
Consider clamping the calculation to zero to avoid the revert.
Note that this could also skew the final NAV after being aggregated in the SimplePriceManager contract.
Developer Response:
Fixed by PR#708.