graphprotocol / graph-node

Graph Node indexes data from blockchains such as Ethereum and serves it over GraphQL
https://thegraph.com
Apache License 2.0
2.91k stars 974 forks source link

cannot specify startBlock at subgraph.yaml for kind: substreams #4382

Closed tw7613781 closed 1 year ago

tw7613781 commented 1 year ago

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

What is the current behavior? blocks for substreams module only starts from block 0. If there is a initialBlock in substreams.yaml, the graph node will log the error "start block 0 smaller than request outputs for module \"graph_out\" with start block 5000000"

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.

What is the expected behavior? feed blocks from specified block number

The details logs

graph-node-graph-node-1  | Feb 20 08:54:55.639 INFO Syncing 1 blocks from Ethereum, code: BlockIngestionStatus, blocks_needed: 1, blocks_behind: 1, latest_block_head: 25826487, current_block_head: 25826486, provider: block-ingestor, component: BlockIngestor
graph-node-graph-node-1  | Feb 20 08:54:55.810 INFO Blockstreams disconnected, connecting, cursor: , start_block: 0, endpoint_uri: substreams-mainnet-0, sgd: 1, subgraph_id: QmZfQSe8SdXRo2hP3wda27nBT4dLN3Ti8XcU5L1vyM17L2, component: SubstreamsBlockStream
graph-node-graph-node-1  | Feb 20 08:54:55.876 INFO Blockstreams connected, sgd: 1, subgraph_id: QmZfQSe8SdXRo2hP3wda27nBT4dLN3Ti8XcU5L1vyM17L2, component: SubstreamsBlockStream
graph-node-graph-node-1  | Feb 20 08:54:55.878 INFO received err, sgd: 1, subgraph_id: QmZfQSe8SdXRo2hP3wda27nBT4dLN3Ti8XcU5L1vyM17L2, component: SubstreamsBlockStream
graph-node-graph-node-1  | Feb 20 08:54:55.878 ERRO An error occurred while streaming blocks: status: InvalidArgument, message: "start block 0 smaller than request outputs for module \"graph_out\" with start block 5000000", details: [], metadata: MetadataMap { headers: {} }, sgd: 1, subgraph_id: QmZfQSe8SdXRo2hP3wda27nBT4dLN3Ti8XcU5L1vyM17L2, component: SubstreamsBlockStream
graph-node-graph-node-1  | Feb 20 08:54:56.879 INFO Blockstreams disconnected, connecting, cursor: , start_block: 0, endpoint_uri: substreams-mainnet-0, sgd: 1, subgraph_id: QmZfQSe8SdXRo2hP3wda27nBT4dLN3Ti8XcU5L1vyM17L2, component: SubstreamsBlockStream
graph-node-graph-node-1  | Feb 20 08:54:56.980 INFO Blockstreams connected, sgd: 1, subgraph_id: QmZfQSe8SdXRo2hP3wda27nBT4dLN3Ti8XcU5L1vyM17L2, component: SubstreamsBlockStream
graph-node-graph-node-1  | Feb 20 08:54:56.981 INFO received err, sgd: 1, subgraph_id: QmZfQSe8SdXRo2hP3wda27nBT4dLN3Ti8XcU5L1vyM17L2, component: SubstreamsBlockStream

version: graph node: graphprotocol/graph-node c21487e 3a80a40131e2 substreams module: https://github.com/streamingfast/substreams-eth-block-meta/tree/feature/graph-node

YaroShkvorets commented 1 year ago

Also ran into this issue.

This logic of picking the startBlock, where we pick the MIN initialBlock among all modules in the package, seems wrong.

We should either