You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, delegates can only set a global take rate that applies to all subnets. To provide more flexibility and allow delegates to optimize their strategies for different subnets, we need to implement a feature that enables delegates to set subnet-specific take rates via the command line. This is required for the Child Keys feature.
This feature will utilize the set_delegate_takes extrinsic, which allows setting take rates for multiple subnets simultaneously. The implementation should include proper error handling, rate limiting, and validation to ensure the takes do not exceed the initial default take.
Acceptance Criteria
Implement a new CLI command to set subnet-specific take rates for delegates
Allow delegates to specify multiple subnet-take pairs in a single command
Tasks
Create a new CLI command btcli delegate set_takes
classSetDelegateTakesCommand:
@staticmethoddefrun(cli: "bittensor.cli"):
r"""Set subnet-specific take rates for a delegate."""wallet=bittensor.wallet(config=cli.config)
subtensor=bittensor.subtensor(config=cli.config)
SetDelegateTakesCommand._run(cli, subtensor, wallet)
@staticmethoddef_run(cli: "bittensor.cli", subtensor: "bittensor.subtensor", wallet: "bittensor.wallet"):
# Implementation details here
Implement input parsing for subnet-take pairs
@staticmethoddefadd_args(parser: argparse.ArgumentParser):
parser.add_argument(
'--subnet_take_pairs',
type=str,
nargs='+',
help='List of subnet-take pairs in the format "netuid:take_rate"'
)
@staticmethoddefcheck_config(config: "bittensor.config"):
ifnotconfig.is_set('subnet_take_pairs'):
raiseValueError("--subnet_take_pairs argument is required")
subnet_take_pairs= []
forpairinconfig.subnet_take_pairs:
netuid, take_rate=pair.split(':')
subnet_take_pairs.append((int(netuid), int(float(take_rate) *65535)))
config.subnet_take_pairs=subnet_take_pairs
Add validation for subnet existence and take rate limits
defvalidate_subnet_take_pairs(subtensor: "bittensor.subtensor", subnet_take_pairs: List[Tuple[int, int]]):
fornetuid, take_rateinsubnet_take_pairs:
ifnotsubtensor.subnet_exists(netuid):
raiseValueError(f"Subnet with netuid {netuid} does not exist")
max_take_rate=subtensor.get_max_take_rate()
iftake_rate>max_take_rate:
raiseValueError(f"Take rate for subnet {netuid} exceeds the maximum allowed rate of {max_take_rate/65535:.4f}")
Description
Currently, delegates can only set a global take rate that applies to all subnets. To provide more flexibility and allow delegates to optimize their strategies for different subnets, we need to implement a feature that enables delegates to set subnet-specific take rates via the command line. This is required for the Child Keys feature.
This feature will utilize the
set_delegate_takes
extrinsic, which allows setting take rates for multiple subnets simultaneously. The implementation should include proper error handling, rate limiting, and validation to ensure the takes do not exceed the initial default take.Acceptance Criteria
Tasks
btcli delegate set_takes
set_delegate_takes
extrinsicRelated links:
The text was updated successfully, but these errors were encountered: