Skip to content

Commit

Permalink
BTCli integration with new governance protocol (#1398)
Browse files Browse the repository at this point in the history
* Begin senate cli

* Add helper functions to subtensor object for query_module, query_module_map

* Remove unused senate helpers

* Rename SenateCommand -> ProposalsCommand

* Remove unused proposals info datatype

* Add proposals data in rich table

* Clarify + beautify calldata column

* Add SenateRegisterCommand

* Add helper function wallet.is_senate_member

* Add subtensor *_senate extrinsics, is_senate_member, get_vote_data impl

* Use helper function to check senate membership

* Add command to view senate members

* Use get_vote_data helper and refactor call data formatting for recursion

* Add senate_vote and senate_leave cmd classes

* Add membership check in senate_register command

* Add senate_leave, senate_vote extrinsic functions

* Import senate_leave, senate_vote extrinsic functions in subtensor_impl

* Add senate, proposal_votes, senate_leave, senate_vote cmds to cli

* Move closure helper funcs to main scope, add display_votes helper

* Add senate size and active proposals metric, vote overview and nice names

* Add delegate nice-name support to proposal_votes

* Use coldkey for senate actions instead of hotkey
  • Loading branch information
Ayden Brewer authored Jun 28, 2023
1 parent 157801f commit 96de08f
Show file tree
Hide file tree
Showing 7 changed files with 818 additions and 2 deletions.
19 changes: 19 additions & 0 deletions bittensor/_cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,13 @@ def __create_parser__() -> 'argparse.ArgumentParser':
ListDelegatesCommand.add_args( cmd_parsers )
RegenColdkeypubCommand.add_args( cmd_parsers )
RecycleRegisterCommand.add_args( cmd_parsers )
SenateCommand.add_args( cmd_parsers )
ProposalsCommand.add_args( cmd_parsers )
ShowVotesCommand.add_args( cmd_parsers )
SenateRegisterCommand.add_args( cmd_parsers )
SenateLeaveCommand.add_args( cmd_parsers )
VoteCommand.add_args( cmd_parsers )


return parser

Expand Down Expand Up @@ -156,6 +163,18 @@ def check_config (config: 'bittensor.Config'):
MyDelegatesCommand.check_config( config )
elif config.command == "recycle_register":
RecycleRegisterCommand.check_config( config )
elif config.command == "senate":
SenateCommand.check_config( config )
elif config.command == "proposals":
ProposalsCommand.check_config( config )
elif config.command == "proposal_votes":
ShowVotesCommand.check_config( config )
elif config.command == "senate_register":
SenateRegisterCommand.check_config( config )
elif config.command == "senate_leave":
SenateLeaveCommand.check_config( config )
elif config.command == "senate_vote":
VoteCommand.check_config( config )
else:
console.print(":cross_mark:[red]Unknown command: {}[/red]".format(config.command))
sys.exit()
Expand Down
12 changes: 12 additions & 0 deletions bittensor/_cli/cli_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,16 @@ def run ( self ):
ListSubnetsCommand.run( self )
elif self.config.command == 'recycle_register':
RecycleRegisterCommand.run( self )
elif self.config.command == "senate":
SenateCommand.run( self )
elif self.config.command == "proposals":
ProposalsCommand.run( self )
elif self.config.command == "proposal_votes":
ShowVotesCommand.run( self )
elif self.config.command == "senate_register":
SenateRegisterCommand.run( self )
elif self.config.command == "senate_leave":
SenateLeaveCommand.run( self )
elif self.config.command == "senate_vote":
VoteCommand.run( self )

1 change: 1 addition & 0 deletions bittensor/_cli/commands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
from .metagraph import MetagraphCommand
from .list import ListCommand
from .misc import UpdateCommand, ListSubnetsCommand
from .senate import SenateCommand, ProposalsCommand, ShowVotesCommand, SenateRegisterCommand, SenateLeaveCommand, VoteCommand
Loading

0 comments on commit 96de08f

Please sign in to comment.