Skip to content
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

Incorrectly marking bad blocks halts chain #5460

Open
siladu opened this issue May 16, 2023 · 2 comments
Open

Incorrectly marking bad blocks halts chain #5460

siladu opened this issue May 16, 2023 · 2 comments
Labels
bug Something isn't working enhancement New feature or request mainnet P3 Medium (ex: JSON-RPC request not working with a specific client library due to loose spec assumtion)

Comments

@siladu
Copy link
Contributor

siladu commented May 16, 2023

Problem: If Besu puts an INVALID block in the bad block cache and that block is subsequently valid, then we can only recover with a manual restart.

Some reasons that Besu might 'incorrectly' mark blocks as INVALID:

There are other scenarios where besu marks blocks as INVALID such as when backwards syncing that probably should continue to do that so we don't end up with besu on a fork.

Potential Solutions:

  1. Maintain both an "operational" and an "archive" bad block cache. Always add to the "archive", maybe don't add to the "operational" (this might be useful even alongside the other options).
  2. Have the cache expire after some time or after repeated hits (converse of (3)).
  3. Use a circuit breaker approach where we only add it to the bad block cache if we get the same bad block after X retries (converse of (2)).
  4. Extreme version of (1) where we only maintain an "archive", no "operational" cache and so always re-process bad blocks - this is the most lenient approach.

(2) is what geth do: https://github.com/ethereum/go-ethereum/blob/73697529994e14996b7740730481e926d5ec3e40/eth/catalyst/api.go#L105-L109

Geth's response about how they handle it https://discord.com/channels/595666850260713488/892088344438255616/1078206539548078122:

Seems I was somewhat wrong about that. In the 'core' blockchain, we do have badblocks-tagging, and we do store it to disk, but never ever consult it ourselves during processing. So I was right about that. However, the beacon API module has it's own cache for bad blocks, to avoid re-validating already known 'bad' blocks, and I didn't know about that. The cache is pretty small, though, and apparently the idea was to actually sometimes revalidate them anyway and not be too strict about it.

The reasoning behind not caching bad blocks would be just what happened here: a (temporary) situation occurs, which marks a good block as bad. Later, after the situation has been resolved, the reputation of certain blocks lingers, and causes long-term problems / longer splits than necessary.

Related to:

Original discussion here: https://discord.com/channels/905194001349627914/905205502940696607/1077867357487243315

@non-fungible-nelson
Copy link
Contributor

expire with persistence on disk

@non-fungible-nelson non-fungible-nelson added P3 Medium (ex: JSON-RPC request not working with a specific client library due to loose spec assumtion) TeamGroot GH issues worked on by Groot Team TeamRevenant GH issues worked on by Revenant Team TeamChupa GH issues worked on by Chupacabara Team labels May 25, 2023
@non-fungible-nelson non-fungible-nelson added the bug Something isn't working label Jul 10, 2023
@non-fungible-nelson
Copy link
Contributor

@siladu - any update on this issue?

@jflo jflo removed TeamChupa GH issues worked on by Chupacabara Team TeamGroot GH issues worked on by Groot Team TeamRevenant GH issues worked on by Revenant Team labels Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request mainnet P3 Medium (ex: JSON-RPC request not working with a specific client library due to loose spec assumtion)
Projects
None yet
Development

No branches or pull requests

3 participants