Skip to content

solana-driver: report the network fee in /quote - #5101

Open
squadgazzz wants to merge 4 commits into
mainfrom
solana-services/be-411-quote-network-fee
Open

squadgazzz wants to merge 4 commits into
mainfrom
solana-services/be-411-quote-network-fee

Conversation

@squadgazzz

Copy link
Copy Markdown
Contributor

Description

The driver prices the route and the orderbook prices the trade, the EVM gas shape, but the Solana driver's /quote answers the amounts only, so the orderbook prices every quote at a 6,400 lamport placeholder (#5055): the compute unit ceiling at a made-up price.

/quote answers networkFee in lamports: the 5,000 lamport signature fee plus the priority fee the driver's own estimator gives over the accounts the quoted interactions write, at the engine's cuEstimate, or at the 1.4M unit ceiling when the engine sent none. Those are the numbers settle pays. A fee over the configured budget refuses the quote with PriorityFeeTooHigh, as it refuses the settlement. The amounts stay the engine's raw legs, the orderbook nets the fee in BE-366.

Changes

  • /quote answers networkFee, documented in openapi.yml
  • Estimate::network_fee adds the signature fee to the priority fee
  • The writable-account listing is shared by the settlement and the quote

How to test

New and updated driver API tests.

Related issues

BE-411

@linear-code

linear-code Bot commented Oct 15, 2026

Copy link
Copy Markdown

BE-411

@github-actions

Copy link
Copy Markdown

Reminder: Please consider backward compatibility when modifying the API specification.
If breaking changes are unavoidable, ensure:

  • You explicitly pointed out breaking changes.
  • You communicate the changes to affected teams (at least Frontend team and SAFE team).
  • You provide proper versioning and migration mechanisms.

Caused by:

tilacog added a commit that referenced this pull request Oct 15, 2026
The driver's `/quote` answers `networkFee` for the quoted route (#5101),
so BE-366 takes the fee from there rather than pricing the compute unit
ceiling at a configured price. The TODO and the openapi text name that
instead of the formula that goes away.
@squadgazzz
squadgazzz marked this pull request as ready for review October 16, 2026 12:46
@squadgazzz
squadgazzz requested a review from a team as a code owner October 16, 2026 12:46
@claude

claude Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @squadgazzz's task in 2m 51s —— View job


PR Review: solana-driver: report the network fee in /quote

  • Read the diff and surrounding code
  • Check fee-estimation parity with the settle path
  • Verify tests and error mapping
  • Check CI

Verdict

Looks good — no blocking issues found. The change is well-scoped and the /quote fee path mirrors the settle path cleanly:

  • network_fee reuses the exact same priority_fee.estimate(..) + recent_prioritization_fees(..) machinery that settlement uses, so the budget refusal (PriorityFeeTooHigh → BAD_REQUEST) behaves identically. Verified the OverBudget → Error::PriorityFeeTooHigh → Kind::PriorityFeeTooHigh mapping all lines up (competition.rs:826, error.rs:90).
  • The shared writable_accounts(payer, instructions) extraction is a clean dedup; the settlement method is now a one-line wrapper and keeps the payer-first + unique() behavior.
  • LAMPORTS_PER_SIGNATURE = 5_000 as a single (not multiplied) constant matches reality — the settlement transaction carries exactly one signer (the solver); buffer creations are landed as separate transactions.
  • Estimate::network_fee uses saturating conversion/add, and lamports is already bounded by the max_priority_fee_lamports (u64) check before this point, so overflow isn't reachable in practice — defensive is fine.
  • Tests are internally consistent (ceiling case 14_000 + 5_000 = 19_000; cuEstimate case 2_000 + 5_000 = 7_000; over-budget at 13_999) and the pull request CI job is green.

One thing to be aware of (not blocking, already acknowledged in the description)

The quote prices over solution.interactions' writable accounts only, while the real settlement prices over the full instruction set (ATA/buffer/PDA/state accounts, compute-budget, BeginSettle/FinalizeSettle). Since getRecentPrioritizationFees returns the per-slot max over the supplied accounts, the quote's estimate can only be ≤ the settlement's — so the quoted networkFee and the quote-time budget check are systematically a touch looser than what settle ultimately pays. The PR description already frames this as an intentional placeholder approach ("A quote's settlement accounts are placeholders, so only the interactions' accounts are read"), so flagging only for visibility, not as a requested change.
· branch solana-services/be-411-quote-network-fee

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