Skip to content

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

Open
mateeullahmalik wants to merge 1 commit intomasterfrom
test/audit-empty-active-set-deadlock
Open

test: add empty active set deadlock and bootstrap tests for audit module#105
mateeullahmalik wants to merge 1 commit intomasterfrom
test/audit-empty-active-set-deadlock

Conversation

@mateeullahmalik
Copy link
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.

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
@roomote-v0
Copy link

roomote-v0 bot commented Mar 10, 2026

Rooviewer Clock   See task

Reviewed all changes. No issues found -- the unit tests and system tests are well-structured, mock expectations align with the enforcement logic, and the helper usage follows existing patterns.

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

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