Skip to content

feat: speed up DIPs on-chain acceptance under backlog#1200

Open
MoonBoi9001 wants to merge 1 commit into
main-dipsfrom
mb9/dedicated-fast-loop-for-dips-acceptance
Open

feat: speed up DIPs on-chain acceptance under backlog#1200
MoonBoi9001 wants to merge 1 commit into
main-dipsfrom
mb9/dedicated-fast-loop-for-dips-acceptance

Conversation

@MoonBoi9001
Copy link
Copy Markdown
Member

@MoonBoi9001 MoonBoi9001 commented Apr 22, 2026

TL;DR

Under a backlog, DIPs agreements were timing out before the agent accepted them on-chain, because acceptance only ran on the agent's slow two-minute housekeeping cycle. This gives acceptance its own fast loop that works through pending agreements in parallel, so they land well inside the window they stay open for. It also keeps a just-accepted agreement's indexing rule in place until the network's record of that agreement catches up.

Motivation

The indexer-agent accepts DIPs agreements on-chain, but today it only does that on its general housekeeping cycle, which runs every two minutes. On a fresh deploy with a backlog, working through the pending agreements takes several of those cycles — longer than the five-minute window an agreement stays open for — so agreements expire before they are accepted and the indexer loses the work.

Accepting in parallel also means the agent writes down the indexing rule for an agreement the moment it is accepted, before the network's published record of that agreement is visible to the agent. The same housekeeping cycle removes rules that have no matching agreement, so without care it would delete that brand-new rule and undo the acceptance; this change keeps a just-accepted rule in place until the network's record catches up.

Summary

  • Acceptance moves to its own 5-second loop instead of the agent's two-minute cycle.
  • Pending agreements are accepted in parallel (up to four at once) to clear backlogs in time.
  • The indexing rule is created up front so the subgraph deploys before the next cycle runs.
  • A just-accepted rule is kept until the network's record of its agreement catches up.
  • A specific contract-call error is treated as permanent, so the agent stops retrying it.
  • Before accepting, the agent checks the offer exists on-chain (reusing the base branch's check).
  • The database migration can safely run again if the value it adds is already there.

@github-project-automation github-project-automation Bot moved this to 🗃️ Inbox in Indexer Apr 22, 2026
@Maikol Maikol force-pushed the feat/dips-on-chain-cancel branch from c4d0d52 to 861cddf Compare April 22, 2026 14:29
MoonBoi9001 added a commit to edgeandnode/local-network that referenced this pull request Apr 25, 2026
The indexer-agent's DIPs accept gate (graphprotocol/indexer#1200)
queries the indexing-payments-subgraph for OfferStored entities
before calling acceptIndexingAgreement. Without a configured
endpoint the gate is a no-op and a dropped offer() tx loses the
agreement to a permanent deterministic rejection.

Set INDEXER_AGENT_INDEXING_PAYMENTS_SUBGRAPH_ENDPOINT alongside the
existing INDEXER_AGENT_OFFCHAIN_SUBGRAPHS so the agent picks up the
gate as soon as the subgraph deployment is detected.

Also add inline shellcheck directives to silence pre-existing
SC1091 / SC2153 notes the post-edit-lint hook surfaced.
@MoonBoi9001 MoonBoi9001 force-pushed the mb9/dedicated-fast-loop-for-dips-acceptance branch from 78f4c6c to 790355a Compare April 28, 2026 06:17
@MoonBoi9001 MoonBoi9001 changed the base branch from feat/dips-on-chain-cancel to feat/dips-new-subgraph April 28, 2026 06:17
@MoonBoi9001 MoonBoi9001 force-pushed the mb9/dedicated-fast-loop-for-dips-acceptance branch 3 times, most recently from 33c5e22 to 76346c1 Compare April 28, 2026 07:33
@MoonBoi9001 MoonBoi9001 changed the title feat: dedicated fast-path loop for DIPs proposal acceptance feat(dips): dedicated fast loop with offer-existence gate Apr 28, 2026
Base automatically changed from feat/dips-new-subgraph to feat/dips-on-chain-cancel April 28, 2026 19:37
Base automatically changed from feat/dips-on-chain-cancel to feat/dips-on-chain-collect April 28, 2026 20:09
@Maikol Maikol force-pushed the feat/dips-on-chain-collect branch from f792bc2 to 078630f Compare April 28, 2026 20:23
Base automatically changed from feat/dips-on-chain-collect to main-dips April 28, 2026 20:28
@MoonBoi9001 MoonBoi9001 force-pushed the mb9/dedicated-fast-loop-for-dips-acceptance branch 5 times, most recently from 2f6c404 to 4e965d5 Compare May 7, 2026 05:35
@MoonBoi9001 MoonBoi9001 force-pushed the mb9/dedicated-fast-loop-for-dips-acceptance branch 2 times, most recently from d6e4df1 to e15eb66 Compare May 15, 2026 11:38
@MoonBoi9001 MoonBoi9001 changed the base branch from main-dips to mb9/collect-after-payer-cancel May 15, 2026 11:39
@MoonBoi9001
Copy link
Copy Markdown
Member Author

Rebased on #1216

Base automatically changed from mb9/collect-after-payer-cancel to main-dips May 28, 2026 02:20
@MoonBoi9001 MoonBoi9001 force-pushed the mb9/dedicated-fast-loop-for-dips-acceptance branch 2 times, most recently from 3386f36 to 01053fa Compare May 29, 2026 00:05
@MoonBoi9001 MoonBoi9001 changed the title feat(dips): dedicated fast loop with offer-existence gate feat: speed up DIPs acceptance and stop unpaid indexing May 29, 2026
@MoonBoi9001 MoonBoi9001 force-pushed the mb9/dedicated-fast-loop-for-dips-acceptance branch 2 times, most recently from 9b082b7 to 19ef3d0 Compare May 29, 2026 05:29
@MoonBoi9001 MoonBoi9001 force-pushed the mb9/dedicated-fast-loop-for-dips-acceptance branch from 19ef3d0 to c90d378 Compare May 29, 2026 06:40
@MoonBoi9001 MoonBoi9001 changed the title feat: speed up DIPs acceptance and stop unpaid indexing feat: speed up DIPs on-chain acceptance under backlog May 29, 2026
The agent accepted DIPs agreements only on its 120s reconcile cycle, so under backlog they
expired past the 300s deadline. This adds a dedicated 5s loop that accepts proposals in
parallel (one per deployment, nonce-serialised) and creates the rule up front to deploy early.
@MoonBoi9001 MoonBoi9001 force-pushed the mb9/dedicated-fast-loop-for-dips-acceptance branch from c90d378 to 1c1fb04 Compare May 29, 2026 07:49
@MoonBoi9001 MoonBoi9001 requested a review from Maikol May 29, 2026 08:13
import { sequentialTimerMap } from '../sequential-timer'
import { OfferVerifier } from './offer-verifier'

const DIPS_ACCEPTANCE_INTERVAL = 5_000
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we make this values configurable?

// markAccepted clears the pending row, so the deployment drops out of the
// reconcile target set until the subgraph indexes the agreement. Shield
// its rule from the reaper meanwhile.
this.recentlyAcceptedDeployments.set(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

given the explanation needed for this line I would extract this to a new function and avoid the duplication in acceptWithExistingAllocation

@github-project-automation github-project-automation Bot moved this from 🗃️ Inbox to ✅ Approved in Indexer May 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: ✅ Approved

Development

Successfully merging this pull request may close these issues.

2 participants