-
-
Notifications
You must be signed in to change notification settings - Fork 270
Description
Describe the bug
Summary
While I've been working with my re-mapping of the PancakeSwap CLMM endpoints I went in circles until I noticed that there is an issue in the Gateway CLMM flow where client code and the Gateway/connector disagree about the expected format for the network/network id parameter. Some clients send a short network name (for example bsc) while connectors or internal routing expect a chain-network style identifier (for example bsc-mainnet). This mismatch leads to connector route resolution problems and unexpected 404 responses for CLMM endpoints such as clmm/quote-position. This allowed me to create a position in the pool and then could not find it when requesting it's data.
Why this matters
- Network id ambiguity leads to route 404s (e.g., connector
clmm/quote-positionmissing) and inconsistencies between client and connector expectations. - Automation and scripts that rely on deterministic Gateway routing fail when their
networkvalue doesn't match what the connector expects.
Concrete example (observed during testing)
When the autorun script submits a CLMM payload with "network": "bsc", Gateway responded with 404 for the clmm/quote-position route in some cases. Normalizing the network identifier to the expected chain-network format resolved route discovery in our environment.
Reproduction steps
- Run Gateway (example in this repo:
docker compose up -d). - Submit a CLMM payload using the short network name (e.g.,
network: bsc) to/connectors/pancakeswap/clmm/quote-positionor via the client helper. - Observe a 404 or connector-route not found error. Then retry using
network: bsc-mainnet(or the connector's expected id) and observe successful route resolution.
Expected behavior
- The Gateway REST schema and docs should clearly state whether connectors expect a short
networkid (e.g.,bsc) or achain-networkid (e.g.,bsc-mainnet). - The client libraries and routers should validate and normalize the
networkparameter before calling connector routes so that eitherbscorbsc-mainnetwill work consistently.
Suggested fixes (minimal, high-impact)
-
Gateway client / router normalization
- Add validation/normalization in
services/gateway_client.pyand in routers (e.g.,routers/gateway_clmm.py) so that clients usingnetwork='bsc'ornetwork='bsc-mainnet'will be normalized to the connector's expected format. - Update API docs and OpenAPI schema to document the exact expected
networkidentifier format.
- Add validation/normalization in
-
Tests and docs
- Add a test that submits requests with both
bscandbsc-mainnetand asserts that the router resolves to the correct connector route.
- Add a test that submits requests with both
Severity and impact
- Severity: Medium — causes convenience/automation failures (404s) but is straightforward to normalize and fix.
- Affects: Any client or automated script that supplies
networkin a format different from the connector expectation.
Suggested issue labels
- bug
- clmm
- gateway
Additional notes / references
- Gateway client call originates from
services/gateway_client.py::clmm_open_positionin the local repo. - If you'd like, I can prepare a minimal patch that normalizes
networkvalues and add a test demonstrating both formats resolve to the same connector route.
Steps to reproduce
- I'm working with a PancakeSwap CLMM on bsc when I noticed this behavior
- Enable CLMM add/remove liquidity endpoints hummingbot-api#105 have the api side of the endpoints
- I haven't completed the pr for gateway yet, once I do I can list exact steps. However, without the endpoints you'll just have to query the mapping to see the issue.
Release version
0
Type of installation
Docker