feat(config): centralize solver defaults into a layered config file - #320
Open
zizou0x wants to merge 1 commit into
Open
feat(config): centralize solver defaults into a layered config file#320zizou0x wants to merge 1 commit into
zizou0x wants to merge 1 commit into
Conversation
All tuning defaults live in an embedded default_config.toml, overlaid field by field by the local config file (fynd.toml) and CLI flags. The legacy worker_pools.toml is still honored but deprecated. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
zizou0x
force-pushed
the
zz/eng-6176-config-file
branch
from
July 17, 2026 08:30
98178eb to
5167d62
Compare
Breaking API Changes (Intentional)Breaking API changes detected and declared in the PR title. semver-checks output |
brunoguerios
self-requested a review
July 17, 2026 16:13
brunoguerios
left a comment
Contributor
There was a problem hiding this comment.
Elegant solution! 😃
LGTM ✅
| protocols: Vec<String>, | ||
| min_tvl: f64, | ||
| ) -> Self { | ||
| let embedded = crate::config::embedded_default(); |
Contributor
There was a problem hiding this comment.
Are these inline imports intentional?
Should we move them to the top of the file?
| /// Path to worker pools TOML config file | ||
| #[arg(short, long, env, default_value = "worker_pools.toml")] | ||
| pub worker_pools_config: PathBuf, | ||
| #[arg(long, help = cfg_help("Only include tokens traded within this many days", embedded_default().traded_n_days_ago))] |
Contributor
There was a problem hiding this comment.
Nice cleanup/improvement 👏
Comment on lines
+26
to
+32
| //! let overrides = PartialConfig { worker_router_timeout_ms: Some(50), ..Default::default() }; | ||
| //! let config = embedded_default() | ||
| //! .clone() | ||
| //! .apply(&PartialConfig::from_file("fynd.toml")?) | ||
| //! .apply(&overrides); | ||
| //! let builder = FyndBuilder::new(chain, tycho_url, rpc_url, config.protocols.clone(), min_tvl) | ||
| //! .apply_config(&config)?; // validates the config |
brunoguerios
approved these changes
Jul 20, 2026
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.
What
All solver-tuning defaults now live in one file,
fynd-core/src/config/default_config.toml, embedded in the binary. Itdeserializes directly into a complete
config::Config(every fieldrequired except the chain-specific
min_tvl), so adding a config fieldwithout updating the file fails the build's tests.
Configuration resolves field by field through three layers, highest
priority first:
--config-file/CONFIG_FILE, default./fynd.tomlLibrary API
config::embedded_default()returns the cached, complete defaultConfigConfig::apply(&PartialConfig)overlays a layer (exhaustivedestructuring: a new
PartialConfigfield without an overlay arm is acompile error)
Config::validate()range-checks the resolved result;FyndBuilder::apply_config(&Config)validates automaticallyFyndBuilder::newseeds its defaults from the embedded configBackward compatibility
worker_pools.toml(file or--worker-pools-config/WORKER_POOLS_CONFIG)keeps working; its pools override the config file's so existing
deployments keep their pools. A deprecation warning points to
fynd.toml.worker_pools.tomlis renamed tofynd.tomland extendedinto a full config example; docker-compose and the record-market /
integration-test includes follow.
fynd_core::solver::defaults(and their fynd-rpc re-exports) areremoved; read
config::embedded_default()instead.Behavior
Defaults are unchanged — the embedded values match the previous
constants, and
--helpnow renders them from the config file. Startuplogs the full resolved config.
🤖 Generated with Claude Code