preflight: --network check fails for RPC setups dincli accepts (credentialed URLs, config.json, dotenv parsing)
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
Start with _check_rpc and _read_env_value in scripts/preflight.py, then compare network resolution with dincli/cli/utils.py and the existing mocked-urlopen tests in tests/test_preflight.py. Run the preflight tests and check getting-started.md if choosing the documentation alternative for config lookup. Done means the specified credential, lookup, dotenv, and IPFS-provider cases are covered, output hides credentials and URL paths, and python3 -I -S scripts/preflight.py --help still works.
由索引模型根据 Issue 内容生成。
描述
Summary
scripts/preflight.py --network <name> can now fail (exit 1) for an RPC setup that dincli itself uses without trouble. PR No. 303 made the RPC and IPFS checks required, and that's correct, but it means every gap between how preflight resolves and calls the RPC and how dincli does is now a false failure, not a harmless [WARN]. Follow-up from the PR No. 303 re-review. Part of BL-32 (issue No. 245).
Part A: RPC URLs with credentials in them fail (bug)
Some RPC providers put basic-auth credentials in the URL (https://user:pass@host/...). _check_rpc sends the URL straight to urllib.request, which doesn't strip the userinfo: it tries to resolve user:pass@host as a hostname. web3's HTTPProvider, which dincli uses in get_w3, handles the same URL fine.
Reproduced on PR No. 303's head (e22e360) against a local anvil --port 18545 --chain-id 1337:
LOCAL_RPC_URL=http://user:[email protected]:18545 python3 scripts/preflight.py --network local
→ [MISSING] RPC not reachable: http://127.0.0.1:18545/*** (exit 1)
urllib.request.urlopen(...) → URLError <urlopen error [Errno -2] Name or service not known>
Web3(HTTPProvider(url)) → is_connected() == True, chain_id == 1337
Proposed fix (in _check_rpc): split the URL with urllib.parse.urlsplit. If username/password are set, rebuild the URL without them and send an Authorization: Basic <base64(user:pass)> header instead. _sanitize_url already keeps credentials out of the output; keep it that way.
Tests: in tests/test_preflight.py, using the existing mocked-urlopen fixtures:
- a credentialed URL reaches
urlopenwith no userinfo in the request URL and with the expectedAuthorizationheader; - neither the username nor the password appears anywhere in stdout or stderr;
- a URL without userinfo sends no
Authorizationheader.
Part B: make the RPC lookup match dincli's
config.jsonfallback. dincli'sresolve_network_value(dincli/cli/utils.py) checksos.environ, then.envin the cwd, thenconfig.json → networks.<network>.rpc_url. Preflight stops after.env, so an RPC URL set only inconfig.jsongets[MISSING] No RPC URL found. No dincli command writes that key today (it's hand-edited only), so either read it in preflight, when dincli is importable, or say in theNo RPC URL foundhint and ingetting-started.mdthat only env and.envare checked..envparsing. dincli reads.envwith python-dotenv'sdotenv_values. Preflight uses its own stdlib parser,_read_env_value, so that it works beforepip install -e .. This is the "full dotenv parity" item the PR 255 merge proposal and issue No. 245's status update left optional. Whendotenvis importable, preflight could usedotenv_valuesand keep_read_env_valueas the stdlib fallback, so the two never disagree once dincli is installed.
Part C (nit): name the unknown IPFS provider
PR No. 303 changed IPFS unknown provider '{provider}' to IPFS unknown provider. The provider name is a config choice, not a credential, and showing it is the quickest way to spot a typo (filebse). Put it back.
Acceptance
- Part A's reproduction prints
[OK] RPC reachableand exits 0 (apart from unrelated checks), and the new tests pass. - Part B: preflight finds the RPC URL wherever dincli would find it, or the docs say exactly where preflight looks.
- No credentials or URL paths appear in any preflight output.
python3 -I -S scripts/preflight.py --helpstill works with only the standard library.
- 主要语言
- Python
- 星标
- 4
- 派生
- 7
- 平均合并
- 3 天 5 小时
- 30 天内合并 PR
- 34
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
InfiniteZeroFoundation/DevNet 的其他 Issue
-
ROADMAP.md: refresh "What is still open for P3" (several items were fixed in October)可能已有人在做 @umermjd11 于 3 天前认领。 未关闭documentation good first issue
难度 2/5 1-3 小时 新手友好度 74/100
InfiniteZeroFoundation/DevNet#285 · 1 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
Update the 25 translated organisation READMEs to match the English version可能已有人在做 @mrCabez 于 1 天前认领。 未关闭good first issue help wanted
难度 2/5 1-3 小时 新手友好度 76/100
InfiniteZeroFoundation/DevNet#277 · 2 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
Update the client-service guide to explain training and uploading separately可能已有人在做 @Santiagocetran 于 1 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 76/100
InfiniteZeroFoundation/DevNet#266 · 已指派 1 人 ·
维护者通常 1 天内回复
-
Few questions related to GI2 aggregator可能已有人在做 @Abidoyesimze 今天认领。 未关闭
InfiniteZeroFoundation/DevNet#307 · 1 个 reaction · 已指派 4 人 ·
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 25/100
InfiniteZeroFoundation/DevNet#299 · 2 条评论 ·
维护者通常 1 天内回复
查看 InfiniteZeroFoundation/DevNet 的全部 Issue
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 86/100
NousResearch/hermes-agent#147104 ·
维护者通常 1 天内回复
-
[oblt-aw][autodoc] Document new required `shared-org-key` input for `obs-aw-dependency-review`可能已有人在做 @github-actions 今天认领。 未关闭
难度 1/5 1 小时以内 新手友好度 90/100
维护者通常 1 天内回复
-
bot-triaged module: inductor oncall: pt2 topic: fuzzer triaged
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
getchaintips leaves out the active tip once a header is staged on it, where Core always lists it未关闭
难度 2/5 1-3 小时 新手友好度 88/100
btclib-org/btclib-node#2158 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 75/100
patrick-hudson/put.gd-desktop#979 · 1 条评论 ·
维护者通常 1 天内回复