Skip to content
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

Add raw spec for local test and new bins #1243

Merged
merged 50 commits into from
Apr 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
42ec984
add spec and new bins
camfairchild Mar 29, 2023
c0bb762
fix config netuid
camfairchild Mar 29, 2023
82d058b
use dot get
camfairchild Mar 30, 2023
a10fae3
check if config netuid is list
camfairchild Mar 30, 2023
f9b5243
add start to mockstatus
camfairchild Mar 30, 2023
4ee1828
add attr to mock neuron
camfairchild Mar 30, 2023
5e5c9ab
add info to mock from neurons
camfairchild Mar 30, 2023
efcf13b
change ordering of neuron dict to namespace
camfairchild Mar 30, 2023
de5f2b5
remove test for wandb for axon
camfairchild Mar 30, 2023
6595247
use regex for looser match
camfairchild Mar 30, 2023
ae66c25
fix blacklist metagraph mock
camfairchild Mar 30, 2023
e374357
use real mock netuid
camfairchild Mar 30, 2023
7196726
use mock network and netuid in constructor
camfairchild Mar 30, 2023
12c233b
fix patch
camfairchild Mar 30, 2023
9219be4
patch delegate check
camfairchild Mar 30, 2023
6798aed
use mock network and netuid
camfairchild Mar 30, 2023
71bc80f
remove check for wallet hotkey
camfairchild Mar 30, 2023
aa94bad
fix tests for subtensor init
camfairchild Mar 30, 2023
4ed041f
dont set netuid for overview test
camfairchild Mar 30, 2023
87284b3
typo in docstring
camfairchild Mar 30, 2023
985bb09
Merge branch 'staging' into update-test-bins
camfairchild Mar 31, 2023
d9c10c5
add mock status stop
camfairchild Apr 3, 2023
b9bb309
add low mock tx limit
camfairchild Apr 3, 2023
01be210
oops typo
camfairchild Apr 3, 2023
633a43b
use dot get
camfairchild Apr 3, 2023
04dc7a3
add wait for final and incl args
camfairchild Apr 4, 2023
88e0b31
use args during setup
camfairchild Apr 4, 2023
ad734ba
update bins and use 100ms blocktime
camfairchild Apr 4, 2023
f5f19c5
Merge branch 'staging' into update-test-bins
camfairchild Apr 4, 2023
428065e
pass block arg
camfairchild Apr 4, 2023
f1fccd1
remove bittensor.logging and a old test
Eugene-hu Apr 4, 2023
c1b5d9c
Merge branch 'update-test-bins' of https://github.com/opentensor/bitt…
Eugene-hu Apr 4, 2023
5b9624b
use random port
Eugene-hu Apr 4, 2023
4bb620d
backward fix
Eugene-hu Apr 4, 2023
a32409d
Merge branch 'staging' into update-test-bins
camfairchild Apr 4, 2023
9f2d4f9
fix block time to 1s
camfairchild Apr 5, 2023
7b01596
compile no symb on linux
camfairchild Apr 5, 2023
d6cd496
compile no symb mac
camfairchild Apr 5, 2023
e40ff38
remove useless init on var
camfairchild Apr 5, 2023
924b47a
use dot get for new flags
camfairchild Apr 5, 2023
3797e5b
update test durations
camfairchild Apr 5, 2023
8355c6f
update test durations
camfairchild Apr 5, 2023
9c93f5a
use dot get for config
camfairchild Apr 5, 2023
49228b2
output error msg
camfairchild Apr 5, 2023
131b8de
mock to_default
Eugene-hu Apr 5, 2023
25890ab
Merge branch 'update-test-bins' of https://github.com/opentensor/bitt…
Eugene-hu Apr 5, 2023
5f2e42a
remove to defaults in help
Eugene-hu Apr 5, 2023
33ace3b
reduce neruons, remove flaky test
Eugene-hu Apr 6, 2023
83cc0f2
deactivate test
Eugene-hu Apr 6, 2023
e679962
mvoe key pair tests out of the subtensor interface
Eugene-hu Apr 6, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
190 changes: 155 additions & 35 deletions .test_durations

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions bittensor/_cli/commands/delegates.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ class MyDelegatesCommand:
def run( cli ):
'''Delegates stake to a chain delegate.'''
config = cli.config.copy()
if config.all == True:
if config.get('all', d=None) == True:
wallets = _get_coldkey_wallets_for_path( config.wallet.path )
else:
wallets = [bittensor.wallet( config = config )]
Expand Down Expand Up @@ -508,7 +508,7 @@ def add_args( parser: argparse.ArgumentParser ):

