graphprotocol / graphprotocol/graph-node
Make ChainStore agnostic to block serialization format
Nobody has claimed this yet.
- 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.blockswhich helps reduce the data that needs to be deserialized. ChainStoreneeds to be object safe, soblocksandancestor_blockcan't be parametrized on some sort ofFromChainStoreDatatrait
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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