Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Process genesis for initial state #79

Closed
bryanchriswhite opened this issue Sep 8, 2022 · 0 comments · Fixed by #105 or #115
Closed

Process genesis for initial state #79

bryanchriswhite opened this issue Sep 8, 2022 · 0 comments · Fixed by #105 or #115
Labels
C-enhancement Category: New feature or request
Milestone

Comments

@bryanchriswhite
Copy link

bryanchriswhite commented Sep 8, 2022

Acceptance Criteria

  1. The repo contains a script which downloads the network Genesis from a given URL.
  2. The schema includes a NativeBalanceGenesis entity.
  3. The repo contains a script which processes the downloaded Genesis according to the needs of various features (i.e. entities which depend on it).
  4. These scripts are executed automatically at some point in the startup of the subquery node.

Proposal

  1. An environment variable seems like the most straightforward place to store the genesis URL.
  2. Example:
type NativeBalanceGenesis {
  id: ID!
  account: String!
  amount: BigInt!
  denom: String!
}
  1. It probably makes sense for the initial version of script to interact directly with the database. We can use the same tooling as our end-to-end tests (python + psycopg) to avoid introducing additional dependencies and keep tooling consistent. Perhaps we'll want/need to upgrade to something more robust and/or javascript-native in the future. I would also propose that it would be good for maintainability and onboarding if the script employed inversion of control to support distinct genesis state handler functions, defined separately. I would suggest considering ReactiveX (PyPI) which implements the observer pattern flavor of IoC. This design also allows for concern-scoped handlers to be reasoned about and maintained independently.
  2. I imagine we can use a kubernetes job to run through once at the beginning of indexing but we should ensure that the job doesn't start until after the SubQuery node is up (i.e. has created all tables).
@bryanchriswhite bryanchriswhite changed the title Processing genesis for initial state Process genesis for initial state Sep 8, 2022
@bryanchriswhite bryanchriswhite added this to the v0.2 milestone Sep 8, 2022
This was referenced Sep 8, 2022
@bryanchriswhite bryanchriswhite added the C-enhancement Category: New feature or request label Sep 13, 2022
@bryanchriswhite bryanchriswhite linked a pull request Sep 22, 2022 that will close this issue
@bryanchriswhite bryanchriswhite linked a pull request Sep 29, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: New feature or request
Projects
None yet
2 participants