Skip to content

fix(rust-miner): real CPU brand + burned-in MACs on macOS - #8615

Open
Scottcjn wants to merge 2 commits into
mainfrom
fix/miner-macos-cpu-brand-hw-mac
Open

Scottcjn wants to merge 2 commits into
mainfrom
fix/miner-macos-cpu-brand-hw-mac

Conversation

@Scottcjn

@Scottcjn Scottcjn commented Nov 5, 2026

Copy link
Copy Markdown
Owner

BCOS Checklist (Required For Non-Doc PRs)

  • Add a tier label: BCOS-L1
  • No new code files (edits to rustchain-miner/src/hardware.rs only)
  • Provide test evidence (below)

What Changed

  • CPU brand: sysinfo global_cpu_info().name() returns the per-core label ("0"), not the model, so the Rust miner reported cpu = "0" on every platform. It now uses brand(), with a sysctl -n machdep.cpu.brand_string fallback on macOS. Without a real brand, Apple chips risk being classed as generic ARM by derive_verified_device.
  • macOS MAC addresses: on modern macOS, ifconfig only shows private or randomized addresses (en0 private Wi-Fi, awdl0, llw0, utun*). They churn and can trip MAC_MAX_UNIQUE_PER_DAY. The miner now reads burned-in addresses from networksetup -listallhardwareports, and falls back to ifconfig if that returns nothing.

Testing / Evidence

Built and run on a MacBook Neo (Apple A18 Pro, macOS 26.5, arm64):

cargo build --release   -> Finished, no warnings
cargo test --release    -> test result: ok. 32 passed / 1 passed (33 total), 0 failed
rustchain-miner --dry-run
  before: CPU: 0              MAC count: 4  (all locally-administered)
  after:  CPU: Apple A18 Pro  MAC count: 1  (hardware Wi-Fi address)
  Health probe: HTTP 200 OK, node 2.2.1-rip200

Not verified locally: the Linux/Windows build. The cfg(target_os = "macos") paths are the only new code, and the CPU change (name() → brand()) applies on every platform. Please let CI confirm.

Separate issue, not fixed here: the miner generates a new Ed25519 signing key at every start (miner.rs), so a restart presents a different public_key. This needs checking against the node's enroll/attest key binding.

🤖 Generated with Claude Code

- CPU: sysinfo `global_cpu_info().name()` is the per-core label ("0"),
  not the model, so every miner reported cpu="0". Use `brand()`, with a
  `sysctl machdep.cpu.brand_string` fallback on macOS. Without a brand,
  Apple chips risk falling through to the generic-ARM rate on the node.
- MACs (macOS): `ifconfig` only shows per-network private/randomized
  addresses (en0 private Wi-Fi, awdl0, llw0, utun*), which churn and trip
  MAC_MAX_UNIQUE_PER_DAY. Read burned-in addresses from
  `networksetup -listallhardwareports`; keep ifconfig as fallback.

Tested on a MacBook Neo (Apple A18 Pro, macOS 26.5): cargo build
--release clean, cargo test 33 passed, --dry-run shows
"CPU: Apple A18 Pro" and "MAC count: 1" (was "CPU: 0", 4 MACs).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Scottcjn Scottcjn added the BCOS-L1 Beacon Certified Open Source tier BCOS-L1 (required for non-doc PRs) label Nov 5, 2026
@github-actions github-actions Bot added the size/S PR: 11-50 lines label Nov 5, 2026
@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ BCOS v2 Scan Results

Metric Value
Trust Score 36/100
Certificate ID BCOS-f82a73a4
Tier L1 (not met)

BCOS Badge

What does this mean?

The BCOS (Beacon Certified Open Source) engine scans for:

  • SPDX license header compliance
  • Known CVE vulnerabilities (OSV database)
  • Static analysis findings (Semgrep)
  • SBOM completeness
  • Dependency freshness
  • Test infrastructure evidence
  • Review attestation tier

Full report | What is BCOS?


BCOS v2 Engine - Free & Open Source (MIT) - Elyan Labs

@elvergon8888 elvergon8888 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Revisando los cambios, noto lo siguiente:

  1. Parseo de MAC (validación de hex): Al leer la MAC desde networksetup -listallhardwareports, solo se valida la longitud de la cadena o el formato superficial, pero no se verifica estrictamente que todos los caracteres sean hexadecimales ([0-9A-Fa-f]), lo que podría permitir strings inválidos.
  2. Fallback a ifconfig: Si el comando principal falla y cae al fallback, sigue devolviendo MACs aleatorizadas por privacidad (Private Wi-Fi Address) sin lanzar una advertencia clara al usuario de que el fingerprint puede ser incorrecto.
  3. Función brand() en Linux: Retorna un string vacío si no encuentra el modelo, pero carece de un fallback genérico (ej. "Generic CPU"), lo que puede romper la lógica río abajo.
  4. Nota del autor: Coincido en que el problema del reinicio de la llave Ed25519 (generada en cada start) es crítico para el enrolamiento y debe tratarse en un issue/PR separado.

This branch has not been deployed

No deployments
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) size/S PR: 11-50 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants