Skip to content
This repository was archived by the owner on Sep 8, 2026. It is now read-only.

feat(validator-debt): better summarized debt - #218

Merged
karl-dz merged 2 commits into
mainfrom
bgm/deliquents
Dec 3, 2025
Merged

feat(validator-debt): better summarized debt #218
karl-dz merged 2 commits into
mainfrom
bgm/deliquents

Conversation

@bgm-malbeclabs

@bgm-malbeclabs bgm-malbeclabs commented Dec 2, 2025

Copy link
Copy Markdown
Collaborator

Summary of Changes

This PR adds in more details for when debt collection is posted to slack and also summarizes debt collection for all epochs. It moves some of the debt-related slack composition to the validator-debt crate so we can reuse the existing structs instead of a many-arity function. It also adds total debt, total paid, and insufficient payment counts to the pay debt GenServer which are then posted to slack at the end of a debt collection run.

Closes malbeclabs/doublezero#2256.

Testing Verification

  • This was tested locally in a private slack channel:
Screenshot 2025-12-02 at 17 19 46

@bgm-malbeclabs
bgm-malbeclabs marked this pull request as draft December 2, 2025 00:41
@bgm-malbeclabs bgm-malbeclabs changed the title delinquents WIP: handle accruing debt Dec 2, 2025
@bgm-malbeclabs
bgm-malbeclabs force-pushed the bgm/deliquents branch 3 times, most recently from c039ec1 to 67dbaec Compare December 3, 2025 01:19
@bgm-malbeclabs bgm-malbeclabs changed the title WIP: handle accruing debt Better summarized debt Dec 3, 2025
@bgm-malbeclabs bgm-malbeclabs self-assigned this Dec 3, 2025
@bgm-malbeclabs
bgm-malbeclabs marked this pull request as ready for review December 3, 2025 01:23

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances debt collection reporting by adding detailed summaries for both individual epochs and aggregated totals across all epochs. The changes move Slack notification logic into the validator-debt crate to improve code reusability and add tracking of total debt, total paid amounts, and insufficient payment counts throughout the debt collection process.

Key Changes:

  • Refactored debt collection results to use detailed structs instead of simple counts
  • Added cumulative tracking of debt metrics across epochs in the PayDebt GenServer
  • Created a new endpoint to post aggregated debt summaries to Slack

Reviewed changes

Copilot reviewed 11 out of 12 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
scheduler/native/scheduler_doublezero/src/lib.rs Added debt collection structs, new post_debt_summary NIF function, and modified pay_debt to return detailed collection results
scheduler/native/scheduler_doublezero/Cargo.toml Added reqwest dependency for HTTP requests
scheduler/mix.exs Removed trailing comma from deps() call
scheduler/lib/scheduler/worker/pay_debt.ex Enhanced GenServer state to track cumulative debt metrics and post summary on completion
scheduler/lib/scheduler/validator_debt/debt_collection.ex Created Elixir structs for debt collection results
scheduler/lib/scheduler/scheduler_doublezero.ex Added NIF declaration for post_debt_summary
scheduler/CHANGELOG.md Added changelog entry for debt summarization feature
crates/validator-debt/src/worker.rs Moved post_debt_collection_to_slack function from slack-notifier with enhanced details
crates/validator-debt/src/transaction.rs Changed debt collection results from counts to vectors of detailed results
crates/solana-cli/src/command/revenue_distribution/relay/mod.rs Updated to use refactored debt collection posting function
crates/slack-notifier/src/validator_debt.rs Removed post_debt_collection_to_slack function and changed post_to_slack visibility to public

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread crates/validator-debt/src/worker.rs Outdated
Comment thread crates/validator-debt/src/worker.rs Outdated
Comment thread scheduler/lib/scheduler/validator_debt/debt_collection.ex Outdated
Comment thread scheduler/CHANGELOG.md Outdated
@karl-dz karl-dz changed the title Better summarized debt feat(validator-debt): better summarized debt Dec 3, 2025
@karl-dz
karl-dz merged commit 8ab45a6 into main Dec 3, 2025
2 checks passed
@karl-dz
karl-dz deleted the bgm/deliquents branch December 3, 2025 22:07
bgm-malbeclabs added a commit to malbeclabs/doublezero that referenced this pull request Aug 28, 2026
…ffchain#218)

## Summary of Changes
This PR adds in more details for when debt collection is posted to slack
and also summarizes debt collection for all epochs. It moves some of the
debt-related slack composition to the validator-debt crate so we can
reuse the existing structs instead of a many-arity function. It also
adds total debt, total paid, and insufficient payment counts to the pay
debt GenServer which are then posted to slack at the end of a debt
collection run.

Closes #2256.

## Testing Verification
* This was tested locally in a private slack channel:

<img width="1269" height="702" alt="Screenshot 2025-12-02 at 17 19 46"
src="https://github.com/user-attachments/assets/a8f75951-01e0-4ba4-a4f6-9d8cf2657dab"
/>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Summarize validator debt, showing deliquent validator debt

3 participants