Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
15 changes: 0 additions & 15 deletions bittensor/chain_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,10 @@
["kappa", "Compact<u16>"],
["difficulty", "Compact<u64>"],
["immunity_period", "Compact<u16>"],
["validator_batch_size", "Compact<u16>"],
["validator_sequence_length", "Compact<u16>"],
["validator_epochs_per_reset", "Compact<u16>"],
["validator_epoch_length", "Compact<u16>"],
["max_allowed_validators", "Compact<u16>"],
["min_allowed_weights", "Compact<u16>"],
["max_weights_limit", "Compact<u16>"],
["scaling_law_power", "Compact<u16>"],
["synergy_scaling_law_power", "Compact<u16>"],
["subnetwork_n", "Compact<u16>"],
["max_allowed_uids", "Compact<u16>"],
["blocks_since_last_step", "Compact<u64>"],
Expand Down Expand Up @@ -713,15 +708,10 @@ class SubnetInfo:
kappa: int
difficulty: int
immunity_period: int
validator_batch_size: int
validator_sequence_length: int
validator_epochs_per_reset: int
validator_epoch_length: int
max_allowed_validators: int
min_allowed_weights: int
max_weight_limit: float
scaling_law_power: float
synergy_scaling_law_power: float
subnetwork_n: int
max_n: int
blocks_since_epoch: int
Expand Down Expand Up @@ -768,15 +758,10 @@ def fix_decoded_values(cls, decoded: Dict) -> "SubnetInfo":
kappa=decoded["kappa"],
difficulty=decoded["difficulty"],
immunity_period=decoded["immunity_period"],
validator_batch_size=decoded["validator_batch_size"],
validator_sequence_length=decoded["validator_sequence_length"],
validator_epochs_per_reset=decoded["validator_epochs_per_reset"],
validator_epoch_length=decoded["validator_epoch_length"],
max_allowed_validators=decoded["max_allowed_validators"],
min_allowed_weights=decoded["min_allowed_weights"],
max_weight_limit=decoded["max_weights_limit"],
scaling_law_power=decoded["scaling_law_power"],
synergy_scaling_law_power=decoded["synergy_scaling_law_power"],
subnetwork_n=decoded["subnetwork_n"],
max_n=decoded["max_allowed_uids"],
blocks_since_epoch=decoded["blocks_since_last_step"],
Expand Down
1 change: 0 additions & 1 deletion bittensor/commands/metagraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ def run(cli):
cli.config.subtensor.network
)
)
print("netuid in metagraphCommand:", cli.config.netuid)
metagraph: bittensor.metagraph = subtensor.metagraph(netuid=cli.config.netuid)
metagraph.save()
difficulty = subtensor.difficulty(cli.config.netuid)
Expand Down
45 changes: 25 additions & 20 deletions bittensor/extrinsics/registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,12 +375,12 @@ def run_faucet_extrinsic(
)
):
return False

# Unlock coldkey
wallet.coldkey

# Get previous balance.
old_balance = subtensor.get_balance( wallet.coldkeypub.ss58_address )
old_balance = subtensor.get_balance(wallet.coldkeypub.ss58_address)

# Attempt rolling registration.
attempts = 1
Expand Down Expand Up @@ -418,31 +418,36 @@ def run_faucet_extrinsic(
log_verbose=log_verbose,
)
call = subtensor.substrate.compose_call(
call_module="SubtensorModule",
call_function="faucet",
call_params={
"block_number": pow_result.block_number,
"nonce": pow_result.nonce,
"work": [int(byte_) for byte_ in pow_result.seal],
},
)
extrinsic = subtensor.substrate.create_signed_extrinsic( call = call, keypair = wallet.coldkey)
response = subtensor.substrate.submit_extrinsic(
call_module="SubtensorModule",
call_function="faucet",
call_params={
"block_number": pow_result.block_number,
"nonce": pow_result.nonce,
"work": [int(byte_) for byte_ in pow_result.seal],
},
)
extrinsic = subtensor.substrate.create_signed_extrinsic(
call=call, keypair=wallet.coldkey
)
response = subtensor.substrate.submit_extrinsic(
extrinsic,
wait_for_inclusion = wait_for_inclusion,
wait_for_finalization = wait_for_finalization
wait_for_inclusion=wait_for_inclusion,
wait_for_finalization=wait_for_finalization,
)

# process if registration successful, try again if pow is still valid
response.process_events()
if not response.is_success:
bittensor.__console__.print(f":cross_mark: [red]Failed[/red]: Error: {response.error_message}" )

bittensor.__console__.print(
f":cross_mark: [red]Failed[/red]: Error: {response.error_message}"
)

# Successful registration
else:
new_balance = subtensor.get_balance( wallet.coldkeypub.ss58_address )
bittensor.__console__.print( f"Balance: [blue]{old_balance}[/blue] :arrow_right: [green]{new_balance}[/green]" )
new_balance = subtensor.get_balance(wallet.coldkeypub.ss58_address)
bittensor.__console__.print(
f"Balance: [blue]{old_balance}[/blue] :arrow_right: [green]{new_balance}[/green]"
)

except KeyboardInterrupt:
return True, 'Done'

return True, "Done"
22 changes: 11 additions & 11 deletions bittensor/subtensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@
from .extrinsics.staking import add_stake_extrinsic, add_stake_multiple_extrinsic
from .extrinsics.unstaking import unstake_extrinsic, unstake_multiple_extrinsic
from .extrinsics.serving import serve_extrinsic, serve_axon_extrinsic
from .extrinsics.registration import register_extrinsic, burned_register_extrinsic, run_faucet_extrinsic
from .extrinsics.registration import (
register_extrinsic,
burned_register_extrinsic,
run_faucet_extrinsic,
)
from .extrinsics.transfer import transfer_extrinsic
from .extrinsics.set_weights import set_weights_extrinsic
from .extrinsics.prometheus import prometheus_extrinsic
Expand Down Expand Up @@ -401,7 +405,7 @@ def register(
update_interval=update_interval,
log_verbose=log_verbose,
)

def run_faucet(
self,
wallet: "bittensor.wallet",
Expand Down Expand Up @@ -1924,10 +1928,8 @@ def metagraph(
metagraph_.sync(block=block, lite=lite, subtensor=self)

return metagraph_

def incentive(
self, netuid: int, block: Optional[int] = None
) -> List[int]:

def incentive(self, netuid: int, block: Optional[int] = None) -> List[int]:
"""Returns a list of incentives for the subnet.
Args:
netuid ( int ):
Expand All @@ -1936,19 +1938,17 @@ def incentive(
block to sync from, or None for latest block.
Returns:
i_map ( List[int] ):
The list of incentives for the subnet at the block,
The list of incentives for the subnet at the block,
indexed by UID.
"""
i_map = []
i_map_encoded = self.query_map_subtensor(
name="Incentive", block=block
)
i_map_encoded = self.query_map_subtensor(name="Incentive", block=block)
if i_map_encoded.records:
for netuid_, incentives_map in i_map_encoded:
if netuid_ == netuid:
i_map = incentives_map.serialize()
break

return i_map

def weights(
Expand Down
4 changes: 3 additions & 1 deletion bittensor/utils/registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,9 @@ def _solve_for_difficulty_fast(
finished_queues = [multiprocessing.Queue() for _ in range(num_processes)]
check_block = multiprocessing.Lock()

hotkey_bytes = wallet.coldkeypub.public_key if netuid == -1 else wallet.hotkey.public_key
hotkey_bytes = (
wallet.coldkeypub.public_key if netuid == -1 else wallet.hotkey.public_key
)
# Start consumers
solvers = [
_Solver(
Expand Down