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 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])) diff --git a/openvalidators/config.py b/openvalidators/config.py index d773032..4c00c21 100644 --- a/openvalidators/config.py +++ b/openvalidators/config.py @@ -166,6 +166,16 @@ def add_args(cls, parser): default=4096, ) + parser.add_argument( + "--neuron.axon_off", + "--axon_off", + action="store_true", + # 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, + ) + 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 a52da3c..bbbfd7e 100644 --- a/openvalidators/neuron.py +++ b/openvalidators/neuron.py @@ -127,12 +127,31 @@ 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 - ) + if not self.config.neuron.axon_off: + bt.logging.debug('serving ip to chain...') + 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, + ) + 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 - 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")