Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ The pre-push hooks also run repository checks before a branch can be pushed:
- `client`: TypeScript typechecking via `npm exec --no -- tsc --noEmit`
- `server`: `golangci-lint run -c .golangci.yaml`
- `plugin/proto`: `golangci-lint run -c .golangci.yaml`
- `plugin/antminer`: `golangci-lint run -c .golangci.yaml`

## Git Workflow

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const miners: MinerStateSnapshot[] = [
model: "S19 Pro",
manufacturer: "Bitmain",
workerName: "worker-01",
driverName: "antminer",
driverName: "asicrs",
hashrate: [
{
timestamp: { seconds: BigInt(1641024000), nanos: 0 },
Expand Down Expand Up @@ -76,7 +76,7 @@ export const miners: MinerStateSnapshot[] = [
model: "S19 Pro",
manufacturer: "Bitmain",
workerName: "worker-02",
driverName: "antminer",
driverName: "asicrs",
hashrate: [
{
timestamp: { seconds: BigInt(1641024000), nanos: 0 },
Expand Down Expand Up @@ -133,7 +133,7 @@ export const miners: MinerStateSnapshot[] = [
model: "S19 Pro",
manufacturer: "Bitmain",
workerName: "worker-03",
driverName: "antminer",
driverName: "asicrs",
hashrate: [
{
timestamp: { seconds: BigInt(1641024000), nanos: 0 },
Expand Down Expand Up @@ -190,7 +190,7 @@ export const miners: MinerStateSnapshot[] = [
model: "S19 Pro",
manufacturer: "Bitmain",
workerName: "worker-04",
driverName: "antminer",
driverName: "asicrs",
hashrate: [
{
timestamp: { seconds: BigInt(1641024000), nanos: 0 },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export const hashingMiner: MinerStateSnapshot = {
pairingStatus: PairingStatus.PAIRED,
model: "S19 Pro",
manufacturer: "Bitmain",
driverName: "antminer",
driverName: "asicrs",
...baseMeasurements,
deviceStatus: DeviceStatus.ONLINE,
temperatureStatus: TemperatureStatus.OK,
Expand All @@ -116,7 +116,7 @@ export const offlineMiner: MinerStateSnapshot = {
model: "S19 Pro",
manufacturer: "Bitmain",
workerName: "worker-offline",
driverName: "antminer",
driverName: "asicrs",
hashrate: [],
efficiency: [],
powerUsage: [],
Expand All @@ -143,7 +143,7 @@ export const sleepingMiner: MinerStateSnapshot = {
model: "S19 Pro",
manufacturer: "Bitmain",
workerName: "worker-sleeping",
driverName: "antminer",
driverName: "asicrs",
hashrate: [
{
timestamp: { seconds: BigInt(1641283200), nanos: 0 },
Expand Down Expand Up @@ -179,7 +179,7 @@ export const authRequiredMiner: MinerStateSnapshot = {
model: "S19 Pro",
manufacturer: "Bitmain",
workerName: "worker-auth",
driverName: "antminer",
driverName: "asicrs",
hashrate: [],
efficiency: [],
powerUsage: [],
Expand All @@ -205,7 +205,7 @@ export const poolRequiredMiner: MinerStateSnapshot = {
pairingStatus: PairingStatus.PAIRED,
model: "S19 Pro",
manufacturer: "Bitmain",
driverName: "antminer",
driverName: "asicrs",
...baseMeasurements,
deviceStatus: DeviceStatus.NEEDS_MINING_POOL,
temperatureStatus: TemperatureStatus.OK,
Expand All @@ -224,7 +224,7 @@ export const controlBoardFailureMiner: MinerStateSnapshot = {
pairingStatus: PairingStatus.PAIRED,
model: "S19 Pro",
manufacturer: "Bitmain",
driverName: "antminer",
driverName: "asicrs",
...baseMeasurements,
deviceStatus: DeviceStatus.ERROR,
temperatureStatus: TemperatureStatus.OK,
Expand All @@ -243,7 +243,7 @@ export const hashboardFailureMiner: MinerStateSnapshot = {
pairingStatus: PairingStatus.PAIRED,
model: "S19 Pro",
manufacturer: "Bitmain",
driverName: "antminer",
driverName: "asicrs",
...baseMeasurements,
deviceStatus: DeviceStatus.ERROR,
temperatureStatus: TemperatureStatus.OK,
Expand All @@ -262,7 +262,7 @@ export const psuFailureMiner: MinerStateSnapshot = {
pairingStatus: PairingStatus.PAIRED,
model: "S19 Pro",
manufacturer: "Bitmain",
driverName: "antminer",
driverName: "asicrs",
...baseMeasurements,
deviceStatus: DeviceStatus.ERROR,
temperatureStatus: TemperatureStatus.OK,
Expand All @@ -281,7 +281,7 @@ export const fanFailureMiner: MinerStateSnapshot = {
pairingStatus: PairingStatus.PAIRED,
model: "S19 Pro",
manufacturer: "Bitmain",
driverName: "antminer",
driverName: "asicrs",
...baseMeasurements,
deviceStatus: DeviceStatus.ERROR,
temperatureStatus: TemperatureStatus.OK,
Expand All @@ -304,7 +304,7 @@ export const multipleHashboardFailuresMiner: MinerStateSnapshot = {
pairingStatus: PairingStatus.PAIRED,
model: "S19 Pro",
manufacturer: "Bitmain",
driverName: "antminer",
driverName: "asicrs",
...baseMeasurements,
deviceStatus: DeviceStatus.ERROR,
temperatureStatus: TemperatureStatus.OK,
Expand All @@ -323,7 +323,7 @@ export const multipleComponentFailuresMiner: MinerStateSnapshot = {
pairingStatus: PairingStatus.PAIRED,
model: "S19 Pro",
manufacturer: "Bitmain",
driverName: "antminer",
driverName: "asicrs",
...baseMeasurements,
deviceStatus: DeviceStatus.ERROR,
temperatureStatus: TemperatureStatus.OK,
Expand Down
2 changes: 1 addition & 1 deletion deployment-files/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ extract_and_cd "/tmp/${TAR_NAME}" "$INSTALL_DIR"
# Validate plugin binaries exist
echo "🔌 Validating plugin binaries..."
PLUGIN_DIR="server"
REQUIRED_PLUGINS=("proto-plugin" "antminer-plugin" "asicrs-plugin")
REQUIRED_PLUGINS=("proto-plugin" "asicrs-plugin")
MISSING_PLUGINS=()

for plugin in "${REQUIRED_PLUGINS[@]}"; do
Expand Down
2 changes: 1 addition & 1 deletion deployment-files/server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ WORKDIR /app
COPY fleetd /app/

RUN mkdir -p /app/plugins
COPY proto-plugin antminer-plugin asicrs-plugin asicrs-config.yaml /app/plugins/
COPY proto-plugin asicrs-plugin asicrs-config.yaml /app/plugins/

RUN chmod 755 /app/fleetd /app/plugins/*-plugin

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public sealed class PluginValidator : IPluginValidator
private static readonly string[] RequiredPlugins =
[
"proto-plugin",
"antminer-plugin"
"asicrs-plugin"
];

private readonly WslCommandExecutor _executor;
Expand Down
3 changes: 1 addition & 2 deletions docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ The backend is a Go service that handles device pairing, telemetry collection, c
Proto Fleet supports multiple miner integrations through plugins:

- `plugin/proto/` for Proto miners
- `plugin/antminer/` for Antminer devices
- `plugin/virtual/` for the virtual miner simulator used in development and testing
- `plugin/asicrs/` for Rust-based multi-manufacturer ASIC miner support
- `plugin/asicrs/` for Rust-based multi-manufacturer ASIC miner support, including stock and aftermarket Antminers
- `plugin/example-python/` for the example Python plugin (template for plugin authors)

Shared RPC and message contracts live in `proto/`. Miner-hosted ProtoOS API definitions live in `proto-rig-api/`.
Expand Down
1 change: 0 additions & 1 deletion go.work
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
go 1.25.4

use (
./plugin/antminer
./plugin/proto
./plugin/virtual
./server
Expand Down
62 changes: 36 additions & 26 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,22 @@ build-plugins-docker: (_build-go-plugins-cross "linux" "arm64" "server/plugins")
# build plugin binaries for multiple architectures (deployment)
build-plugins-release: _build-go-plugins-multi-arch _asicrs-build-release

# rebuild a specific plugin for the Docker runtime (linux/arm64): proto, antminer, virtual, or asicrs
# rebuild a specific plugin for the Docker runtime (linux/arm64): proto, virtual, or asicrs
rebuild-plugin name:
#!/usr/bin/env bash
set -euo pipefail
case "{{name}}" in
proto|antminer|virtual|asicrs) ;;
proto|virtual|asicrs) ;;
*)
echo "Unknown plugin: {{name}}. Valid: proto, antminer, virtual, asicrs" >&2
echo "Unknown plugin: {{name}}. Valid: proto, virtual, asicrs" >&2
exit 1
;;
esac
# Fleet loads every executable in PLUGINS_DIR, so ensure all siblings are
# present and built for linux/arm64 before force-rebuilding the named one.
just build-plugins-docker
case "{{name}}" in
proto|antminer)
proto)
(cd plugin/{{name}} && GOOS=linux GOARCH=arm64 go build -o ../../server/plugins/{{name}}-plugin .)
chmod +x server/plugins/{{name}}-plugin
;;
Expand All @@ -70,7 +70,7 @@ build-virtual-plugin: (rebuild-plugin "virtual")
# --- Tests ---

# run plugin contract tests (each test suite in its own container for port isolation)
test-contract: _asicrs-build
test-contract: _asicrs-build-contract
#!/usr/bin/env bash
set -euo pipefail
GO_VERSION=$(grep '^go ' tests/plugin-contract/go.mod | awk '{print $2}')
Expand Down Expand Up @@ -100,7 +100,6 @@ test-contract: _asicrs-build
"$IMAGE" sh -c '
mkdir -p server/plugins && \
(cd plugin/proto && go build -o ../../server/plugins/proto-plugin .) && \
(cd plugin/antminer && go build -o ../../server/plugins/antminer-plugin .) && \
(cd tests/plugin-contract && go test -c -o bin/miners.test ./miners/)
'

Expand Down Expand Up @@ -179,8 +178,6 @@ update-go-deps:
(cd server && go get -u -t ./... && go mod tidy)
echo "Updating plugin/proto dependencies..."
(cd plugin/proto && go get -u -t ./... && go mod tidy)
echo "Updating plugin/antminer dependencies..."
(cd plugin/antminer && go get -u -t ./... && go mod tidy)
echo "Updating plugin/virtual dependencies..."
(cd plugin/virtual && go get -u -t ./... && go mod tidy)
echo "Updating server/fake-proto-rig dependencies..."
Expand Down Expand Up @@ -258,7 +255,6 @@ _lint-plugins:
#!/usr/bin/env bash
set -euo pipefail
(cd plugin/proto && golangci-lint run -c .golangci.yaml)
(cd plugin/antminer && golangci-lint run -c .golangci.yaml)

[working-directory: 'server']
_format-server:
Expand All @@ -272,7 +268,6 @@ _format-plugins:
#!/usr/bin/env bash
set -euo pipefail
(cd plugin/proto && goimports -w .)
(cd plugin/antminer && goimports -w .)

_gen-protos:
PATH="$(pwd)/client/node_modules/.bin:$PATH" buf generate
Expand Down Expand Up @@ -307,46 +302,40 @@ _build-go-plugins-native outdir: _go-work-sync
#!/usr/bin/env bash
set -euo pipefail
# Plugins import from ../../server, so server module files also affect the graph.
SOURCES="plugin/proto plugin/antminer server/sdk/v1 go.work go.work.sum server/go.mod server/go.sum plugin/proto/go.mod plugin/proto/go.sum plugin/antminer/go.mod plugin/antminer/go.sum"
SOURCES="plugin/proto server/sdk/v1 go.work go.work.sum server/go.mod server/go.sum plugin/proto/go.mod plugin/proto/go.sum"
PROTO_BIN={{outdir}}/proto-plugin
ANT_BIN={{outdir}}/antminer-plugin
PLATFORM_MARKER={{outdir}}/.go-plugins-platform
WANT_PLATFORM="native"
if [ -f "$PROTO_BIN" ] && [ -f "$ANT_BIN" ] \
if [ -f "$PROTO_BIN" ] \
&& [ -f "$PLATFORM_MARKER" ] && [ "$(cat "$PLATFORM_MARKER")" = "$WANT_PLATFORM" ] \
&& [ -z "$(find $SOURCES -newer "$PROTO_BIN" -type f 2>/dev/null | head -1)" ] \
&& [ -z "$(find $SOURCES -newer "$ANT_BIN" -type f 2>/dev/null | head -1)" ]; then
&& [ -z "$(find $SOURCES -newer "$PROTO_BIN" -type f 2>/dev/null | head -1)" ]; then
echo "Go plugins up to date, skipping build."
exit 0
fi
echo "Building Go plugins..."
mkdir -p {{outdir}}
(cd plugin/proto && go build -o ../../{{outdir}}/proto-plugin .)
(cd plugin/antminer && go build -o ../../{{outdir}}/antminer-plugin .)
chmod +x {{outdir}}/proto-plugin {{outdir}}/antminer-plugin
chmod +x {{outdir}}/proto-plugin
echo "$WANT_PLATFORM" > "$PLATFORM_MARKER"

_build-go-plugins-cross goos goarch outdir: _go-work-sync
#!/usr/bin/env bash
set -euo pipefail
# Plugins import from ../../server, so server module files also affect the graph.
SOURCES="plugin/proto plugin/antminer server/sdk/v1 go.work go.work.sum server/go.mod server/go.sum plugin/proto/go.mod plugin/proto/go.sum plugin/antminer/go.mod plugin/antminer/go.sum"
SOURCES="plugin/proto server/sdk/v1 go.work go.work.sum server/go.mod server/go.sum plugin/proto/go.mod plugin/proto/go.sum"
PROTO_BIN={{outdir}}/proto-plugin
ANT_BIN={{outdir}}/antminer-plugin
PLATFORM_MARKER={{outdir}}/.go-plugins-platform
WANT_PLATFORM="{{goos}}/{{goarch}}"
if [ -f "$PROTO_BIN" ] && [ -f "$ANT_BIN" ] \
if [ -f "$PROTO_BIN" ] \
&& [ -f "$PLATFORM_MARKER" ] && [ "$(cat "$PLATFORM_MARKER")" = "$WANT_PLATFORM" ] \
&& [ -z "$(find $SOURCES -newer "$PROTO_BIN" -type f 2>/dev/null | head -1)" ] \
&& [ -z "$(find $SOURCES -newer "$ANT_BIN" -type f 2>/dev/null | head -1)" ]; then
&& [ -z "$(find $SOURCES -newer "$PROTO_BIN" -type f 2>/dev/null | head -1)" ]; then
echo "Go plugins up to date for {{goos}}/{{goarch}}, skipping build."
exit 0
fi
echo "Building Go plugins for {{goos}}/{{goarch}}..."
mkdir -p {{outdir}}
(cd plugin/proto && GOOS={{goos}} GOARCH={{goarch}} go build -o ../../{{outdir}}/proto-plugin .)
(cd plugin/antminer && GOOS={{goos}} GOARCH={{goarch}} go build -o ../../{{outdir}}/antminer-plugin .)
chmod +x {{outdir}}/proto-plugin {{outdir}}/antminer-plugin
chmod +x {{outdir}}/proto-plugin
echo "$WANT_PLATFORM" > "$PLATFORM_MARKER"

_build-go-plugins-multi-arch: _go-work-sync
Expand All @@ -355,9 +344,7 @@ _build-go-plugins-multi-arch: _go-work-sync
echo "Building Go plugins for multiple architectures..."
mkdir -p deployment-files/server
(cd plugin/proto && GOOS=linux GOARCH=amd64 go build -o ../../deployment-files/server/proto-plugin-amd64 .)
(cd plugin/antminer && GOOS=linux GOARCH=amd64 go build -o ../../deployment-files/server/antminer-plugin-amd64 .)
(cd plugin/proto && GOOS=linux GOARCH=arm64 go build -o ../../deployment-files/server/proto-plugin-arm64 .)
(cd plugin/antminer && GOOS=linux GOARCH=arm64 go build -o ../../deployment-files/server/antminer-plugin-arm64 .)
chmod +x deployment-files/server/*-plugin-*

_asicrs-build outdir="server/plugins":
Expand Down Expand Up @@ -406,6 +393,29 @@ _asicrs-build outdir="server/plugins":
touch "$BIN"
echo "$WANT_PLATFORM" > "$PLATFORM_MARKER"

_asicrs-build-contract:
#!/usr/bin/env bash
set -euo pipefail
BIN=server/plugins/asicrs-plugin
PLATFORM_MARKER=server/plugins/.asicrs-platform
WANT_PLATFORM="contract-docker-default"
if [ -f "$BIN" ] \
&& [ -f "$PLATFORM_MARKER" ] && [ "$(cat "$PLATFORM_MARKER")" = "$WANT_PLATFORM" ] \
&& [ -z "$(find plugin/asicrs sdk/rust server/sdk/v1/pb -newer "$BIN" -type f 2>/dev/null | head -1)" ]; then
echo "asicrs plugin up to date for contract tests, skipping build."
exit 0
fi
echo "Building asicrs plugin for contract tests using Docker's default platform..."
mkdir -p server/plugins
docker buildx build \
--file plugin/asicrs/Dockerfile.build \
--output type=local,dest=server/plugins \
.
chmod +x "$BIN"
# buildx --output type=local preserves the in-image mtime; touch so freshness checks see "now".
touch "$BIN"
echo "$WANT_PLATFORM" > "$PLATFORM_MARKER"

_asicrs-build-docker:
#!/usr/bin/env bash
set -euo pipefail
Expand Down
4 changes: 0 additions & 4 deletions lefthook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,3 @@ pre-push:
plugin-proto-lint:
root: plugin/proto
run: golangci-lint run -c .golangci.yaml

plugin-antminer-lint:
root: plugin/antminer
run: golangci-lint run -c .golangci.yaml
Loading
Loading