@staticmethod
def check_config( config: 'bittensor.Config' ):
if not config.all and config.wallet.get('name') == bittensor.defaults.wallet.name and not config.no_prompt:
if not config.get( 'all', d=None ) and config.wallet.get('name') == bittensor.defaults.wallet.name and not config.no_prompt:
wallet_name = Prompt.ask("Enter wallet name", default = bittensor.defaults.wallet.name)
config.wallet.name = str(wallet_name)

Expand Down
4 changes: 2 additions & 2 deletions bittensor/_cli/commands/inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class InspectCommand:
def run (cli):
r""" Inspect a cold, hot pair.
"""
if cli.config.all == True:
if cli.config.get('all', d=False) == True:
wallets = _get_coldkey_wallets_for_path( cli.config.wallet.path )
else:
wallets = [bittensor.wallet( config = cli.config )]
Expand Down Expand Up @@ -139,7 +139,7 @@ def run (cli):

@staticmethod
def check_config( config: 'bittensor.Config' ):
if not config.all and config.wallet.get('name') == bittensor.defaults.wallet.name and not config.no_prompt:
if not config.get( 'all', d=None ) and config.wallet.get('name') == bittensor.defaults.wallet.name and not config.no_prompt:
wallet_name = Prompt.ask("Enter wallet name", default = bittensor.defaults.wallet.name)
config.wallet.name = str(wallet_name)

Expand Down
1 change: 0 additions & 1 deletion bittensor/_cli/commands/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
class HelpCommand:
@staticmethod
def run (cli):
cli.config.to_defaults()
sys.argv = [sys.argv[0], '--help']
# Run miner.
if cli.config.model == 'core_server':
Expand Down
11 changes: 7 additions & 4 deletions bittensor/_cli/commands/overview.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def run( cli ):
total_balance = bittensor.Balance(0)

# We are printing for every coldkey.
if cli.config.all:
if cli.config.get( 'all', d=None ):
cold_wallets = get_coldkey_wallets_for_path(cli.config.wallet.path)
for cold_wallet in tqdm(cold_wallets, desc="Pulling balances"):
if cold_wallet.coldkeypub_file.exists_on_device() and not cold_wallet.coldkeypub_file.is_encrypted():
Expand Down Expand Up @@ -102,7 +102,7 @@ def run( cli ):
grid = Table.grid(pad_edge=False)

title: str = ""
if not cli.config.all:
if not cli.config.get( 'all', d=None ):
title = ( "[bold white italic]Wallet - {}:{}".format(cli.config.wallet.name, wallet.coldkeypub.ss58_address) )
else:
title = ( "[bold whit italic]All Wallets:" )
Expand Down Expand Up @@ -333,10 +333,13 @@ def add_args( parser: argparse.ArgumentParser ):

@staticmethod
def check_config( config: 'bittensor.Config' ):
if config.wallet.get('name') == bittensor.defaults.wallet.name and not config.no_prompt and not config.all:
if config.wallet.get('name') == bittensor.defaults.wallet.name and not config.no_prompt and not config.get( 'all', d=None ):
wallet_name = Prompt.ask("Enter wallet name", default = bittensor.defaults.wallet.name)
config.wallet.name = str(wallet_name)

if config.netuid != []:
config.netuid = [int(netuid) for netuid in config.netuid]
if not isinstance(config.netuid, list):
camfairchild marked this conversation as resolved.
Show resolved Hide resolved
config.netuid = [int(config.netuid)]
else:
config.netuid = [int(netuid) for netuid in config.netuid]

4 changes: 2 additions & 2 deletions bittensor/_cli/commands/unstake.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ def check_config( cls, config: 'bittensor.Config' ):
wallet_name = Prompt.ask("Enter wallet name", default = bittensor.defaults.wallet.name)
config.wallet.name = str(wallet_name)

