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
The chain contains non-consensus blocks #1644
Comments
Possible remedy: wait until all internal transactions get successfully imported, and re-fetch the remaining blocks. As each and every transaction has at least one internal transaction, missing transactions will prevent their blocks from being marked as indexed anyway, so we can safely assume that unmarked blocks contain missing transactions and need to be re-fetched. |
The number of affected blocks:
The bug manifested itself occasionally from |
Due to a bug in the realtime fetcher some of the blocks weren't marked as non-consensus and now they create a discontinuity in the main chain (#1644). This PR adds a temporary fetcher, which forces a refetch of blocks that don't belong to the main chain.
Due to a bug in the realtime fetcher some of the blocks weren't marked as non-consensus and now they create a discontinuity in the main chain (#1644). This PR adds a temporary fetcher, which forces a refetch of blocks that don't belong to the main chain.
Due to a bug in the realtime fetcher some of the blocks weren't marked as non-consensus and now they create a discontinuity in the main chain (#1644). This PR adds a temporary fetcher, which forces a refetch of blocks that don't belong to the main chain.
It seems that I found a reason for this bug. Consider this chain of consensus blocks successfully imported and stored in the database:
(where Now two new blocks arrive from a node:
As all these blocks are marked as consensus and there're no holes in numbering, we don't try to refetch block Proposed solution: when importing block force consensus loss not only for existing block on the same If the forked chain is larger than two blocks, it's still fine, as the consensus loss will propagate when the missing block will be refetched. |
Fixes #1644 When reorg occurs and the older of new blocks fails to be imported, the old consensus block remains in the database. Catchup fetcher ignores it, and we get a discontinuity in the main chain. This commit adds an additional consensus loss step during block import: the parent block with hash not matching parent_hash of current block is marked non-consensus, thus creating a hole in main chain, forcing catchup fetcher to retry fetching it.
Fixes #1644 When reorg occurs and the older of new blocks fails to be imported, the old consensus block remains in the database. Catchup fetcher ignores it, and we get a discontinuity in the main chain. This commit adds an additional consensus loss step during block import: the parent block with hash not matching parent_hash of current block is marked non-consensus, thus creating a hole in main chain, forcing catchup fetcher to retry fetching it.
Fixes #1644 When reorg occurs and the older of new blocks fails to be imported, the old consensus block remains in the database. Catchup fetcher ignores it, and we get a discontinuity in the main chain. This commit adds an additional consensus loss step during block import: the parent block with hash not matching parent_hash of current block is marked non-consensus, thus creating a hole in main chain, forcing catchup fetcher to retry fetching it.
Fixes #1644 When reorg occurs and the older of new blocks fails to be imported, the old consensus block remains in the database. Catchup fetcher ignores it, and we get a discontinuity in the main chain. This commit adds an additional consensus loss step during block import: the parent block with hash not matching parent_hash of current block is marked non-consensus, thus creating a hole in main chain, forcing catchup fetcher to retry fetching it.
* master: Update changelog Address review comments Add a migration to mark all invalid blocks as non-consensus (#1644) Force consensus loss for parent block if its hash mismatches parent_hash Add regression test for #1644 feat: add listcontracts endpoint fix view test use correct type for evm_version define evm versions in one place fix dialyzer set only hours in env var fetch transaction period from env variables add changelog entry add petersburg evm version add CHANGELOG entry fix credo fix tests use cache for estimated transaction count add transaction count cache
This causes foreign key violations when importing internal transactions for them.
Compare, for example:
https://etherscan.io/txs?block=6479035 — 160 txs
https://blockscout.com/eth/mainnet/blocks/6479035/transactions — 9 txs
This particular block was fetched on October 8th, 2018.
As it was imported 10 seconds after mining, the bug was most probably present in the realtime fetcher.
UPD: the block in our database is a non-consensus one, which can be confirmed by its hash.
Blocks on the both sides from it are consensus ones.
The text was updated successfully, but these errors were encountered: