Skip to content

revenue-distribution: add debt recovery for written off debt#103

Open
karl-dz wants to merge 20 commits intomainfrom
rev-distribution/debt-recovery
Open

revenue-distribution: add debt recovery for written off debt#103
karl-dz wants to merge 20 commits intomainfrom
rev-distribution/debt-recovery

Conversation

@karl-dz
Copy link
Contributor

@karl-dz karl-dz commented Feb 3, 2026

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 DoubleZeroEpoch and impl_unit_share to have const 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.

@karl-dz karl-dz force-pushed the rev-distribution/debt-recovery branch 2 times, most recently from d579eb9 to cf38bef Compare February 5, 2026 20:54
@karl-dz karl-dz force-pushed the rev-distribution/debt-recovery branch from 93e7564 to 5ab7e5e Compare February 19, 2026 03:31
@karl-dz karl-dz marked this pull request as ready for review February 19, 2026 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

implement RFC for debt recovery process

1 participant