-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Bug report
Steps to reproduce:
- launch graph-node with a subgraph, without any rpc provider, so that firehose is used as the blockIngestor
- restart graph-node without firehose, using rpc provider as the blockingestor and stream source for the subgraph
- observe the following debug logs:
DEBG Block stream produced a non-fatal error, error: missing fieldparentHash,
Workaround
- Flushing the block cache fixes the issue
Explanation
The "firehose block ingestor" is implemented differently that the "rpc block ingestor". It only saves the block hash and number to the database:
graph-node/store/postgres/src/chain_store.rs
Lines 1740 to 1745 in 3d6645e
| update(n::table.filter(n::name.eq(&self.chain))) | |
| .set(( | |
| n::head_block_hash.eq(&hash), | |
| n::head_block_number.eq(number), | |
| n::head_block_cursor.eq(cursor), | |
| )) |
(called from
https://github.com/graphprotocol/graph-node/blob/master/graph/src/blockchain/firehose_block_ingestor.rs#L153)
The "rpc block ingestor" saves more data in the database:
graph-node/store/postgres/src/chain_store.rs
Lines 1570 to 1574 in 3d6645e
| // We should always have the parent block available to us at this point. | |
| if let Some(parent_hash) = block.parent_hash() { | |
| self.recent_blocks_cache | |
| .insert_block(block.ptr(), block.data().ok(), parent_hash); | |
| } |
(called from ingest_block() in https://github.com/graphprotocol/graph-node/blob/master/chain/ethereum/src/ingestor.rs#L181)
Proposed solution
either:
- fix the firehose-based ingestor so that it adds all the required fields (namely, parent_hash)
- add a check on graph-node start: if the subgraphs are being served from RPC for a given chain, validate that the blocks are complete in the database or flush the cache)
Relevant log output
No response
IPFS hash
No response
Subgraph name or link to explorer
No response
Some information to help us out
- Tick this box if this bug is caused by a regression found in the latest release.
- Tick this box if this bug is specific to the hosted service.
- I have searched the issue tracker to make sure this issue is not a duplicate.
OS information
None
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working