-
Notifications
You must be signed in to change notification settings - Fork 296
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
Add a minimal but extensible indexer #4573
Conversation
Example:
psql
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/cometbft/cometbft/blob/main/state/indexer/sink/psql/schema.sql
it'd be helpful to add a link noting that this is not a scheme we've come up with ourselves, but is drawn from cometbft itself, here. i imagine when we upgrade to newer versions of cometbft, this might someday need to be updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'd like @plaidfinch to have a chance to sign off on this before i give it a formal approval, but this looks good to me. it looks like a great foundation for us to build additional indexing facilities with.
✔️ ✔️ ✔️
(rebased onto 9398d67 on jun 13)
used to confirm that polling works properly when running locally against a devnet.
i have implemented the changes outlined in the to-do list, and confirmed that polling works correctly by running this against a local devnet. pending CI, this should now be ready for a review! |
closing in favor of #4610 ➡️ |
reset the |
Describe your changes
Adds the skeleton of a minimal but extensible indexer. The indexer consumes events from a source (raw event) database and writes to a destination database with compiled / processed tables. The indexer is a library that other binaries import and slot their indexes into.
The
cometindex
library is intended to be generic over any cometbft events. Thepindexer
binary is for penumbra specifically and we can add all our own code to it. This structure mirrors the existing distinction between comet (generic) and the app. The code is intended to be shaped so that it's easy for users to plug in additional indexes. In particular, all of the "meat" of the binary is in thecometindex::Indexer
type, which builds an indexer and handles all arg parsing. This way, the external interface of the program, how it's invoked, etc, is the same no matter what app views are present, and orchestration code like containers doesn't need to be concerned with them.Before merging:
Index
trait toAppView
(it's a view of some application data)create_tables
method toinit_chain
pindexer
AppView
traits are public so thatpindexer
can be pulled in as a librarypindexer
crate that adds anIndexer::with_default_penumbra_app_views()
method that hooks in all theAppView
impls, so we can add to it as we fill in implsFollowup:
init_chain
to take aserde_json::Value
and add plumbing to theIndexer
builder to take agenesis.json
file in a standardized way so that every instance of the binary doesn't need to implement that -- ideally this is the exactgenesis.json
that was used by comet, and the plumbing in theIndexer
builder pulls out theapp_state
key and saves it to be able to pass it into eachAppView
. Longer term we could explore other options but for now I think it's simplest if we just make it a required parameter every time.Closes #4604
Checklist before requesting a review
If this code contains consensus-breaking changes, I have added the "consensus-breaking" label. Otherwise, I declare my belief that there are not consensus-breaking changes, for the following reason: