Skip to content

Commit

Permalink
fix: check entire commitment string
Browse files Browse the repository at this point in the history
  • Loading branch information
distributedstatemachine committed Nov 30, 2024
1 parent 767b446 commit 53e769b
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 18 deletions.
25 changes: 16 additions & 9 deletions neurons/miner.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,22 @@ def __init__(self):
tplr.logger.info(f'\nWallet: {self.wallet}\nSubtensor: {self.subtensor}\nMetagraph: {self.metagraph}\nUID: {self.uid}')

# Init bucket.
# try:
# tplr.logger.info(f'bucket_name: {tplr.config.BUCKET_SECRETS["bucket_name"]}')
# commitment = self.chain_manager.get_commitment(self.uid)
# if tplr.config.BUCKET_SECRETS["bucket_name"] != commitment.name:
# raise ValueError('')
# except Exception:
# tplr.commit(self.subtensor, self.wallet, self.config.netuid)
# tplr.logger.info('Bucket:' + tplr.config.BUCKET_SECRETS["bucket_name"])
tplr.commit(self.subtensor, self.wallet, self.config.netuid)
try:
tplr.logger.info(f'bucket_name: {tplr.config.BUCKET_SECRETS["bucket_name"]}')
commitment = self.chain_manager.get_commitment(self.uid)
current_bucket = tplr.Bucket(
name=tplr.config.BUCKET_SECRETS["bucket_name"],
account_id=tplr.config.BUCKET_SECRETS["account_id"],
access_key_id=tplr.config.BUCKET_SECRETS["access_key_id"],
secret_access_key=tplr.config.BUCKET_SECRETS["secret_access_key"]
)
if current_bucket != commitment:
# TODO: Handle mismatched commitments
raise ValueError("Bucket commitment data does not match.")
raise ValueError('')
except Exception:
tplr.commit(self.subtensor, self.wallet, self.config.netuid)
tplr.logger.info('Bucket:' + tplr.config.BUCKET_SECRETS["bucket_name"])

# Init Wandb.
# Ensure the wandb directory exists
Expand Down
26 changes: 17 additions & 9 deletions neurons/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,23 @@ def __init__(self):
tplr.logger.info(f'\nWallet: {self.wallet}\nSubtensor: {self.subtensor}\nMetagraph: {self.metagraph}\nUID: {self.uid}')

# Init bucket.
# try:
# tplr.logger.info(f'bucket_name: {tplr.config.BUCKET_SECRETS["bucket_name"]}')
# commitment = self.chain_manager.get_commitment(self.uid)
# if tplr.config.BUCKET_SECRETS["bucket_name"] != commitment.name:
# raise ValueError('')
# except Exception:
# tplr.commit(self.subtensor, self.wallet, self.config.netuid)
# tplr.logger.info('Bucket:' + tplr.config.BUCKET_SECRETS["bucket_name"])
tplr.commit(self.subtensor, self.wallet, self.config.netuid)
try:
tplr.logger.info(f'bucket_name: {tplr.config.BUCKET_SECRETS["bucket_name"]}')
commitment = self.chain_manager.get_commitment(self.uid)
current_bucket = tplr.Bucket(
name=tplr.config.BUCKET_SECRETS["bucket_name"],
account_id=tplr.config.BUCKET_SECRETS["account_id"],
access_key_id=tplr.config.BUCKET_SECRETS["access_key_id"],
secret_access_key=tplr.config.BUCKET_SECRETS["secret_access_key"]
)
if current_bucket != commitment:
# TODO: Handle mismatched commitments
raise ValueError("Bucket commitment data does not match.")
raise ValueError('')
except Exception:
tplr.commit(self.subtensor, self.wallet, self.config.netuid)
tplr.logger.info('Bucket:' + tplr.config.BUCKET_SECRETS["bucket_name"])
# tplr.commit(self.subtensor, self.wallet, self.config.netuid)

# Init Wandb.
# Ensure the wandb directory exists
Expand Down

0 comments on commit 53e769b

Please sign in to comment.