Skip to content

feat(solana-indexer) PR 14: binary wiring - #4744

Open
squadgazzz wants to merge 10 commits into
solana-indexer/PR13-onchain-ordersfrom
solana-indexer/PR14-wiring
Open

feat(solana-indexer) PR 14: binary wiring#4744
squadgazzz wants to merge 10 commits into
solana-indexer/PR13-onchain-ordersfrom
solana-indexer/PR14-wiring

Conversation

@squadgazzz

@squadgazzz squadgazzz commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Description

The binary comes alive: a TOML configuration (same shape as the solana-driver's, reusing configs::shared), the database pool, the RPC client, the ingester-to-decoder channel, and a shutdown signal, all assembled in run::start. The CLI takes --config plus a --start-slot override for the first subscription (bounded by the provider's replay window). The process runs until the stream loop or the decoder stops or a signal arrives.

The stream loop owns the restart policy. A dropped stream reconnects and resumes one past the last indexed slot. When that resume is rejected, which usually means the slot fell out of the provider's replay window (~150 slots), the loop logs an error and resubscribes from the live tip instead of crash-looping. The gap stays unindexed until the MVP backfill (BE-204).

SolFlow has no program yet, so its subscription filter only exists when --solflow-program is set, and the decoder sees the settlement program in its place, which makes the SolFlow branch unreachable.

Consuming the modules also fired the planted dead-code expectations (Decoder, Postgres::new, Rpc::new), so those attributes are gone.

Two named gaps, both out of scope here: the latest_chain_slot counter has no reader and solana.chain_tip has no writer yet (that pairing lands with the autopilot's deadline work), and there is no liveness endpoint until the metrics PR (BE-73).

Changes

  • config: TOML file loading with an example.toml kept parseable by a test
  • run::start: config, observability init, pool, RPC client, channel, spawned decoder, stream loop, shutdown via tokio::select!
  • Ingester::serve takes a Resume (watermark or live tip) and an optional SolFlow program
  • Deleted the temporary Send-assertion helper, the real spawn replaces it

How to test

Existing tests. The real test is running the binary against on-chain data, which is the next step after this stack lands.

Related issues

Resolves BE-75.

@linear-code

linear-code Bot commented Aug 14, 2026

Copy link
Copy Markdown

BE-75

@squadgazzz

Copy link
Copy Markdown
Contributor Author

@claude please review

@claude

claude Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Claude finished @squadgazzz's task in 4m 58s —— View job


PR Review: binary wiring

Reviewed the full diff against origin/solana-indexer/PR13-onchain-orders. The wiring is clean and closely mirrors the established solana-driver pattern (TOML config via configs::shared, observe init, tokio::select! shutdown). Config handling, the Option<Pubkey> refactor for the not-yet-existing SolFlow program, the conditional subscription filter, and the removal of the dead-code placeholders all look correct and well-documented. The Resume state machine (Watermark → LiveTip fallback on rejected resume) reads sensibly and self-heals as the watermark advances.

One issue worth addressing, posted inline:

  • run.rs (tokio::select!) — a decoder PersistenceError can be silently swallowed. decoder.run() returns a Result, so a DB failure makes it exit with Err without panicking; that causes serve to return Ok(()) and stream_loop to break at the same moment decoder_task is ready. Since select! polls arms in random order, the root-cause error is only logged about half the time — the rest of the time it logs the generic "stream loop stopped". Suggest surfacing the decoder result deterministically after the loop rather than via the race.

Nothing else blocking — the remaining behavior (live-tip gaps until backfill BE-204, no graceful decoder drain on shutdown) is already acknowledged in the PR description and acceptable for the MVP.
· solana-indexer/PR14-wiring

Comment thread crates/solana-indexer/src/run.rs
@squadgazzz
squadgazzz marked this pull request as ready for review August 14, 2026 15:13
@squadgazzz
squadgazzz requested a review from a team as a code owner August 14, 2026 15:13
@squadgazzz
squadgazzz requested a review from tilacog August 14, 2026 15:13
@claude

claude Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Claude finished @squadgazzz's task in 3m 7s —— View job


PR Review: binary wiring

  • Read the PR diff against origin/solana-indexer/PR13-onchain-orders
  • Analyze the changed files
  • Review run::start wiring, Resume state machine, config loading, and the Option<Pubkey> refactor
  • Verify the previously-flagged decoder-exit race

Re-reviewed the full diff. Since my last review, the decoder-exit concern I raised has been fixed (commit e4ef70bf4): the tokio::select! now awaits and logs decoder_task deterministically after stream_loop breaks, instead of relying on the random arm-polling order. I traced the terminal states to confirm the fix is sound:

  • Ingester::serve returns Ok(()) only when the decoder dropped its rx (run.rs:103ingester.rs:114-134). By then decoder.run() has returned and the spawned task is complete, so (&mut decoder_task).await at run.rs:127 resolves promptly rather than hanging — and the shutdown arm can't be starved.
  • A returned PersistenceError now surfaces via arm 2 (result = &mut decoder_task), which fires directly on decoder death even while the ingester is idle in stream.next(). 👍

Everything else holds up:

  • Resume state machine self-heals correctly. Watermark→LiveTip on a rejected resume (no crash-loop), and after a LiveTip stint the watermark has advanced back inside the replay window, so a later reconnect resumes cleanly from Watermark.
  • Config (config.rs) mirrors the solana-driver pattern; deny_unknown_fields, the optional-pubkey deserializer paired with #[serde(default)], and the example.toml parseability test are all correct and validated by load_example_toml.
  • Option<Pubkey> SolFlow refactor is threaded consistently through the decoder, relevant_instructions, the subscription filter (only inserted when set), and the updated tests.
  • Dead-code placeholder removals (Decoder, Postgres::new, Rpc::new) and the deleted assert_serve_future_is_send helper are all justified now that the real spawn exists.

No blocking issues. The acknowledged gaps (live-tip gap until BE-204 backfill, no reader for latest_chain_slot / no solana.chain_tip writer until the autopilot deadline work, no liveness endpoint until BE-73, no graceful decoder drain on shutdown) are all noted in the PR description and fine for the MVP. LGTM.
· solana-indexer/PR14-wiring

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant