Skip to content

fix(network): preserve fractional message rate credit - #904

Draft
czarcas7ic wants to merge 3 commits into
mainfrom
adam/preserve-message-rate-credit
Draft

fix(network): preserve fractional message rate credit#904
czarcas7ic wants to merge 3 commits into
mainfrom
adam/preserve-message-rate-credit

Conversation

@czarcas7ic

@czarcas7ic czarcas7ic commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Motivation

The transport token bucket discards fractional credit whenever it adds whole tokens. For example, an empty bucket configured for two messages per second admits one message after 750 ms, then incorrectly rejects another after the remaining 250 ms. Arrival timing can therefore reduce the configured allowance.

Solution

Preserve fractional credit between refills and discard excess credit when the bucket reaches its burst capacity. This keeps the configured rates, burst allowances, shared bucket scope, and disconnect policy unchanged.

Testing

The fractional-refill regression fails against the old accounting and passes with the fix. All 68 Linux handler tests passed, along with network Clippy for all targets, formatting, and the release node build. Tests also cover sustained traffic below the configured rate and clipping idle credit at capacity. A four-client native trial reached every target without rate-limit events. One client still entered a no-progress cooldown, so broader sync liveness remains under investigation. This arithmetic fix alone does not establish GetBlocks production readiness.

Changelog

Added an operator-facing changelog fragment; fragment validation and Markdown lint passed.

Used Codex to implement the fix and tests and prepare this description.

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.

1 participant