Repository navigation
feat(nexus): run the Tycho market in fynd-nexus - #728
Open
carloszanella wants to merge 13 commits into
Open
carloszanella wants to merge 13 commits into
carloszanella wants to merge 13 commits into
Conversation
WHY: A service that only needs the market (Tycho feed, gas price, derived data) has to start the same components the solver starts, with the same settings. They were built inline in the solver assembly, next to the worker pools, so a market-only start would have copied them. HOW: - Move the construction of the Tycho feed, gas price fetcher and computation manager into FyndBuilder::assemble_market, which returns a MarketParts value. - assemble_components calls it and keeps the worker pool, encoder and router setup. ADDITIONAL NOTES: Pure refactor; the order of construction and the settings are unchanged. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
WHY: A service that probes components on chain needs the live Tycho market and its derived data (prices, depths) but no worker pools, encoder or router. FyndBuilder could only start the whole solver. HOW: - FyndBuilder::build_market starts the Tycho feed, gas price fetcher, metrics sampler and computation manager with the builder's Tycho settings, and returns a MarketFeed. - MarketFeed gives out the market data, the derived data and a market event receiver, and has wait_until_ready, feed_has_ended and shutdown. - The task spawning and the readiness wait are shared with the solver build instead of copied. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Scenarios covered: - the market starts with no worker pool and is not ready before a block - an invalid RPC URL fails the market build Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
WHY: The module guide of fynd-core did not mention the market-only build, so a reader looking for how a service can run the market without a solver would not find it. HOW: - Add build_market and MarketFeed to the solver row. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
WHY: Nexus will run the Tycho client and keep the market up to date, so operators need to point it at a Tycho server and a node. HOW: - add MarketArgs with --tycho-url, --tycho-api-key, --tycho-use-tls, --min-tvl and --rpc-url, each with an environment variable - the market is on when --tycho-url is set, and --tycho-url requires --rpc-url, which the market reads gas prices from - Debug shows whether a key or an RPC URL is set, not its value ADDITIONAL NOTES: The arguments are not read by the binary yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- the defaults leave the market off and TLS on - --tycho-url turns the market on, --rpc-url alone does not - --tycho-url without --rpc-url is rejected and names --rpc-url - TLS can be turned off - Debug hides the API key and the RPC URL Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
WHY: Nexus has to run the Tycho client and keep the market and its derived data up to date, so that what it serves next can be built from them. Nothing started the market yet. HOW: - add launch_market, which resolves every on-chain protocol system from Tycho, applies the TVL floor and the default blocklist, and starts fynd-core's market-only build - it returns the market feed, shared, with a task that waits for the first block and the derived data (up to 15 minutes) and then ends with an error once the Tycho feed has ended - add wait_until_market_ready so a reader of the market can wait the same way - depend on fynd-rpc for the protocol system lookup ADDITIONAL NOTES: The service does not start the market yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
WHY: The service is about to run the market without any venue, but --venues could not be emptied: an empty value was read as an unknown venue, so a market-only deployment could not start. HOW: - --venues accepts zero values; the flag alone lists no venue Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
WHY: With --venues empty and the market on, the service stopped at startup with "none of the listed venues supports the chain", although no venue was listed. A market-only deployment could not start. HOW: - streams_to_serve returns no streams for an empty list of venues, and still fails when venues are listed and none supports the chain Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- an empty list of venues gives no streams and no error Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
WHY: The market could be started but nothing started it, so nexus still held no Tycho state. Nexus should run the market whenever it is given a Tycho URL, with or without venues. HOW: - add the market settings to the command line - the service starts the market when --tycho-url is set - the service stops, with the reason, when the market's task ends: the Tycho feed ended or the market did not become ready - startup fails with "nothing to run" when no venue is listed and the market is off Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- --venues with no value and the market flags parse, and the market is off by default - startup fails with "nothing to run" when there are no venues and no market Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
WHY: Operators need to know how to turn the market on and what it needs and does. HOW: - README: the market flags, the --rpc-url requirement, --venues with no value, the readiness wait and the stop when the Tycho feed ends - note the market in the codebase map Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Breaking API Changes DetectedThis PR introduces breaking API changes, but the PR title does not declare them.
semver-checks output |
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.
Business logic
Feature
fynd-nexuscan now run the Tycho client for its chain and keep fynd's market data and derived data (spot prices, pool depths, and token prices) up to date without worker pools. Nothing reads the market yet; it provides the foundation for serving derived data and for the component health monitor (#694).Business decisions
--tycho-urlis set. It then requires--rpc-url, whichFyndBuilderuses to read gas prices. It is configured through--tycho-api-key,--tycho-use-tls(default: true), and--min-tvl(default: the chain's low TVL threshold).--venueswith no value runs no venue, allowing a deployment to run the market alone. The service refuses to start if it has neither a venue nor the market.Design
fynd-core:FyndBuilder::build_marketstarts the Tycho feed, market data, and derived data without worker pools and returns aMarketFeed. Market setup was separated from solver assembly so both paths share it.fynd-nexus: the newmarketmodule containsMarketArgsandlaunch_market.launch_marketreturns aLaunchedMarketthat holds a sharedArc<MarketFeed>and the task that watches the feed.fynd-nexusnow depends onfynd-rpcfor the protocol list.For the reviewer
fynd-core/src/solver.rs(build_marketand the shared market setup) andfynd-nexus/src/market/market_launch.rs.MarketFeedtasks are never shut down; the process exits when the feed ends.🤖 Generated with Claude Code