Skip to content

[sdk]: Fix permanent LZ OFT channel brick on a reverting inbound message#989

Merged
Wizdave97 merged 1 commit into
mainfrom
fix/lz-endpoint-onaccept-brick
Jun 24, 2026
Merged

[sdk]: Fix permanent LZ OFT channel brick on a reverting inbound message#989
Wizdave97 merged 1 commit into
mainfrom
fix/lz-endpoint-onaccept-brick

Conversation

@Wizdave97

Copy link
Copy Markdown
Member

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.

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).
@Wizdave97 Wizdave97 force-pushed the fix/lz-endpoint-onaccept-brick branch from fbbb7cb to 5c7587a Compare June 24, 2026 12:51
@Wizdave97 Wizdave97 merged commit 4710bc7 into main Jun 24, 2026
1 check passed
@Wizdave97 Wizdave97 deleted the fix/lz-endpoint-onaccept-brick branch June 24, 2026 14:49
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