fix: raise snap response limits to prevent SnapSync regression#10904
Merged
kamilchodola merged 2 commits intomasterfrom Mar 20, 2026
Merged
fix: raise snap response limits to prevent SnapSync regression#10904kamilchodola merged 2 commits intomasterfrom
kamilchodola merged 2 commits intomasterfrom
Conversation
MaxResponseAccounts (16,384) and MaxResponseSlotsPerAccount (16,384) were too low for valid snap protocol responses within the 3 MiB cap. Peers sending 25K-38K accounts or large storage ranges triggered RlpLimitException, which disconnected and banned the peer for 15 minutes — collapsing SnapSync throughput to ~1% in 15 minutes (was 25% in 5 minutes before #10753). Raise both limits to 131,072 which safely exceeds the theoretical maximum item count at minimum entry size within a 3 MiB response. Add invariant tests that verify response limits are consistent with MaxResponseBytes, plus boundary roundtrip tests at production-scale counts (40K accounts, 50K slots).
flcl42
approved these changes
Mar 20, 2026
LukaszRozmej
approved these changes
Mar 20, 2026
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.
Summary
MaxResponseAccountsandMaxResponseSlotsPerAccountfrom 16,384 to 131,072 inSnapMessageLimitsChanges
#10753 introduced RLP deserialization limits for snap protocol messages. The response-side limits were set at 16,384 — too low for valid responses within the 3 MiB cap. Peers sending normal AccountRange responses (25K–38K accounts observed on Hoodi) triggered
RlpLimitException, which disconnects and bans the peer for 15 minutes with -10,000 reputation. This progressively banned all snap-serving peers, collapsing SnapSync from ~25% in 5 minutes to ~1% in 15 minutes.131,072 safely exceeds the theoretical maximum at minimum entry size (3 MiB / ~36 bytes ≈ 87K items).
Type of change
Testing
SnapMessageLimitsTests:MaxResponseAccounts_accommodates_max_response_bytes— invariant: limit ≥ max items at min entry sizeMaxResponseSlotsPerAccount_accommodates_max_response_bytes— same for storage slotsRoundtrip_AccountRange_at_40k_accounts— serialize/deserialize 40K accounts without RlpLimitExceptionRoundtrip_StorageRange_at_50k_slots— serialize/deserialize 50K slots without RlpLimitExceptionSee also #10902 for additional follow-up findings from the #10753 refactor.