Skip to content

Allow single-node payments with one quote#150

Open
mickvandijke wants to merge 2 commits into
mainfrom
fix/single-node-min-quotes
Open

Allow single-node payments with one quote#150
mickvandijke wants to merge 2 commits into
mainfrom
fix/single-node-min-quotes

Conversation

@mickvandijke

@mickvandijke mickvandijke commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • keep the single-node quote path attempting the close-group quote count it used before this PR
  • relax the witnessed single-node success threshold so one valid quote is enough if fewer than seven quotes arrive
  • select the largest supported quote set that was fetched, preserving 3x-median payment behavior when multiple quotes are available
  • add/update quote selection, payment, and security tests for variable quote counts

Tests

  • cargo check -p ant-core
  • cargo check -p ant-core --tests
  • cargo test -p ant-core data::client::batch::tests --lib
  • cargo test -p ant-core data::client::quote::tests --lib
  • cargo test -p ant-core --lib
  • cargo test -p ant-core --test e2e_payment test_quote_collection -- --nocapture
  • git diff --check

@mickvandijke mickvandijke force-pushed the fix/single-node-min-quotes branch from ef4091f to 2e9599e Compare July 10, 2026 10:56
…sholds

- Remove unused `price` from loops processing quotes.
- Replace inline constants with `SINGLE_NODE_PAYMENT_MULTIPLIER` and `SINGLE_NODE_MIN_QUOTE_COUNT`.
- Enforce quote count constraints and sort by price in single-node payment calculations.
- Add tests for quote processing, extended range validation, and payment behavior.

@grumbach grumbach left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the selection and payment changes. The degraded path only goes as far as needed: quote collection still attempts the full 7, selection takes the largest quorum-supported set (iterating down from 7), and the witness quorum requirement itself is unchanged. The median index matches the node verifier for every quote count, and the parity test against the protocol implementation at full size is a good drift guard. The merkle/closest-by-distance path correctly keeps the full close-group requirement.

Two non-blocking notes:

  • an e2e test for the actual 1-quote payment + PUT + readback path would be good as a follow-up (unit tests cover selection and payment construction, but not the full flow)
  • PreparedChunk::payment is a public type change, so ant-core needs the semver bump at release

Security Audit failure is inherited from main (crossbeam-epoch advisory), not from this PR.

The node-side price floor discussed in Slack lands separately.

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.

2 participants