Skip to content

metagraph bug for sn2 #3064

Description

@cmcg99

Hi,

The bittensor sdk fails when attempting to obtain the metagraph for subnet 2:

import bittensor as bt
bt.Subtensor().subnets.metagraph(2)

This causes the following error:

  File ".../bittensor/metagraph.py", line 500, in _timelock_round
    for variant, value in (entry or {}).items()
                          ^^^^^^^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'items'

The commit info fields list for this sn is just a single string value:

import bittensor as bt

client = bt.Subtensor()
committed = client.query_map(bt.storage.Commitments.CommitmentOf, [2])
print(committed[0][1]['info']['fields'])
# ['ResetBondsFlag']

whereas it's expecting a dictionary here:

for variant, value in (entry or {}).items():

and here:
for variant, value in (entry or {}).items()

Replacing (entry or {}) with (entry if isinstance(entry, dict) else {}) got me up and running again but I'm not sure that's the way you'd like to address it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions