pendulum-chain / pendulum-squids

The subsquid squids we use for Pendulum/Amplitude/Foucoco.
GNU General Public License v3.0
0 stars 0 forks source link

Create local archive endpoint to allow updating indexers before enactment of runtime upgrades #64

Closed ebma closed 3 months ago

ebma commented 6 months ago

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:

TODO

ebma commented 6 months ago

@pendulum-chain/product this ticket is relevant for improving the downtime of our indexers when runtime upgrades happen.

TorstenStueber commented 5 months ago

@ebma the ticket is quite clear but a I have some question about the context:

prayagd commented 5 months ago

Hey team! Please add your planning poker estimate with Zenhub @ebma @gianfra-t @TorstenStueber @bogdanS98

ebma commented 5 months ago

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.