[sdk]: Fix permanent LZ OFT channel brick on a reverting inbound message#989
Merged
Conversation
onAccept committed the inbound nonce and then called the OApp's lzReceive in the same frame, so a deterministically-reverting lzReceive rolled back the nonce write. Combined with the ISMP host deleting the receipt on a failed onAccept (allowing infinite retry) and the no-op skip/clear/nilify/ burn stubs, a single reverting message at nonce N stranded the (receiver, srcEid, sender) channel at N-1 forever, with no recovery path. Decouple nonce advancement from execution: commit the nonce, then call lzReceive inside a try/catch; on failure retain the payload hash for later recovery. Recovery is exposed via a dedicated retryPayload() (which mirrors onAccept's direct-to-OApp call) plus the LZ V2 primitives clear/skip/nilify/ burn, inboundPayloadHash, and setDelegate, gated to the OApp or its delegate. The endpoint's own ILayerZeroEndpointV2 lzReceive stays a revert stub, since Hyperbridge delivers by calling lzReceive directly on the OApp from onAccept, never on this endpoint. Adds regression tests proving a reverting message no longer bricks the lane, that a retained payload can be retried once the failure condition clears, and that recovery is access-controlled. The mock receiver enforces the same onlyEndpoint guard a real OApp does. Reported via HackenProof (HYPERBR-1939).
fbbb7cb to
5c7587a
Compare
seunlanlege
approved these changes
Jun 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
onAccept committed the inbound nonce and then called the OApp's lzReceive in the same frame, so a deterministically-reverting lzReceive rolled back the nonce write. Combined with the ISMP host deleting the receipt on a failed onAccept (allowing infinite retry) and the no-op skip/clear/nilify/ burn stubs, a single reverting message at nonce N stranded the (receiver, srcEid, sender) channel at N-1 forever, with no recovery path.
Decouple nonce advancement from execution: commit the nonce, then call lzReceive inside a try/catch with a gas reserve; on failure retain the payload hash for later recovery. Recovery is exposed via a dedicated retryPayload() (which mirrors onAccept's direct-to-OApp call) plus the LZ V2 primitives clear/skip/nilify/burn, inboundPayloadHash, and setDelegate, gated to the OApp or its delegate. The endpoint's own ILayerZeroEndpointV2 lzReceive stays a revert stub, since Hyperbridge delivers by calling lzReceive directly on the OApp from onAccept, never on this endpoint.
Adds regression tests proving a reverting message no longer bricks the lane, that a retained payload can be retried once the failure condition clears, and that recovery is access-controlled. The mock receiver enforces the same onlyEndpoint guard a real OApp does.