graphprotocol / graphprotocol/graph-node

Allow File Data Sources to update an entity

Open
#4,087 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Currently, different File Data Sources can create multiple entities with the same ID.

File Data Sources should instead be able to update an entity with the same ID. Note that this will not be an upsert, which is the current pattern that is used for chain-based data sources. Instead this should completely overwrite the prior entity.

Situation:

file data source A created in block 1
A is found, saves entity X
file data source B created in block 5
file data source C created in block 10
C is found, saves entity X again <-- this is the most recent
B is found, saves entity X again

Entity updates should apply a "most recent wins" approach, where the time is determined by block time, not handler execution time. This is a new pattern (where entities might be created with closed block ranges), and order will need to be resolved within blocks (as well as between blocks)

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

No file, test, or entry point is named. Start by tracing how file data sources save entities and compare that path with the existing chain-based upsert pattern, then determine how block time and ordering within a block are represented. Done means repeated saves use the most recent block-ordered value and completely overwrite the prior entity without upserting.

Written by the indexing model from the issue text.

Assessment

Tech stack
blockchain, rust
Domain
backend, blockchain
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.