Skip to content
This repository was archived by the owner on Sep 8, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/validator-debt/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

- feat(validator-debt): add overrides flat file to exclude validators from debt collection ([216](https://github.com/doublezerofoundation/doublezero-offchain/pull/216))
- add `debt_record_key` method ([#201](https://github.com/doublezerofoundation/doublezero-offchain/pull/201))
- feat(validator-debt): use s3 bucket to fetch validator keys ([#196](https://github.com/doublezerofoundation/doublezero-offchain/pull/196))

Expand Down
29 changes: 29 additions & 0 deletions crates/validator-debt/src/transaction.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::fs::File;

use anyhow::{Result, anyhow, bail};
use doublezero_program_tools::{instruction::try_build_instruction, zero_copy};
use doublezero_revenue_distribution::{
Expand Down Expand Up @@ -256,8 +258,35 @@ impl Transaction {
let mut debt_collection_result: Vec<DebtCollectionResult> =
Vec::with_capacity(debt.debts.len());

let mut overrides = Vec::new();

// TODO: This is a temporary fix to exclude a couple of validators
// the longer term fix will be using data on-chain as it's more transparent, less error-prone
if let Ok(file) = File::open("/opt/doublezero-offchain-scheduler/overrides.csv") {
Comment thread
karl-dz marked this conversation as resolved.
let mut rdr = csv::Reader::from_reader(file);
overrides.extend(
rdr.records()
.filter_map(|result| result.ok())
.filter_map(|record| {
let pubkey = record.get(0)?;
let epoch = record.get(1)?.parse::<u64>().ok()?;
Some((pubkey.to_string(), epoch))
}),
);
Comment thread
karl-dz marked this conversation as resolved.
}

let debt_clone = debt.clone();
for d in debt.debts {
let node_id_str = d.node_id.to_string();
if overrides
.iter()
.any(|(key, epoch)| key == &node_id_str && *epoch == dz_epoch)
{
println!(
"Validator {node_id_str} for epoch #{dz_epoch} excluded from debt collection"
);
continue;
Comment thread
bgm-malbeclabs marked this conversation as resolved.
}
let debt_proof = debt_clone.find_debt_proof(&d.node_id).unwrap();
let (_, proof) = debt_proof;
let instruction = try_build_instruction(
Expand Down