Skip to content

fix: use rustchain.org for SDK public defaults#5580

Merged
Scottcjn merged 2 commits into
Scottcjn:mainfrom
iamdinhthuan:issue-2283-node-url
May 18, 2026
Merged

fix: use rustchain.org for SDK public defaults#5580
Scottcjn merged 2 commits into
Scottcjn:mainfrom
iamdinhthuan:issue-2283-node-url

Conversation

@iamdinhthuan
Copy link
Copy Markdown

Fixes #2283.

Summary

  • replace the public Python SDK and macOS miner default node URL with https://rustchain.org
  • keep TLS verification enabled by default while allowing explicit env/CLI overrides
  • update affected SDK tests so the public default no longer points at the raw node IP

Validation

  • PYTHONPATH=node:. python3 -B -m pytest -q tests/test_tls_config.py --noconftest -> 4 passed
  • PYTHONPATH=sdk/python uv run --no-project --with pytest --with pytest-asyncio --with respx --with httpx --with cryptography --with pynacl python -B -m pytest -q sdk/python/rustchain_sdk/tests/test_client.py --noconftest -> 20 passed
  • python3 -B -m py_compile sdk/python/rustchain_sdk/client.py sdk/python/rustchain_sdk/cli.py sdk/python/rustchain_sdk/__init__.py miners/macos/rustchain_mac_miner_v2.5.py sdk/python/test_rustchain_sdk.py tests/test_tls_config.py
  • git diff --check -- miners/macos/rustchain_mac_miner_v2.5.py sdk/python/README.md sdk/python/rustchain_sdk/__init__.py sdk/python/rustchain_sdk/cli.py sdk/python/rustchain_sdk/client.py sdk/python/rustchain_sdk/tests/test_client.py sdk/python/test_rustchain_sdk.py tests/test_tls_config.py
  • python3 tools/bcos_spdx_check.py --base-ref origin/main -> BCOS SPDX check: OK
  • rg -n "https://50\\.28\\.86\\.131" miners/macos/rustchain_mac_miner_v2.5.py sdk/python/README.md sdk/python/rustchain_sdk/__init__.py sdk/python/rustchain_sdk/cli.py sdk/python/rustchain_sdk/client.py sdk/python/rustchain_sdk/tests/test_client.py sdk/python/test_rustchain_sdk.py tests/test_tls_config.py || true -> no remaining matches in touched files

@github-actions
Copy link
Copy Markdown
Contributor

Welcome to RustChain! Thanks for your first pull request.

