-
Notifications
You must be signed in to change notification settings - Fork 248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to decode extrinsics from blocks older than 24H #1682
Comments
Subxt, by default, doesn't carry any guarantees about being able to decode historic blocks. The reasons for this are:
There is ongoing work on historic block decoding in Rust, but this will likely result in separate libraries for working with histroic state (which would rely on the That said, it is currently possible to manually set the metadata used by Subxt if you know what you're doing and can connect to an archive node. Doing this will break some things (like submitting transactions), but may allow slightly older blocks and storage to be decoded properly: let mut api = OnlineClient::<PolkadotConfig>::from_url("wss://url.to.archive.node").await?;
// Set the metadata to some older metadata which covers the block(s) you're interested in. Even doing this,
// you won't be able to decode any blocks older than when V14 metadata was released a couple of years ago.
api.set_metadata(metadata_for_old_block);
// Now, obtain some older block events etc (that is from the same runtime as the metadata provided above)
// and subxt should be able to decode it properly at the moment:
api.blocks().at(block_hash).await?.events(); But note that this will not work once Subxt moves to using the new RPC APIs by default (although we will probably keep the legacy stuff around for a while, and so there will probably continue to be a way to do this for now).
Could you elaborate on what you want here? Given jsut an event, you can't locate the related extrinsic, but given an extrinsic you can access the related events if the metadata is able to decode them and the node is an archive node in case of older blocks) |
Hi @jsdw |
In that case, I'd guess that your issue might be 4?:
|
I'#ll close this for now, but please re-open if you'd like to discuss more :) |
Hi all,
I am using
subtext
to decode extrinsic from blocks.I receive the following error:
This only happens for blocks older than 24 hours.
Blocks older than 24 hours do contain events.
subxt
or node configuration?The text was updated successfully, but these errors were encountered: