Repository navigation
Conversation
…m a saved nodeURL A nodeURL saved as ' https://...' passes the JSON schema, which only asks for a string, and fails later inside the RPC client: Solana's Connection rejects it with "Endpoint URL must start with `http:` or `https:`" on the first wallet or balance call, far from where the value was entered. /config/update now trims a string value before the type conversion and the write. The two chain config loaders trim nodeURL when they read it, so a value already on disk with a space - pasted into the YAML, or written before this change - keeps working without being re-saved. Reported in hummingbot/hummingbot-api#233; Condor trims on its side, the direct API and the YAML did not.
|
…hitespace An exchange credential such as the OKX passphrase is sent verbatim, so trimming every string through /config/update could alter it. The trim is now limited to fields whose name ends in URL, which is where the failure was.
… text ' true ' for a boolean setting compared unequal to 'true' and was stored as false. The conversions now read the trimmed text; a non-URL string is still stored as sent.
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.
Before submitting this PR, please make sure:
A description of the changes proposed in the pull request:
Addresses hummingbot/hummingbot-api#233 on the Gateway side.
A
nodeURLsaved as' https://...'passes the JSON schema, which only asks for a string, and is written to the YAML as-is. It then fails inside the RPC client, not at save time: Solana'sConnectionrejects it withEndpoint URL must start with http: or https:on the first/wallet/addor balance call, which is where the report saw it. The fix in that thread was on the Condor side; a write through the Gateway API or Swagger, or a hand edit of the YAML, still stored the space, and a config that already had one stayed broken until re-saved.Two small changes:
POST /config/updatetrims a string value whose field name ends inURLbefore the type conversion and the write, so what reaches the YAML is the URL the user meant. Other strings are stored as sent: an exchange credential such as the OKX passphrase goes out verbatim, so its whitespace, if any, is part of the value. The number and boolean conversions read the trimmed text, so' true 'for a boolean setting istrue(it was compared unequal to'true'and stored asfalse).getSolanaNetworkConfigandgetEthereumNetworkConfigtrimnodeURLwhen they read it. Every consumer of the URL goes through these, so a value already on disk with a space works without being re-saved.Nothing changes for a value that has no surrounding whitespace.
Tests performed by the developer:
test/config/node-url-whitespace.test.ts: anodeURLstored with a leading space (Solana) and a trailing newline (Ethereum) is read back clean. Both fail ondevelopmentwithout the change.test/config/config-routes-v2.test.ts:/config/updatewith' https://... 'onnodeURLcallsupdateConfigwith the trimmed URL (fails ondevelopmentwithout the change);' pass phrase 'onokx.passphraseis passed through unchanged;' true 'onserver.logColorsis stored astrue(fails ondevelopmentwithout the change).test/config/andtest/rpc/rpc-provider-simple.test.tspass;pnpm typecheckand eslint/prettier are clean on the changed files.Tips for QA testing:
POST /config/updatewith{"namespace": "solana-mainnet-beta", "path": "nodeURL", "value": " https://api.mainnet-beta.solana.com"};conf/chains/solana/mainnet-beta.ymlshould hold the URL without the space.nodeURLin that YAML by hand, start Gateway, thenPOST /wallet/addfor a Solana wallet. Before this change:Endpoint URL must start with http: or https:. After: the wallet is added.