Skip to content

Conversation

tmigone
Copy link
Member

@tmigone tmigone commented May 16, 2025

This PR introduces support for Graph Horizon, the evolution of The Graph protocol. Here are the key changes:

Changelog

1. Graph Horizon support

  • At startup, indexer-agent is capable of detecting Horizon readiness, switching from "legacy" operation mode to "horizon".
  • indexer-agent and indexer-cli support operating with both legacy and horizon set of protocol contracts.

2. Subgraph Service operation

  • In "horizon" mode, the indexer-agent will perform the following operations when starting up:
    • Create a provision for the Subgraph Service if it does not exist. Indexers need to set INDEXER_AGENT_MAX_PROVISION_INITIAL_SIZE to the desired initial amount for the provision.
    • Once the provision is created, register the indexer in the Subgraph Service using the following as registration data (indexer-agent equivalent options also available):
      • INDEXER_AGENT_INDEXER_GEO_COORDINATES
      • INDEXER_AGENT_PUBLIC_INDEXER_URL
      • INDEXER_AGENT_PAYMENTS_DESTINATION
    • Modifying these values and restarting the agent will trigger a registration data update on chain.

3. Provision management

  • New CLI commands for Subgraph Service provision management (add, get, thaw, remove, list-thaw)
  • Requires previous creation of provision via indexer-agent startup

4. Allocation management

  • indexer-agent automatically handles legacy vs horizon allocation management.
    • Before Horizon, allocation management works same as before.
    • After Horizon:
      • "legacy" allocations will be restricted to being closed or collected. No new legacy allocations will be created.
      • horizon allocations will be the norm, allowing all the usual allocation operations.
      • Differences in allocation management/lifecycle:
        • The only difference with legacy allocation management is when closing an allocation additional data is now expected:
          • legacy allocations: only POI is required to close
          • horizon allocations: indexer's POI is still required, but also normalized POI and block height for those POIs. indexer-agent manages this automatically except for manually closing allocations.
        • In order to qualify for indexing rewards allocations MUST be closed before the usual 28 day period. This is a departure from current protocol behavior where past these 28 days anyone could force close stale allocations but if the affected indexer closed it with valid POI they would still get rewards.

5. Rules and Actions

  • Pre-existing rules and pending actions will continue to work with the Horizon upgrade. Any new allocation that is created as a result will be horizon allocations after the upgrade.

6. GraphTally support (TAPv2)

  • indexer-agent will use GraphTally for horizon allocation query fee collection
  • Support for TAPv1 collection is kept for legacy allocations. To be removed in a future version.

7. Other enhancements

  • Most indexer-cli commands now support setting a maximum column width for output tables. This can be useful when displaying allocation or rules in the terminal on screens that are not wide enough. To use it:
    -w, --wrap [N] Wrap the output to a specific width (default: 0, no wrapping)
  • indexer-agent is now able to process action batches where some of the actions fail. This feature is already present in latest agent version pre-horizon but was re-implemented in this PR. The main motivation for the refactor is that we are now dealing with transaction batches that can be made to two different contracts (HorizonStaking and SubgraphService).

8. Dependencies & Tooling

  • Updated indexer packages from ethers v5 to ethers v6, eliminating a bunch of dependencies in the process.
  • Partially replaced usage of @graphprotocol/common-ts with the new packages:
    • @graphprotocol/address-book for obtaining protocol contract address books
    • @graphprotocol/toolshed for typescript common utilities
  • Future version to completely phase out @graphprotocol/common-ts package in favor of @graphprotocol/toolshed.

9. Full list of indexer-agent option changes

Change CLI option ENV var Description
New --max-provision-initial INDEXER_AGENT_MAX_PROVISION_INITIAL_SIZE The maximum number of tokens for the initial Subgraph Service provision
New --horizon-address-book INDEXER_AGENT_HORIZON_ADDRESS_BOOK Graph Horizon contracts address book file path
New --subgraph-service-address-book INDEXER_AGENT_SUBGRAPH_SERVICE_ADDRESS_BOOK Subgraph Service contracts address book file path
Removed --address-book INDEXER_AGENT_ADDRESS_BOOK Graph contracts address book file path
New --payments-destination INDEXER_AGENT_PAYMENTS_DESTINATION Address where payments are sent to. If not provided payments will be restaked.
New --confirmation-blocks INDEXER_AGENT_CONFIRMATION_BLOCKS The number of blocks to wait for a transaction to be confirmed

Additional resources:

@github-project-automation github-project-automation bot moved this to 🗃️ Inbox in Indexer May 16, 2025
@tmigone tmigone marked this pull request as draft May 16, 2025 18:12
@tmigone tmigone marked this pull request as ready for review September 2, 2025 13:14
Signed-off-by: Tomás Migone <[email protected]>
@github-project-automation github-project-automation bot moved this from 🗃️ Inbox to ✅ Approved in Indexer Sep 9, 2025
@tmigone tmigone changed the title Horizon support feat: horizon support Sep 15, 2025
Signed-off-by: Tomás Migone <[email protected]>
Signed-off-by: Tomás Migone <[email protected]>
@tmigone tmigone requested review from dwerner and fordN September 16, 2025 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Approved
Development

Successfully merging this pull request may close these issues.

4 participants