[EASY] solana-indexer: add the settlement slot to trades - #5009
Open
squadgazzz wants to merge 1 commit into
Open
squadgazzz wants to merge 1 commit into
squadgazzz wants to merge 1 commit into
Conversation
squadgazzz
marked this pull request as ready for review
September 30, 2026 20:39
Contributor
|
Claude finished @squadgazzz's task in 1m 47s —— View job PR Review: add settlement slot to Solana trades
Verdict: LGTM — no blocking issues found, no inline comments needed. What I verified:
Non-issues (already acknowledged in the description, noted only for the record):
|
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
The analytics team copies Solana tables incrementally: each run fetches the rows past the highest key it has already seen. On EVM,
tradeshasblock_numberfor that.solana.tradeshas no slot column, so their extraction has to joinsolana.settlementsto get one.This PR adds
slottosolana.trades, likeblock_numberon the EVMtradestable. The indexer writes each trade in the same DB transaction as its settlement row, and deletes both together when the Solana transaction vanishes before finalization. So a trade's slot always matches its settlement's. The migration backfills existing trades fromsolana.settlements, then setsNOT NULLand indexesslot. A trade without a settlement row makes the migration fail and roll back.The migration is V12, because #4976 holds V10 and #4998 holds V11. It merges after both, or gets renumbered.
Changes
solana.trades.slot:bigint NOT NULL, backfilled fromsolana.settlements, with an index onslotHow to test
Updated DB tests. I also ran the migration in a rolled-back transaction: it copied the settlement's slot, and a trade without a settlement made it fail cleanly. Before merging, this should return 0 on staging: