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

a race condition in blocks state causes accidental backfilling #501

Open
karen-sarkisyan opened this issue Jan 30, 2025 · 1 comment
Open

Comments

@karen-sarkisyan
Copy link
Contributor

In core/src/execution/state.rs there's a race condition when a latest or a finalized block gets pushed into blocks tree.

Each push of a block triggers a check for a need to backfill missed blocks (see push_block() method). There's no intention in helios to backfill blocks at startup, so it starts checking for a need to backfill only when it has at least 2 blocks in state.

However, in case when finalized block is pushed into blocks tree first, and latest block is second, there can be a large gap between these 2 blocks in blocks tree, which is then filled by sending RPC calls.

@sam-ejma081
Copy link

Hello, we tried to solve the issue.

This is what we did:

Modified the push_block and push_finalized_block methods to prevent unnecessary backfilling when there's a large gap between finalized and latest blocks. Added a new max_backfill parameter to limit the number of blocks to backfill.

You can review changes in this commit: sam-ejma081@cf26bbe.

Caution

Disclaimer: The concept of solution was created by AI and you should never copy paste this code before you check the correctness of generated code. Solution might not be complete, you should use this code as an inspiration only.


Latta AI seeks to solve problems in open source projects as part of its mission to support developers around the world. Learn more about our mission at https://latta.ai/ourmission . If you no longer want Latta AI to attempt solving issues on your repository, you can block this account.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants