smartcontractkit / ccip

Cross Chain Interoperability Protocol

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[DEVEL] Add supplementary check in MockCCIPRouter

rya-sge opened this issue · comments

Hello,
Congratulations for all your work ! The code is very clear to understand.
A quick remark:

Description
The function ccipSend in MockCCIPRouter doesn't check if:

  • msg.value is enough to pay the fees in the case of using native tokens.
  • if msg.value == 0 if non native tokens are used

I think it could be a great improvement for automatic tests to add these checks in order to be closer to the true behavior of the router.

Basic Information
Example:

function ccipSend(
uint64 destinationChainSelector,
Client.EVM2AnyMessage calldata message
) external payable returns (bytes32) {
uint256 feeTokenAmount = getFee(destinationChainSelector, message);
if (message.feeToken == address(0)) {
if (msg.value < feeTokenAmount) revert InsufficientFeeTokenAmount();
} else{
if (msg.value > 0) revert InvalidMsgValue();
}

Thank you for the request. You can track progress on the issue at the following PR

#896

Great, thank you very much !