-
Notifications
You must be signed in to change notification settings - Fork 996
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] Configuration flag to allow possible 'null' blocks on a network #4729
Comments
I collaborated with @emmanuelm41 on this issue and want to share that in addition to the issue of constantly reverted blocks we also notice that the graph node falls behind about 200 blocks from the latest block, so it does not seem to keep up due to always reverting. Also, when querying the graph node in GraphQL we very often see an error message "the chain was reorganized while executing the query" which further indicates that this is a revert issue: |
Also, erigon clients for Polygon and BSC have kinda same problems. Some blocks (state transactions) do not return transactions and it causes the graph to treat it as reorg and wait until it gives up. |
@SozinM The When we are live, we check the continuity of the chain by checking if current head block's parent hash is the same as the previous block we have seen: https://github.com/graphprotocol/graph-node/blob/master/graph/src/blockchain/polling_block_stream.rs#L430-L450 (the I don't think the issue description applies to your use case @SozinM if only transactions are missing, it shouldn't cause weird re-org issue. Of course if the block is fully empty, that's another thing. |
At high-level, two approaches would be possible here:
Approach 2 is what you attempted with the proxy, but it runs into the issue which is that if block N is a dummy between blocks, then what should the parent hash of N + 1 be? In some situations we'd want it to be the hash of N - 1 as the chain says, and in others the hash of N to keep a continuous chain. I don't see a good way to solve this problem which leads me to think we should explore approach 1. There is a precedent in Graph Node for a chain which skips blocks, which is Near. In Near, block headers have both a graph-node/chain/near/src/codec.rs Lines 28 to 33 in 1535e24
Contrast it to Ethereum, which assumes the parent block number is graph-node/graph/src/components/ethereum/types.rs Lines 38 to 43 in 1535e24
We'd have to support a
A difference between Near and Ethereum is that Near is Firehose-only, so it uses a Firehose block ingestor. This will use an RPC block ingestor, which lives in This would be my suggestion at this point, hopefully it helps and I'm available to further discuss the approach or answer any questions about the code details. |
I'm going to try and stake a stab at this. |
Hi raulk, is there any update of your test? |
Hello @xianglinhe here is a set of changes that we have tested against a live Lotus node handling the "null blocks present" case: vulcanize#1 |
Hey @dboreham, it would be great to upstream these changes, could you open a PR? |
Description
Filecoin blockchain has added an EVM runtime on top of its blockchain some months ago. From Filecoin docs web:
"The FVM contains an Ethereum Virtual Machine (EVM) runtime, allowing Ethereum and Solidity developers to run their contracts on the FVM with little to no modifications. This page details what exactly this EVM compatibility means, and any other information that Ethereum developers may need to build applications on the FVM."
Because of the Filecoin's miner election process nature, "null" blocks can happen. When the random miner election process occurs, sometimes no winer is chosen. In that scenario, no tipset (group of blocks) is generated. On the ethereum rpc side, this is reflected with an error message indicating the block is null. Please, refer to Ethereum RPC doc.
We are currently trying to use the ethereum rpc on the Filecoin network to connect a graph node so that subgraphs can be deployed. However, the moment a null block is found, the process gets stuck there. Some possible fixes has been explored, but none of them have been effective. In particular, a proxy has been established between the graph node and the filecoin node to produce fake blocks when a null one is found. This an entire valid block with no txs on it. However, the chain is actually broken, as block hashes are not correctly chained (it is impossible to do it in this proxy). For this reason, we see constantly reverted blocks while new blocks are ingested.
One possible workaround to this could be a new flag for specific chains which can allow to "skip" blocks when they are "null".
Some screenshots from our grafana dashboard
These are some of the logs we see on the node
Are you aware of any blockers that must be resolved before implementing this feature? If so, which? Link to any relevant GitHub issues.
No response
Some information to help us out
The text was updated successfully, but these errors were encountered: