feat(contributor-rewards): add on-chain reward distribution#269
Open
feat(contributor-rewards): add on-chain reward distribution#269
Conversation
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
- 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
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.
Summary
Fix malbeclabs/doublezero#3004
Adds the distribute-rewards step to the contributor rewards pipeline:
calculator::distributemodule withtry_distribute_epoch_rewards, idempotent ATA creation, and Merkle proof generation per contributordistribute-rewardssubcommand (dry-run by default, --execute to send)