feat(client): use witnessed SNP quote selection#118
Merged
Conversation
jacderida
approved these changes
Jun 14, 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
Updates SNP quote collection to use a quorum-witnessed close group instead of relying only on the client's local strict-K view.
The client now asks
saorsa-corefor a witnessed close group, fetches store quotes only from that final quorum-recognised set, and builds the SNP median payment from those witnessed quotes. If the client cannot construct a full K-sized witnessed group, it fails before payment with diagnostic context.Problem
PR #117 fixed SNP quote collection to query exactly
CLOSE_GROUP_SIZEpeers instead of over-querying. The saorsa-core pure-XOR revert fixes the reachability re-ranking disagreement, but honest nodes can still have slightly divergent routing-table views because of trust filtering, IP-diversity limits, churn, or missing addresses.In that case, a client-selected median paid quote issuer can be outside a receiver's local strict K, producing failures like:
The fix here is to select SNP quote peers from a set recognised by a quorum of the closest responders, rather than from a single client-local view.
Client Behavior
For single-node payment quote collection, the client now:
CLOSE_GROUP_SIZE = 7.Network::find_witnessed_close_group(target, K, quorum).SingleNodePaymentfrom those witnessed quotes.If fewer than K peers pass quorum, the client returns
Error::InsufficientPeersbefore payment. The error includes the target, initial closest responders, per-responder self-inclusive views, vote counts, quorum threshold, and final witnessed set.Important Boundaries
Dependency Stack
This PR is stacked on the witnessed close-group API and branch pins while the stack is open:
Tests
Added/updated coverage for:
Validation
cargo check --all-targets --all-featurescargo fmt --all -- --checkcargo test -p ant-core --libcargo clippy --all-targets --all-features -- -D warnings