for example the blockchain is upgraded at 1000 height(including systems code updates event), and I need to decode the storage data by metadata at 1000 height, which metadata do I need to use, is it the latest one? or the old metadata of 999 height?

1 Answer 1


If you do the upgrade at block 1000, aka setting the :code storage item, the new runtime will be used for building block 1001.

There is actually an open issue about this topic, as the block that sets the storage item isn't running potential migrations directly. So, you currently get the "wrong" metadata when querying block 1000. Substrate will already return you the metadata of the new runtime while it should return the metadata of the old runtime.

So to your question, to decode items at height 1000, you should use the metadata of height 999.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.