diff --git a/bittensor_cli/src/__init__.py b/bittensor_cli/src/__init__.py index a5ca2170..bba2fdc3 100644 --- a/bittensor_cli/src/__init__.py +++ b/bittensor_cli/src/__init__.py @@ -318,32 +318,33 @@ class WalletValidationTypes(Enum): HYPERPARAMS = { - "rho": "sudo_set_rho", - "kappa": "sudo_set_kappa", - "immunity_period": "sudo_set_immunity_period", - "min_allowed_weights": "sudo_set_min_allowed_weights", - "max_weights_limit": "sudo_set_max_weight_limit", - "tempo": "sudo_set_tempo", - "min_difficulty": "sudo_set_min_difficulty", - "max_difficulty": "sudo_set_max_difficulty", - "weights_version": "sudo_set_weights_version_key", - "weights_rate_limit": "sudo_set_weights_set_rate_limit", - "adjustment_interval": "sudo_set_adjustment_interval", - "activity_cutoff": "sudo_set_activity_cutoff", - "target_regs_per_interval": "sudo_set_target_registrations_per_interval", - "min_burn": "sudo_set_min_burn", - "max_burn": "sudo_set_max_burn", - "bonds_moving_avg": "sudo_set_bonds_moving_average", - "max_regs_per_block": "sudo_set_max_registrations_per_block", - "serving_rate_limit": "sudo_set_serving_rate_limit", - "max_validators": "sudo_set_max_allowed_validators", - "adjustment_alpha": "sudo_set_adjustment_alpha", - "difficulty": "sudo_set_difficulty", - "commit_reveal_weights_interval": "sudo_set_commit_reveal_weights_interval", - "commit_reveal_weights_enabled": "sudo_set_commit_reveal_weights_enabled", - "alpha_values": "sudo_set_alpha_values", - "liquid_alpha_enabled": "sudo_set_liquid_alpha_enabled", - "registration_allowed": "sudo_set_network_registration_allowed", + # btcli name: (subtensor method, sudo bool) + "rho": ("sudo_set_rho", False), + "kappa": ("sudo_set_kappa", False), + "immunity_period": ("sudo_set_immunity_period", False), + "min_allowed_weights": ("sudo_set_min_allowed_weights", False), + "max_weights_limit": ("sudo_set_max_weight_limit", False), + "tempo": ("sudo_set_tempo", True), + "min_difficulty": ("sudo_set_min_difficulty", False), + "max_difficulty": ("sudo_set_max_difficulty", False), + "weights_version": ("sudo_set_weights_version_key", False), + "weights_rate_limit": ("sudo_set_weights_set_rate_limit", False), + "adjustment_interval": ("sudo_set_adjustment_interval", True), + "activity_cutoff": ("sudo_set_activity_cutoff", False), + "target_regs_per_interval": ("sudo_set_target_registrations_per_interval", True), + "min_burn": ("sudo_set_min_burn", False), + "max_burn": ("sudo_set_max_burn", False), + "bonds_moving_avg": ("sudo_set_bonds_moving_average", False), + "max_regs_per_block": ("sudo_set_max_registrations_per_block", True), + "serving_rate_limit": ("sudo_set_serving_rate_limit", False), + "max_validators": ("sudo_set_max_allowed_validators", True), + "adjustment_alpha": ("sudo_set_adjustment_alpha", False), + "difficulty": ("sudo_set_difficulty", False), + "commit_reveal_weights_interval": ("sudo_set_commit_reveal_weights_interval", False), + "commit_reveal_weights_enabled": ("sudo_set_commit_reveal_weights_enabled", False), + "alpha_values": ("sudo_set_alpha_values", False), + "liquid_alpha_enabled": ("sudo_set_liquid_alpha_enabled", False), + "registration_allowed": ("sudo_set_network_registration_allowed", False), } # Help Panels for cli help diff --git a/bittensor_cli/src/commands/sudo.py b/bittensor_cli/src/commands/sudo.py index 5c0057ce..2be3c0f6 100644 --- a/bittensor_cli/src/commands/sudo.py +++ b/bittensor_cli/src/commands/sudo.py @@ -104,7 +104,7 @@ async def set_hyperparameter_extrinsic( if not unlock_key(wallet).success: return False - extrinsic = HYPERPARAMS.get(parameter) + extrinsic, sudo_ = HYPERPARAMS.get(parameter, ("", False)) if extrinsic is None: err_console.print(":cross_mark: [red]Invalid hyperparameter specified.[/red]") return False @@ -144,11 +144,17 @@ async def set_hyperparameter_extrinsic( call_params[str(value_argument["name"])] = value # create extrinsic call - call = await substrate.compose_call( + call_ = await substrate.compose_call( call_module="AdminUtils", call_function=extrinsic, call_params=call_params, ) + if sudo_: + call = await substrate.compose_call( + call_module="Sudo", call_function="sudo", call_params={"call": call_} + ) + else: + call = call_ success, err_msg = await subtensor.sign_and_send_extrinsic( call, wallet, wait_for_inclusion, wait_for_finalization )