Skip to content

Commit

Permalink
Merge pull request #2010 from opentensor/release/7.1.1
Browse files Browse the repository at this point in the history
Hotfix 7.1.1
  • Loading branch information
ibraheem-opentensor committed Jun 12, 2024
2 parents 08bb08d + ed3c69c commit 637c9ca
Show file tree
Hide file tree
Showing 5 changed files with 131 additions and 3 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## 7.1.1 / 2024-06-11

## What's Changed
* commit_reveal_weights_enabled argument parsing hotfix by @camfairchild in https://github.com/opentensor/bittensor/pull/2003

**Full Changelog**: https://github.com/opentensor/bittensor/compare/v7.1.0...v7.1.1

## 7.1.0 / 2024-06-05

## What's Changed
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.1.0
7.1.1
2 changes: 1 addition & 1 deletion bittensor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
nest_asyncio.apply()

# Bittensor code and protocol version.
__version__ = "7.1.0"
__version__ = "7.1.1"

version_split = __version__.split(".")
__version_as_int__: int = (
Expand Down
7 changes: 6 additions & 1 deletion bittensor/commands/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,8 +382,13 @@ def _run(
if (
cli.config.param == "network_registration_allowed"
or cli.config.param == "network_pow_registration_allowed"
or cli.config.param == "commit_reveal_weights_enabled"
):
cli.config.value = True if cli.config.value.lower() == "true" else False
cli.config.value = (
True
if (cli.config.value.lower() == "true" or cli.config.value == "1")
else False
)

subtensor.set_hyperparameter(
wallet,
Expand Down
116 changes: 116 additions & 0 deletions tests/integration_tests/test_cli_no_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -1333,6 +1333,122 @@ def test_vote_command_prompt_proposal_hash(self, _):
# NO prompt happened
mock_ask_prompt.assert_not_called()

@patch("bittensor.wallet", new_callable=return_mock_wallet_factory)
def test_commit_reveal_weights_enabled_parse_boolean_argument(self, mock_sub, __):
param = "commit_reveal_weights_enabled"

def _test_value_parsing(parsed_value: bool, modified: str):
cli = bittensor.cli(
args=[
"sudo",
"set",
"--netuid",
"1",
"--param",
param,
"--value",
modified,
"--wallet.name",
"mock",
]
)
cli.run()

_, kwargs = mock_sub.call_args
passed_config = kwargs["config"]
self.assertEqual(passed_config.param, param, msg="Incorrect param")
self.assertEqual(
passed_config.value,
parsed_value,
msg=f"Boolean argument not correctly for {modified}",
)

for boolean_value in [True, False, 1, 0]:
as_str = str(boolean_value)

_test_value_parsing(boolean_value, as_str)
_test_value_parsing(boolean_value, as_str.capitalize())
_test_value_parsing(boolean_value, as_str.upper())
_test_value_parsing(boolean_value, as_str.lower())

@patch("bittensor.wallet", new_callable=return_mock_wallet_factory)
def test_network_registration_allowed_parse_boolean_argument(self, mock_sub, __):
param = "network_registration_allowed"

def _test_value_parsing(parsed_value: bool, modified: str):
cli = bittensor.cli(
args=[
"sudo",
"set",
"--netuid",
"1",
"--param",
param,
"--value",
modified,
"--wallet.name",
"mock",
]
)
cli.run()

_, kwargs = mock_sub.call_args
passed_config = kwargs["config"]
self.assertEqual(passed_config.param, param, msg="Incorrect param")
self.assertEqual(
passed_config.value,
parsed_value,
msg=f"Boolean argument not correctly for {modified}",
)

for boolean_value in [True, False, 1, 0]:
as_str = str(boolean_value)

_test_value_parsing(boolean_value, as_str)
_test_value_parsing(boolean_value, as_str.capitalize())
_test_value_parsing(boolean_value, as_str.upper())
_test_value_parsing(boolean_value, as_str.lower())

@patch("bittensor.wallet", new_callable=return_mock_wallet_factory)
def test_network_pow_registration_allowed_parse_boolean_argument(
self, mock_sub, __
):
param = "network_pow_registration_allowed"

def _test_value_parsing(parsed_value: bool, modified: str):
cli = bittensor.cli(
args=[
"sudo",
"set",
"--netuid",
"1",
"--param",
param,
"--value",
modified,
"--wallet.name",
"mock",
]
)
cli.run()

_, kwargs = mock_sub.call_args
passed_config = kwargs["config"]
self.assertEqual(passed_config.param, param, msg="Incorrect param")
self.assertEqual(
passed_config.value,
parsed_value,
msg=f"Boolean argument not correctly for {modified}",
)

for boolean_value in [True, False, 1, 0]:
as_str = str(boolean_value)

_test_value_parsing(boolean_value, as_str)
_test_value_parsing(boolean_value, as_str.capitalize())
_test_value_parsing(boolean_value, as_str.upper())
_test_value_parsing(boolean_value, as_str.lower())


if __name__ == "__main__":
unittest.main()

0 comments on commit 637c9ca

Please sign in to comment.