subsquid / squid-sdk

The main repo of the squid SDK
Apache License 2.0
1.23k stars 151 forks source link

How are chain forks handled in subsquid for substrate? #145

Closed sebastianmontero closed 1 year ago

sebastianmontero commented 1 year ago

Hi, not sure if this is the correct place to ask this questions, but I didn't find a discord community or telegram channel for subsquid, I'm starting to evaluate indexing solutions for substrate chains and I was looking into subsquid and didn't find an answer to 2 technical questions that I would like to clarify before picking a solution: 1.- How are chain forks handled? 2.- How are structural data changes overtime handled (runtime upgrades)?

Thanks

eldargab commented 1 year ago

Hi, @sebastianmontero !

How are chain forks handled?

At the moment only finalised blocks are indexed, meaning the is no forks.

Support for non-finalised blocks will be implemented in the near future and will be almost transparent for the end users.

We are going to track DML statements and write a log, that would allow us to rollback statements in case of a fork.

How are structural data changes overtime handled (runtime upgrades)?

We always track the correct metadata to use to decode the particular block.

There is one-to-one correspondence between the metadata and JSON structures mapping developers get in data handlers.

There are tools to generate facade TypeScript classes, that assert that received data has expected shape.

sebastianmontero commented 1 year ago

Hi @eldargab, thank you for the information, is there an ETA for the non-finalised blocks feature?

eldargab commented 1 year ago

ETA is around beginning or mid of the February.

sebastianmontero commented 1 year ago

Ok, thanks, and I don't know if you know this but what are the differences between subsquid and subquery? when would you use one before the other?

On Wed, Dec 28, 2022 at 2:56 AM Eldar Gabdullin @.***> wrote:

ETA is around beginning or mid of the February.

— Reply to this email directly, view it on GitHub https://github.com/subsquid/squid-sdk/issues/145#issuecomment-1366480824, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADEL3AQYKOFLJ657U2PEGZDWPP6FRANCNFSM6AAAAAATKRDHQA . You are receiving this because you were mentioned.Message ID: @.***>

dzhelezov commented 1 year ago

ArrowSquid now supports hot (unfinalized) blocks: https://docs.subsquid.io/basics/unfinalized-blocks/ ArrowSquid for Substrate will be released soon