indexer icon indicating copy to clipboard operation
indexer copied to clipboard

Allow closing allocations when maxBlock is set in manifest

Open dwerner opened this issue 11 months ago • 3 comments

Previously, subgraphs continued scanning even when all the data sources had passed the end block. This update finds the maximum end block across the data sources and stops the subgraph from scanning once the max_end_block is reached.

The agent won't be able to close allocations for those subgraphs because they aren't at chainhead.

related: https://github.com/graphprotocol/graph-node/pull/5583

dwerner avatar Dec 26 '24 22:12 dwerner

Reproducing this with local-network:

  1. create a subgraph with endBlock defined (1000 in my case)
  2. deploy and allocate to it
  3. mine blocks past the end block defined
  4. verify that latestBlock in indexerStatus is remaining at 1000 while chainHeadBlock keeps on going
  5. queue up an unallocate and wait for the action to be executed
  6. observe this error below:
{
    "action": 3,
    "component": "AllocationManager",
    "error": {
        "cause": "POI not available for deployment at current epoch start block.\n              currentEpochStartBlock: 1210\n              deploymentStatus: [{\"subgraphDeployment\":{\"kind\":\"deployment-id\",\"value\":\"0x07e7cae9b5004024f70ad7d0f473b5b1867a7698fc871b9816e625a210d751fd\"},\"synced\":true,\"health\":\"healthy\",\"fatalError\":null,\"node\":\"default\",\"chains\":[{\"network\":\"hardhat\",\"latestBlock\":{\"number\":\"1000\",\"hash\":\"6a7425df7ae6b0e3cba250a85b1b370e49c05e1b08910732903731b8479af38c\"},\"chainHeadBlock\":{\"number\":\"1211\",\"hash\":\"d7487e29ab1280039235fc9d0faab92863cd85dc475a6660351fa20f44efa3c6\"},\"earliestBlock\":{\"number\":\"0\",\"hash\":\"0x0\"}}]}]",
        "code": "IE067",
        "explanation": "https://github.com/graphprotocol/indexer/blob/main/docs/errors.md#ie067"
    },
    "formatted_time": "2025-02-04 15:43:15:223",
    "hostname": "c829539864db",
    "level": 50,
    "level_text": "ERROR",
    "msg": "Failed to prepare tx call data",
    "name": "IndexerAgent",
    "pid": 173,
    "protocolNetwork": "eip155:1337",
    "time": 1738712595223
}

dwerner avatar Feb 04 '25 23:02 dwerner

https://github.com/graphprotocol/indexer/blob/main/packages/indexer-common/src/indexer-management/monitor.ts#L951

dwerner avatar Feb 04 '25 23:02 dwerner

In my fix here https://github.com/graphprotocol/indexer/pull/1085

{
    "action": 4,
    "allocation": "0xcD0A322b8177228bEBe503E1e5BEb94d17CcC32F",
    "amountGRT": "0.005",
    "component": "AllocationManager",
    "deployment": {
        "bytes32": "0x07e7cae9b5004024f70ad7d0f473b5b1867a7698fc871b9816e625a210d751fd",
        "ipfsHash": "QmNsWZYpBmqXm4zEZRq5GpaB1BJ2J1hP8LgwW5ySYSrK3i"
    },
    "formatted_time": "2025-02-05 11:36:40:956",
    "hostname": "c829539864db",
    "indexer": "0xf4EF6650E48d099a4972ea5B414daB86e1998Bd3",
    "indexingRewards": {
        "hex": "0x00",
        "type": "BigNumber"
    },
    "level": 30,
    "level_text": "INFO",
    "msg": "Successfully closed allocation",
    "name": "IndexerAgent",
    "pid": 5703,
    "poi": "0xa0385267ee1d724b48dab571b4e8b73e22d8726adc043e5f831fa74b5309dbbe",
    "protocolNetwork": "eip155:1337",
    "time": 1738784200956,
    "transaction": "0x9eb5cc2e69d7a35d14390bbd5f1d229105cc42095dd3230be3b696745761a950"
}

I am now able to resolve the PoI from the block automatically.

dwerner avatar Feb 05 '25 19:02 dwerner