From 14921d35c4772c5b95c9518f67fb82308fea9e61 Mon Sep 17 00:00:00 2001 From: Cameron Fairchild Date: Sat, 12 Aug 2023 10:57:05 -0400 Subject: [PATCH 1/7] make sure to serve the axon first --- openvalidators/neuron.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/openvalidators/neuron.py b/openvalidators/neuron.py index a52da3c..9d08c7c 100644 --- a/openvalidators/neuron.py +++ b/openvalidators/neuron.py @@ -131,6 +131,12 @@ def __init__(self): axon = bt.axon( wallet=self.wallet, metagraph=self.metagraph, config=self.config ) + self.subtensor.serve_axon( + netuid=self.config.netuid, + axon=axon, + use_upnpc=False, + wait_for_finalization=True, + ) del axon From 79b40694b155e0a87af0c262202da4a0ef06f587 Mon Sep 17 00:00:00 2001 From: Cameron Fairchild Date: Sat, 12 Aug 2023 10:58:44 -0400 Subject: [PATCH 2/7] bump version --- openvalidators/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openvalidators/__init__.py b/openvalidators/__init__.py index 10d715d..87cf974 100644 --- a/openvalidators/__init__.py +++ b/openvalidators/__init__.py @@ -28,6 +28,6 @@ from . import weights from . import event -__version__ = "1.1.7" +__version__ = "1.1.8" version_split = __version__.split(".") __spec_version__ = (1000 * int(version_split[0])) + (10 * int(version_split[1])) + (1 * int(version_split[2])) From 102170415846c6c924f3638537f32d3f3e5765b2 Mon Sep 17 00:00:00 2001 From: Cameron Fairchild Date: Sat, 12 Aug 2023 11:06:04 -0400 Subject: [PATCH 3/7] add changelog --- CHANGELOG.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d58a7ee..86792ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## 1.1.8 / 2023-08-12 + +## What's Changed +- Make sure to serve axon first by @camfairchild in 14921d35c + + +**Full Changelog**: https://github.com/opentensor/validators/compare/v1.1.7...v1.1.8 + + ## 1.1.7 / 2023-08-11 ### What’s Changed - Hotfix cutoff limit by @Eugene-hu in #126 From eb393815e205da6a907391650ce7fe4c381db610 Mon Sep 17 00:00:00 2001 From: Cameron Fairchild Date: Sat, 12 Aug 2023 12:52:32 -0400 Subject: [PATCH 4/7] Add axon off --- openvalidators/config.py | 8 ++++++++ openvalidators/neuron.py | 27 +++++++++++++++------------ 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/openvalidators/config.py b/openvalidators/config.py index d773032..19b9f88 100644 --- a/openvalidators/config.py +++ b/openvalidators/config.py @@ -166,6 +166,14 @@ def add_args(cls, parser): default=4096, ) + parser.add_argument( + "--neuron.axon_off", + "--axon_off", + action="store_true", + help="Don't attempt to serve an Axon.", + default=False, + ) + parser.add_argument("--wandb.off", action="store_true", help="Turn off wandb.", default=False) parser.add_argument( "--wandb.project_name", diff --git a/openvalidators/neuron.py b/openvalidators/neuron.py index 9d08c7c..0a49601 100644 --- a/openvalidators/neuron.py +++ b/openvalidators/neuron.py @@ -127,18 +127,21 @@ def __init__(self): self.gating_model = GatingModel(metagraph=self.metagraph, config=self.config).to(self.device) bt.logging.debug(str(self.gating_model)) - bt.logging.debug('serving ip to chain...') - axon = bt.axon( - wallet=self.wallet, metagraph=self.metagraph, config=self.config - ) - self.subtensor.serve_axon( - netuid=self.config.netuid, - axon=axon, - use_upnpc=False, - wait_for_finalization=True, - ) - - del axon + if not self.config.neuron.axon_off: + bt.logging.debug('serving ip to chain...') + axon = bt.axon( + wallet=self.wallet, metagraph=self.metagraph, config=self.config + ) + self.subtensor.serve_axon( + netuid=self.config.netuid, + axon=axon, + use_upnpc=False, + wait_for_finalization=True, + ) + + del axon + else: + bt.logging.debug('axon off, not serving ip to chain.') # Dendrite pool for querying the network during training. bt.logging.debug("loading", "dendrite_pool") From 99f64b84aee2ccd2c4dc09bf7e735b7c48dc3438 Mon Sep 17 00:00:00 2001 From: Cameron Fairchild Date: Sat, 12 Aug 2023 12:52:45 -0400 Subject: [PATCH 5/7] catch errors for axon serve, skip if error --- openvalidators/neuron.py | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/openvalidators/neuron.py b/openvalidators/neuron.py index 0a49601..fadfb17 100644 --- a/openvalidators/neuron.py +++ b/openvalidators/neuron.py @@ -129,17 +129,27 @@ def __init__(self): if not self.config.neuron.axon_off: bt.logging.debug('serving ip to chain...') - axon = bt.axon( - wallet=self.wallet, metagraph=self.metagraph, config=self.config - ) - self.subtensor.serve_axon( - netuid=self.config.netuid, - axon=axon, - use_upnpc=False, - wait_for_finalization=True, - ) + try: + axon = bt.axon( + wallet=self.wallet, metagraph=self.metagraph, config=self.config + ) + + try: + self.subtensor.serve_axon( + netuid=self.config.netuid, + axon=axon, + use_upnpc=False, + wait_for_finalization=True, + ) + + del axon + except Exception as e: + bt.logging.error(f'Failed to serve Axon with exception: {e}') + pass + except Exception as e: + bt.logging.error(f'Failed to create Axon initialize with exception: {e}') + pass - del axon else: bt.logging.debug('axon off, not serving ip to chain.') From 04a3261fdfd8ee08ff5cf1b712e82fb5811d13ef Mon Sep 17 00:00:00 2001 From: Cameron Fairchild Date: Sat, 12 Aug 2023 13:36:46 -0400 Subject: [PATCH 6/7] fix ordering --- openvalidators/neuron.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openvalidators/neuron.py b/openvalidators/neuron.py index fadfb17..bbbfd7e 100644 --- a/openvalidators/neuron.py +++ b/openvalidators/neuron.py @@ -141,11 +141,11 @@ def __init__(self): use_upnpc=False, wait_for_finalization=True, ) - - del axon except Exception as e: bt.logging.error(f'Failed to serve Axon with exception: {e}') pass + + del axon except Exception as e: bt.logging.error(f'Failed to create Axon initialize with exception: {e}') pass From c447229b4b31fd8b3088c67314787b904b8cf391 Mon Sep 17 00:00:00 2001 From: Cameron Fairchild Date: Sat, 12 Aug 2023 13:38:49 -0400 Subject: [PATCH 7/7] add comment per @opentaco --- openvalidators/config.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/openvalidators/config.py b/openvalidators/config.py index 19b9f88..4c00c21 100644 --- a/openvalidators/config.py +++ b/openvalidators/config.py @@ -170,7 +170,9 @@ def add_args(cls, parser): "--neuron.axon_off", "--axon_off", action="store_true", - help="Don't attempt to serve an Axon.", + # Note: the validator needs to serve an Axon with their IP or they may + # be blacklisted by the firewall of serving peers on the network. + help="Set this flag to not attempt to serve an Axon.", default=False, )