Before we review, please make sure:

  • Non-doc PRs have a BCOS-L1 or BCOS-L2 label
  • Doc-only PRs are exempt from BCOS tier labels when they only touch docs/**, *.md, or common image/PDF files
  • New code files include an SPDX license header
  • You've tested your changes against the live node

Bounty tiers: Micro (1-10 RTC) | Standard (20-50) | Major (75-100) | Critical (100-150)

A maintainer will review your PR soon. Thanks for contributing!

@github-actions github-actions Bot added documentation Improvements or additions to documentation BCOS-L1 Beacon Certified Open Source tier BCOS-L1 (required for non-doc PRs) tests Test suite changes size/M PR: 51-200 lines labels May 17, 2026
@508704820
Copy link
Copy Markdown
Contributor

Security Review ✅

Use rustchain.org for SDK public defaults. Ensures SDK points to correct official endpoint.

Reviewed by Xeophon - Solana: Lt9nERv6VHsojw15LpFeiaabuphAggzfLF9sM9UXRrZ

Copy link
Copy Markdown

@strongkeep-debug strongkeep-debug left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked this at head dbd6211a4205e57265d3bfbe359ce30acd170e92. This resolves #2283's public-default problem in the SDK/macOS surfaces while keeping the installer fallback out of scope as requested by the issue.

Validation I ran locally:

Check Result
Duplicate/overlap search for #2283 / SDK raw-IP defaults no overlapping PR found
git diff --check origin/main...HEAD pass
python -m py_compile sdk/python/rustchain_sdk/client.py sdk/python/rustchain_sdk/cli.py sdk/python/rustchain_sdk/__init__.py miners/macos/rustchain_mac_miner_v2.5.py sdk/python/test_rustchain_sdk.py tests/test_tls_config.py pass
python tools/bcos_spdx_check.py --base-ref origin/main pass
rg -n "https://50\.28\.86\.131" <touched SDK/macOS/test files> no remaining matches
python -m pytest tests/test_tls_config.py --noconftest -q 4 passed
uv run --no-project --with pytest --with pytest-asyncio --with respx --with httpx --with cryptography --with pynacl python -B -m pytest -q sdk/python/rustchain_sdk/tests/test_client.py --noconftest 20 passed

The remaining 50.28.86.131 references outside this patch are intentionally not covered by #2283's SDK/macOS default scope, so this looks ready to merge from my side.

Copy link
Copy Markdown
Contributor

@kongwen686 kongwen686 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed head dbd6211 for issue #2283.

I checked the PR diff and the head file contents through the GitHub API. The Python SDK now centralizes the public default as DEFAULT_NODE_URL = "https://rustchain.org", the CLI default --node options import and use that constant, the SDK test fixture now targets https://rustchain.org, and tests/test_tls_config.py covers the public SDK/macOS default surfaces against the legacy raw IP.

The only failing CI job fails during unrelated full-suite pytest collection because the runner is missing optional dependencies such as aiohttp, flask_cors, and matplotlib before the touched tests can run. The other checks pass, and I do not see a blocking issue in this change.

Note: install.sh still keeping the raw IP is consistent with #2283, which asked to keep it as a fallback for DNS-unavailable environments.

Copy link
Copy Markdown

@ZacharyZhang-NY ZacharyZhang-NY left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed PR #5580 at head dbd6211.

Requesting changes for the macOS installer integrity path. This PR changes miners/macos/rustchain_mac_miner_v2.5.py by updating the default NODE_URL to https://rustchain.org, which changes the miner artifact bytes. setup_miner.py still expects the old Darwin artifact SHA-256 e50cea51a24c8c0337e340287a05e6431f6d95883ab913a1a79c19e99bc03dd8.

Hash evidence on this PR head:

python -c "import hashlib, pathlib; p=pathlib.Path('miners/macos/rustchain_mac_miner_v2.5.py'); print(hashlib.sha256(p.read_bytes()).hexdigest()); print(p.stat().st_size)"
# 1ea8d6eb68326761cd7fdd96c9bea04d1c06f72b12a8c2c552bc1d227be077f9
# 25553

git show origin/main:miners/macos/rustchain_mac_miner_v2.5.py | python -c "import sys,hashlib; data=sys.stdin.buffer.read(); print(hashlib.sha256(data).hexdigest()); print(len(data))"
# e50cea51a24c8c0337e340287a05e6431f6d95883ab913a1a79c19e99bc03dd8
# 25552

After this lands, setup_miner.py will download https://raw.githubusercontent.com/Scottcjn/Rustchain/main/miners/macos/rustchain_mac_miner_v2.5.py, compute 1ea8d6eb..., compare it to the stale expected e50cea51..., and raise Downloaded miner SHA-256 mismatch for Darwin users.

Please update the Darwin entry in setup_miner.py to the new macOS miner SHA-256, or add a test that keeps the installer artifact hashes synchronized with the checked-in miner files.

Validation run:

git diff --check origin/main...HEAD -- miners/macos/rustchain_mac_miner_v2.5.py sdk/python/README.md sdk/python/rustchain_sdk/__init__.py sdk/python/rustchain_sdk/cli.py sdk/python/rustchain_sdk/client.py sdk/python/rustchain_sdk/tests/test_client.py sdk/python/test_rustchain_sdk.py tests/test_tls_config.py
python -B -m py_compile miners/macos/rustchain_mac_miner_v2.5.py sdk/python/rustchain_sdk/__init__.py sdk/python/rustchain_sdk/cli.py sdk/python/rustchain_sdk/client.py sdk/python/rustchain_sdk/tests/test_client.py sdk/python/test_rustchain_sdk.py tests/test_tls_config.py
python -B -m pytest -q tests/test_tls_config.py --tb=short
PYTHONPATH=sdk/python python -B -m pytest -q sdk/python/rustchain_sdk/tests/test_client.py --tb=short

Result: diff check clean, py_compile clean, TLS config tests 4 passed. SDK client tests could not collect in this environment because httpx is missing.

Copy link
Copy Markdown
Contributor

@jaxint jaxint left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! ✅

Copy link
Copy Markdown
Contributor

@HCIE2054 HCIE2054 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@iamdinhthuan
Copy link
Copy Markdown
Author

Addressed the macOS installer hash blocker in commit e49d26f.

What changed:

  • Updated the Darwin SHA-256 in setup_miner.py to match the modified miners/macos/rustchain_mac_miner_v2.5.py artifact on this PR head.
  • Added a focused Darwin artifact-pin regression so the macOS installer path catches this exact drift.
  • Left the existing Linux hash mismatch out of this PR because earlier PR fix: update Linux miner setup checksum #5510 owns that duplicate Linux setup-miner fix.

TDD/validation:

  • RED first: PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 PYTHONPATH=. python3 -B -m pytest -q tests/test_setup_miner_downloads.py::test_setup_miner_pins_current_macos_artifact --noconftest --tb=short failed with old e50cea... vs current 1ea8d6....
  • After fix: same Darwin-focused test -> 1 passed.
  • PYTHONPATH=node:. python3 -B -m pytest -q tests/test_tls_config.py --noconftest -> 4 passed.
  • PYTHONPATH=sdk/python uv run --no-project --with pytest --with pytest-asyncio --with respx --with httpx --with cryptography --with pynacl python -B -m pytest -q sdk/python/rustchain_sdk/tests/test_client.py --noconftest -> 20 passed.
  • python3 -B -m py_compile setup_miner.py tests/test_setup_miner_downloads.py sdk/python/rustchain_sdk/client.py sdk/python/rustchain_sdk/cli.py sdk/python/rustchain_sdk/__init__.py miners/macos/rustchain_mac_miner_v2.5.py sdk/python/test_rustchain_sdk.py tests/test_tls_config.py
  • python3 tools/bcos_spdx_check.py --base-ref origin/main -> BCOS SPDX check OK.
  • git diff --check origin/main...HEAD -- setup_miner.py tests/test_setup_miner_downloads.py miners/macos/rustchain_mac_miner_v2.5.py sdk/python/README.md sdk/python/rustchain_sdk/__init__.py sdk/python/rustchain_sdk/cli.py sdk/python/rustchain_sdk/client.py sdk/python/rustchain_sdk/tests/test_client.py sdk/python/test_rustchain_sdk.py tests/test_tls_config.py
  • Darwin manual hash probe: expected and actual both 1ea8d6eb68326761cd7fdd96c9bea04d1c06f72b12a8c2c552bc1d227be077f9.

Note: the existing all-platform setup miner artifact test still encounters the older Linux mismatch until #5510 is merged/rebased; this PR only fixes the new macOS mismatch introduced by the macOS default URL change.

Copy link
Copy Markdown

@ZacharyZhang-NY ZacharyZhang-NY left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up review on current head e49d26f.

Approved for the macOS installer hash blocker I raised earlier. The Darwin SHA-256 in setup_miner.py now matches the modified miners/macos/rustchain_mac_miner_v2.5.py artifact bytes, and the new focused macOS artifact-pin regression passes.

Verification:

python -c "import hashlib, pathlib, setup_miner; p=pathlib.Path('miners/macos/rustchain_mac_miner_v2.5.py'); print(hashlib.sha256(p.read_bytes()).hexdigest()); print(setup_miner.MINER_ARTIFACTS['Darwin']['sha256'])"
# 1ea8d6eb68326761cd7fdd96c9bea04d1c06f72b12a8c2c552bc1d227be077f9
# 1ea8d6eb68326761cd7fdd96c9bea04d1c06f72b12a8c2c552bc1d227be077f9

git diff --check origin/main...HEAD -- miners/macos/rustchain_mac_miner_v2.5.py sdk/python/README.md sdk/python/rustchain_sdk/__init__.py sdk/python/rustchain_sdk/cli.py sdk/python/rustchain_sdk/client.py sdk/python/rustchain_sdk/tests/test_client.py sdk/python/test_rustchain_sdk.py setup_miner.py tests/test_setup_miner_downloads.py tests/test_tls_config.py
python -B -m py_compile miners/macos/rustchain_mac_miner_v2.5.py sdk/python/rustchain_sdk/__init__.py sdk/python/rustchain_sdk/cli.py sdk/python/rustchain_sdk/client.py sdk/python/rustchain_sdk/tests/test_client.py sdk/python/test_rustchain_sdk.py setup_miner.py tests/test_setup_miner_downloads.py tests/test_tls_config.py
python -B -m pytest -q tests/test_setup_miner_downloads.py::test_setup_miner_pins_current_macos_artifact tests/test_tls_config.py --tb=short

Result: diff check clean, py_compile clean, macOS artifact focused test plus TLS config tests 5 passed.

Context for maintainers: the full tests/test_setup_miner_downloads.py file still reports the existing Linux artifact pin mismatch (9475fe15... expected vs 91815ecf... current file hash). That path is covered by the separate Linux setup-miner hash PR, so this follow-up clears the macOS regression introduced by this branch.

Copy link
Copy Markdown
Contributor

@jaxint jaxint left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Great work on this PR. 🚀

Copy link
Copy Markdown

@TJCurnutte TJCurnutte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified this default-node cleanup.

What I checked at head e49d26f7da0b2bf3fff67403dfae0398d224fec8:

  • git diff --check origin/main...HEAD passed for the full PR diff.
  • python3 -B -m py_compile sdk/python/rustchain_sdk/client.py sdk/python/rustchain_sdk/cli.py sdk/python/rustchain_sdk/__init__.py miners/macos/rustchain_mac_miner_v2.5.py sdk/python/test_rustchain_sdk.py tests/test_tls_config.py setup_miner.py tests/test_setup_miner_downloads.py passed.
  • PYTHONPATH=node:. python3 -B -m pytest -q -o addopts='' --noconftest tests/test_tls_config.py passed with 4 passed in 0.05s.
  • PYTHONPATH=sdk/python uv run --no-project --with pytest --with pytest-asyncio --with respx --with httpx --with cryptography --with pynacl python -B -m pytest -q -o addopts='' --noconftest sdk/python/rustchain_sdk/tests/test_client.py passed with 20 passed in 0.15s.
  • Runtime probe confirmed DEFAULT_NODE_URL=https://rustchain.org, RustChainClient()._base_url=https://rustchain.org, and _tls_verify=True.
  • The changed macOS miner artifact hash in setup_miner.py matches the updated Darwin miner file. The same hash probe still shows an unrelated/base-side Linux hash mismatch, but the Darwin hash touched by this PR is correct.
  • python3 tools/bcos_spdx_check.py --base-ref origin/main returned BCOS SPDX check: OK.

The SDK and macOS miner defaults now move off the raw IP and onto the TLS-valid public domain while preserving explicit override paths and TLS verification. Looks good to merge.

Copy link
Copy Markdown
Contributor

@HCIE2054 HCIE2054 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Copy Markdown
Contributor

@kekehanshujun kekehanshujun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reviewed the SDK default-node migration. Centralizing the public default as DEFAULT_NODE_URL = https://rustchain.org keeps the Python client and CLI aligned, and the TLS regression test checks that public surfaces no longer default to the raw node IP.

This also preserves explicit custom base_url/--node behavior. I do not see a blocker in this patch.

Copy link
Copy Markdown
Contributor

@HCIE2054 HCIE2054 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Copy Markdown
Contributor

@HCIE2054 HCIE2054 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Copy Markdown
Contributor

@HCIE2054 HCIE2054 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Copy Markdown
Contributor

@HCIE2054 HCIE2054 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Copy Markdown
Contributor

@HCIE2054 HCIE2054 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Copy Markdown
Contributor

@HCIE2054 HCIE2054 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Copy Markdown
Contributor

@HCIE2054 HCIE2054 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Copy Markdown
Contributor

@HCIE2054 HCIE2054 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@Scottcjn Scottcjn merged commit fec409e into Scottcjn:main May 18, 2026
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BCOS-L1 Beacon Certified Open Source tier BCOS-L1 (required for non-doc PRs) documentation Improvements or additions to documentation size/M PR: 51-200 lines tests Test suite changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[DOC] Hardcoded node IP (50.28.86.131) in SDK README, tests, and example code should use rustchain.org

10 participants