Skip to content

Needed: Compatibility for older blocks #3138

@thewhaleking

Description

@thewhaleking

Describe the bug

A number of calls (usually runtime calls, but not always) only work for current runtime versions, a key example being Subtensor.metagraph.

Because of the change in the runtime call from #3056, it is no longer possible to use Subtensor.metagraph for calls before that runtime version. But even before that, there was a fairly recent change that made it impossible to make calls older (when we changed to the selective_metagraph runtime call.

We need backwards compatibility (not in terms of API) but in terms of ability to fetch info on older blocks on the chain.

To Reproduce

with Subtensor(ARCHIVE_ENTRYPOINT) as subtensor:
    print(subtensor.metagraph(netuid=0, block=6500000))

produces:

ValueError: Runtime API Call 'SubnetInfoRuntimeApi.get_selective_mechagraph' not found in registry

Expected behavior

I get the metagraph.

Screenshots

No response

Environment

any

Additional context

First step here should be dealing with runtime calls. Queries should be second.

Because runtime versions are sequential, it's fairly simple to define the behavior for a given runtime version for a given call, and then route the logic based on that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions