Skip to content

Commit

Permalink
[Release] v4.0.0 (#1271)
Browse files Browse the repository at this point in the history
* bump version

* Fix permissions for release github script (#1224)

Co-authored-by: Cameron Fairchild <cameron@opentensor.ai>

* should be 4.1.0

* Revert "should be 4.1.0"

This reverts commit 3db08ea.

* Staging into Release branch (#1275)

* (un)Staking multiple avoid tx limit (#1244)

* add tx rate limit

* wait for tx limit if not done multi stake/unstake

* dont "decrypt" hotkey

* additional logging for prometheus (#1246)

* Dataset fix (#1249)

* fix

* added try except

* Grab delegates details from GitHub (#1245)

* add url to init

* add dataclass and util functions

* use in cli

* remove delegates json

---------

Co-authored-by: joeylegere <joeylegere@gmail.com>

* Add raw spec for local test and new bins (#1243)

* add spec and new bins

* fix config netuid

* use dot get

* check if config netuid is list

* add start to mockstatus

* add attr to mock neuron

* add info to mock from neurons

* change ordering of neuron dict to namespace

* remove test for wandb for axon

* use regex for looser match

* fix blacklist metagraph mock

* use real mock netuid

* use mock network and netuid in constructor

* fix patch

* patch delegate check

* use mock network and netuid

* remove check for wallet hotkey

* fix tests for subtensor init

* dont set netuid for overview test

* typo in docstring

* add mock status stop

* add low mock tx limit

* oops typo

* use dot get

* add wait for final and incl args

* use args during setup

* update bins and use 100ms blocktime

* pass block arg

* remove bittensor.logging and a old test

* use random port

* backward fix

* fix block time to 1s

* compile no symb on linux

* compile no symb mac

* remove useless init on var

* use dot get for new flags

* update test durations

* update test durations

* use dot get for config

* output error msg

* mock to_default

* remove to defaults in help

* reduce neruons, remove flaky test

* deactivate test

* mvoe key pair tests out of the subtensor interface

---------

Co-authored-by: Eugene <etesting007@gmail.com>

* Fix list_delegates on non-archive nodes (#1232)

* Change how pull of archival data is handled

* fix for list_delegates too

* .

* use empty dict

* fix spacing

* specify exception

* log out

* add space in log message

* use warning instead

* Blacklist fixes + depreciation of old signatures (#1240)

* fixes blacklist error message + remove

* remove checks for parse signature

* remove sign v1 tests

* fix for the syanpse checks

* fix tests and remove duplicate sign

* [BIT-636] Change u16 weight normalization to max-upscaling (#1241)

* Change u16 weight normalization to max-upscaling

Use full u16 bitwidth so that max_weight=U16_MAX, then rely on subtensor epoch to properly normalize weights in I32F32. This means that weights submission extrinsic to subtensor does not have to be pre-normalized.

* Skip zero sum in weight conversion

* Round u16 weights

* remove duplicate command #1228 (#1231)

* remove duplicate command #1228

* Extract create_parser for cli testing

* mark as private

* use in tests and test for duplicates

* fix test using mock prompt answers

* test_forward_priority_2nd_request_timeout fix (#1276)

fix

* Remove btcli query and btcli set_weights (#1144)

.

---------

Co-authored-by: Eugene-hu <85906264+Eugene-hu@users.noreply.github.com>
Co-authored-by: isabella618033 <49876827+isabella618033@users.noreply.github.com>
Co-authored-by: joeylegere <joeylegere@gmail.com>
Co-authored-by: Eugene <etesting007@gmail.com>
Co-authored-by: opentaco <93473497+opentaco@users.noreply.github.com>

* Remove codecov (#1282)

* Use alt new preseal (#1269)

* use new preseal for reg

* bump cubit req

* fix arg order issue

* cubit req back

* use alt impl

* fix typehint

* use 512

* modify tests for new format

* refactor functions to use helpers and remove useless

* refactor functions

* add test for CPU solver

* modify tests for privitized module and methods

* private register cuda

* move formatting funcs

* use powsolution

* privitize most methods

* fix test

* fix perms

* remove test script

* remove debug

* fix call

* fix seal

* fix combined hash

* move to method

* fix test using real example

* update mock bins

* use new builder

* fix block update tests

* fix some patching in tests

* mock live display for some tests

* fix chain mock

* update linux bin

* add mock network flag

* set max diff at 0 for mock netuid 1

* set min diff too

* add try catch for setup

* add some logging during tests

* don't submit on cli register

* update test durations

* fix test to use mock keypair

* return mock wallet

* should use subtensor instance during rereg

* update node subtensor bins

* use fixtures and multiple subtensor instances

* changelog update

* skip CLI tests (#1284)

* skip tests

* dont test mock functions

* update test durations

---------

Co-authored-by: Eduardo García <garciaruiz.edu+github@gmail.com>
Co-authored-by: Eugene-hu <85906264+Eugene-hu@users.noreply.github.com>
Co-authored-by: isabella618033 <49876827+isabella618033@users.noreply.github.com>
Co-authored-by: joeylegere <joeylegere@gmail.com>
Co-authored-by: Eugene <etesting007@gmail.com>
Co-authored-by: opentaco <93473497+opentaco@users.noreply.github.com>
  • Loading branch information
7 people committed Apr 20, 2023
1 parent 9443c66 commit 9cda4d9
Show file tree
Hide file tree
Showing 63 changed files with 1,456 additions and 1,531 deletions.
536 changes: 220 additions & 316 deletions .test_durations

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
# Changelog

## 4.0.0 / 2023-04-20

## What's Changed
* add mnrv-ai to delegates.json by @SFuller4 in https://github.com/opentensor/bittensor/pull/1226
* Update delegates list by @adriansmares in https://github.com/opentensor/bittensor/pull/1225
* Update delegates.json by @whiterhinoTAO in https://github.com/opentensor/bittensor/pull/1230
* Hotfix - Cli unstake fix by @Eugene-hu in https://github.com/opentensor/bittensor/pull/1233
* Fix permissions for release github script by @eduardogr in https://github.com/opentensor/bittensor/pull/1224
* Staging into Release branch by @camfairchild in https://github.com/opentensor/bittensor/pull/1275
* Remove codecov by @camfairchild in https://github.com/opentensor/bittensor/pull/1282
* Use alt new preseal by @camfairchild in https://github.com/opentensor/bittensor/pull/1269

## New Contributors
* @SFuller4 made their first contribution in https://github.com/opentensor/bittensor/pull/1226
* @whiterhinoTAO made their first contribution in https://github.com/opentensor/bittensor/pull/1230

**Full Changelog**: https://github.com/opentensor/bittensor/compare/v3.7.0...v4.0.0


## 3.6.3 / 2023-01-21

## What's Changed
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.7.0
4.0.0
5 changes: 4 additions & 1 deletion bittensor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
nest_asyncio.apply()

# Bittensor code and protocol version.
__version__ = '3.7.0'
__version__ = '4.0.0'
version_split = __version__.split(".")
__version_as_int__ = (100 * int(version_split[0])) + (10 * int(version_split[1])) + (1 * int(version_split[2]))
__new_signature_version__ = 360
Expand Down Expand Up @@ -59,6 +59,9 @@ def turn_console_off():
# Pip address for versioning
__pipaddress__ = 'https://pypi.org/pypi/bittensor/json'

# Raw github url for delegates registry file
__delegates_details_url__: str = "https://github.com/raw/opentensor/bittensor-delegates/main/public/delegates.json"

# Substrate ss58_format
__ss58_format__ = 42

Expand Down
43 changes: 11 additions & 32 deletions bittensor/_axon/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,22 +374,6 @@ def __init__(
self.blacklist = blacklist
self.receiver_hotkey = receiver_hotkey

def parse_legacy_signature(
self, signature: str
) -> Union[Tuple[int, str, str, str, int], None]:
r"""Attempts to parse a signature using the legacy format, using `bitxx` as a separator"""
parts = signature.split("bitxx")
if len(parts) < 4:
return None
try:
nonce = int(parts[0])
parts = parts[1:]
except ValueError:
return None
receptor_uuid, parts = parts[-1], parts[:-1]
signature, parts = parts[-1], parts[:-1]
sender_hotkey = "".join(parts)
return (nonce, sender_hotkey, signature, receptor_uuid, 1)

def parse_signature_v2(
self, signature: str
Expand All @@ -405,7 +389,7 @@ def parse_signature_v2(
sender_hotkey = parts[1]
signature = parts[2]
receptor_uuid = parts[3]
return (nonce, sender_hotkey, signature, receptor_uuid, 2)
return (nonce, sender_hotkey, signature, receptor_uuid)

def parse_signature(
self, metadata: Dict[str, str]
Expand All @@ -418,10 +402,9 @@ def parse_signature(
if int(version) < 370:
raise Exception("Incorrect Version")

for parser in [self.parse_signature_v2, self.parse_legacy_signature]:
parts = parser(signature)
if parts is not None:
return parts
parts = self.parse_signature_v2(signature)
if parts is not None:
return parts
raise Exception("Unknown signature format")

def check_signature(
Expand All @@ -430,17 +413,12 @@ def check_signature(
sender_hotkey: str,
signature: str,
receptor_uuid: str,
format: int,
):
r"""verification of signature in metadata. Uses the pubkey and nonce"""
keypair = Keypair(ss58_address=sender_hotkey)
# Build the expected message which was used to build the signature.
if format == 2:
message = f"{nonce}.{sender_hotkey}.{self.receiver_hotkey}.{receptor_uuid}"
elif format == 1:
message = f"{nonce}{sender_hotkey}{receptor_uuid}"
else:
raise Exception("Invalid signature version")
message = f"{nonce}.{sender_hotkey}.{self.receiver_hotkey}.{receptor_uuid}"

# Build the key which uniquely identifies the endpoint that has signed
# the message.
endpoint_key = f"{sender_hotkey}:{receptor_uuid}"
Expand All @@ -467,8 +445,10 @@ def black_list_checking(self, hotkey: str, method: str):
if request_type is None:
raise Exception("Unknown request type")

if self.blacklist(hotkey, request_type):
raise Exception("Request type is blacklisted")
failed, error_message = self.blacklist(hotkey, request_type)
if failed:
raise Exception(str(error_message))


def intercept_service(self, continuation, handler_call_details):
r"""Authentication between bittensor nodes. Intercepts messages and checks them"""
Expand All @@ -481,12 +461,11 @@ def intercept_service(self, continuation, handler_call_details):
sender_hotkey,
signature,
receptor_uuid,
signature_format,
) = self.parse_signature(metadata)

# signature checking
self.check_signature(
nonce, sender_hotkey, signature, receptor_uuid, signature_format
nonce, sender_hotkey, signature, receptor_uuid
)

# blacklist checking
Expand Down
25 changes: 13 additions & 12 deletions bittensor/_cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,10 @@ def __new__(
return naka_CLI(config=config)
else:
return cli_impl.CLI( config = config)

@staticmethod
def config(args: List[str]) -> 'bittensor.config':
""" From the argument parser, add config to bittensor.executor and local config
Return: bittensor.config object

@staticmethod
def __create_parser__() -> 'argparse.ArgumentParser':
""" Creates the argument parser for the bittensor cli.
"""
parser = argparse.ArgumentParser(
description=f"bittensor cli v{bittensor.__version__}",
Expand All @@ -74,7 +73,6 @@ def config(args: List[str]) -> 'bittensor.config':
RunCommand.add_args( cmd_parsers )
HelpCommand.add_args( cmd_parsers )
ListCommand.add_args( cmd_parsers )
QueryCommand.add_args( cmd_parsers )
StakeCommand.add_args( cmd_parsers )
UpdateCommand.add_args( cmd_parsers )
InspectCommand.add_args( cmd_parsers )
Expand All @@ -86,9 +84,7 @@ def config(args: List[str]) -> 'bittensor.config':
NominateCommand.add_args( cmd_parsers )
NewHotkeyCommand.add_args( cmd_parsers )
MetagraphCommand.add_args( cmd_parsers )
SetWeightsCommand.add_args( cmd_parsers )
NewColdkeyCommand.add_args( cmd_parsers )
NewHotkeyCommand.add_args( cmd_parsers )
MyDelegatesCommand.add_args( cmd_parsers )
ListSubnetsCommand.add_args( cmd_parsers )
RegenHotkeyCommand.add_args( cmd_parsers )
Expand All @@ -99,6 +95,15 @@ def config(args: List[str]) -> 'bittensor.config':
RegenColdkeypubCommand.add_args( cmd_parsers )
RecycleRegisterCommand.add_args( cmd_parsers )

return parser

@staticmethod
def config(args: List[str]) -> 'bittensor.config':
""" From the argument parser, add config to bittensor.executor and local config
Return: bittensor.config object
"""
parser = cli.__create_parser__()

# If no arguments are passed, print help text.
if len(args) == 0:
parser.print_help()
Expand Down Expand Up @@ -136,14 +141,10 @@ def check_config (config: 'bittensor.Config'):
MetagraphCommand.check_config( config )
elif config.command == "weights":
WeightsCommand.check_config( config )
elif config.command == "set_weights":
SetWeightsCommand.check_config( config )
elif config.command == "list":
ListCommand.check_config( config )
elif config.command == "inspect":
InspectCommand.check_config( config )
elif config.command == "query":
QueryCommand.check_config( config )
elif config.command == "help":
HelpCommand.check_config( config )
elif config.command == "update":
Expand Down
4 changes: 0 additions & 4 deletions bittensor/_cli/cli_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,8 @@ def run ( self ):
MetagraphCommand.run( self )
elif self.config.command == "weights":
WeightsCommand.run( self )
elif self.config.command == "set_weights":
SetWeightsCommand.run( self )
elif self.config.command == "inspect":
InspectCommand.run( self )
elif self.config.command == "query":
QueryCommand.run( self )
elif self.config.command == "help":
HelpCommand.run( self )
elif self.config.command == 'update':
Expand Down
3 changes: 1 addition & 2 deletions bittensor/_cli/commands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@
from .inspect import InspectCommand
from .metagraph import MetagraphCommand
from .list import ListCommand
from .weights import SetWeightsCommand, WeightsCommand
from .query import QueryCommand
from .weights import WeightsCommand
from .misc import HelpCommand, UpdateCommand, ListSubnetsCommand
Loading

0 comments on commit 9cda4d9

Please sign in to comment.