if not config.hotkey_ss58address and config.wallet.get('hotkey') == bittensor.defaults.wallet.hotkey and not config.no_prompt and not config.get('all_hotkeys') and not config.get('hotkeys'):
if not config.get('hotkey_ss58address') and config.wallet.get('hotkey') == bittensor.defaults.wallet.hotkey and not config.no_prompt and not config.get('all_hotkeys') and not config.get('hotkeys'):
hotkey = Prompt.ask("Enter hotkey name", default = bittensor.defaults.wallet.hotkey)
config.wallet.hotkey = str(hotkey)

# Get amount.
if not config.hotkey_ss58address and not config.get('amount') and not config.get('unstake_all') and not config.get('max_stake'):
if not config.get('hotkey_ss58address') and not config.get('amount') and not config.get('unstake_all') and not config.get('max_stake'):
hotkeys: str = ''
if config.get('all_hotkeys'):
hotkeys = "all hotkeys"
Expand Down
8 changes: 4 additions & 4 deletions bittensor/_cli/commands/wallets.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def check_config( config: 'bittensor.Config' ):
wallet_name = Prompt.ask("Enter wallet name", default = bittensor.defaults.wallet.name)
config.wallet.name = str(wallet_name)

if config.mnemonic == None and config.seed == None and config.json == None:
if config.mnemonic == None and config.get( 'seed', d=None ) == None and config.get( 'json', d=None ) == None:
prompt_answer = Prompt.ask("Enter mnemonic, seed, or json file location")
if prompt_answer.startswith("0x"):
config.seed = prompt_answer
Expand All @@ -57,7 +57,7 @@ def check_config( config: 'bittensor.Config' ):
else:
config.json = prompt_answer

if config.json and config.json_password == None:
if config.get( 'json', d=None ) and config.get( 'json_password', d=None ) == None:
config.json_password = Prompt.ask("Enter json backup password", password=True)

@staticmethod
Expand Down Expand Up @@ -213,7 +213,7 @@ def check_config( config: 'bittensor.Config' ):
hotkey = Prompt.ask("Enter hotkey name", default = bittensor.defaults.wallet.hotkey)
config.wallet.hotkey = str(hotkey)

if config.mnemonic == None and config.seed == None and config.json == None:
if config.mnemonic == None and config.get( 'seed', d=None ) == None and config.get( 'json', d=None ) == None:
prompt_answer = Prompt.ask("Enter mnemonic, seed, or json file location")
if prompt_answer.startswith("0x"):
config.seed = prompt_answer
Expand All @@ -222,7 +222,7 @@ def check_config( config: 'bittensor.Config' ):
else:
config.json = prompt_answer

if config.json and config.json_password == None:
if config.get( 'json', d=None ) and config.get( 'json_password', d=None ) == None:
config.json_password = Prompt.ask("Enter json backup password", password=True)

@staticmethod
Expand Down
4 changes: 2 additions & 2 deletions bittensor/_cli/naka_cli_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ def overview(self):
total_balance = bittensor.Balance(0)

# We are printing for every coldkey.
if self.config.all:
if self.config.get('all', d=None):
cold_wallets = CLI._get_coldkey_wallets_for_path(self.config.wallet.path)
for cold_wallet in tqdm(cold_wallets, desc="Pulling balances"):
if cold_wallet.coldkeypub_file.exists_on_device() and not cold_wallet.coldkeypub_file.is_encrypted():
Expand Down Expand Up @@ -728,7 +728,7 @@ def overview(self):

total_neurons = len(neurons)
table = Table(show_footer=False, width=self.config.get('width', None), pad_edge=False, box=None)
if not self.config.all:
if not self.config.get('all', d=None):
table.title = ( "[white]Wallet - {}:{}".format(self.config.wallet.name, wallet.coldkeypub.ss58_address) )
else:
table.title = ( "[white]All Wallets:" )
Expand Down
2 changes: 1 addition & 1 deletion bittensor/_subtensor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class subtensor:
"""Factory Class for both bittensor.Subtensor and Mock_Subtensor Classes

The Subtensor class handles interactions with the substrate subtensor chain.
By default, the Subtensor class connects to the Nakamoto which serves as the main bittensor network.
By default, the Subtensor class connects to the Finney which serves as the main bittensor network.
camfairchild marked this conversation as resolved.
Show resolved Hide resolved

"""

