Repository navigation
fix(node): rate-limit admit reads and drop voucherless lanes - #3032
Open
alpergundogdu wants to merge 2 commits into
Open
alpergundogdu wants to merge 2 commits into
alpergundogdu wants to merge 2 commits into
Conversation
Admission getPool/getAuthorization reads are charged to a per-peer and a node-wide token bucket on top of the in-flight slot cap; a refused read gets the slot-wait refusal. The pool refresh loop drops lanes that never carried a voucher once their capability expires, from memory and redb. Closes #2770 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Code coverage overviewLanguages: Rust Rust / code-coverage/cargo-llvm-cov
View coverage of the 10 most impacted files.
ℹ️ Calculations represent line coverage. Results may change as calculations are updated. Updated |
Each [[blockchain.payment_chains]] entry takes admit_reads_per_sec, admit_read_burst, admit_reads_per_peer_per_sec and admit_read_burst_per_peer (defaults 20, 40, 2, 8). One budget serves every pool on a chain, since the chain's RPC endpoint carries the quota. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This branch has not been deployed
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.
Closes #2770. Finishes what #3016 started.
§1: token buckets on admission chain reads, set per payment chain
Each admission
getPoolandgetAuthorizationread is charged to two token buckets before it takes a read slot: one per requesting peer (keyed by its irohPublicKey, a bounded map pruned past 4096 peers) and one for the whole payment chain. TheADMIT_CHAIN_READ_CONCURRENCY = 16limit on reads in flight stays. The peer bucket is charged first, so a read that one peer's bucket refuses spends nothing of the chain-wide budget. Only the request that sends the read is charged: a request that waits on another request's read of the same pool or signer is not. A refused read is refused like a slot-wait timeout (PoolUnconfirmed/ signer unconfirmed, nothing cached).The rates are set in each
[[blockchain.payment_chains]]entry, since each chain has its ownrpc_urland quota. Every pool on a chain shares one budget (AdmitReadBudget, built once per chain inaccepted_pools). The defaults are deliberately generous:admit_reads_per_secadmit_read_burstadmit_reads_per_peer_per_secadmit_read_burst_per_peerEach key must be at least 1.
decdn config validateprints the resolved rates, and the default template lists the four keys.PoolViewgainsadmit_status/admit_signer_authorization, which take the requester. Their defaults delegate, so test doubles are unchanged.ResolvingPoolView::newtakes the chain'sArc<AdmitReadBudget>. New counters:decdn_serve_admit_read_rate_limited_{per_peer,global}_total.§2: drop voucherless lanes
ClientHandler::forget_voucherless_expired_lanesruns in the 30 s pool refresh loop. It drops each lane that never carried a voucher (last_signatureisNone) once its capability has expired, from both the live map and the lane store (viaforget_lane). The voucher path refuses vouchers inside the expiry margin, so the check under the lane lock cannot race a voucher. New counter:decdn_lanes_dropped_voucherless_total.Declined or moot
warn!invoucher.rswas already deleted by docs(adr)!: the payer fronts credit #2877, so there is no line left to throttle or list.Docs
architecture.mdthreat row.appendix-observability.md: rows for the three new counters.Checks
cargo nextest run -p decdn-common -p decdn-cli -p decdn-node: 3336 passed. One retry of the known-flakynode_origin_pull::concurrent_pulls_resume_at_their_own_frontier_not_the_lanespassed.cargo clippy --workspace --all-targets --all-features: cleancargo docgate: cleancargo test --no-run -p decdn-e2e --features anvil-e2e: builds🤖 Generated with Claude Code