Skip to content

AsyncSubtensor get_neuron_for_pubkey_and_subnet passes block and block_hash to future calls #3083

@yuma-doc

Description

@yuma-doc

Describe the bug

When using an async subtensor and calling https://github.com/opentensor/bittensor/blob/master/bittensor/core/async_subtensor.py#L2519 with the block parameter the block_hash is received and passed to the following method https://github.com/opentensor/bittensor/blob/master/bittensor/core/async_subtensor.py#L2530.
This eventually calls https://github.com/opentensor/bittensor/blob/master/bittensor/core/async_subtensor.py#L3818 with both block and block_hash.

To Reproduce

import asyncio

from bittensor.core.async_subtensor import AsyncSubtensor


async def main():
    async with AsyncSubtensor("wss://archive.chain.opentensor.ai:443") as subtensor:
        try:
            result = await subtensor.get_neuron_for_pubkey_and_subnet(
                hotkey_ss58="5CnvuQgNLBd2tmhykivRfnJZBYc5D2NZEBYxjFm2fc5Msn1o",
                netuid=10,
                block=6602498,
            )
            print(result.active)
        except Exception as e:
            print(e)
        return


if __name__ == "__main__":
    asyncio.run(main())

Expected behavior

Function should work correctly when block is passed

Screenshots

No response

Environment

Ubuntu

Additional context

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions