graph-node
graph-node copied to clipboard
[Bug] If eth_getLogs returns block with "removed": true - subgraph stucks indefinitely
Bug report
Maaaybe connected with #3105
My subgraph stucked on my chain on 4073521 block and I see Index node is trying to resync it constantly (see log output).
I checked that Index node is doing that with eth_getLogs, and performed the request myself. In the output I saw two different blocks even though the request was only for 1 block:
{
"jsonrpc":"2.0",
"method":"eth_getLogs",
"params":[{
"fromBlock":"0x3E2831",
"toBlock":"0x3E2831"
}],
"id":74
}
So, I went ahead and checked that these 2 blocks in response one has removed: false and another has removed: true, so it seems some reorg happened at that block, and node knows about that so returns data about both events.
Although, Index node seems to not to interpret this data correctly and stucks trying to understand why 1 block is actually two blocks (see log output).
Probably, this is an expected behavior:
https://github.com/graphprotocol/graph-node/blob/master/chain/ethereum/src/ethereum_adapter.rs#L1708C1-L1716C22
In these lines of code authors wrote that this function will not properly handle if the chain is a subject of reorgs. But it sounds a bit weird to me as there is no information on ethereum.org (https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getlogs) that eth_getLogs shall not return removed blocks after the finality time.
Is this something that could be fixed? Thanks!
Relevant log output
Oct 11 03:01:28.099 INFO Scanning blocks [4073521, 4073521], target_range_size: 1, sgd: 9, subgraph_id: Qma3GhjAmct4Gbkz74KYLuEho7RYMd74JMfiqo1FgxWv5i, component: BlockStream
Oct 11 03:01:28.099 DEBG Finding nearest valid `to` block to 4073521, sgd: 9, subgraph_id: Qma3GhjAmct4Gbkz74KYLuEho7RYMd74JMfiqo1FgxWv5i, component: BlockStream
Oct 11 03:01:28.145 DEBG Requesting logs for blocks [4073521, 4073521], contract 0xf7c27a7c5b33933880ce8f4054c4d340020181b2, 6 events, topic1: [None], topic2: [None], topic3: [None], sgd: 9, subgraph_id: Qma3GhjAmct4Gbkz74KYLuEho7RYMd74JMfiqo1FgxWv5i, component: BlockStream
Oct 11 03:01:28.145 DEBG Requesting logs for blocks [4073521, 4073521], contract 0x35e9d8e0223a75e51a67aa731127c91ea0779fe2, 5 events, topic1: [None], topic2: [None], topic3: [None], sgd: 9, subgraph_id: Qma3GhjAmct4Gbkz74KYLuEho7RYMd74JMfiqo1FgxWv5i, component: BlockStream
Oct 11 03:01:28.145 DEBG Requesting logs for blocks [4073521, 4073521], contract 0xb74749b2213916b1da3b869e41c7c57f1db69393, 2 events, topic1: [None], topic2: [None], topic3: [None], sgd: 9, subgraph_id: Qma3GhjAmct4Gbkz74KYLuEho7RYMd74JMfiqo1FgxWv5i, component: BlockStream
Oct 11 03:01:28.147 DEBG Found 2 relevant block(s), sgd: 9, subgraph_id: Qma3GhjAmct4Gbkz74KYLuEho7RYMd74JMfiqo1FgxWv5i, component: BlockStream
Oct 11 03:01:28.151 DEBG Requesting 2 block(s), sgd: 9, subgraph_id: Qma3GhjAmct4Gbkz74KYLuEho7RYMd74JMfiqo1FgxWv5i, component: BlockStream
Oct 11 03:01:33.731 DEBG Trigger data had duplicate triggers, new_length: 1, old_length: 2, block_hash: 9bdcfa3dcf978b56901e94e2b6ac6e220d27f957e7113d614e522a47e78496cb, block_number: 4073521, sgd: 9, subgraph_id: Qma3GhjAmct4Gbkz74KYLuEho7RYMd74JMfiqo1FgxWv5i, component: BlockStream
Oct 11 03:01:33.734 DEBG Block stream produced a non-fatal error, error: block stream error block #4073521 (94b6432ae5fa4183633d1f4a40de651e09492b5d1fa6bbb707db340899e81814) not found in `triggers_by_block`, sgd: 9, subgraph_id: Qma3GhjAmct4Gbkz74KYLuEho7RYMd74JMfiqo1FgxWv5i, component: SubgraphInstanceManager
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.
- [X] I have searched the issue tracker to make sure this issue is not a duplicate.
OS information
Linux