[Bug] Linux miner --dry-run still makes five HTTP attempts during local preflight

Aperta
#8,408 4 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 10 giorni

@Cid-oe ci sta già lavorando.

Dal 17/9/2026.

  • #8420 di @Cid-oe — chiusa senza merge
  • #8439 di @Cid-oe — aperta
  • #8475 di @Cid-oe — chiusa senza merge

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
25/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
python
Ambito
networking

Direzione di ricerca

Read miners/linux/rustchain_linux_miner.py around run_dry() and _request_with_network_retry, then miners/linux/fingerprint_checks.py around the cloud-metadata probes. Trace how dry-run policy reaches validate_all_checks() and check_anti_emulation(). Add a regression test that patches both HTTP request surfaces and verifies the chosen offline contract results in zero attempts, while local checks remain covered; multiple open pull requests are already linked.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug
Component

Miner (rustchain_*_miner)

What happened?

Summary

At commit aa584b344a766f6c0f8613ba7198d1cc7ffbae35, the documented Linux miner command

python miners/linux/rustchain_linux_miner.py --dry-run --show-payload --verbose --wallet ShaXiaozhu

exits successfully and does not attest, enroll, or mine, but it still attempts five HTTP requests during what the onboarding bounty describes as a no-network dry run:

  1. http://169.254.169.254/
  2. http://169.254.169.254/latest/api/token
  3. https://rustchain.org/health three times through the retry loop

This is a dry-run contract and side-effect bug. The requests were intercepted before transmission, so this report does not depend on production access.

Environment

  • Date reproduced: 2026-09-14
  • OS: Microsoft Windows 11 Home, version 10.0.26200 (build 26200)
  • CPU: AMD Ryzen 7 4800H with Radeon Graphics
  • Architecture: AMD64
  • Python: repository-local Python 3.12 virtual environment
  • Source: Scottcjn/Rustchain@aa584b344a766f6c0f8613ba7198d1cc7ffbae35
  • Miner entrypoint: miners/linux/rustchain_linux_miner.py

The Linux miner correctly warns that Windows probes may be degraded. That warning is separate from the outbound-attempt behavior reported here.

Steps to reproduce

  1. Check out commit aa584b344a766f6c0f8613ba7198d1cc7ffbae35 and install the miner requirements in a clean virtual environment.
  2. Replace urllib.request.urlopen and requests.sessions.Session.request with record-and-raise functions so attempted requests are logged and blocked before transmission.
  3. Run the command above without changing the miner source.
  4. Inspect the recorded attempt list and exit code.

The recorded list was:

[
  {"surface":"urllib","url":"http://169.254.169.254/"},
  {"surface":"urllib","url":"http://169.254.169.254/latest/api/token"},
  {"surface":"requests","method":"get","url":"https://rustchain.org/health"},
  {"surface":"requests","method":"get","url":"https://rustchain.org/health"},
  {"surface":"requests","method":"get","url":"https://rustchain.org/health"}
]

File writes were also denied, and ~/.rustchain/miner_key.json was absent before and after the run. The miner exited with code 0; all 6/6 fingerprint checks passed. The complete sanitized run is published here:

https://github.com/Scottcjn/rustchain-bounties/issues/2784#issuecomment-5659014628

Source path

The two link-local requests come from the anti-emulation cloud-metadata checks:

The dry-run health request is issued from run_dry() and retried by _request_with_network_retry:

Expected behavior

One contract should be made explicit and enforced:

  1. --dry-run performs no outbound request attempts; network-backed anti-emulation probes and the node health probe are skipped; or
  2. if online read-only probes are intentional, add a separate --offline or --skip-network-probes option and update onboarding text so --dry-run is not described as making no network calls.

For automated compatibility testing, a fully offline mode is the least surprising behavior.

Actual behavior

Object construction runs the fingerprint suite, including its cloud-metadata URL probes, before run_dry() executes. run_dry() then performs a node health request with three retries. There is no command-line option that makes the documented dry-run fully offline.

Impact

This is primarily an onboarding and automation-safety problem. A user can reasonably select dry-run to inspect local hardware without contacting the public node or a link-local cloud metadata service. Isolated CI and sandbox runs are also delayed by expected health-request retries.

Suggested fix

  • Thread an offline/dry-run policy into validate_all_checks() and check_anti_emulation() so cloud-metadata probes can be skipped without disabling local anti-emulation checks.
  • Make the /health probe opt-in during fully offline dry-run.
  • Add a regression test that patches both HTTP surfaces and asserts zero outbound attempts under the offline contract.
  • Keep current online probes available under an explicit flag if they remain useful for normal miner validation.

AI assistance disclosure: EarnPilot/Codex prepared the isolation harness and this report. The miner was executed locally on the recorded host and commit. No production mutation, attestation, enrollment, mining, or payment action occurred.

Expected behavior

A fully offline dry-run should make zero outbound request attempts. If read-only online probes are intentional, the CLI should expose an explicit --offline or --skip-network-probes mode and the onboarding text should distinguish online dry-run from offline hardware inspection.

Steps to reproduce
  1. Check out Scottcjn/Rustchain@aa584b344a766f6c0f8613ba7198d1cc7ffbae35 and install the Linux miner requirements in a clean Python 3.12 virtual environment.
  2. Patch urllib.request.urlopen and requests.sessions.Session.request with record-and-raise functions so every attempted HTTP request is logged and blocked before transmission.
  3. Run python miners/linux/rustchain_linux_miner.py --dry-run --show-payload --verbose --wallet ShaXiaozhu without modifying the miner source.
  4. Observe two link-local cloud-metadata attempts and three retries of https://rustchain.org/health even though the miner exits with code 0 and does not attest, enroll, or mine.
Version / Commit

aa584b344a766f6c0f8613ba7198d1cc7ffbae35

Operating System

Windows

Relevant logs
exit_code=0
fingerprint_checks=6/6 PASS
network_attempts=5
- urllib: http://169.254.169.254/
- urllib: http://169.254.169.254/latest/api/token
- requests GET: https://rustchain.org/health (3 attempts)
network_policy=all attempts blocked before transmission
keystore_before=false
keystore_after=false
attestation=false; enrollment=false; mining=false
Lingua principale
Python
Stelle
850
Fork
589
Merge medio
11g 7h
PR unite (30g)
29

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Scottcjn/Rustchain

Tutte le issue di Scottcjn/Rustchain

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.