Skip to content

Migrate autopilot native price estimation config from CLI args to config file#4194

Merged
jmg-duarte merged 8 commits intomainfrom
jmgd/config/native_estimators
Feb 25, 2026
Merged

Migrate autopilot native price estimation config from CLI args to config file#4194
jmg-duarte merged 8 commits intomainfrom
jmgd/config/native_estimators

Conversation

@jmg-duarte
Copy link
Contributor

@jmg-duarte jmg-duarte commented Feb 22, 2026

Description

Move native price estimator settings (estimators, api_estimators, results_required, cache_refresh_interval, native_price_prefetch_time) from CLI arguments to the TOML config file.

Changes

  • Move the autopilot native price estimator settings
  • Add tests

Migration Guide

Autopilot native price estimator CLI arguments have been moved to the TOML config file under the [native-price-estimation] table.

Estimator format

Previously, estimator variants were specified as |-separated strings. Now they are inline tables with a type field:

Old (CLI) New (TOML)
CoinGecko { type = "CoinGecko" }
OneInchSpotPriceApi { type = "OneInchSpotPriceApi" }
Driver|solver1|http://localhost:8080 { type = "Driver", name = "solver1", url = "http://localhost:8080" }
Forwarder|http://localhost:12088 { type = "Forwarder", url = "http://localhost:12088" }

Stages (previously separated by ;) become separate inner arrays. Estimators within a stage (previously separated by ,) are elements of the same inner array.

Old (CLI):

CoinGecko,OneInchSpotPriceApi;Driver|solver1|http://localhost:8080;Forwarder|http://localhost:12088

New (TOML):

[native-price-estimation]
estimators = [
    [{ type = "CoinGecko" }, { type = "OneInchSpotPriceApi" }],
    [{ type = "Driver", name = "solver1", url = "http://localhost:8080" }],
    [{ type = "Forwarder", url = "http://localhost:12088" }],
]

Arguments

  • --native-price-estimators (CLI) / NATIVE_PRICE_ESTIMATORS (env):
[native-price-estimation]
estimators = []
  • --api-native-price-estimators (CLI) / API_NATIVE_PRICE_ESTIMATORS (env):
[native-price-estimation]
api-estimators = []
  • --native-price-estimation-results-required (CLI) / NATIVE_PRICE_ESTIMATION_RESULTS_REQUIRED (env):
[native-price-estimation]
results-required = 2
  • --native-price-cache-refresh (CLI) / NATIVE_PRICE_CACHE_REFRESH (env):
[native-price-estimation]
cache-refresh-interval = "1s"
  • --native-price-prefetch-time (CLI) / NATIVE_PRICE_PREFETCH_TIME (env):
[native-price-estimation]
prefetch-time = "80s"

How to test

Staging

jmg-duarte and others added 2 commits February 20, 2026 19:13
Move banned_users, order_events_cleanup_interval/threshold, and S3
upload settings from CLI arguments to the TOML config file, following
the same pattern as prior fee_policy and trusted_tokens migrations.

- Add config modules: banned_users, order_events_cleanup, s3
- Remove infra::persistence::cli (S3 CLI args)
- Delete corresponding CLI arguments and Display impl entries
- Wire config values through run.rs

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move native price estimator settings (estimators, api_estimators,
results_required, cache_refresh_interval, native_price_prefetch_time)
from CLI arguments to the TOML config file. Add Serialize/Deserialize
derives to NativePriceEstimators and related types. Update e2e test
setup to construct NativePriceConfig programmatically. Add unit tests
for deserialization and defaults.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jmg-duarte jmg-duarte requested a review from a team as a code owner February 22, 2026 14:50
@jmg-duarte jmg-duarte marked this pull request as draft February 22, 2026 14:51
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

The pull request successfully migrates the autopilot's native price estimation settings from CLI arguments to the TOML configuration file. This change improves configuration management by grouping related parameters (estimators, API estimators, results required, cache refresh interval, and prefetch time) within the native-price-estimation section of the config. The migration preserves existing logic, maintains sensible defaults, and includes comprehensive updates to the E2E test suite to reflect the new configuration structure. No critical issues were found during the review.

Base automatically changed from jmgd/config/misc to main February 23, 2026 12:25
@jmg-duarte jmg-duarte marked this pull request as ready for review February 23, 2026 18:39
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

The pull request successfully migrates native price estimation configuration from CLI arguments to a TOML config file. This improves maintainability and centralizes configuration. The changes are well-tested and reflect the intended migration. No critical issues were found.

Copy link
Contributor

@squadgazzz squadgazzz left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@MartinquaXD MartinquaXD left a comment

Choose a reason for hiding this comment

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

Just minor nits.

Copy link
Contributor

@MartinquaXD MartinquaXD left a comment

Choose a reason for hiding this comment

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

Actually left another comment on the format when I saw it fully in the services PR here. Given that the full format wasn't really easily visible in this PR I wonder if the next step should be to introduce another test that deserializes an example config with all formats inside. That way we have a reference that at least has the possibility to stay up-to-date and new formats that get introduced are easier to spot.

@m-sz
Copy link
Contributor

m-sz commented Feb 24, 2026

Let's add a migration guide entry to this PR:

Migration Guide

Autopilot native price estimator cli arguments have been moved to the TOML config file, under the table `[native-price-estimation]:
The following CLI arguments

  • --native-price-estimators (cli), NATIVE_PRICE_ESTIMATORS (env), becomes:
[native-price-estimation]
estimators = []

Important note, the values for specific estimator were previously separated by |, now they have to be constructed as inline tables:
Driver|solver1|http://localhost:8000 becomes: { Driver = { name = "solver1", url = "http://localhost:8000" } }

  • --api-native-price-estimators (cli), API_NATIVE_PRICE_ESTIMATORS (env), becomes:
[native-price-estimation]
api-estimators = []
  • --native-price-estimation-results-required (cli), NATIVE_PRICE_ESTIMATION_RESULTS_REQUIRED (env), becomes:
[native-price-estimation]
results-required = 
  • --native-price-cache-refresh (cli), NATIVE_PRICE_CACHE_REFRESH (env), becomes:
[native-price-estimation]
cache-refresh-interval = 
  • --native-price-prefetch-time (cli), NATIVE_PRICE_PREFETCH_TIME (env), becomes:
[native-price-estimation]
native-price-prefetch-time = 

@jmg-duarte jmg-duarte added this pull request to the merge queue Feb 25, 2026
Merged via the queue into main with commit 47ea629 Feb 25, 2026
19 checks passed
@jmg-duarte jmg-duarte deleted the jmgd/config/native_estimators branch February 25, 2026 14:56
@github-actions github-actions bot locked and limited conversation to collaborators Feb 25, 2026
@jmg-duarte jmg-duarte added the track:config-migration Issues/PRs relating to the autopilot and orderbook migration label Feb 27, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

track:config-migration Issues/PRs relating to the autopilot and orderbook migration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants