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): check invocation gas limit also in retryMessage #16660

Merged
merged 9 commits into from
Apr 5, 2024
6 changes: 6 additions & 0 deletions packages/protocol/contracts/bridge/Bridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,12 @@ contract Bridge is EssentialContract, IBridge {
if (_message.gasLimit == 0 || _isLastAttempt) {
if (msg.sender != _message.destOwner) revert B_PERMISSION_DENIED();
}
// We do not need to check _message.gasLimit is bigger than (gasleft() * 63) >> 6), simply
// because user can bump the gasleft and it would cause no harm as message status would not
// change anyways.
if (_message.gasLimit != 0 && _message.gasLimit > gasleft()) {
dantaik marked this conversation as resolved.
Show resolved Hide resolved
revert B_NOT_ENOUGH_GASLEFT();
}

bytes32 msgHash = hashMessage(_message);
if (messageStatus[msgHash] != Status.RETRIABLE) {
Expand Down
Loading