SIP-106: L2 Debt Register Fix

Author
StatusImplemented
TypeGovernance
NetworkOptimism
ImplementorTBD
ReleaseTBD
Created2021-01-17

Simple Summary

After the deployment of Synthetix to L2 an issue was identified in the debt register calculation causing debt to increase as more SNX was staked, this fix addresses the issue in the debt register ensuring the debt balance for each staker is accurate.

Abstract

The debt register uses a rolled up calculation of all minting and burning events to enable the debt of each staker to be stored on-chain. During post deployment testing two small mints of ~2 wei sUSD were performed. These mints caused the precision in the debt register to be lost resulting in every incremental mint increasing the debt for all stakers. This fix addresses the loss of precision in the debt register restoring the correct debt values.

Motivation

Phase 0 of OE was designed to minimise the risk to stakers, so it is critical debt does not fluctuate until exchanges are enabled. This fix addresses an edge case where the debt register does not accurately reflect the minted debt of each staker. This is achieved without the need to make any further changes to the debt calculation logic or requiring all stakers to take any action, reducing the impact to L2 stakers.

Specification

Overview

The original multicurrency deployment upgraded the old debt register to the new debt register, it did this by calculating the issued nUSD of all addresses and then migrating them to the new debt register. Given that no exchanges have been made on L2 the pDAO will replicate this migration using sUSD issued on L2 to replay and import the debt register with the correct debt values for each address.

Rationale

There is an alternative to this debt register fix, which would require a redeployment of the entire L2 contract suite and then ensuring the fix mint event is sufficiently large as to not trigger this precision issue with the debt register. If this path was taken it would require all SNX stakers to migrate their SNX to L2 again, given the impact to the system and the cost of migration to users, it appears that this would be a much worse alternative.

Technical Specification

No interface changes are required.

Test Cases

Test cases for an implementation are mandatory for SIPs but can be included with the implementation.

Configurable Values (Via SCCP)

N/A

Test Cases

Test cases are included with the implementation in its pull request.

Copyright and related rights waived via CC0.