Skip to content

Comments

feat(contributor-rewards): add on-chain reward distribution#269

Open
vihu wants to merge 3 commits intomainfrom
rg/fix-3004
Open

feat(contributor-rewards): add on-chain reward distribution#269
vihu wants to merge 3 commits intomainfrom
rg/fix-3004

Conversation

@vihu
Copy link
Collaborator

@vihu vihu commented Feb 18, 2026

Summary

Fix malbeclabs/doublezero#3004

Adds the distribute-rewards step to the contributor rewards pipeline:

  • New calculator::distribute module with try_distribute_epoch_rewards, idempotent ATA creation, and Merkle proof generation per contributor
  • CLI distribute-rewards subcommand (dry-run by default, --execute to send)
  • Scheduler worker calls distribution after each write cycle (skipped in dry-run)
  • Removes the TODO from validator-debt initialize_distribution

Adds the distribute-rewards step to the contributor rewards pipeline:
- New `calculator::distribute` module with
  `try_distribute_epoch_rewards`, idempotent ATA creation, and Merkle
  proof generation per contributor
- CLI `distribute-rewards` subcommand (dry-run by default, --execute to
  send)
- Scheduler worker calls distribution after each write cycle (skipped in
  dry-run)
- Removes the TODO from validator-debt initialize_distribution
vihu added 2 commits February 18, 2026 13:00
- Add DistributionOutcome enum (NotReady/AlreadyComplete/Distributed(n))
  replacing the opaque Result<bool> return from
  try_distribute_epoch_rewards
- Track last_distributed_epoch and consecutive_distribution_failures in
  SchedulerState (serde(default) for backward compat with existing state
  files)
- Add should_distribute_epoch idempotency guard to skip RPC work for
  epochs already fully distributed
- Extract try_get_distribution_epoch helper to decouple config fetch
  from distribution; log calculation/distribution epoch pairing each
  tick
- Align distribution failure handling with calculation failures: error!
  log, state persistence, 10x escalation counter
- Update CLI DistributeRewards handler for new return type
@vihu vihu marked this pull request as ready for review February 23, 2026 16:39
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.

contributor-rewards: add distribute-rewards calls after initializing distribution

1 participant