Skip to content

feat: client-side close group quorum validation#16

Draft
mickvandijke wants to merge 5 commits intomainfrom
feat/close-group-quorum-validation
Draft

feat: client-side close group quorum validation#16
mickvandijke wants to merge 5 commits intomainfrom
feat/close-group-quorum-validation

Conversation

@mickvandijke
Copy link
Copy Markdown
Contributor

Summary

  • Client extracts close group views from quote responses and validates mutual recognition before paying
  • Finds the largest subset of queried peers where every peer appears in every other's close group view
  • Fails with CloseGroupQuorumFailure if no mutually-recognizing subset of CLOSE_GROUP_MAJORITY (3) peers exists
  • New error variant CloseGroupQuorumFailure in data::error

Motivation

Ensures the client only pays when data will be accepted by enough close group nodes for durable storage and replication. The mutual-recognition threshold matches what nodes enforce server-side during payment verification.

Test plan

🤖 Generated with Claude Code

mickvandijke and others added 5 commits March 30, 2026 18:13
The client now extracts close group views from quote responses and validates
that a mutually-recognizing subset of at least CLOSE_GROUP_MAJORITY peers
exists before paying. This ensures the client only pays when the data will
be accepted by enough close group nodes for durable storage and replication.

The validation finds the largest subset of queried peers where every peer
in the subset appears in every other peer's close group view — matching the
server-side threshold that nodes enforce during payment verification. Fails
with CloseGroupQuorumFailure if no such subset of sufficient size exists.

Key changes:
- get_store_quotes extracts close_group from ChunkQuoteResponse::Success
- validate_close_group_quorum finds largest mutual-recognition clique
- New CloseGroupQuorumFailure error variant in data::error

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Without the P2P node, test nodes return empty close_group views in quote
responses, which causes the new quorum validation to always fail.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Covers next_combination, is_mutual_subset, find_largest_mutual_subset,
and validate_close_group_quorum with 16 tests: full clique, partial
clique at majority boundary, below-majority failure, empty views,
asymmetric recognition, rogue peer, and combination enumeration.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Reorder quoted peers so that mutually-recognizing quorum members appear
first in the list returned by get_store_quotes. Since
chunk_put_to_close_group takes the first CLOSE_GROUP_MAJORITY peers as
its initial upload targets, this ensures we try the peers most likely to
accept payment proofs before falling back to non-quorum peers.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@mickvandijke mickvandijke marked this pull request as ready for review March 30, 2026 20:00
@mickvandijke mickvandijke marked this pull request as draft March 31, 2026 13:52
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