Fix: Rep Selection#39
Merged
Merged
Conversation
|
Srayman
approved these changes
Jul 25, 2026
| } | ||
|
|
||
| #[test] | ||
| fn pick_fails_over_when_the_leader_reliability_decays() { |
There was a problem hiding this comment.
Is this necessary for now? If a highest weight rep is unreliable doesn't seem like the network will be able to accomplish much.
Collaborator
Author
There was a problem hiding this comment.
What if in the future highest weight is ~20% and second is ~19%? I think we can leave it for now and figure out something better later.
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
Rust client improperly handled rep selection, so a lagging rep could return a stale/null head and blocks built on it were rejected out-of-order. This PR uses the highest weighted rep first deferring more complex selection for later.
Changes
Note
Medium Risk
Changes how all read paths (head, balance, builder context) choose representatives, which can alter which node is trusted for chain tip data; behavior is more deterministic but shifts load and failure modes compared to random Po2C.
Overview
Rep selection for ledger reads no longer uses power-of-two random choices.
RepBook::pick()always returns the representative with the highest effective score (voting weight fraction × AIMD reliability). Failed reads still decay that rep’s score, so retries indispatch_anynaturally move to the next-best peer. The in-treeSmallRng,rng_counter, andrand_coredependency are removed.Client stack patch releases:
keetanetwork-client0.5.1,keetanetwork-bindings0.4.4,keetanetwork-client-wasi0.6.1,keetanetwork-client-wasm0.5.1 (workspace + lockfile).E2e coverage adds cases for transmitting on a stale head after another staple lands, and for abandoned temporary votes conflicting with a reworked fee retry.
scripts/release.shcentralizes crates.io metadata fetch with a required User-Agent, fails publish checks on lookup errors, and toleratescargo packagewhen workspace deps are not yet on crates.io during batched releases.Reviewed by Cursor Bugbot for commit b1e16a2. Bugbot is set up for automated code reviews on this repo. Configure here.