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
Orphan blocks not removed from Block table #114
Comments
The simplest solution to this is is to remove blocks which have been orphaned like this. As an alternative to removing them, we could move them to an separate Having an |
My very first thought was also: clean the orphaned block out, but keep it somewhere. It could become even an option for the node to store all detected forks including all blocks from the abandoned side arm in this table. Purging after x slots is simple. diagnostics and tracing of what's happened is much easier then. |
The question about lost TXs is interesting. As a quick idea, without knowing if it's cryptographically possible and 100% safe: If a (db-sync enabled) node detect TXs from orphaned blocks, he could try to reinsert them in his mempool. Not broadcast it further, but only process it if it's his turn to produce a block. If the utxo owner meanwhile (until forks are resolved and orphaned blocks detected) submitted a second attempt, the previous TX becomes invalid. If instead the tx is still valid, it will automatically appear in a new valid block again. Wallets need to be able to handle a situation then, where they might see their tx in a block, who then is orphaned, and some blocks later the same tx is placed in another, then hopefully valid block. |
Its important to note that The wallet of course has different behavior from |
If the TXs are almost certainly processed by other block producers then ofc there is no need to "re-inject" them with some tool from db to node's mempool. |
However maintaining a list of block orphaned within the last 100 or so slots may be useful for debugging. |
I think the block should be removed on rollback, and we should use cascading deletes to delete everything that is logically within the deleted blocks. There is no point trying to preserve blocks that have been rolled back. This is not a monitoring tool for monitoring block propagation within the network. It is only observing at one place, and as a node client, so it would be very unreliable when used in that role. |
I agree we should keep db-sync as pure as possible a reflection of actual chain state. However, it would greatly simplify my life if ALL blocks made it into db-sync, and then were deleted on on rollbacks. That way I can trigger on the postgres delete and do what I want with the data. |
This is needed by other clients and Sam says it is critical for any db-sync release, including Testnet. |
It seems like rollbacks aren't working as expected. We see multiple blocks in the DB with the same block height. Here's an example (on mainnet): cexplorer=# SELECT * FROM block WHERE block_no=4224831; |
Rollback messages from chainsync were not being handled correctly which meant that orphaned blocks were not removed. When orphaned blocks were not removed from the block table that table could end up with two or more rows with the same block number. Closes: #114
Rollback messages from chainsync were not being handled correctly which meant that orphaned blocks were not removed. When orphaned blocks were not removed from the block table that table could end up with two or more rows with the same block number. Closes: #114
Rollback messages from chainsync were not being handled correctly which meant that orphaned blocks were not removed. When orphaned blocks were not removed from the block table that table could end up with two or more rows with the same block number. Closes: #114
Rollback messages from chainsync were not being handled correctly which meant that orphaned blocks were not removed. When orphaned blocks were not removed from the block table that table could end up with two or more rows with the same block number. Closes: #114
Rollback messages from chainsync were not being handled correctly which meant that orphaned blocks were not removed. When orphaned blocks were not removed from the block table that table could end up with two or more rows with the same block number. Closes: #114
The validate program reports:
and a simple query:
results in two rows where only one was expected.
The block with the lower slot number was obviously orphaned, but the fact that no later block extended that chain was not detected and hence, the block not removed from the database.
Blocks that are orphaned like this should either be removed from the database, or avoided in the validate process.
The text was updated successfully, but these errors were encountered: