feat(autopilot-svm) PR09: settlement observation - #4754
Open
squadgazzz wants to merge 1 commit into
Open
Conversation
squadgazzz
marked this pull request as ready for review
August 19, 2026 08:25
Contributor
|
Claude finished @squadgazzz's task in 2m 50s —— View job PR Review: settlement observationThe design is clean — windows persisted in the DB, NOTIFY + reconnect re-seed for convergence, and timeouts upgraded to
Nothing blocking beyond the first item; the second is a heads-up for when multi-winner arrives.
|
squadgazzz
force-pushed
the
ilya/be-184-pr08-seam-implementations-single-auction-cycle
branch
from
August 19, 2026 11:14
8f29d7e to
5c1b874
Compare
squadgazzz
force-pushed
the
ilya/be-185-pr09-settlement-observation
branch
from
August 19, 2026 11:15
03436e2 to
760fcae
Compare
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 loop dispatches settlements and forgets them: nothing notices whether the transaction ever landed. This PR closes that gap. The executor opens a window in
solana.settlement_executionsper dispatched settlement, the indexer's insert intosolana.settlementsfires a NOTIFY (trigger added to the schema, landing with its first listener), aListenSessioncloses the window aslandedwith the on-chain signature, and windows whose submission deadline passes without a settlement close astimeoutwith an error log. A settlement observed after the timeout upgrades the window back tolanded, it executed, just late, and the lateness stays visible asend_slotpastdeadline_slot. Windows live in the database, so a restart mid-window loses nothing: the listen seed re-checks every open window.Why observation is indexer-driven at all: the Solana driver returns the signature at submission and landing is asynchronous, so unlike EVM there is no blocking
/settleresponse to learn the outcome from. That also sets the column's contract apart from EVM'ssettlement_executions.outcome(V080): theirs records the driver's report and stays put, ours records what the indexer observed on chain, which is why a late-observed landing overwrites a timeout here and can't there. Once the competition tables exist (BE-220), timeout becomes derivable from the auction deadline the EVM way (fetch_in_flight_ordersshape) and the per-cycle sweep shrinks.Settlements are rare events, so NOTIFY fits here, unlike slot-cadence data the run loop polls per cycle. The
ListenSessionseed re-read covers notifies missed across reconnects: every tracked auction is re-checked whenever the listen connection (re)establishes.Two scope notes, both marked in code:
solution_uidcarries the winner's driver-local solution id until competition persistence (BE-220) allocates uids, and the timeout check runs per competition cycle, so on an idle chain a miss surfaces with the next auction rather than at its deadline slot.Changes
solana.settlementsgains anAFTER INSERTtrigger notifyingsolana_settlement_finalizedwith the auction id (V2 edited in place, the series is deployed nowhere)infra/observation.rs: opens, lands, and times outsolana.settlement_executionswindows, with theNotifyHandlerresolving notifies and reconnect re-reads againstsolana.settlementsHow to test
New DB-backed tests driving the full path (INSERT fires the trigger, the listener closes the window as landed with the signature) and the deadline expiry. The mock-cycle test now also asserts the dispatch opens a window.