Replies: 4 comments 5 replies
-
|
Can we investigate a bit deeper this issue? Cause it sounds strange that squid can't get info from genesis block.
|
Beta Was this translation helpful? Give feedback.
-
Saying this, I choose option 4. If DB is empty, it means it's the first run and nothing was indexed, then insert objects from chain to squid DB. But option 1 is also good. Maybe we can somehow benefit from having orgs in the migration instead of the genesis, but to me it's not obvious now. |
Beta Was this translation helpful? Give feedback.
-
|
Avoiding genesis block (option 1) doesn't look right. But as on PROD it is a one-time action, we can create orgs even manually once, right? On other hand, to have some consistency in all envs, it's better to have the same approach everywhere. But it will require additional manual steps on every deployment. Option 2 is not good as it requires additional maintenance and may produce discrepancies. Among 3 and 4 would also prefer 4 to reduce complexity. |
Beta Was this translation helpful? Give feedback.
-
also as yura mentions, it is a one time action, but i assume the genesis should really mint the token as designed on genesis. so not sure, triggering a custom event manually could help. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Problem statement
There is no possibility to index chain data, populated during genesis block.
This happens because there are no events emitted during genesis.
Since squid indexing service relies on the events to track chain state changes, it will miss those.
This way we will have data stored on chain but missing on the graph side.
Expected result
We would like to define solution for this problem and have objects, generated during genesis to be correctly reflected on the squid indexer side.
Possible solutions
Let's discuss options to solve this issue, pros and cons of each of them.
Option 1: Chain migration
With this approach, nothing is stored during genesis and initial chain objects are created with additional storage migration instead.
They are all populated during additional runtime upgrade, containing storage migration to insert all the objects.
This will allow all events to be triggered and squid process will go usual path, reacting on the events.
Pros:
Cons:
Option 2: Squid fixture/migration
It is known beforehand all the details of each object, which is created during genesis. So we can populate squid database with those objects as initial state for the squid database.
Pros:
Cons:
Option 3: Additional script to populate from chain storage
This approach involves usage of additional script prior to starting squid indexer service.
This script will query all the objects from the chain storage via polkadot.js library and insert those in the squid database.
Pros:
Cons:
Option 4: Alter squid processor
This is similar to Option 3, but instead of having separate process to populate initial data, this will be part of squid processor.
Once service started, prior to setting up listener for new chain blocks/events, check if there are some objects in the graph database populated. If no, query chain storage for interested objects.
Pros:
Cons:
@vovacha @FiberMan @AlexisZero @2075 feel free to add more details, alternative solutions and vote for the preferred one!
3 votes ·
Beta Was this translation helpful? Give feedback.
All reactions