Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(protocol): fix Bridge bug in retrying message #15403

Merged
merged 9 commits into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions packages/protocol/contracts/bridge/Bridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -270,15 +270,17 @@ contract Bridge is EssentialContract, IBridge {
revert B_NON_RETRIABLE();
}

ISignalService signalService = ISignalService(resolve("signal_service", false));

// Attempt to invoke the messageCall.
if (_invokeMessageCall(message, msgHash, gasleft())) {
// Update the message status to "DONE" on successful invocation.
_updateMessageStatus(signalService, msgHash, Status.DONE);
} else {
_updateMessageStatus(
ISignalService(resolve("signal_service", false)), msgHash, Status.DONE
);
} else if (isLastAttempt) {
// Update the message status to "FAILED"
_updateMessageStatus(signalService, msgHash, Status.FAILED);
_updateMessageStatus(
ISignalService(resolve("signal_service", false)), msgHash, Status.FAILED
);
}
}

Expand Down
9 changes: 6 additions & 3 deletions packages/protocol/test/bridge/Bridge.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -420,12 +420,15 @@ contract BridgeTest is TaikoTest {
assertEq(status == Bridge.Status.RETRIABLE, true);

vm.stopPrank();
vm.prank(message.owner);

destChainBridge.retryMessage(message, true);

vm.prank(message.owner);
destChainBridge.retryMessage(message, false);
Bridge.Status postRetryStatus = destChainBridge.messageStatus(msgHash);
assertEq(postRetryStatus == Bridge.Status.RETRIABLE, true);

vm.prank(message.owner);
destChainBridge.retryMessage(message, true);
postRetryStatus = destChainBridge.messageStatus(msgHash);
assertEq(postRetryStatus == Bridge.Status.FAILED, true);
}

Expand Down
Loading