diff --git a/packages/oft-evm/contracts/NativeOFTAdapter.sol b/packages/oft-evm/contracts/NativeOFTAdapter.sol index bd319e54e..0ca54e515 100644 --- a/packages/oft-evm/contracts/NativeOFTAdapter.sol +++ b/packages/oft-evm/contracts/NativeOFTAdapter.sol @@ -70,8 +70,9 @@ abstract contract NativeOFTAdapter is OFTCore { ) public payable virtual override returns (MessagingReceipt memory msgReceipt, OFTReceipt memory oftReceipt) { // @dev Ensure the native funds in msg.value are enough to cover the fees and amount to send (with dust removed). // TODO should we remove dust from _sendParam.amountLD here? - if (_fee.nativeFee + _removeDust(_sendParam.amountLD) != msg.value) { - revert NotEnoughNative(msg.value); + uint256 requiredMsgValue = _fee.nativeFee + _removeDust(_sendParam.amountLD); + if (msg.value != requiredMsgValue) { + revert InsufficientMessageValue(msg.value, requiredMsgValue); } return super.send(_sendParam, _fee, _refundAddress); diff --git a/packages/oft-evm/test/OFT.t.sol b/packages/oft-evm/test/OFT.t.sol index 6a6bad801..ac07cd854 100644 --- a/packages/oft-evm/test/OFT.t.sol +++ b/packages/oft-evm/test/OFT.t.sol @@ -448,15 +448,14 @@ contract OFTTest is TestHelperOz5 { ); MessagingFee memory fee = dNativeOFTAdapter.quoteSend(sendParam, false); + uint256 msgValue = fee.nativeFee + sendParam.amountLD; vm.prank(userD); vm.expectRevert( - abi.encodeWithSelector(OAppSender.NotEnoughNative.selector, fee.nativeFee) + abi.encodeWithSelector(NativeOFTAdapter.InsufficientMessageValue.selector, fee.nativeFee, msgValue) ); dNativeOFTAdapter.asNativeOFTAdapterMock().send{ value: fee.nativeFee}(sendParam, fee, userD); - uint256 msgValue = fee.nativeFee + sendParam.amountLD; - vm.prank(userD); dNativeOFTAdapter.asNativeOFTAdapterMock().send{ value: msgValue }(sendParam, fee, userD);