feat: avoid rate limit syncing#8166
Merged
Merged
Conversation
wemeetagain
reviewed
Aug 11, 2025
wemeetagain
approved these changes
Aug 11, 2025
wemeetagain
pushed a commit
that referenced
this pull request
Aug 11, 2025
**Motivation** - sync chain was stuck because some peers incorrectly response 0 block for a batch when they don't have it, see #8147 - batch `n` has 0 block so chain does not process anything (and note that this is wrong response from peers, most likely peer started from a `checkpointSyncUrl` - batch `n+1` cannot process due to `UNKNOWN_BLOCK_PARENT` - then SyncChain stuck - sometimes other clients throw `ResourceUnavailable` instead, and that's expected in the spec **Description** - set `MAX_BATCH_PROCESSING_ATTEMPTS` to 0, ie if we cannot process a batch, we remove that sync chain and RangeSync will automatically add a new one - do not sync from peers without `earliestAvailableSlot` - throw error if peers return 0 blocks (peers should have returned `ResourceUnavailable` error in that case according to [the spec](https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/p2p-interface.md#responding-side), we handle just in case. For lodestar, I tracked that in #8149) Closes #8147 was able to sync `fusaka-devnet-3` 2 times using this branch along with #8166 <img width="851" height="346" alt="Screenshot 2025-08-09 at 14 45 32" src="https://github.com/user-attachments/assets/1f3afca0-13a6-4f7a-9c18-51d03cc34793" /> --------- Co-authored-by: Tuyen Nguyen <twoeths@users.noreply.github.com>
wemeetagain
pushed a commit
that referenced
this pull request
Aug 13, 2025
**Motivation** - per spec, we should not issue more than 2 requests per protocol per peer https://github.com/ethereum/consensus-specs/blob/master/specs/phase0/p2p-interface.md#constants - we should be able to self detect that and see `REQUEST_ERROR_RATE_LIMITED` instead of sending requests to peer and get `RESPONSE_ERROR_RATE_LIMITED` **Description** - Implement SelfRateLimiter - before sending out a request, call `selfRateLimiter.allows()` - after finishing a request, call `selfRateLimiter.requestCompleted()` - check for disconnected peers automatically, similar to `RateLimiterGRCA` - RangeSync already manage active requests and prevent that from happening, see #8166 - UnknownBlockSync needs to implement the same thing, tracked in #8182 part of #8033 --------- Co-authored-by: Tuyen Nguyen <twoeths@users.noreply.github.com>
Member
|
🎉 This PR is included in v1.34.0 🎉 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Description
part of #8033
Test results on fusaka-devnet-3
was able to sync
fusaka-devnet-32 times using this branch along with #8150