revenue-distribution: add debt recovery for written off debt#103
Open
revenue-distribution: add debt recovery for written off debt#103
Conversation
d579eb9 to
cf38bef
Compare
update CHANGELOG
93e7564 to
5ab7e5e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change implements RFC-0003, which outlines the ability to recover bad debt and to classify debt as erroneous.
One addition to this change is a field to the program config, which controls when debt can be recovered (number of epochs relative to the distribution's epoch). For example, if this field were to be configured to 2 epochs, written off debt for epoch 69 can only be recovered at epoch 71, which allows the debt account to reclassify debt during epochs 69 and 70.
This change also splits resolving bad debt into two separate instructions: reclassify and recover Solana validator bad debt. Because the two additional accounts felt awkward in the old resolve-bad-solana-validator-debt instruction (optional depending on whether debt is recovered), I modified the implementation (also reflected in the RFC).
I also refactored some of the processor logic to reduce code repetition. And I added new methods and modified existing methods for
DoubleZeroEpochandimpl_unit_shareto haveconst fn.Some state interfaces changed, which necessitates a zero-versioned minor bump. Integrators on v0.1, however, will still be able to read the previous state variables.
No account migration needed with this change.
Closes malbeclabs/doublezero#2350.