feat(antd): opt-in signed-quote exposure + stateless VerifyQuotes - #242
Open
Nic-dorman wants to merge 4 commits into
Open
feat(antd): opt-in signed-quote exposure + stateless VerifyQuotes#242Nic-dorman wants to merge 4 commits into
Nic-dorman wants to merge 4 commits into
Conversation
…ST + gRPC) Hosted payments fraud control (V2-854 work items 1 + 1b): in hosted mode the party that pays is not the party that collected the quotes, so the payer must be able to verify a payment batch offline before settling it. Exposure: `include_signed_quotes` on the three prepare endpoints. Wave-batch responses carry `signed_quotes[]` — one entry per payments[] triple with the full signed PaymentQuote and its ADR-0004 commitment sidecar as opaque base64(msgpack) bytes (sidecars matched to quotes by commitment_hash == pin; entries restricted to the payment intent's paid quote set, since the network quotes the whole close group but single-quote payments pay only the median). Default-off; existing consumers see no change. Merkle candidate exposure is blocked upstream (private candidate pools, commitments deliberately discarded) and rides V2-934. Verification: POST /v1/verify/quotes + gRPC VerifyService. Stateless offline port of ant-core's quote_commitment_binding_is_valid, run by the party about to pay on its own antd: quote-hash recomputation, ML-DSA-65 signature, paid-fields equality (amount == 3x the signed price — the single-node payment multiplier), and the ADR-0004 binding with exact on-curve pricing. Verdicts carry the extracted fields caller-side policy needs (timestamp, content, price, rewards address, key count, pinned). New direct dep ant-protocol = "=2.3.2", pinned to the locked transitive version; all PQC verification routed through its re-exports. Verified against a live local devnet: real-quote batch verifies; inflated amount, redirected payee, and fabricated quote_hash are all rejected with named rules. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Go client surface for the V2-854 daemon additions: PrepareOptions with IncludeSignedQuotes (PrepareUploadWithOptions / PrepareDataUploadWithOptions / PrepareChunkUploadWithOptions), SignedQuoteEntry parsing on both prepare results, and VerifyQuotes with per-entry verdict models. Quote and sidecar blobs stay opaque — the client relays them, only antd parses them. Generated protobuf refresh for the new fields + verify.proto service. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The generated PrepareChunkRequest/PrepareFileUploadRequest/ PrepareDataUploadRequest structs gained include_signed_quotes and the prepare responses gained signed_quotes; antd-rust's exhaustive struct literals must name them. Requests default to false (no behaviour change); the antd-rust client surface for the new options/endpoint can follow separately if wanted. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Nic-dorman
force-pushed
the
feat/signed-quote-exposure
branch
from
August 24, 2026 10:23
bc14d47 to
419c57c
Compare
Newer stable clippy (CI's @stable moved past the last antd-rust run) flags every tonic-generated client method's Result<_, tonic::Status> as result_large_err — 24 hits across all services, none actionable in generated code. Scoped allow on the include_proto module. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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
Hosted-payments fraud control (Linear V2-854): in hosted mode the party that pays is not the party that collected the quotes — the payer receives
payments[]triples from a customer-controlled instance and must not trust them (a fabricated triple could name any address and amount). This PR gives the payer the means to verify a batch offline before settling it, in two halves:1. Opt-in signed-quote exposure (
include_signed_quotes)All three prepare endpoints (upload / data / chunk, REST + gRPC) accept the flag. Wave-batch responses then carry
signed_quotes[]— one entry perpayments[]triple with the full signedPaymentQuoteand its ADR-0004 commitment sidecar as opaque base64(msgpack) bytes (only antd ever parses them):signed_quotes[]is guaranteed 1:1 withpayments[].commitment_hash(sidecar) == quote.commitment_pinat emit time, so each entry is self-contained.2. Stateless offline verification (
POST /v1/verify/quotes+ gRPCVerifyService)A pure function of the request — no network, wallet, or session state — run by "the party about to pay" on its own antd. Per entry (port of ant-core's client-side
quote_commitment_binding_is_valid, with the peer identity derived from the quote's ownpub_key):quote_hash == hash(signed_quote)— the triple is tied to a concrete quoterewards_addressexact,amount == 3× signed price(the single-node payment multiplier — mirrored as a documented local const since ant-core's ispub(crate))commitment_hash == pin, count equality, andprice == calculate_price(count)by exact recomputation (baseline== calculate_price(0))Verdicts carry the fields caller-side policy needs (timestamp, content XorName, price, rewards address, key count, pinned). Policy itself (expiry, replay ledgers, chunk-set equality, count caps) deliberately stays caller-side. CPU-bound work runs on
spawn_blocking; 1024-entry cap.Dependencies
ant-protocol = "=2.3.2"— pinned exactly to the already-locked transitive version soPaymentQuote/StorageCommitmentcan't fork in the graph. All PQC verification routed through its re-exports (no new saorsa deps).xor_nameas dev-dependency (test quote construction).ant-cli-v0.3.3). No ant-client changes involved.Testing
VerifyQuotespasses on real network quotes; inflated amount, redirected payee, and fabricatedquote_hasheach rejected with the named rule. Two real-network corrections came out of this (paid-set filter; 3× multiplier) — both covered by unit tests now.Docs
docs/external-signer-flow.md(exposure + verification recipe + policy split),antd/openapi.yaml(new path + 5 schemas), proto comments throughout.Release note
Version bump left out per house convention (separate
chore/bump-*PR at release time — docs reference the feature as "antd 0.13.0").🤖 Generated with Claude Code