Skip to content

test: add empty active set deadlock and bootstrap tests for audit module#105

Merged
mateeullahmalik merged 2 commits intomasterfrom
test/audit-empty-active-set-deadlock
Apr 13, 2026
Merged

test: add empty active set deadlock and bootstrap tests for audit module#105
mateeullahmalik merged 2 commits intomasterfrom
test/audit-empty-active-set-deadlock

Conversation

@mateeullahmalik
Copy link
Copy Markdown
Contributor

Summary

Add unit and system tests that reproduce the testnet deadlock where all supernodes are POSTPONED and the epoch anchor has an empty active set. Without active probers, peer observations cannot be generated, making audit recovery impossible.

Tests Added

Unit tests (x/audit/v1/keeper/enforcement_empty_active_set_test.go)

  • TestEnforceEpochEnd_EmptyActiveSet_PostponedCannotRecover — Proves that compliant host-only reports from POSTPONED SNs are insufficient for recovery when no peer observations exist.
  • TestEnforceEpochEnd_LegacyRecoveredSN_SurvivesWithReport — Proves that SNs recovered to ACTIVE mid-epoch (via legacy metrics) with audit reports survive the EndBlocker enforcement.

System tests (tests/systemtests/audit_empty_active_set_bootstrap_test.go)

  • TestAuditEmptyActiveSetDeadlock_HostOnlyReportsCannotRecover — Full-chain E2E: registers SNs, misses epoch 0, submits host-only reports for 3 epochs — all remain POSTPONED throughout.
  • TestAuditEmptyActiveSetBootstrap_LegacyMetricsBreaksDeadlock — Full-chain E2E: same deadlock setup, then legacy metrics recovery breaks the deadlock — SNs survive enforcement and remain ACTIVE.

Context

On testnet (lumera-testnet-2), all supernodes running v2.4.5-testnet were POSTPONED before the audit module activated (legacy staleness handler). The audit module's recovery requires peer observations from active probers, but the active set has been empty since epoch 1. Fix applied in supernode#275.

These tests ensure the edge case is covered for future upgrades.

@roomote-v0
Copy link
Copy Markdown

roomote-v0 bot commented Mar 10, 2026

Rooviewer Clock   See task

Reviewed commit e33eb42. The stabilization changes are solid: replacing client-side target replication with auditQueryAssignedTargets gRPC queries, adding 45s timeout slack for CI, removing race-prone immediate-state assertions, and adding a retry loop for non-deterministic recovery assignment. The MetricsAggregate.Metrics type fix in the deregister test aligns with the proto definition. One minor duplication noted.

  • [audit_peer_ports_enforcement_test.go] awaitAtLeastHeightWithSlackPeerPorts is a duplicate of awaitAtLeastHeightWithSlack -- consolidate into shared helpers
Previous reviews

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

Add unit and system tests that reproduce the testnet deadlock where all
supernodes are POSTPONED and the epoch anchor has an empty active set.
Without active probers, peer observations cannot be generated, making
audit recovery impossible.

Tests:
- TestEnforceEpochEnd_EmptyActiveSet_PostponedCannotRecover (unit)
  Proves that compliant host-only reports from POSTPONED SNs are
  insufficient for recovery when no peer observations exist.

- TestEnforceEpochEnd_LegacyRecoveredSN_SurvivesWithReport (unit)
  Proves that SNs recovered to ACTIVE mid-epoch (via legacy metrics)
  with audit reports survive the EndBlocker enforcement.

- TestAuditEmptyActiveSetDeadlock_HostOnlyReportsCannotRecover (system)
  Full-chain E2E: registers SNs, misses epoch 0, submits host-only
  reports for 3 epochs — all remain POSTPONED throughout.

- TestAuditEmptyActiveSetBootstrap_LegacyMetricsBreaksDeadlock (system)
  Full-chain E2E: same deadlock setup, then legacy metrics recovery
  breaks the deadlock — SNs survive enforcement and remain ACTIVE.

Ref: LumeraProtocol/supernode#275
@mateeullahmalik mateeullahmalik force-pushed the test/audit-empty-active-set-deadlock branch from 3daf7e4 to 7724e68 Compare April 8, 2026 14:02
roomote-v0[bot]
roomote-v0 bot previously approved these changes Apr 8, 2026
@mateeullahmalik mateeullahmalik merged commit 4ffe74b into master Apr 13, 2026
14 checks passed
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