Skip to content

Commit

Permalink
fix(protocol): fix Bridge bug in retrying message (#15403)
Browse files Browse the repository at this point in the history
  • Loading branch information
dantaik committed Dec 19, 2023
1 parent 482250c commit 8cb9a64
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
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

2 comments on commit 8cb9a64

@vercel
Copy link

@vercel vercel bot commented on 8cb9a64 Dec 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

bridge-ui-v2-a6 – ./packages/bridge-ui-v2

bridge-ui-v2-a6.vercel.app
bridge-ui-v2-a6-taikoxyz.vercel.app
bridge-ui-v2-a6-git-alpha-6-taikoxyz.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 8cb9a64 Dec 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

bridge-ui-v2-internal – ./packages/bridge-ui-v2

bridge-ui-v2-internal-git-alpha-6-taikoxyz.vercel.app
bridge-ui-v2-internal.vercel.app
bridge-ui-v2-internal-taikoxyz.vercel.app

Please sign in to comment.