Skip to content

Commit

Permalink
fix(protocol): use gasleft() in Bridge's retryMessage function (#17708)
Browse files Browse the repository at this point in the history
  • Loading branch information
dantaik authored Jun 30, 2024
1 parent c88fcd1 commit d86893c
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions packages/protocol/contracts/bridge/Bridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -331,17 +331,12 @@ contract Bridge is EssentialContract, IBridge {
if (_unableToInvokeMessageCall(_message, resolve(LibStrings.B_SIGNAL_SERVICE, false))) {
succeeded = _message.destOwner.sendEther(_message.value, _SEND_ETHER_GAS_LIMIT, "");
} else {
uint256 invocationGasLimit;
if (msg.sender != _message.destOwner) {
if (_message.gasLimit == 0 || _isLastAttempt) revert B_PERMISSION_DENIED();
invocationGasLimit = _invocationGasLimit(_message);
} else {
// The owner uses all gas left in message invocation
invocationGasLimit = gasleft();
if ((_message.gasLimit == 0 || _isLastAttempt) && msg.sender != _message.destOwner) {
revert B_PERMISSION_DENIED();
}

// Attempt to invoke the messageCall.
succeeded = _invokeMessageCall(_message, msgHash, invocationGasLimit, false);
succeeded = _invokeMessageCall(_message, msgHash, gasleft(), false);
}

if (succeeded) {
Expand Down

0 comments on commit d86893c

Please sign in to comment.