Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .claude/CODEBASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ See `docs/ARCHITECTURE.md` for the full architecture diagram and detailed compon
| `HTTP_HOST` | HTTP bind address (default: `0.0.0.0`) |
| `HTTP_PORT` | API port (default: `3000`) |
| `WORKER_POOLS_CONFIG` | Worker pools config file (default: `worker_pools.toml`) |
| `BLACKLIST_CONFIG` | Blacklist config file (default: `blacklist.toml`) |
| `BLOCKLIST_CONFIG` | Blocklist config file (default: `blocklist.toml`) |
| `RUST_LOG` | Tracing filter (e.g. `info,fynd=debug`) |

### CLI Commands
Expand All @@ -112,7 +112,7 @@ See `docs/ARCHITECTURE.md` for the full architecture diagram and detailed compon
| File | Purpose |
|---|---|
| `worker_pools.toml` | Worker pool definitions: algorithm, num_workers, hop limits, timeout |
| `blacklist.toml` | Pool IDs to exclude from routing |
| `blocklist.toml` | Pool IDs to exclude from routing |

## Testing

Expand Down
18 changes: 10 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 11 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ solving.
| `--min-tvl` | - | `10.0` | Minimum pool TVL in native token |
| `--worker-router-timeout-ms` | - | `100` | Default solve timeout |
| `-w, --worker-pools-config` | `WORKER_POOLS_CONFIG` | `worker_pools.toml` | Worker pools config |
| `--blacklist-config` | `BLACKLIST_CONFIG` | `blacklist.toml` | Blacklist config |
| `--blocklist-config` | `BLOCKLIST_CONFIG` | `blocklist.toml` | Path to blocklist TOML config file |
| `--gas-price-stale-threshold-secs` | - | *(disabled)* | Health returns 503 when gas price exceeds this age |

See `--help` for the full list.
Expand Down Expand Up @@ -260,12 +260,19 @@ pools within the timeout.

Each order gets 2 candidate solutions — one from each pool — and the best is selected.

### Blacklist (blacklist.toml)
### Blocklist Config

Exclude specific pools from routing:
By default, Fynd loads `blocklist.toml` from the working directory. The default excludes components with known
simulation issues (e.g., rebasing tokens). Override with `--blocklist-config`:

```bash
cargo run --release serve -- --blocklist-config my_blocklist.toml
```

The config file uses a `[blocklist]` section with component IDs to exclude:

