Can't get timestamp for old blocks
Closed this issue · 10 comments
Describe the bug
I get
SubstrateRequestException: Client error: Execution failed: Other: Exported method Metadata_metadata_at_version is not foundwhen calling Subtensor.get_timestamp with blocks older than around a year.
To Reproduce
This gives the error message mentioned above:
import bittensor as bt
subtensor = bt.subtensor("archive")
subtensor.get_timestamp(block=3010611)It works as expected with block 3020611 and newer. Haven't pinned down earliest block that works though.
Expected behavior
I expect to get a result from the method call, for example:
In [62]: import bittensor as bt
...: subtensor = bt.subtensor("archive")
...: subtensor.get_timestamp(block=3020611)
Out[62]: datetime.datetime(2024, 5, 23, 17, 58, 36, 2000, tzinfo=datetime.timezone.utc)Screenshots
No response
Environment
macOS 15.3.2, bittensor 9.4.0
Additional context
No response
This issue is related with Subtensor
This issue is related with Subtensor
This is a client-side issue that happens with old blocks.
We had decided not to support blocks past a certain point and instead require downgrading bittensor.
Might be worth reconsidering.
This issue is related with Subtensor
This is a client-side issue that happens with old blocks. We had decided not to support blocks past a certain point and instead require downgrading bittensor. Might be worth reconsidering.
Yep. My point was that client (sdk, cli, or any other) can't affect to this behavior other than add checker if the block not less than some (3010611)
Since all requests go through async-substrate-interface, I think it's best to limit this behavior there, by calculating the last available blockhash (for block 3010611) in the archive node and probably raise related custom created error.
@thewhaleking any concerns?
Hey @noaonoszko,
I added a specific error/message for this in #113, but the way to do this is to use py-substrate-interface (https://github.com/JAMdotTech/py-polkadot-sdk). We do not have support for very old blocks.
Hey @noaonoszko, I added a specific error/message for this in #113, but the way to do this is to use py-substrate-interface (https://github.com/JAMdotTech/py-polkadot-sdk). We do not have support for very old blocks.
Hi, thanks for the reply. Got it, will use the polkadot sdk. I'm curious though why it was decided to not support old blocks?
Hey @noaonoszko, I added a specific error/message for this in #113, but the way to do this is to use py-substrate-interface (https://github.com/JAMdotTech/py-polkadot-sdk). We do not have support for very old blocks.
Hi, thanks for the reply. Got it, will use the polkadot sdk. I'm curious though why it was decided to not support old blocks?
Largely because we built all the dynamic decoding based on Metadata V15. Adding support for pre-V15 blocks would have added a substantial amount of complexity, and required additional dependencies. We would essentially have to have two versions of decoding we need to maintain and develop for.
Ok thanks for the explanation :)
Decided to add in V14 Metadata decoding in PR #141