Align priceQuality implementation with API docs - #4805
Conversation
|
Reminder: Please consider backward compatibility when modifying the API specification.
Caused by: |
|
Claude finished @fleupold's task in 3m 33s —— View job PR Review: Align priceQuality implementation with API docs
The change is well-structured and correctly implements the documented split between
One maintainability note (inline): the No correctness issues found. The behavior change for clients explicitly requesting |
| let unverified_price_estimator = price_estimator_factory | ||
| .unverified_price_estimator( | ||
| &config | ||
| .order_quoting | ||
| .price_estimation_drivers | ||
| .iter() | ||
| .map( | ||
| |price_estimator_driver| configs::native_price_estimators::ExternalSolver { | ||
| name: price_estimator_driver.name.clone(), | ||
| url: price_estimator_driver.url.clone(), | ||
| }, | ||
| ) | ||
| .collect::<Vec<_>>(), | ||
| native_price_estimator.clone(), | ||
| gas_price_estimator.clone(), | ||
| ) | ||
| .unwrap(); |
There was a problem hiding this comment.
This price_estimation_drivers.iter().map(...).collect() block is now repeated three times verbatim (here plus the price_estimator and fast_price_estimator calls above). Consider extracting it into a small local binding once, e.g.:
let price_estimation_solvers: Vec<_> = config
.order_quoting
.price_estimation_drivers
.iter()
.map(|d| configs::native_price_estimators::ExternalSolver {
name: d.name.clone(),
url: d.url.clone(),
})
.collect();and pass &price_estimation_solvers to all three. Reduces the risk of the three copies drifting.
MartinquaXD
left a comment
There was a problem hiding this comment.
Looks alright to me.
|
Given this is a breaking change, I'm holding off merging until we have figured out which existing integration partners should change their |
| Estimates do not get verified by | ||
| simulation. | ||
| Optimal: The price estimate is chosen among all price estimates, ranked | ||
| purely by the promised price. Estimates do not get verified by | ||
| simulation. | ||
| Verified: All price estimates get verified by simulation whenever | ||
| possible and verified estimates are preferred over unverified ones, | ||
| even when an unverified estimate promises a better price. The | ||
| response's `verified` flag indicates whether the returned estimate | ||
| was actually verified. |
There was a problem hiding this comment.
nit
| Estimates do not get verified by | |
| simulation. | |
| Optimal: The price estimate is chosen among all price estimates, ranked | |
| purely by the promised price. Estimates do not get verified by | |
| simulation. | |
| Verified: All price estimates get verified by simulation whenever | |
| possible and verified estimates are preferred over unverified ones, | |
| even when an unverified estimate promises a better price. The | |
| response's `verified` flag indicates whether the returned estimate | |
| was actually verified. | |
| Estimates do not get verified by simulation. | |
| Optimal: The price estimate is chosen among all price estimates, ranked | |
| purely by the promised price. Estimates do not get verified by simulation. | |
| Verified: All price estimates get verified by simulation whenever | |
| possible and verified estimates are preferred over unverified ones, | |
| even when an unverified estimate promises a better price. The | |
| response's `verified` flag indicates whether the returned estimate | |
| was actually verified. |
Description
The API docs state that "optimal" quotes should only care about the out amount, without attempting or taking verification into account. However, the current logic uses the same behavior for optimal and verified quotes. This PR changes this.
Note, that verification can still be turned off server side by setting
verification-mode unverified.Streamed quotes continue to use the verified quoting logic (as per docs)
Changes
How to test
Adjusted e2e test