SIP-145: Debt Cache Event Consistency
Fixes an incorrect debt cache event value.
SIP 136 updated the debt cache system to properly exclude non-SNX-backed debt
from the system debt. However, it did not perform the same deduction from the value emitted in the
The true debt snapshot value and the emitted value are out of sync; although the true cached value is being computed
correctly, the event emitted concurrently with this value being updated does not properly exclude non-SNX-backed debt.
This makes it difficult to track the true historical debt value from the events.
Additionally, as this affected only full snapshots and not partial ones, the emitted debt cache value time series was
fluctuating wildly by a factor of 2 between adjacent
The event emitted inside
DebtCache.takeDebtSnapshot will contain a corrected value, which properly excludes
debt accounted for by the ether wrapper, loans contracts, et cetera.
This is the most direct means of fixing the problem. A speedy resolution will limit the number of incorrect data points pushed onto the chain.
emit DebtCacheUpdated(snxCollateralDebt) will be replaced with
The code is available on github.
See the accompanying pull request.
Configurable Values (Via SCCP)
Copyright and related rights waived via CC0.