No on-chain cumulative bad-debt tracking
badDebtUsdcUnits is computed and emitted per finalize event but never accumulated on-chain, so cumulative protocol bad-debt requires off-chain event indexing rather than a single on-chain read.
Description
badDebtUsdcUnits is computed in CloseLib.calculateCloseDistribution and emitted in PositionClosed / PositionSettled / PositionLiquidated / PositionForceUnwound events, but never accumulated in a storage variable. Determining cumulative protocol bad-debt exposure for governance, capital-pool sizing, or solvency assessment requires off-chain event indexing rather than a single on-chain read.
Recommendation
Add a totalBadDebtUsdcUnits storage variable, incremented in finalizeClose, finalizeSettle, finalizeLiquidate, and the terminal branch of finalizeForceUnwind, to enable on-chain solvency queries.
Resolution
Acknowledged. On-chain bad-debt accumulator deferred on contract-size grounds; off-chain indexing of finalize events covers the same data.

