hiero-ledger / hiero-ledger/hiero-consensus-node
CLPR-2.4: Response ordering and HALT detection
- Dominant language
- Java
- Stars
- 407
- Forks
- 226
- Avg merge
- 3d 4h
- Merged PRs (30d)
- 210
Description
## Story CLPR-2.4: Response Ordering and HALT Detection
**Parent Epic:** #24514 (CLPR-2: Messaging Layer)
### Objective
Implement the response ordering verification algorithm (cross-platform spec §4.5) that detects peer-side ordering bugs and transitions affected Connections to HALTED.
### Acceptance Criteria
- **AC-1:** When a Response Message arrives in a bundle, walk the outbound queue of retained Data Messages (skip Response/Control Messages).
- **AC-2:** The response's `message_id` must match the oldest unresponded Data Message's ID.
- **AC-3:** Match: deliver response to originating application, delete matched Data Message.
- **AC-4:** Mismatch: transition Connection to HALTED. Halt acceptance of new outbound messages. Inbound bundles continue to be processed.
- **AC-5:** HALTED is resumable — admin can call `resumeConnection` once the peer has fixed the issue.
- **AC-6:** Application delivery: if sender is a contract implementing `IClprReceiver`, dispatch `onClprResponse(connectionId, messageId, status, responseData)`. If sender is an EOA, record in transaction record only.
- **AC-7:** Bad bundles (failed verification in steps 1–5 of submitBundle) cause no state change — Connection stays ACTIVE. Only response ordering violations trigger HALT.
- **AC-8:** Black-box tests: correct ordering accepted, out-of-order halts Connection, delivery to contract, delivery to EOA (transaction record), HALTED rejects outbound but accepts inbound, HALTED → ACTIVE by admin resume, HALTED → CLOSED by admin close
### Dependencies
- #24517 (CLPR-2.3: SubmitBundle — responses arrive in bundles)
- #24511 (CLPR-1.5: Connection governance — HALTED → ACTIVE/CLOSED)
### Risk
**Medium** — The ordering check must be precise. False positives would HALT functional Connections.
Contributor guide
Research direction
Start with #24517 to understand how submitBundle delivers responses, then read #24511 for the HALTED state transitions. Implement and verify the ordering, delivery, resume, and close behavior through the requested black-box tests, including the rule that invalid bundles leave the Connection ACTIVE.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend, distributed-systems
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100