graphprotocol / graphprotocol/graph-node

Make ChainStore agnostic to block serialization format

Open
#2,999 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

PR #2886 and #2998 still leave some assumptions about how blocks are serialized and deserialized in the ChainStore. In particular, they assume that the serialization follows the form of an EthereumBlock. That can cause issues for other chains if they store blocks with a different serialization format and try to read them, assuming they get their own serialization back.

A more robust fix would parametrize ChainStore.blocks and ChainStore,ancestor_block (the only methods that read the serialized data from the chain store and now return a json::Value) so that the caller passes in instructions on how to deserialize instead of leaving it up to the store. That is not entirely trivial because

  • the current code does not read transaction receipts in ChainStore.blocks which helps reduce the data that needs to be deserialized.
  • ChainStore needs to be object safe, so blocks and ancestor_block can't be parametrized on some sort of FromChainStoreData trait

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 by reviewing ChainStore.blocks and ChainStore.ancestor_block, along with the assumptions identified in PRs #2886 and #2998. Trace how these methods deserialize serialized blocks and how object safety constrains the API. Done means callers provide deserialization instructions, transaction-receipt handling remains appropriate, and non-Ethereum block formats can be read back in their own serialization.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.