Expand Down
2 changes: 1 addition & 1 deletion bittensor/_subtensor/chain_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,8 @@ def _neuron_dict_to_namespace(neuron_dict) -> 'NeuronInfo':
return NeuronInfo._null_neuron()
else:
neuron = NeuronInfo( **neuron_dict )
neuron.stake = Balance.from_rao(neuron.total_stake)
neuron.stake_dict = { hk: Balance.from_rao(stake) for hk, stake in neuron.stake.items() }
neuron.stake = Balance.from_rao(neuron.total_stake)
neuron.total_stake = neuron.stake
neuron.rank = neuron.rank / U16_MAX
neuron.trust = neuron.trust / U16_MAX
Expand Down
2 changes: 1 addition & 1 deletion bittensor/_subtensor/extrinsics/staking.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def add_stake_extrinsic(
hotkey_ss58 = wallet.hotkey.ss58_address

# Flag to indicate if we are using the wallet's own hotkey.
own_hotkey: bool = (wallet.hotkey.ss58_address == hotkey_ss58)
own_hotkey: bool

with bittensor.__console__.status(":satellite: Syncing with chain: [white]{}[/white] ...".format(subtensor.network)):
old_balance = subtensor.get_balance( wallet.coldkeypub.ss58_address )
Expand Down
42 changes: 21 additions & 21 deletions bittensor/_subtensor/subtensor_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,107 +408,107 @@ def make_substrate_call_with_retry():

""" Returns network Rho hyper parameter """
def rho (self, netuid: int, block: Optional[int] = None ) -> Optional[int]:
if not self.subnet_exists( netuid ): return None
if not self.subnet_exists( netuid, block ): return None
return self.query_subtensor( "Rho", block, [netuid] ).value

""" Returns network Kappa hyper parameter """
def kappa (self, netuid: int, block: Optional[int] = None ) -> Optional[float]:
if not self.subnet_exists( netuid ): return None
if not self.subnet_exists( netuid, block ): return None
return U16_NORMALIZED_FLOAT( self.query_subtensor( "Kappa", block, [netuid] ).value )

""" Returns network Difficulty hyper parameter """
def difficulty (self, netuid: int, block: Optional[int] = None ) -> Optional[int]:
if not self.subnet_exists( netuid ): return None
if not self.subnet_exists( netuid, block ): return None
return self.query_subtensor( "Difficulty", block, [netuid] ).value

""" Returns network Burn hyper parameter """
def burn (self, netuid: int, block: Optional[int] = None ) -> Optional[bittensor.Balance]:
if not self.subnet_exists( netuid ): return None
if not self.subnet_exists( netuid, block ): return None
return bittensor.Balance.from_rao( self.query_subtensor( "Burn", block, [netuid] ).value )

""" Returns network ImmunityPeriod hyper parameter """
def immunity_period (self, netuid: int, block: Optional[int] = None ) -> Optional[int]:
if not self.subnet_exists( netuid ): return None
if not self.subnet_exists( netuid, block ): return None
return self.query_subtensor("ImmunityPeriod", block, [netuid] ).value

""" Returns network ValidatorBatchSize hyper parameter """
def validator_batch_size (self, netuid: int, block: Optional[int] = None ) -> Optional[int]:
if not self.subnet_exists( netuid ): return None
if not self.subnet_exists( netuid, block ): return None
return self.query_subtensor("ValidatorBatchSize", block, [netuid] ).value

""" Returns network ValidatorPruneLen hyper parameter """
def validator_prune_len (self, netuid: int, block: Optional[int] = None ) -> int:
if not self.subnet_exists( netuid ): return None
if not self.subnet_exists( netuid, block ): return None
return self.query_subtensor("ValidatorPruneLen", block, [netuid] ).value

""" Returns network ValidatorLogitsDivergence hyper parameter """
def validator_logits_divergence (self, netuid: int, block: Optional[int] = None ) -> Optional[float]:
if not self.subnet_exists( netuid ): return None
if not self.subnet_exists( netuid, block ): return None
return U16_NORMALIZED_FLOAT(self.query_subtensor("ValidatorLogitsDivergence", block, [netuid]).value)

""" Returns network ValidatorSequenceLength hyper parameter """
def validator_sequence_length (self, netuid: int, block: Optional[int] = None ) -> Optional[int]:
if not self.subnet_exists( netuid ): return None
if not self.subnet_exists( netuid, block ): return None
return self.query_subtensor("ValidatorSequenceLength", block, [netuid] ).value

""" Returns network ValidatorEpochsPerReset hyper parameter """
def validator_epochs_per_reset (self, netuid: int, block: Optional[int] = None ) -> Optional[int]:
if not self.subnet_exists( netuid ): return None
if not self.subnet_exists( netuid, block ): return None
return self.query_subtensor("ValidatorEpochsPerReset", block, [netuid] ).value

""" Returns network ValidatorEpochLen hyper parameter """
def validator_epoch_length (self, netuid: int, block: Optional[int] = None ) -> Optional[int]:
if not self.subnet_exists( netuid ): return None
if not self.subnet_exists( netuid, block ): return None
return self.query_subtensor("ValidatorEpochLen", block, [netuid] ).value

""" Returns network ValidatorEpochLen hyper parameter """
def validator_exclude_quantile (self, netuid: int, block: Optional[int] = None ) -> Optional[float]:
if not self.subnet_exists( netuid ): return None
if not self.subnet_exists( netuid, block ): return None
return U16_NORMALIZED_FLOAT( self.query_subtensor("ValidatorExcludeQuantile", block, [netuid] ).value )

""" Returns network MaxAllowedValidators hyper parameter """
def max_allowed_validators(self, netuid: int, block: Optional[int] = None) -> Optional[int]:
if not self.subnet_exists( netuid ): return None
if not self.subnet_exists( netuid, block ): return None
return self.query_subtensor( 'MaxAllowedValidators', block, [netuid] ).value

""" Returns network MinAllowedWeights hyper parameter """
def min_allowed_weights (self, netuid: int, block: Optional[int] = None ) -> Optional[int]:
if not self.subnet_exists( netuid ): return None
if not self.subnet_exists( netuid, block ): return None
return self.query_subtensor("MinAllowedWeights", block, [netuid] ).value

""" Returns network MaxWeightsLimit hyper parameter """
def max_weight_limit (self, netuid: int, block: Optional[int] = None ) -> Optional[float]:
if not self.subnet_exists( netuid ): return None
if not self.subnet_exists( netuid, block ): return None
return U16_NORMALIZED_FLOAT( self.query_subtensor('MaxWeightsLimit', block, [netuid] ).value )

""" Returns network ScalingLawPower hyper parameter """
def scaling_law_power (self, netuid: int, block: Optional[int] = None ) -> Optional[float]:
if not self.subnet_exists( netuid ): return None
if not self.subnet_exists( netuid, block ): return None
return self.query_subtensor('ScalingLawPower', block, [netuid] ).value / 100.

""" Returns network SynergyScalingLawPower hyper parameter """
def synergy_scaling_law_power (self, netuid: int, block: Optional[int] = None ) -> Optional[float]:
if not self.subnet_exists( netuid ): return None
if not self.subnet_exists( netuid, block ): return None
return self.query_subtensor('SynergyScalingLawPower', block, [netuid] ).value / 100.

""" Returns network SubnetworkN hyper parameter """
def subnetwork_n (self, netuid: int, block: Optional[int] = None ) -> int:
if not self.subnet_exists( netuid ): return None
if not self.subnet_exists( netuid, block ): return None
return self.query_subtensor('SubnetworkN', block, [netuid] ).value

""" Returns network MaxAllowedUids hyper parameter """
def max_n (self, netuid: int, block: Optional[int] = None ) -> Optional[int]:
if not self.subnet_exists( netuid ): return None
if not self.subnet_exists( netuid, block ): return None
return self.query_subtensor('MaxAllowedUids', block, [netuid] ).value

""" Returns network BlocksSinceLastStep hyper parameter """
def blocks_since_epoch (self, netuid: int, block: Optional[int] = None) -> int:
if not self.subnet_exists( netuid ): return None
if not self.subnet_exists( netuid, block ): return None
return self.query_subtensor('BlocksSinceLastStep', block, [netuid] ).value

""" Returns network Tempo hyper parameter """
def tempo (self, netuid: int, block: Optional[int] = None) -> int:
if not self.subnet_exists( netuid ): return None
if not self.subnet_exists( netuid, block ): return None
return self.query_subtensor('Tempo', block, [netuid] ).value

##########################
Expand Down
Loading