fix(payment): require issuer-aware SNP quote quorum - #132
Conversation
Query the witnessed close group as before, but require enough successful quote responses to choose the cheapest paid quote expected to pass quorum price floors. Keep a single paid quote in the proof and avoid selecting inflated high outliers when lower quotes clear the target.
Allow partially stored chunks to proceed when already-stored close-group votes cover part of the witnessed acceptance target. Carry the adjusted target from quote collection into the one-quote payment selector so retries do not fail before payment after valid partial availability.
|
The core diagnosis here is a good one and still holds on main — the storer really does check the paid-quote issuer against its local K-closest, and verifier.rs:1835 still emits the exact error you quoted in the description. The single-quote proof would land now too, since Main has moved a fair way underneath it (108 commits), so a few questions before a rebase:
Happy to help re-scope on top of main if it's still live — after the above it may be a good deal smaller than the current diff. |
Summary
This PR fixes single-node payment quote selection for chunk uploads after several real upload failures where the client either spent successfully but one close-group PUT was later rejected by the storer, or failed before payment despite having enough reachable quote responders to attempt majority storage.
The client still queries the witnessed close group for quotes, but the proof of payment only needs to include one paid quote. The paid quote is now selected as the cheapest quote that should be accepted by the required storage majority, instead of paying a median/high quote or falling back to less relevant peers.
What changed
CLOSE_GROUP_SIZEwitnessed SNP quote peers for single-node uploads, without falling back to extra peers or weaker witnessed candidates when some peers do not return usable quotes.CLOSE_GROUP_MAJORITYsuccessful quote acceptors, not the stricter witnessed-consensus quorum, once the seven-peer candidate set has already been witnessed. This allows uploads with four usable quotes out of seven to proceed when those four should accept the selected paid quote.Failure modes addressed
PUT rejected after fresh payment
One observed failure was not stale cached proof reuse. The client paid a fresh quote, then one chunk only stored on 3 of 4 required peers.
The rejected PUTs showed two checks the old client-side selector did not model together:
Paid quote price below local floor: the paid quote price was accepted by a price-only quorum, but not by all PUT peers.Paid quote issuer ... is not among this node's local K=20 closest peers: a storer can reject a paid quote issuer even if the amount is otherwise acceptable.There was also a mismatch between the quote responders and the later PUT targets. A quote could be selected using one witnessed peer set while the chunk was stored to a different initial peer set, which made the client-side acceptance estimate too optimistic.
Pre-payment failure with four usable quotes
upload-36.logfailed before payment:That
need 5target was too strict for paid quote acceptance. The 5-of-7 witnessed quorum is still used to build the trusted close-group candidate set, but after that the upload only needsCLOSE_GROUP_MAJORITYpeers to accept the PUT. With four usable quotes and no already-stored confirmations, the client should be able to select a paid quote accepted by those four peers and attempt storage.Expected behavior
For SNP chunk upload payment:
Tests
Ran locally:
Added regression coverage for: