hiero-ledger / hiero-ledger/hiero-consensus-node
CLPR HAPI: TSS Ledger-ID Gating & Multi-Network Clients
- Dominant language
- Java
- Stars
- 406
- Forks
- 226
- Avg merge
- 3d 4h
- Merged PRs (30d)
- 210
Description
# Objective
Ensure the dual-network HAPI harness blocks on TSS-derived ledger IDs before any CLPR exchange, and support deterministic test scenarios that simulate TSS outages.
# Implementation Tasks
- Extend `DualNetworkEnvironment` / `HapiClients` with utilities:
- `waitForLedgerId(NetworkRole role, Duration timeout)` — poll `spec.clients().getLedgerId()` until a non-empty value is observed.
- Logging on each retry so failures provide actionable diagnostics.
- Add outage simulation helpers that reuse `TssVerbs.startIgnoringTssSignatureRequests()` / `stopIgnoringTssSignatureRequests()` so tests can pause/resume signature availability.
- Update `ClprSuite` with targeted tests, for example:
```java
dualHapiTest(builder -> builder
.onPrimary(spec -> spec.given(waitForLedgerId(PRIMARY, Duration.ofMinutes(2))))
.onPeer(spec -> spec.given(waitForLedgerId(PEER, Duration.ofMinutes(2))))
.runCrossNetwork(ctx -> ctx
.simulateTssOutage(role -> role.run(startIgnoringTssSignatureRequests()))
.sleep(Duration.ofSeconds(5))
.restoreTss(role -> role.run(stopIgnoringTssSignatureRequests()))
.awaitLedgerSync()))
.asDynamicTests("dual-network-tss-gating");
```
# Testing / Validation
- New ClprSuite tests fail fast with a descriptive error if a ledger ID never appears.
- During outage simulation, CLPR-related ops should pause; after restoration, subsequent waits succeed.
- Existing single-network tests remain unaffected.
# Notes
- Document the new helpers in `docs/dev/clpr-dual-network-testing.md`.
- This issue assumes the dual-network harness from #20409 is already in place.
Contributor guide
Assessment
This issue has not been assessed yet.