fix(payment): require issuer-aware SNP quote quorum#132
Open
mickvandijke wants to merge 5 commits into
Open
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.
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
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: