PR: #51 (feat/23-testnet-config)
File: crates/charon-cli/src/main.rs, line 113
Refs #51
Problem
run_listen contains:
let bnb = config.chain.get("bnb").context("chain 'bnb' not configured — required for v0.1")?;
The testnet TOML must use a distinct chain key (e.g. bnb_testnet or chapel) to avoid collision with the mainnet [chain.bnb] section. The hard-coded "bnb" lookup returns None for any profile that uses a different key, and the ? propagates the error immediately — before the read-only gate (flashloan/liquidator presence check) is ever reached.
The PR description says the gate is added to the opportunity-processing arm, but the chain lookup is above that arm and is unconditional. Testnet profile cannot run in read-only mode because startup fails before the gate.
Impact
Any operator running charon --config config/testnet.toml listen receives:
Error: chain 'bnb' not configured — required for v0.1
and the bot exits. The entire testnet / Grafana demo path is broken.
Fix
Replace the hard-coded lookup with a resolution that works across config profiles:
- Add
bot.chain field to BotConfig naming the active chain key (preferred).
- Accept a
--chain flag in the Listen subcommand (mirrors TestConnection).
- Require exactly one chain entry and use
.values().next() when the map has one entry.
Option 1 aligns best with the existing BotConfig pattern and requires no new CLI flags.
PR: #51 (feat/23-testnet-config)
File: crates/charon-cli/src/main.rs, line 113
Refs #51
Problem
run_listencontains:The testnet TOML must use a distinct chain key (e.g.
bnb_testnetorchapel) to avoid collision with the mainnet[chain.bnb]section. The hard-coded"bnb"lookup returnsNonefor any profile that uses a different key, and the?propagates the error immediately — before the read-only gate (flashloan/liquidator presence check) is ever reached.The PR description says the gate is added to the opportunity-processing arm, but the chain lookup is above that arm and is unconditional. Testnet profile cannot run in read-only mode because startup fails before the gate.
Impact
Any operator running
charon --config config/testnet.toml listenreceives:and the bot exits. The entire testnet / Grafana demo path is broken.
Fix
Replace the hard-coded lookup with a resolution that works across config profiles:
bot.chainfield toBotConfignaming the active chain key (preferred).--chainflag in theListensubcommand (mirrorsTestConnection)..values().next()when the map has one entry.Option 1 aligns best with the existing BotConfig pattern and requires no new CLI flags.