Skip to content

feat(solana-indexer) PR16: write created and traded order events - #4786

Merged
squadgazzz merged 84 commits into
mainfrom
solana-indexer/be-242-order-events
Aug 25, 2026
Merged

squadgazzz merged 84 commits into
mainfrom
solana-indexer/be-242-order-events

Conversation

@squadgazzz

@squadgazzz squadgazzz commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

Description

The indexer now writes the order events for the flows it observes: created when it inserts a solana.orders row, traded when it inserts a solana.trades row, each in the same transaction as the row itself. The rows_affected gates keep replays idempotent, a conflicted insert writes no event. On EVM the components observing these flows write the same labels, on Solana that observer is the indexer.

Neither write takes the advisory lock #4775 uses, because neither needs a dedup read: the gate is whether the row insert won its unique constraint, and Postgres serializes that already. The two writers stay clear of each other by owning disjoint labels, created and traded here against ready, executing and considered in the autopilot. A writer that takes a label from the other's set needs the lock too.

Changes

  • created and traded order events written atomically with their orders/trades rows

How to test

Extended the batch-persistence Postgres test: exactly one event per inserted row, stable under replay.

…ill-state

# Conflicts:
#	crates/solana-indexer/example.toml
#	crates/solana-indexer/src/config.rs
#	crates/solana-indexer/src/indexer/decoder/tests.rs
#	crates/solana-indexer/src/indexer/ingester.rs
#	crates/solana-indexer/src/run.rs
…5.6-adopt-cow-solana-rpc

# Conflicts:
#	crates/solana-indexer/src/run.rs
…cle' into ilya/be-185-pr09-settlement-observation

# Conflicts:
#	crates/autopilot-svm/src/tests.rs
…cle' into ilya/be-185-pr09-settlement-observation
…86-pr10-wiring-liveness-devnet-runbook

# Conflicts:
#	Cargo.lock
#	crates/autopilot-svm/Cargo.toml
…cle' into ilya/be-185-pr09-settlement-observation
…lement-observation

# Conflicts:
#	crates/autopilot-svm/src/infra/executor.rs
#	crates/autopilot-svm/src/infra/mod.rs
#	crates/autopilot-svm/src/infra/observer.rs
#	crates/autopilot-svm/src/tests.rs
…olana-autopilot/be-232-order-events

# Conflicts:
#	crates/autopilot-svm/src/infra/observer.rs
#	crates/autopilot-svm/src/run.rs
#	crates/autopilot-svm/src/tests.rs
…olana-autopilot/be-232-order-events

# Conflicts:
#	crates/autopilot-svm/src/run.rs
#	crates/autopilot-svm/src/tests.rs
…er/be-242-order-events

Keep the solana-owned OrderEventLabel from PR11 and cast against it.
@squadgazzz
squadgazzz changed the base branch from main to solana-autopilot/be-232-order-events August 25, 2026 08:17
@squadgazzz
squadgazzz marked this pull request as ready for review August 25, 2026 09:26
@squadgazzz
squadgazzz requested a review from a team as a code owner August 25, 2026 09:26
@claude

claude Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @squadgazzz's task in 1m 55s —— View job


PR Review: write created and traded order events

  • Read the diff and surrounding persistence.rs context
  • Check the solana.order_events schema/enum
  • Verify idempotency gates and the extended test
  • Post findings

Verdict: Looks good. The design is sound: each event is gated on rows_affected > 0 of its row insert, and since both inserts are ON CONFLICT DO NOTHING, replays write nothing — so the append-only event log stays exactly-once without needing the advisory lock. The extended test nails the interesting case (seeded order → only traded, fresh order → only created, stable across a second replay).

I left one minor, optional note inline. Nothing blocking.
· solana-indexer/be-242-order-events

Comment thread crates/solana-indexer/src/persistence.rs
Base automatically changed from solana-autopilot/be-232-order-events to main August 25, 2026 13:31
@squadgazzz
squadgazzz added this pull request to the merge queue Aug 25, 2026
Merged via the queue into main with commit 7046899 Aug 25, 2026
24 checks passed
@squadgazzz
squadgazzz deleted the solana-indexer/be-242-order-events branch August 25, 2026 17:21
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 25, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants