block / block/proto-fleet

Antminer IP recovery cannot verify rediscovered device identity

Open
#792 0 comments 0 reactions 0 assignees View on GitHub
bug server
Dominant language
Go
Stars
55
Forks
16
Avg merge
1d 17h
Merged PRs (30d)
84

Description

🤖 Filed by an AI agent after manually testing the automatic IP scanner from #782.

## Problem

The automatic IP scanner can discover an offline paired Antminer at its current address, but identity verification rejects it. The scan completes with devices_found=0, so Fleet never updates the existing discovered_device row to the recovered IP.

## Reproduction

1. Pair a fake Antminer with valid credentials and confirm telemetry is healthy.
2. Change its stored discovered_device.ip_address to an unused address in the same /24 and mark its device_status OFFLINE.
3. Start or restart Fleet so the IP scanner runs immediately.
4. Observe that the Antminer plugin discovers devices in the subnet, but the target is not matched and the stored IP remains unchanged.

## Root cause

antminer.Driver.DiscoverDevice intentionally returns empty SerialNumber and MacAddress because discovery uses unauthenticated RPC port 4028. pairing.Service.IsSameDevice then calls plugins.Pairer.GetDeviceInfo, which constructs the device with Driver.NewDevice and calls DescribeDevice. The Antminer implementation returns the original discovery-backed DeviceInfo without performing a credentialed web API identity fetch, so serial and MAC remain empty. Comparing those empty fields with the paired device identity always fails.

## Expected behavior

The credentialed identity-verification path should obtain the Antminer serial number and MAC address before comparing them with the paired device, allowing the scanner to update the existing device endpoint without creating a duplicate.

## Acceptance criteria

- Rediscovered Antminers can be identity-verified using stored valid credentials even though unauthenticated discovery returns empty serial/MAC fields.
- A matching device updates the existing discovered_device network information and does not create a duplicate miner.
- Invalid or missing credentials still fail identity verification safely.
- Regression coverage exercises an Antminer discovery result with empty identity fields followed by a successful credentialed identity fetch.

Related: #782

Contributor guide

Open the contributing guide

Research direction

Start with antminer.Driver.DiscoverDevice, pairing.Service.IsSameDevice, plugins.Pairer.GetDeviceInfo, Driver.NewDevice, and DescribeDevice to trace discovery into credentialed identity verification. Reproduce the empty serial/MAC case, then add regression coverage for a successful credentialed fetch and verify that the existing discovered_device is updated without a duplicate while invalid credentials still fail safely.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.