```toml
[blacklist]
[blocklist]
components = [
"0x86d257cdb7bc9c0df10e84c8709697f92770b335",
]
Expand Down
15 changes: 13 additions & 2 deletions blacklist.toml → blocklist.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Component blacklist configuration
# Component blocklist configuration
# Exclude specific pools from routing due to simulation issues

[blacklist]
[blocklist]
# Component IDs to exclude (pool addresses)
components = [
# AMPL pools - AMPL is a rebasing token that breaks simulation assumptions
Expand All @@ -17,4 +17,15 @@ components = [
"0x69accb968b19a53790f43e57558f5e443a91af22",
# Fluid syrupUSDC/USDC — ERC-4626 vault token, simulation can't track accumulating rate
"0x79eea4a1be86c43a9a9c4384b0b28a07af24ae29",
# Curve weETH/WETH (StableSwapNG) — MissingAccount error, oracle deps not in simulated state
"0xdb74dfdd3bb46be8ce6c33dc9d82777bcfc3ded5",
# "Dollars" (USD, 0xd233d1f6) token pools — fake stablecoin with mispriced reserves
# UniswapV2 LINK/"Dollars"
"0x81a8bd7f2b29cee72aae18da9b4637acf4bc125a",
# UniswapV2 MKR/"Dollars"
"0xa16a3cbc92d77b720a851d33a91890c4fbfb0299",
# UniswapV2 DAI/"Dollars" (last trade Sep 2020)
"0x1d1126cc2c77384448913b41fbf308563aae1f16",
# UniswapV2 WETH/"Dollars" (1938 WETH locked, mispriced)
"0x582e3da39948c6339433008703211ad2c13eb2ac",
]
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ services:
- "9898:9898"
volumes:
- ./worker_pools.toml:/etc/fynd/worker_pools.toml:ro
- ./blacklist.toml:/etc/fynd/blacklist.toml:ro
- ./blocklist.toml:/etc/fynd/blocklist.toml:ro
environment:
- RPC_URL=${RPC_URL}
- TYCHO_API_KEY=${TYCHO_API_KEY:-}
- TYCHO_URL=${TYCHO_URL:-tycho-fynd-ethereum.propellerheads.xyz}
- WORKER_POOLS_CONFIG=/etc/fynd/worker_pools.toml
- BLACKLIST_CONFIG=/etc/fynd/blacklist.toml
- BLOCKLIST_CONFIG=/etc/fynd/blocklist.toml
- RUST_LOG=fynd=info
- OTEL_EXPORTER_OTLP_ENDPOINT=http://tempo:4317
depends_on:
Expand Down
2 changes: 1 addition & 1 deletion docs/ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ Provides `extract_subset()` for creating filtered snapshots that algorithms can

**Crate:** `fynd-core` **Location:** `fynd-core/src/feed/tycho_feed.rs`

Background task that connects to Tycho's WebSocket API, processes component/state updates, updates SharedMarketData, and broadcasts `MarketEvent`s. Applies TVL filtering with hysteresis (components are added at `min_tvl` and removed at `min_tvl / tvl_buffer_ratio`), token recency filtering (`traded_n_days_ago`), blacklisting, and token quality filtering.
Background task that connects to Tycho's WebSocket API, processes component/state updates, updates SharedMarketData, and broadcasts `MarketEvent`s. Applies TVL filtering with hysteresis (components are added at `min_tvl` and removed at `min_tvl / tvl_buffer_ratio`), token recency filtering (`traded_n_days_ago`), blocklisting, and token quality filtering.

***

Expand Down
16 changes: 11 additions & 5 deletions docs/guides/server-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ icon: server

# Server Configuration

Reference for all Fynd server flags, worker pool tuning, blacklisting, logging, and monitoring.
Reference for all Fynd server flags, worker pool tuning, blocklist configuration, logging, and monitoring.

## Run options

Expand Down Expand Up @@ -87,7 +87,7 @@ Run `cargo run --release -- serve --help` for the full list.
| `--worker-router-timeout-ms` | — | `100` | Default solve timeout (ms) |
| `--worker-router-min-responses` | — | `0` | Early return threshold (0 = wait for all pools) |
| `-w, --worker-pools-config` | `WORKER_POOLS_CONFIG` | `worker_pools.toml` | Worker pools config file path |
| `--blacklist-config` | `BLACKLIST_CONFIG` | `blacklist.toml` | Blacklist config file path |
| `--blocklist-config` | `BLOCKLIST_CONFIG` | `blocklist.toml` | Path to blocklist TOML config file. Components listed here are excluded from the Tycho stream. |
| `--disable-tls` | — | `false` | Disable TLS for Tycho connection |
| `--min-token-quality` | — | `100` | Minimum [token quality](https://docs.propellerheads.xyz/tycho/overview/concepts#token) filter |
| `--gas-refresh-interval-secs` | — | `30` | Gas price refresh interval |
Expand Down Expand Up @@ -151,12 +151,18 @@ To use a custom config file:
cargo run --release -- serve -w my_worker_pools.toml
```

## Blacklist (`blacklist.toml`)
## Blocklist config

Exclude specific components from routing, useful for components with known simulation issues (e.g., [rebasing tokens on UniswapV3 pools](https://docs.uniswap.org/concepts/protocol/integration-issues)):
By default, Fynd loads `blocklist.toml` from the working directory. The default excludes components with known simulation issues (e.g., [rebasing tokens on UniswapV3 pools](https://docs.uniswap.org/concepts/protocol/integration-issues)). Override with `--blocklist-config`:

```bash
cargo run --release -- serve --blocklist-config my_blocklist.toml
```

The config file uses a `[blocklist]` section listing component IDs to exclude:

```toml
[blacklist]
[blocklist]
components = [
"0x86d257cdb7bc9c0df10e84c8709697f92770b335",
]
Expand Down
10 changes: 5 additions & 5 deletions fynd-core/src/feed/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ pub(crate) struct TychoFeedConfig {
pub(crate) reconnect_delay: Duration,
/// Only include tokens traded within this many days.
pub(crate) traded_n_days_ago: Option<u64>,
/// Component IDs to exclude from routing.
pub(crate) blacklisted_components: HashSet<String>,
/// Component IDs to exclude from the Tycho stream.
pub(crate) blocklisted_components: HashSet<String>,
}

impl TychoFeedConfig {
Expand All @@ -69,7 +69,7 @@ impl TychoFeedConfig {
tvl_buffer_ratio: 1.1,
gas_refresh_interval: Duration::from_secs(30),
reconnect_delay: Duration::from_secs(5),
blacklisted_components: HashSet::new(),
blocklisted_components: HashSet::new(),
}
}

Expand Down Expand Up @@ -98,8 +98,8 @@ impl TychoFeedConfig {
self
}

pub(crate) fn blacklisted_components(mut self, components: HashSet<String>) -> Self {
self.blacklisted_components = components;
pub(crate) fn blocklisted_components(mut self, components: HashSet<String>) -> Self {
self.blocklisted_components = components;
self
}
}
Expand Down
Loading
Loading