[Feature] Query all time-travel versions of an entity as a list

Open
#3,480 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
graphql
Domain
api, backend

Research direction

The issue provides a GraphQL example for querying time-travel versions but names no files, tests, or implementation entry points. Clarify the schema and storage design with maintainers first; done should include a defined query for historical entity versions and tests covering its results.

Written by the indexing model from the issue text.

Description

area/graphql Stale

Do you want to request a feature or report a bug?
Feature

What is the current behavior?
To query a time-travel version of an entity, you have to specify a block number/hash and you can only query one version at a time.

When you display the history of an entity, you need to store a separate immutable snapshot entity every time the main entity changes. It's a very OK strategy but feels like a waste when behind the scenes there's already a history stored in the database (if I'm not mistaken).

What is the expected behavior?
Enable to query all the time-travel versions of an entity, without any knowledge of blocks the entity changed at. Example of a GraphQL query:

query getBalanceHistory {
  balance(id: "example_id") {
    currentBalance
    timeTravelVersions(first: 10) { # This is a collection on every mutable entity where you can get all the time-travel versions from.
      currentBalance
      blockNumber
    }
  }
}

Why do I need this?
To do historical visualizations of entities (namely balances).

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

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.

More from graphprotocol/graph-node

All issues in graphprotocol/graph-node

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.