Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
f3cca53
(un)Staking multiple avoid tx limit (#1244)
camfairchild Mar 29, 2023
d989163
additional logging for prometheus
Eugene-hu Mar 30, 2023
660f63e
Merge branch 'staging' of https://github.com/opentensor/bittensor int…
Eugene-hu Mar 31, 2023
1857eff
additional logging for prometheus (#1246)
Eugene-hu Apr 3, 2023
9a3d8ee
Dataset fix (#1249)
isabella618033 Apr 3, 2023
6cf0380
Grab delegates details from GitHub (#1245)
camfairchild Apr 4, 2023
5ce8ff2
Add raw spec for local test and new bins (#1243)
camfairchild Apr 6, 2023
1cb9bed
Fix list_delegates on non-archive nodes (#1232)
camfairchild Apr 6, 2023
4741f62
Blacklist fixes + depreciation of old signatures (#1240)
Eugene-hu Apr 12, 2023
691607b
Improve development workflow documentation
Apr 13, 2023
5039d88
[BIT-636] Change u16 weight normalization to max-upscaling (#1241)
opentaco Apr 14, 2023
a28fdc3
Merge branch 'staging' of https://github.com/opentensor/bittensor int…
Eugene-hu Apr 14, 2023
92d6bac
remove duplicate command #1228 (#1231)
camfairchild Apr 18, 2023
b8661dc
Merge branch 'staging' of https://github.com/opentensor/bittensor int…
Eugene-hu Apr 18, 2023
9e876fb
test_forward_priority_2nd_request_timeout fix (#1276)
isabella618033 Apr 19, 2023
065de16
Remove btcli query and btcli set_weights (#1144)
camfairchild Apr 19, 2023
3b57662
Merge branch 'staging' of https://github.com/opentensor/bittensor int…
Eugene-hu Apr 20, 2023
3de56cc
Merge releases 4.0.0 and 4.0.1 back to staging (#1306)
camfairchild Apr 27, 2023
d283d39
Merge branch 'staging' of https://github.com/opentensor/bittensor int…
Eugene-hu May 19, 2023
55fa419
Merge branch 'staging' into dev/techdebt_pathes_quac
ifrit98 May 23, 2023
b4b7681
Update DEVELOPMENT_WORKFLOW.md
ifrit98 May 23, 2023
d411536
Merge pull request #1262 from opentensor/dev/techdebt_pathes_quac
ifrit98 May 24, 2023
eab306a
Merge branch 'staging' of https://github.com/opentensor/bittensor int…
Eugene-hu Oct 5, 2023
c23f9e6
Merge remote-tracking branch 'origin/master' into staging
Eugene-hu Oct 5, 2023
303b4fd
final fixes
Eugene-hu Oct 5, 2023
ff57031
staging updates and fixes (#1540)
ifrit98 Oct 5, 2023
b661f79
Add root get_weights command to btcli (#1536)
Oct 5, 2023
d80c057
Fix typo (#1543)
steffencruz Oct 10, 2023
6b69d96
remove duplicated debug message in dendrite (#1544)
ifrit98 Oct 10, 2023
30e5fd3
Cli fix (#1541)
ifrit98 Oct 10, 2023
ff40702
update faucet helpstr (#1542)
ifrit98 Oct 10, 2023
e6c02b6
Added mechanism to sum all delegated tao (#1547)
shibshib Oct 17, 2023
de71c4a
Dict hash fix (#1548)
ifrit98 Oct 17, 2023
75858f9
update version
ifrit98 Oct 17, 2023
e943aee
update changelog
ifrit98 Oct 17, 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
29 changes: 29 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,34 @@
# Changelog

## 6.1.0 / 2023-10-17

## What's Changed
* (un)Staking multiple avoid tx limit by @camfairchild in https://github.com/opentensor/bittensor/pull/1244
* additional logging for prometheus by @Eugene-hu in https://github.com/opentensor/bittensor/pull/1246
* Dataset fix by @isabella618033 in https://github.com/opentensor/bittensor/pull/1249
* Grab delegates details from GitHub by @camfairchild in https://github.com/opentensor/bittensor/pull/1245
* Add raw spec for local test and new bins by @camfairchild in https://github.com/opentensor/bittensor/pull/1243
* Fix list_delegates on non-archive nodes by @camfairchild in https://github.com/opentensor/bittensor/pull/1232
* Blacklist fixes + depreciation of old signatures by @Eugene-hu in https://github.com/opentensor/bittensor/pull/1240
* [BIT-636] Change u16 weight normalization to max-upscaling by @opentaco in https://github.com/opentensor/bittensor/pull/1241
* remove duplicate command #1228 by @camfairchild in https://github.com/opentensor/bittensor/pull/1231
* test_forward_priority_2nd_request_timeout fix by @isabella618033 in https://github.com/opentensor/bittensor/pull/1276
* Remove btcli query and btcli set_weights by @camfairchild in https://github.com/opentensor/bittensor/pull/1144
* Merge releases 4.0.0 and 4.0.1 back to staging by @camfairchild in https://github.com/opentensor/bittensor/pull/1306
* Improve development workflow documentation by @quac88 in https://github.com/opentensor/bittensor/pull/1262
* staging updates and fixes by @ifrit98 in https://github.com/opentensor/bittensor/pull/1540
* Add root get_weights command to btcli by @Rubberbandits in https://github.com/opentensor/bittensor/pull/1536
* Fix typo by @steffencruz in https://github.com/opentensor/bittensor/pull/1543
* remove duplicated debug message in dendrite by @ifrit98 in https://github.com/opentensor/bittensor/pull/1544
* Cli fix by @ifrit98 in https://github.com/opentensor/bittensor/pull/1541
* update faucet helpstr by @ifrit98 in https://github.com/opentensor/bittensor/pull/1542
* Added mechanism to sum all delegated tao by @shibshib in https://github.com/opentensor/bittensor/pull/1547
* Dict hash fix by @ifrit98 in https://github.com/opentensor/bittensor/pull/1548


**Full Changelog**: https://github.com/opentensor/bittensor/compare/v6.0.1...v6.1.0


## 6.0.1 / 2023-10-02

## What's Changed
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.0.1
6.1.0
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__ = "6.0.1"
__version__ = "6.1.0"
version_split = __version__.split(".")
__version_as_int__ = (
(100 * int(version_split[0]))
Expand Down
15 changes: 5 additions & 10 deletions bittensor/axon.py
Original file line number Diff line number Diff line change
Expand Up @@ -526,16 +526,11 @@ async def some_endpoint(body_dict: dict = Depends(verify_body_integrity)):

# Load the body dict and check if all required field hashes match
body_dict = json.loads(request_body)
field_hashes = []
for required_field in required_hash_fields:
# Hash the field in the body to compare against the header hashes
body_value = body_dict.get(required_field, None)
if body_value == None:
raise ValueError(f"Missing required field {required_field}")
field_hash = bittensor.utils.hash(str(body_value))
field_hashes.append(field_hash)

parsed_body_hash = bittensor.utils.hash("".join(field_hashes))

# Reconstruct the synapse object from the body dict and recompute the hash
syn = self.forward_class_types[request_name](**body_dict)
parsed_body_hash = syn.body_hash # Rehash the body from request

body_hash = request.headers.get("computed_body_hash", "")
if parsed_body_hash != body_hash:
raise ValueError(
Expand Down
1 change: 1 addition & 0 deletions bittensor/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
"commands": {
"list": RootList,
"weights": RootSetWeightsCommand,
"get_weights": RootGetWeightsCommand,
"senate_vote": VoteCommand,
"register": RootRegisterCommand,
"proposals": ProposalsCommand,
Expand Down
7 changes: 6 additions & 1 deletion bittensor/commands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,9 @@
SubnetHyperparamsCommand,
SubnetGetHyperparamsCommand,
)
from .root import RootRegisterCommand, RootList, RootSetWeightsCommand
from .root import (
RootRegisterCommand,
RootList,
RootSetWeightsCommand,
RootGetWeightsCommand,
)
3 changes: 3 additions & 0 deletions bittensor/commands/delegates.py
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,7 @@ def run(cli):
table.add_column("[overline white]VPERMIT", justify="right", no_wrap=True)
table.add_column("[overline white]24h/k\u03C4", style="green", justify="center")
table.add_column("[overline white]Desc", style="rgb(50,163,219)")
total_delegated = 0

for wallet in tqdm(wallets):
if not wallet.coldkeypub_file.exists_on_device():
Expand All @@ -544,6 +545,7 @@ def run(cli):
my_delegates[delegate[0].hotkey_ss58] = staked

delegates.sort(key=lambda delegate: delegate[0].total_stake, reverse=True)
total_delegated += sum(my_delegates.values())

registered_delegate_info: Optional[
DelegatesDetails
Expand Down Expand Up @@ -602,6 +604,7 @@ def run(cli):
)

bittensor.__console__.print(table)
bittensor.__console__.print("Total delegated Tao: {}".format(total_delegated))

@staticmethod
def add_args(parser: argparse.ArgumentParser):
Expand Down
82 changes: 43 additions & 39 deletions bittensor/commands/overview.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,15 @@ def run(cli: "bittensor.cli"):
total_coldkey_stake_from_metagraph = defaultdict(
lambda: bittensor.Balance(0.0)
)
checked_hotkeys = set()
for neuron_list in neurons.values():
for neuron in neuron_list:
if neuron.hotkey in checked_hotkeys:
continue
total_coldkey_stake_from_metagraph[
neuron.coldkey
] += neuron.stake_dict[neuron.coldkey]
checked_hotkeys.add(neuron.hotkey)

alerts_table = Table(show_header=True, header_style="bold magenta")
alerts_table.add_column("🥩 alert!")
Expand Down Expand Up @@ -209,40 +213,38 @@ def run(cli: "bittensor.cli"):
)
executor.shutdown(wait=True) # wait for all complete

for result in results:
coldkey_wallet, de_registered_stake, err_msg = result
if err_msg is not None:
console.print(err_msg)
for result in results:
coldkey_wallet, de_registered_stake, err_msg = result
if err_msg is not None:
console.print(err_msg)

if len(de_registered_stake) == 0:
continue # We have no de-registered stake with this coldkey.

de_registered_neurons = []
for hotkey_addr, our_stake in de_registered_stake:
# Make a neuron info lite for this hotkey and coldkey.
de_registered_neuron = bittensor.NeuronInfoLite._null_neuron()
de_registered_neuron.hotkey = hotkey_addr
de_registered_neuron.coldkey = (
coldkey_wallet.coldkeypub.ss58_address
)
de_registered_neuron.total_stake = bittensor.Balance(our_stake)

if len(de_registered_stake) == 0:
continue # We have no de-registered stake with this coldkey.

de_registered_neurons = []
for hotkey_addr, our_stake in de_registered_stake:
# Make a neuron info lite for this hotkey and coldkey.
de_registered_neuron = bittensor.NeuronInfoLite._null_neuron()
de_registered_neuron.hotkey = hotkey_addr
de_registered_neuron.coldkey = (
coldkey_wallet.coldkeypub.ss58_address
)
de_registered_neuron.total_stake = bittensor.Balance(our_stake)

de_registered_neurons.append(de_registered_neuron)

# Add this hotkey to the wallets dict
wallet_ = bittensor.Wallet(
name=wallet,
)
wallet_.hotkey = hotkey_addr
wallet.hotkey_str = hotkey_addr[
:5
] # Max length of 5 characters
hotkey_coldkey_to_hotkey_wallet[hotkey_addr][
coldkey_wallet.coldkeypub.ss58_address
] = wallet_

# Add neurons to overview.
neurons["-1"].extend(de_registered_neurons)
de_registered_neurons.append(de_registered_neuron)

# Add this hotkey to the wallets dict
wallet_ = bittensor.Wallet(
name=wallet,
)
wallet_.hotkey = hotkey_addr
wallet.hotkey_str = hotkey_addr[:5] # Max length of 5 characters
hotkey_coldkey_to_hotkey_wallet[hotkey_addr][
coldkey_wallet.coldkeypub.ss58_address
] = wallet_

# Add neurons to overview.
neurons["-1"].extend(de_registered_neurons)

# Setup outer table.
grid = Table.grid(pad_edge=False)
Expand Down Expand Up @@ -279,7 +281,11 @@ def run(cli: "bittensor.cli"):
total_emission = 0

for nn in neurons[str(netuid)]:
hotwallet = hotkey_coldkey_to_hotkey_wallet[nn.hotkey][nn.coldkey]
hotwallet = hotkey_coldkey_to_hotkey_wallet.get(nn.hotkey, {}).get(
nn.coldkey, None
)
if not hotwallet:
continue
nn: bittensor.NeuronInfoLite
uid = nn.uid
active = nn.active
Expand Down Expand Up @@ -551,13 +557,11 @@ def _get_de_registered_stake_for_coldkey_wallet(
## Filter out hotkeys that are in our wallets
## Filter out hotkeys that are delegates.
def _filter_stake_info(stake_info: "bittensor.StakeInfo") -> bool:
hotkey_addr, our_stake = stake_info

if our_stake == 0:
if stake_info.stake == 0:
return False # Skip hotkeys that we have no stake with.
if hotkey_addr in all_hotkey_addresses:
if stake_info.hotkey_ss58 in all_hotkey_addresses:
return False # Skip hotkeys that are in our wallets.
if subtensor.is_hotkey_delegate(hotkey_ss58=hotkey_addr):
if subtensor.is_hotkey_delegate(hotkey_ss58=stake_info.hotkey_ss58):
return False # Skip hotkeys that are delegates, they show up in btcli my_delegates table.

return True
Expand Down
2 changes: 1 addition & 1 deletion bittensor/commands/register.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ def run(cli):
@staticmethod
def add_args(parser: argparse.ArgumentParser):
run_faucet_parser = parser.add_parser(
"faucet", help="""Register a wallet to a network."""
"faucet", help="""Perform PoW to receieve test TAO in your wallet."""
)
run_faucet_parser.add_argument(
"--register.num_processes",
Expand Down
59 changes: 59 additions & 0 deletions bittensor/commands/root.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,3 +210,62 @@ def check_config(config: "bittensor.config"):
if not config.is_set("wallet.hotkey") and not config.no_prompt:
hotkey = Prompt.ask("Enter hotkey name", default=defaults.wallet.hotkey)
config.wallet.hotkey = str(hotkey)


class RootGetWeightsCommand:
@staticmethod
def run(cli):
r"""Get weights for root network."""
subtensor = bittensor.subtensor(config=cli.config)
weights = subtensor.weights(0)

table = Table(show_footer=False)
table.title = "[white]Root Network Weights"
table.add_column(
"[overline white]UID",
footer_style="overline white",
style="rgb(50,163,219)",
no_wrap=True,
)
table.add_column(
"[overline white]NETUID",
footer_style="overline white",
justify="right",
style="green",
no_wrap=True,
)
table.add_column(
"[overline white]WEIGHT",
footer_style="overline white",
justify="right",
style="green",
no_wrap=True,
)
table.show_footer = True

for matrix in weights:
uid = matrix[0]
for weight_data in matrix[1]:
table.add_row(
str(uid),
str(weight_data[0]),
"{:0.2f}%".format((weight_data[1] / 65535) * 100),
)

table.box = None
table.pad_edge = False
table.width = None
bittensor.__console__.print(table)

@staticmethod
def add_args(parser: argparse.ArgumentParser):
parser = parser.add_parser(
"get_weights", help="""Get weights for root network."""
)

bittensor.wallet.add_args(parser)
bittensor.subtensor.add_args(parser)

@staticmethod
def check_config(config: "bittensor.config"):
pass
3 changes: 0 additions & 3 deletions bittensor/dendrite.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,6 @@ async def call(

# Set process time and log the response
synapse.dendrite.process_time = str(time.time() - start_time)
bittensor.logging.debug(
f"dendrite | <-- | {synapse.get_total_size()} B | {synapse.name} | {synapse.axon.hotkey} | {synapse.axon.ip}:{str(synapse.axon.port)} | {synapse.axon.status_code} | {synapse.axon.status_message}"
)

except aiohttp.ClientConnectorError as e:
synapse.dendrite.status_code = "503"
Expand Down
2 changes: 1 addition & 1 deletion bittensor/extrinsics/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def register_subnetwork_extrinsic(
burn_cost = bittensor.utils.balance.Balance(subtensor.get_subnet_burn_cost())
if burn_cost > your_balance:
bittensor.__console__.print(
f"Your balance of: [green]{your_balance}[/green] is not enough to pay the subnet burn cost of: [green]{burn_cost}[/green]"
f"Your balance of: [green]{your_balance}[/green] is not enough to pay the subnet lock cost of: [green]{burn_cost}[/green]"
)
return False

Expand Down
2 changes: 1 addition & 1 deletion bittensor/synapse.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ def body_hash(self) -> str:
hashes = []

# Getting the fields of the instance
instance_fields = self.__dict__
instance_fields = self.dict()

for field, value in instance_fields.items():
# If the field is required in the subclass schema, hash and add it.
Expand Down