Skip to content

fix: filter virtual interface MACs in Linux miner fingerprint collection (#4820)#7773

Merged
Scottcjn merged 3 commits into
Scottcjn:mainfrom
lequangsang01:fix/bounty-4820
Jul 1, 2026
Merged

fix: filter virtual interface MACs in Linux miner fingerprint collection (#4820)#7773
Scottcjn merged 3 commits into
Scottcjn:mainfrom
lequangsang01:fix/bounty-4820

Conversation

@lequangsang01

Copy link
Copy Markdown
Contributor

Closes #4820

RTC wallet: RTCfe13452d122263caf633ab1876bd9631133b68b1

Changes

  • Filter out virtual interface MACs (Docker, veth, Tailscale, virbr, tun, tap, etc.) from Linux miner fingerprint collection
  • Applied to both ip -o link and ifconfig -a fallback paths
  • Prevents false mac_churn detection during /epoch/enroll enrollment
  • Virtual MACs from Docker bridges, VPN tunnels, and container interfaces are now excluded

Testing

  • Code compiles without syntax errors
  • Filter logic correctly identifies virtual interface prefixes

…ion (Scottcjn#4820)

- Filter out Docker, veth, Tailscale, and other virtual interface MACs
- Prevents false mac_churn detection during enrollment
- Applied to both ip-link and ifconfig fallback paths
@github-actions github-actions Bot added BCOS-L1 Beacon Certified Open Source tier BCOS-L1 (required for non-doc PRs) size/S PR: 11-50 lines labels Jun 30, 2026

@jujujuda jujujuda 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.

LGTM. Filters virtual interface MACs from fingerprint. Covers ip -o link and ifconfig -a. Ready to merge.

@FakerHideInBush FakerHideInBush left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Two concerns before merging:

1. _VIRT_PREFIXES is defined twice inside _get_mac_addresses — once for the ip link code path and once for the ifconfig fallback

Both definitions are identical:

_VIRT_PREFIXES = ("docker", "br-", "veth", "tailscale", "ts-", "virbr", "vnet", "tun", "tap", "wg", "bond", "dummy", "lo")

This violates DRY and creates a maintenance hazard: adding a new virtual prefix in the future requires updating two places. A future reviewer might update one definition and miss the other, resulting in inconsistent filtering between the two code paths.

The tuple should be extracted to a module-level constant (e.g. _VIRTUAL_IFACE_PREFIXES) defined once at the top of the file, referenced in both code paths. Being a module-level constant also means it's computed once rather than allocated on every call to _get_mac_addresses().

2. The _VIRT_PREFIXES variable name uses a leading underscore suggesting it is a module-private name, but it is currently defined as a local variable inside the method — the scope and the naming convention do not match

Module-private convention (_NAME) implies the variable lives at module scope and is not part of the public API. Since it is actually local to the method, a plain name like VIRT_PREFIXES or an inner variable like virtual_prefixes is more accurate. Alternatively (and preferably), move it to module scope as _VIRTUAL_IFACE_PREFIXES so the convention is correct.

@jaxint jaxint left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

PR Review by jaxint

Summary

Reviewed PR #7773: fix: filter virtual interface MACs in Linux miner fingerprint collection (#4820)

Code Analysis

Author: lequangsang01

Assessment

✅ Code review completed
✅ Changes reviewed for correctness
✅ No blocking issues found

Verdict

APPROVE


Reviewer: jaxint
Wallet: AhqbFaPBPLMMiaLDzA9WhQcyvv4hMxiteLhPk3NhG1iG

@github-actions github-actions Bot added BCOS-L2 Beacon Certified Open Source tier BCOS-L2 (required for non-doc PRs) node Node server related api API endpoint related labels Jun 30, 2026
@Scottcjn
Scottcjn merged commit 0c1287f into Scottcjn:main Jul 1, 2026
11 checks passed
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

RTC Reward

This merged PR earned 5 RTC — sent to RTCfe13452d122263caf633ab1876bd9631133b68b1.

RustChain Bounty Program

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api API endpoint related BCOS-L1 Beacon Certified Open Source tier BCOS-L1 (required for non-doc PRs) BCOS-L2 Beacon Certified Open Source tier BCOS-L2 (required for non-doc PRs) node Node server related size/S PR: 11-50 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Linux miner submits sparse fingerprint data and virtual MACs

5 participants