regen-network / indexer

:rocket: Blockchain indexer and database
Other
2 stars 0 forks source link

Index project admins #31

Closed blushi closed 1 year ago

blushi commented 1 year ago

Hey team! Please add your planning poker estimate with Zenhub @ryanchristo @wgwz

ryanchristo commented 1 year ago

EventCreateProject will be emitted when a new Project is created in state and EventUpdateProjectAdmin will be emitted when the admin is updated in state.

blushi commented 1 year ago

After double checking the code, we just query for all projects https://buf.build/regen/regen-ledger/docs/main:regen.ecocredit.v1#regen.ecocredit.v1.Query.Projects with a single query and then we can look up the admins in the result list of projects directly so I guess indexing projects admins could be nice to have because we could have a more efficient query like "get projects by admin address" but I don't think this is mandatory to improve significantly the performance, while indexing credit class issuers #30 will be a real game-changer in this case.

EDIT: Regen Ledger already provides such a query https://buf.build/regen/regen-ledger/docs/main:regen.ecocredit.v1#regen.ecocredit.v1.Query.ProjectsByAdmin so we could just use that instead as part of https://github.com/regen-network/rnd-dev-team/issues/1757 instead of the current code: https://github.com/regen-network/regen-web/blob/7a15d9302d04786f9ee83229fd58ad2befd1c591/web-registry/src/hooks/useQueryListProjects.ts#L28

blushi commented 1 year ago

Let's close this for now and try using https://buf.build/regen/regen-ledger/docs/main:regen.ecocredit.v1#regen.ecocredit.v1.Query.ProjectsByAdmin instead. If we feel like we do need to index project admins, we can always re-open this.