Skip to content

revenue-distribution: add configure-contributor-rewards CLI command#257

Merged
karl-dz merged 2 commits intodoublezerofoundation:mainfrom
RedaRahmani:feature/revenue-distribution-configure-contributor-rewards
Feb 23, 2026
Merged

revenue-distribution: add configure-contributor-rewards CLI command#257
karl-dz merged 2 commits intodoublezerofoundation:mainfrom
RedaRahmani:feature/revenue-distribution-configure-contributor-rewards

Conversation

@RedaRahmani
Copy link
Contributor

revenue-distribution: add configure-contributor-rewards CLI command

Closes : malbeclabs/doublezero#2663

Description

What’s included

  • New write CLI command to configure a ContributorRewards account:
  • Accepts repeated --recipient PUBKEY:PERCENT inputs (human percent 1–100) and converts internally to basis points.

Supports mutually exclusive flags:

  • --block-protocol-management
  • --allow-protocol-management
  • Block/allow flag instruction is only sent when requested, If you don’t pass --block-protocol-management or --allow-protocol-management , the command does not change the “protocol management blocked” setting. It will only update recipients (if you provided --recipient). If you pass block or allow, it includes that extra on-chain instruction.

Strong input validation:

  • Rejects malformed PUBKEY:PERCENT, invalid pubkeys, duplicates, out-of-range percents, and totals that don’t sum to 100.
  • Errors on “nothing to do” (no recipients + no block/allow).
  • Compute budget + optional priority fee, built via a testable helper , The transaction includes a ComputeBudget CU limit instruction so the tx has enough compute. If you set --with-compute-unit-price, it also includes a priority fee (CU price) instruction. Instruction building is done in a small helper function so we can unit test the exact instruction list (order + what’s included) without RPC/sending a tx.
  • Preflight check: fetches ContributorRewards and fails early if signer != current rewards_manager_key.

Tests

  • Added unit tests covering:

    • PUBKEY:PERCENT parsing (missing/extra :, invalid pubkey, non-numeric percent)
    • percent range validation (reject 0 and >100) + total must sum to 100
    • duplicate recipients + max recipients limit
    • mutual exclusivity of --block-protocol-management / --allow-protocol-management
    • instruction planning behavior

    Validated end-to-end on localnet.

@karl-dz
Copy link
Contributor

karl-dz commented Jan 28, 2026

Hi @RedaRahmani thank you for addressing this. We are spending some time with this CLI interaction to make sure this works as we like. But as far as addressing the issue, looks good so far. Will keep you updated, thanks again

@RedaRahmani
Copy link
Contributor Author

Hey @karl-dz , Thanks for the update and the review! I’m happy to tweak anything around the CLI UX behavior if you’d like changes, just let me know.

@karl-dz
Copy link
Contributor

karl-dz commented Feb 19, 2026

Hey @karl-dz , Thanks for the update and the review! I’m happy to tweak anything around the CLI UX behavior if you’d like changes, just let me know.

Hi @RedaRahmani apologies for the delay in reviewing this. I'm going to give it another pass through, but overall looks good. Can you update the CHANGELOG when you get a chance? Thank you

@RedaRahmani RedaRahmani force-pushed the feature/revenue-distribution-configure-contributor-rewards branch from c59fe7b to 2a58c93 Compare February 20, 2026 01:43
@RedaRahmani
Copy link
Contributor Author

Hey @karl-dz Thanks for the review, I’ve updated the CHANGELOG and pushed the change. It should be ready for review now. Appreciate you taking another look!

@karl-dz karl-dz merged commit 986e7a9 into doublezerofoundation:main Feb 23, 2026
6 checks passed
@RedaRahmani RedaRahmani deleted the feature/revenue-distribution-configure-contributor-rewards branch February 23, 2026 17:52
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.

add revenue-distribution configure-contributor-rewards to doublezero-solana

2 participants