feat(solana-indexer): PR 14 PostgresStore persist decoded events + slot watermark#4631
Draft
squadgazzz wants to merge 2 commits into
Draft
feat(solana-indexer): PR 14 PostgresStore persist decoded events + slot watermark#4631squadgazzz wants to merge 2 commits into
squadgazzz wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Implements the PostgresStore persistence for the indexer's live path: decoded settlement events and the slot watermark land in the
solana.*tables in one transaction. This retires thetodo!()stubs onPersistencefor the ingest path and gives the decoder a real store to write through in a follow-up.Runs ahead of the schema being frozen. The
solana.*DDL lives in a test-only fixture applied to docker Postgres in the#[ignore]test, not a committed flyway migration, so staging and prod stay clean until the shape settles. When it does, it promotes todatabase/sql-solana/plus a compose service, mirroring the pool-indexer.Changes
Persistenceholds aPgPooland implementspersist_events(events plus watermark in one transaction),write_watermark(monotonic), andread_watermark, all runtime sqlx queries.OrderCreatedwritessolana.order_pda(off-chain path,solana.ordersis the orderbook's row),SettlementFinalizedwritessolana.settlementsplus per-ordersolana.tradesplus the cumulativesolana.order_pdacounters,OrderClosed/OrderCancelledset the cancellation timestamp. Buffer and admin events are skipped (no MVP table).schema.sqlfixture and an#[ignore]docker-Postgres test.Persistencemethods staytodo!()(their own PRs, recovery is out of scope for v0.1).How to test
docker compose up -d, thencargo nextest run -p solana-indexer --run-ignored all --test-threads 1. Non-ignored tests run without a database.Notes
instruction_indexandfee_amountonsolana.trades, and the buy-side amount, are constants until the decoder resolves them from proposed-solution data.persist_eventsyet. Wiring it needs aStoretrait so the decoder unit tests inject a fake rather than a live database, deferred to a follow-up.schema.sqlis deliberately not a flyway migration (see Description).