Skip to content

feat(events producer): implement subgraph indexing agreements events emitter in callsites#656

Open
cmwhited wants to merge 4 commits into
chris.whited/feat-producer/kafka-config-producerfrom
chris.whited/feat-producer/wire-into-dipper-svc
Open

feat(events producer): implement subgraph indexing agreements events emitter in callsites#656
cmwhited wants to merge 4 commits into
chris.whited/feat-producer/kafka-config-producerfrom
chris.whited/feat-producer/wire-into-dipper-svc

Conversation

@cmwhited

Copy link
Copy Markdown

Description

This PR wires the SubgraphIndexingAgreementsEventsEmitter into the dipper-service message queue and agreement state callsites to emit the correct event, exactly once, for the given event:

  • subgraph.indexing.agreement.request.received -> when a subgraph indexing agreement request is received
  • subgraph.indexing.agreement.proposed -> when the dipper has received Indexer candidates from the IISA, but before accepted onchain
  • subgraph.indexing.agreement.accepted -> when an indexer accepts the indexing agreement
  • subgraph.indexing.agreement.request.expired -> when an indexer fails to accept in the given time limit
  • subgraph.indexing.agreement.n_indexers_unavailable -> when the selection returns fewer indexer candidates than the requested amount
  • subgraph.indexing.agreement.terminated -> when the subgraph dev, indexer, or dipper cancel the indexing agreement

@cmwhited cmwhited requested a review from MoonBoi9001 June 26, 2026 21:10
cmwhited and others added 2 commits June 29, 2026 08:12
* fix(reassess): send shortfall event after the chain-time read

The "not enough indexers" event was sent before the step that reads chain time to
stamp deadlines. In local runs that read can fail and retry the whole job, resending
the event each round; sending it after the read makes a retried round emit it once.

* fix(expiration): report proposal time from the deadline clock

The expiry event mixed clocks: "proposed at" came from wall time, "expired at" from
chain time, so with local time controls on, expiry could look earlier than the proposal.
Agreements now stamp proposal time in the deadline's clock; old rows fall back to created_at.
@MoonBoi9001 MoonBoi9001 added the agreement-events Kafka producer for agreement lifecycle events (Studio integration) label Jul 7, 2026
@MoonBoi9001

Copy link
Copy Markdown
Member

Two forward-looking notes from the offer-pacing work (#661), for whichever branch rebases second.

First, the n_indexers_unavailable gate: this PR emits it when to_add is non-empty and IISA returned fewer candidates than requested, with the gate deliberately preventing a standing shortfall from re-firing forever. #661 adds a case that defeats that intent: a request capped by the in-flight window re-runs its reassessment every 12-18s, and if IISA is also returning a shortfall during that window, the event re-fires on every poll — a sustained stream into Kafka that reads as indexer scarcity when the cause is throttling. Suggested reconciliation (one line): suppress the emit on passes where pacing withheld additions (withheld > 0), so the event only ever means a genuine supply shortfall. Note #661 also short-circuits before IISA when the global window is full, so the saturated case never reaches this emit site at all — the suppress only matters for per-indexer-capped passes.

Second, for the Studio topic listener you mentioned starting: #662 adds priority classes to the job queue (Interactive vs Background). The listener's handler should enqueue its reassessments at JobPriority::Interactive, same as the admin RPC path, so Studio-driven requests are served ahead of the background reassignment sweep.

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

Labels

agreement-events Kafka producer for agreement lifecycle events (Studio integration)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants