fix(p2p): check peer rate limit before global to prevent quota starvation#21997
Merged
PhilWindle merged 1 commit intomerge-train/spartanfrom Mar 25, 2026
Merged
Conversation
…tion Fixes https://linear.app/aztec-labs/issue/A-758 Made-with: Cursor
PhilWindle
approved these changes
Mar 25, 2026
AztecBot
pushed a commit
that referenced
this pull request
Mar 25, 2026
…tion (#21997) ## Summary In `SubProtocolRateLimiter.allow()`, the global rate limiter was checked first. `GCRARateLimiter.allow()` advances its virtual scheduling time (VST) as a side effect whenever it returns `true`, so a request that passed the global check but failed the per-peer check would silently consume a global quota token. A single spamming peer could therefore exhaust the global rate limit, starving all other peers on that sub-protocol. Fix: check the per-peer limit first. A peer that exceeds its individual quota is rejected immediately, without touching the shared global bucket. Fixes [A-758](https://linear.app/aztec-labs/issue/A-758) Made with [Cursor](https://cursor.com)
Collaborator
|
✅ Successfully backported to backport-to-v4-next-staging #21995. |
nchamo
added a commit
that referenced
this pull request
Mar 26, 2026
BEGIN_COMMIT_OVERRIDE feat!: scoped capsules (backport #21533) (#21986) feat(aztec-nr): add initialization check to utility functions (#21751) refactor(aztec-nr): remove storage from init_test_contract (#21996) fix(p2p): check peer rate limit before global to prevent quota starvation (#21997) chore: remove claude file (#22012) fix: disallow infinite pubkeys (#22026) END_COMMIT_OVERRIDE
github-merge-queue bot
pushed a commit
that referenced
this pull request
Mar 27, 2026
BEGIN_COMMIT_OVERRIDE fix: only clear provenBlockNumber when it exceeds prune point (#21946) chore: (A-779) load all accounts before calling LogService.#getSecretsForSenders (#21923) fix: align staging-public mana target with testnet/mainnet (#21983) chore: (A-777) add warn logs for regressive path in block synchronizer (#21925) fix: fully validate txs retrieved from tx file store (#21988) refactor: extract checkpoint proposal handling to ProposalHandler (#21999) fix: unbounded memory in calldataRetriever (#22004) fix(p2p): check peer rate limit before global to prevent quota starvation (#21997) fix(p2p): evict expired failed-auth-handshake entries on heartbeat (#21992) chore: defensively handle skipPushProposedBlocksToArchiver (#22017) chore: bump testnet prover resource profile to prod-hi-tps (#22019) chore: (A-835) remove unused serializer (#22037) fix(p2p): remove disconnected peers from scoring maps (#22009) fix(e2e): set anvilSlotsInAnEpoch in slashing tests (#21869) fix(ethereum): Audit fixes A-810, A-812 (nonce race, isEscapeHatchOpen logging) (#21948) chore: remove old TxPool implementation (#22028) fix: Fix blob encoding when uploaded from proposals (#22045) chore: Adds /cycle and /fix skills. Also configures linear mcp server (#22043) chore: remove validatorReexecute config option (#22024) fix(sequencer): use last L1 slot of L2 slot as eth_simulateV1 timestamp (#22023) docs(simulator): clarify teardown gas billing is intentional (#22057) chore: revert account loading optimization in log service (#22062) fix: use DateProvider in PeerScoring (#22070) fix(aztec.js): preserve extraHashedArgs in DeployMethod.with() (#22053) fix(p2p): replace process.exit() with graceful shutdown in worker cleanup (#22046) chore: merge next (#22089) fix(stdlib): correct NoteDao size (#22068) feat: improve blob download from filestores (#22096) fix: remove stale tx_pool v1 benchmark reference (#22104) END_COMMIT_OVERRIDE
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
In
SubProtocolRateLimiter.allow(), the global rate limiter was checked first.GCRARateLimiter.allow()advances its virtual scheduling time (VST) as a side effect whenever it returnstrue, so a request that passed the global check but failed the per-peer check would silently consume a global quota token. A single spamming peer could therefore exhaust the global rate limit, starving all other peers on that sub-protocol.Fix: check the per-peer limit first. A peer that exceeds its individual quota is rejected immediately, without touching the shared global bucket.
Fixes A-758
Made with Cursor