Closed ebma closed 3 months ago
@pendulum-chain/product this ticket is relevant for improving the downtime of our indexers when runtime upgrades happen.
@ebma the ticket is quite clear but a I have some question about the context:
"blockNumber": 0
above, however, the data returned by the endpoint seems to contain the actual block number for the runtime upgrades. Do we have reason to believe that it works when just specifying "blockNumber": 0
?Hey team! Please add your planning poker estimate with Zenhub @ebma @gianfra-t @TorstenStueber @bogdanS98
The archive endpoints are not linked to any of our deployed squids. I checked the docs and apparently they know call these archives, the 'Subsquid network'.
Subsquid Network is a distributed query engine and data lake that the Subsquid ecosystem is built around. Currently it serves historical blockchain data for 80+ networks.
As far as I understand, they have a service that reads our blockchain data and derives info like the one you can see at the archive endpoint. So it doesn't matter what's happening in our indexers; once a runtime upgrade goes live on our production endpoints, the archive endpoint should provide the new metadata soon after.
Do we have reason to believe that it works when just specifying
"blockNumber": 0
?
I checked the code of the typegen package but I didn't find any meaningful mention of the blocknumber so I would assume it's safe to ignore. As long as the spec versions are numbered in ascending order, the block number should not matter.
What would we need to do next, just run typegen?
Yes, I think re-generating the types with typegen
and then adding the new version number (if any) to the respective array here is enough.
As far as I know, the typegen
command only focuses on the metadata changes to events, calls and storage items we define in the respective typegen file, see eg. here. That's why it's not problematic that some runtime upgrades seem to be ignored and we don't have type files for each version number.
Context
In https://github.com/pendulum-chain/tasks/issues/186 we did some research how we can improve the indexer downtime whenever a runtime upgrade happens. In the past we noticed that the metadata changes introduced by runtime upgrades make our indexers unable to decode some of the events properly.
We now want to implement the agreed outcome of the research task. The idea is the following:
Local archive endpoint
We create a new command or script that:
runtime.wasm
file somewhere in the local directoryruntime.wasm
to extract the metadata from it. The metadata is then stored in a fileruntime.metadata
runtime.metadata
file we created earlier and creates a new JSON object of the form{"blockNumber":0,"blockHash":"xxx","specName":"foucoco","specVersion":<the_new_spec_version>,"metadata":"<content_of_runtime.metadata>"}
with itTODO
http-server
package. It should live in an extra folder. It does not need to live in thesrc
folder with the rest of the squid files so we can reduce the overhead by using Javascript over Typescript.typegen-{network}
command to regenerate the types. This might be tricky as the typegen commands need to know the network they are used for and we need to adjust the contained specVersions endpoint eg. here.