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

eth/downloader: introduce stricter block body throttling #31509

Draft
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

jwasinger
Copy link
Contributor

Currently, Geth calculates an exponentially-weighted moving average for the size of recently downloaded blocks, and uses this as a heuristic to figure out how many recently-downloaded blocks Geth is willing to keep in memory while they are pending addition to the chain. If we hit this number, we will throttle preventing subsequent requests for new blocks until the ones we have are imported into the chain.

Because this heuristic for expected average block size looks at recently downloaded blocks, we can have a situation where a prolonged lull in average block size drives the average down, causing Geth to increase the number of blocks it will simultaneously request. Then, if the newly-downloaded blocks are much larger than we expected, Geth can choke and go OOM.

In practice, this can't actually happen in a real-world setting: An attacker would have to be able to control the creation of a large sequence of hundreds of blocks.

However, we are seeing some OOMs in contrived attack scenarios, and this change intends to prevent those from occurring while hopefully not having a measurable effect on the sync speed.

@jwasinger jwasinger changed the title eth/downloader: introduce stricter block body throttle throttling eth/downloader: introduce stricter block body throttling Mar 27, 2025
@jwasinger jwasinger marked this pull request as draft March 28, 2025 08:30
@rjl493456442 rjl493456442 self-assigned this Mar 28, 2025
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

Successfully merging this pull request may close these issues.

2 participants