Skip to content

Commit

Permalink
Fix router mock contract check location
Browse files Browse the repository at this point in the history
  • Loading branch information
RensR committed Feb 19, 2024
1 parent 65a5b9c commit 92cd617
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions contracts/src/v0.8/ccip/test/mocks/MockRouter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ contract MockCCIPRouter is IRouter, IRouterClient {
uint256 gasLimit,
address receiver
) external returns (bool success, bytes memory retData, uint256 gasUsed) {
// Only send through the router if the receiver is a contract and implements the IAny2EVMMessageReceiver interface.
if (receiver.code.length == 0 || !receiver.supportsInterface(type(IAny2EVMMessageReceiver).interfaceId))
return (true, "", 0);

return _routeMessage(message, gasForCallExactCheck, gasLimit, receiver);
}

Expand All @@ -44,6 +40,10 @@ contract MockCCIPRouter is IRouter, IRouterClient {
uint256 gasLimit,
address receiver
) internal returns (bool success, bytes memory retData, uint256 gasUsed) {
// Only send through the router if the receiver is a contract and implements the IAny2EVMMessageReceiver interface.
if (receiver.code.length == 0 || !receiver.supportsInterface(type(IAny2EVMMessageReceiver).interfaceId))
return (true, "", 0);

bytes memory data = abi.encodeWithSelector(IAny2EVMMessageReceiver.ccipReceive.selector, message);

(success, retData, gasUsed) = CallWithExactGas._callWithExactGasSafeReturnData(
Expand Down

0 comments on commit 92cd617

Please sign in to comment.