-
Notifications
You must be signed in to change notification settings - Fork 62
Refactor set-children function in children_hotkeys.py
#782
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: staging
Are you sure you want to change the base?
Conversation
|
@thewhaleking would you review my updates for set_children as we discussed? |
thewhaleking
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tests are failing
|
Hi @ibraheem-abe would you review my test for |
7a6224a to
fb9b950
Compare
05617d2 to
61d90b9
Compare
|
@thewhaleking I fixed the conflict and this is ready for review |
Summary
Refactors
stake child setto be simpler and more consistent, adds a parent hotkey override in the CLI, and adds e2e coverage.Changes
set_childrenrefactor: Simplifiedbittensor_cli/src/commands/stake/children_hotkeys.py:set_children()into a single loop over target netuids (dict_outputkeyed by netuid).--parent-hotkeyto:btcli stake child setand plumbed it through tochildren_hotkeys.set_children(..., hotkey=...).set_childrento reject when (\sum proportions > 1.0) (prints an error; when--json-outputis set, returns a JSON error payload).set_childrentotests/e2e_tests/test_children_hotkeys.py:test_set_childrentest_set_children_multiple_proportionsBefore vs After
Before:
After:
netuidswith consistentdict_outputstructure.hotkeyparameter (CLI:--parent-hotkey) to manage children for a different parent hotkey SS58.Test Coverage
Added 7 comprehensive e2e tests in
tests/e2e_tests/test_children_hotkeys.py:stake child getTests:test_get_children_json_output- Tests getting children with--json-outputflag, verifies JSON structure and validates response formattest_get_children_non_json_output- Tests getting children without JSON flag, verifies table format outputstake child setTests:test_set_children_single_child- Tests setting a single child hotkey with 50% proportion, verifiescompletion_blockandset_blockin responsetest_set_children_multiple_proportions- Tests setting multiple children (Bob 30%, Charlie 40%) with different proportions, verifies both are set correctlyTest Commands Verified
Added e2e tests in
tests/e2e_tests/test_children_hotkeys.py:btcli stake child get --netuid <netuid>btcli stake child get --all-netuidsbtcli stake child set --children <address> --proportions <proportion> --netuid <netuid>btcli stake child setwith multiple children and proportionsFiles Changed
bittensor_cli/src/commands/stake/children_hotkeys.pybittensor_cli/cli.pytests/e2e_tests/test_children_hotkeys.pyContribution by Gittensor, learn more at https://gittensor.io/