Skip to content

feat: embed signed close_group in PaymentQuote#28

Draft
mickvandijke wants to merge 5 commits intomainfrom
feat/signed-close-group-in-quote
Draft

feat: embed signed close_group in PaymentQuote#28
mickvandijke wants to merge 5 commits intomainfrom
feat/signed-close-group-in-quote

Conversation

@mickvandijke
Copy link
Copy Markdown
Contributor

Summary

  • Move close_group from ChunkQuoteResponse::Success into the PaymentQuote struct, covered by the ML-DSA-65 signature — prevents a malicious node from forging its close group view
  • Node-side verifier also accepts peers from its own signed quote's close_group to handle routing table churn between quote issuance and PUT arrival
  • Client extracts close_group from deserialized PaymentQuote for quorum validation (same algorithm, just different data source)
  • New e2e test suite (e2e_close_group_quorum) with 6 tests verifying the full flow

Note: This PR contains the ant-core side. The corresponding changes in evmlib and saorsa-node must be published before the path deps can be replaced with version pins.

Test plan

  • cargo check — all three repos compile
  • cargo test --lib --all — 141 unit tests pass
  • cargo test --test e2e_close_group_quorum — 6/6 pass
  • cargo test --test e2e_chunk — 9/9 pass
  • cargo test --test e2e_data — 6/6 pass
  • cargo test --test e2e_file — 4/4 pass
  • cargo test --test e2e_payment — 8/8 pass
  • cargo test --test e2e_security — 10/10 pass
  • cargo test --test e2e_merkle — 4/4 pass
  • evmlib tests — 1/1 pass
  • saorsa-node tests — 496/496 pass

🤖 Generated with Claude Code

mickvandijke and others added 5 commits April 3, 2026 14:21
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>
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>
Move the close group view from ChunkQuoteResponse into the PaymentQuote
struct so it is covered by the ML-DSA-65 signature. This prevents a
malicious node from lying about its close group view.

Changes span three repos (evmlib, saorsa-node, ant-core):
- evmlib: add close_group field to PaymentQuote, include in signing bytes
- saorsa-node: remove close_group from ChunkQuoteResponse, pass it to
  create_quote instead; verifier also accepts peers from the node's own
  signed quote to handle routing table churn
- ant-core: extract close_group from deserialized PaymentQuote; add e2e
  test suite (e2e_close_group_quorum) verifying the full flow

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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