Skip to content

feat(control-plane): show active Network Validators on the dashboard - #66

Merged
flo2517 merged 1 commit into
mainfrom
feat/issue-29-dashboard-validator-views
Aug 6, 2026
Merged

feat(control-plane): show active Network Validators on the dashboard#66
flo2517 merged 1 commit into
mainfrom
feat/issue-29-dashboard-validator-views

Conversation

@flo2517

@flo2517 flo2517 commented Aug 6, 2026

Copy link
Copy Markdown
Owner

Summary

Contained slice of #29 / ADR-011's dashboard bullet: validator count and list.

Scope, and why it stops here

The full ADR-011 dashboard requirement is "validator count, challenge outcomes, score history, and degraded quorum." This PR ships the count/list honestly. The rest — challenge outcomes, score history, degraded-quorum-per-round — needs reading pallet-network-validator's Rounds/Evidence StorageNMap, which requires correctly replicating Substrate's Blake2_128Concat/Twox64Concat multi-key hashing for a 3-key map. That's real additional risk to get right blind — this sandbox has no live chain to verify decoding against — so it's deliberately left for a follow-up rather than shipped half-verified.

What's here

internal/blockchainbridge/networkvalidator.go: reads pallet-network-validator's ActiveValidatorSet (a StorageValue, so only a fixed twox128(pallet)+twox128(item) key — no per-entry hashing needed) and SCALE-decodes the compact-prefixed Vec<AccountId32> it holds. Adds a decodeCompactUint counterpart to the existing compactUint encoder (registrar.go) and round-trips every mode (single-byte, two-byte, four-byte, big-integer) against it in tests — a subtly wrong decode would silently misread real validator counts rather than error, so this is exactly the kind of logic that needs a real round-trip test, not just "it compiles."

dashboard.go: ValidatorsActive is -1 on a failed read, never 0 — ADR-011's own requirement that a degraded observation must not read as false success applies here as much as to any on-chain state. A pinned JSON-contract test guards the sentinel against a refactor silently dropping it back to Go's int zero value. index.html/app.js render the same distinction: for unavailable, the real count (including a genuine 0) otherwise.

Verification

$ go build ./...
$ go vet ./...
$ gofmt -l .
$ go test ./...

Full suite green, including 6 new blockchainbridge SCALE-decode tests and the dashboard JSON-contract test.

🤖 Generated with Claude Code

Contained slice of #29/ADR-011's dashboard bullet: validator count and
list, the smallest honest piece of 'dashboard shows validator count,
challenge outcomes, score history, and degraded quorum' -- the rest
(challenge outcomes, score history, degraded-quorum-per-round) needs
reading pallet-network-validator's Rounds/Evidence StorageNMap, which
requires correctly replicating Substrate's Blake2_128Concat/
Twox64Concat multi-key hashing for a 3-key map. That is real
additional risk to get right blind (no live chain in this sandbox to
verify against), so it is deliberately left for a follow-up rather
than shipped half-verified.

internal/blockchainbridge/networkvalidator.go: reads
pallet-network-validator's ActiveValidatorSet (a StorageValue, so only
a fixed twox128(pallet)+twox128(item) key -- no per-entry hashing) and
SCALE-decodes the compact-prefixed Vec<AccountId32> it holds. Adds a
decodeCompactUint counterpart to the existing compactUint encoder
(registrar.go) and round-trips every mode (single-byte, two-byte,
four-byte, big-integer) against it in tests, since a subtly wrong
decode would silently misread real validator counts rather than error.

dashboard.go: ValidatorsActive is -1 on a failed read, never 0 --
ADR-011's own requirement that a degraded observation must not read as
false success applies here as much as to any on-chain state. A pinned
JSON-contract test (TestOverviewReportsUnavailableValidatorSetDistinctlyFromZero)
guards the sentinel against a refactor silently dropping it back to
Go's int zero value. index.html/app.js render the same distinction:
'-' for unavailable, the real count (including 0) otherwise.

Verified (control-plane/): go build ./...; go vet ./...; gofmt -l .;
go test ./... (full suite, incl. 6 new blockchainbridge SCALE-decode
tests and the dashboard JSON-contract test).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@flo2517
flo2517 merged commit 7376f88 into main Aug 6, 2026
4 checks passed
@flo2517
flo2517 deleted the feat/issue-29-dashboard-validator-views branch August 6, 2026 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants