Skip to content

fix(cli): treat a zero bounty payout as success, not failure#1614

Open
dalledajay-coder wants to merge 1 commit into
entrius:testfrom
dalledajay-coder:fix/payout-zero-success
Open

fix(cli): treat a zero bounty payout as success, not failure#1614
dalledajay-coder wants to merge 1 commit into
entrius:testfrom
dalledajay-coder:fix/payout-zero-success

Conversation

@dalledajay-coder

Copy link
Copy Markdown

Summary

gitt admin payout-issue reports a successful payout as a failure whenever payout_bounty returns 0. payout_bounty returns a non-None int on success (0 when the pre-read bounty amount is unavailable) and None only on failure, but the caller in gittensor/cli/issue_commands/admin.py used a truthiness check (if result:), so a successful zero-amount payout printed "Payout failed." and exited 1 even though the transaction went through.

This implements the caller-side fix @anderdc described when closing #1577: change the guard to if result is not None: — one line in the caller, no change to contract_client.py, no extra re-read on the success path.

The sibling admin commands (cancel-issue, set-owner, set-treasury, add-vali, remove-vali) are deliberately unchanged: their client methods all return bool via _exec_tx_bool, so truthiness is correct there.

Related Issues

None — implements the correct fix spelled out in the closure of PR #1577.

Type of Change

  • Bug fix
  • New feature
  • Refactor
  • Documentation
  • Other (describe below)

Testing

  • Tests added/updated
  • Manually tested

Added TestCliAdminPayoutResultHandling in tests/cli/test_cli_helpers.py, mocking the contract client on the existing CLI-runner path: a payout_bounty return of 0 must report success and exit 0, and a return of None must still report failure and exit non-zero.

Full local run on this branch: uv run pytest — 962 passed; uv run ruff check . and uv run ruff format --check . — clean; uv run pyright — 0 errors, 0 warnings.

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • Changes are documented (if applicable)

payout_bounty returns a non-None int on success (0 when the pre-read
bounty amount is unavailable) and None only on failure, but the
payout-issue command checked the result for truthiness, so a
successful zero-amount payout was reported as a failed transaction
and exited non-zero. Check 'is not None' instead.

Adds a regression test asserting a 0 return reports success and a
None return still reports failure.
@xiao-xiao-mao xiao-xiao-mao Bot added the bug Something isn't working label Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant