graphprotocol / graphprotocol/graph-node

Gas errors on the network

Open
#3,558 6 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

area/runtime
Dominant language
Rust
Stars
3.2k
Forks
1.1k
Avg merge
4d 1h
Merged PRs (30d)
1

Description

A number of subgraphs on the network have hit the default gas limit, so indexers must configure a larger one. We should look into these with the purpose of adjusting gas costs that may be overestimated. These subgraphs have been reported as going over the limit:

QmTiKBqwDjDtjAoCNgKLFjyg9UmwyFkVMFRVzBdnFmwYEi, QmayVPFDjZ4PP8rsKiNsZ3bZsqrQo4RTaeMm966wQsjP7R, QmWd8mE5nedM5smvzQhDYmsWEcgiAtdqccdZ2XCsvCdVEK.

The Eden Network (QmWd8mE5nedM5smvzQhDYmsWEcgiAtdqccdZ2XCsvCdVEK, source link case has more details. It fails with:

May 11 12:44:54.957 ERRO Subgraph failed with non-deterministic error: failed to process trigger: block #13807949 (0x0bf6…ac4c), transaction 0229c81e816101dbb7f5ecfb4ea3a0eb2c82083f10123e0a504a1dbd7063eaa1: Gas limit exceeded. Used: 10000016722787	wasm backtrace:	    0: 0x2235 - <unknown>!~lib/@graphprotocol/graph-ts/index/Value#toArray	    1: 0x2891 - <unknown>!src/network/stakeUnstake	    2: 0x271f - <unknown>!src/network/stakeUnstake~anonymous|5	    3: 0x292b - <unknown>!src/network/stake	    4: 0x29d2 - <unknown>!~lib/internal/memory/memcmp	, retry_delay_s: 1800, attempt: 651, sgd: 101, subgraph_id: QmWd8mE5nedM5smvzQhDYmsWEcgiAtdqccdZ2XCsvCdVEK, component: SubgraphInstanceManager
May 11 12:44:54.955 INFO Done processing trigger, gas_used: 0, data_source: EdenNetwork, handler: stake, total_ms: 62643, transaction: 0x0229…eaa1, address: 0x9e33…c453, signature: Stake(indexed address,uint256), block_hash: 0x0bf6b37adec469650eeac0d9dea4add97fcf9acbc37c3412accf40b96399ac4c, block_number: 13807949, sgd: 101, subgraph_id: QmWd8mE5nedM5smvzQhDYmsWEcgiAtdqccdZ2XCsvCdVEK, component: SubgraphInstanceManager

Probably due to iterating over a large collection, the network.stakers array might be as large as 4.5k entries.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the gas-limit failure in the reported log and compare it with the Eden Network source at packages/subgraph/src/network.ts lines 116-124, especially the large network.stakers collection. Trace how this execution is metered in graph-node and identify whether the reported gas cost is overestimated; done means the affected subgraphs no longer hit the default limit without requiring a configuration increase.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend, blockchain, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.