Skip to content

Add short CLI flag aliases, fix stake flags, and harden disk cache#4

Open
grubbhook wants to merge 5 commits intounconst:mainfrom
grubbhook:main
Open

Add short CLI flag aliases, fix stake flags, and harden disk cache#4
grubbhook wants to merge 5 commits intounconst:mainfrom
grubbhook:main

Conversation

@grubbhook
Copy link
Contributor

@grubbhook grubbhook commented Mar 18, 2026

Summary

  • Add -w/--wallet, -n/--network, -k/--hotkey-name short aliases for global CLI args
  • Add -a/--amount and -u/--netuid short flags to stake subcommands
  • Fix --hotkey → --hotkey-name in docs to avoid confusion and add reg.sh
  • Fix flaky test: replace wait_for_finalized_success with in-best-block poll
  • Fix concurrent_writes_no_corruption CI failure: concurrent threads shared the same temp file path (keyed only by PID), causing write corruption; now uses a per-call atomic counter for unique tmp paths

Test plan

  • cargo test passes locally (135 tests, 0 failures)
  • Stake subcommands accept -a/-u short flags
  • Global CLI accepts -w/-n/-k short flags
  • reg.sh works correctly

This ticket will resolve ticket #5 as well.

Related Issue

grubbhook and others added 5 commits March 17, 2026 11:34
Follow-up to the hotkey flag rename: update reg.sh and two doc files
that referenced the global --hotkey flag by its old name.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
-e --endpoint, -d --wallet-dir, -H --hotkey-name, -o --output
(-n/-w/-v/-y were already present; -h is reserved for --help)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…poll

wait_for_finalized_success() requires GRANDPA finality which takes 36-72s
on Bittensor (3-6 blocks × 12s), blowing past the 30s timeout even when
the extrinsic was already successfully included in a block.

Replace with a manual poll loop that resolves on TxStatus::InBestBlock
(or InFinalizedBlock, whichever arrives first), then calls wait_for_success()
to check for dispatch errors. In-block confirmation is sufficient to
guarantee staking/transfer success — GRANDPA finality follows automatically.

The 30s timeout is now appropriate: one block takes ~12s so 30s gives
ample headroom without the false-failure behaviour.

Fixes: transaction timed out after 30s despite successful on-chain inclusion

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
All threads shared the same .{key}-{pid}.tmp path, causing concurrent
writes to corrupt the temp file before rename. Add a global atomic
counter so each put() call gets a distinct tmp path.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@grubbhook grubbhook changed the title Add short flag aliases for global CLI args + add reg.sh for automated registering neurons Add short CLI flag aliases, fix stake flags, and harden disk cache Mar 19, 2026
@grubbhook
Copy link
Contributor Author

Added a fix for ticket #5

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.

sign_submit: hardcoded 30s finalization timeout causes false failure on successful transactions

1 participant