From 7d07e87db7f813e2c233142e55639ae797bb65fb Mon Sep 17 00:00:00 2001 From: 0xIryna Date: Fri, 3 Feb 2023 17:35:22 -0800 Subject: [PATCH] Added payload size check from the internal contract --- contracts/RelayerV2.sol | 2 ++ 1 file changed, 2 insertions(+) diff --git a/contracts/RelayerV2.sol b/contracts/RelayerV2.sol index 9b84197..ff93dbc 100644 --- a/contracts/RelayerV2.sol +++ b/contracts/RelayerV2.sol @@ -137,6 +137,7 @@ contract RelayerV2 is ReentrancyGuard, OwnableUpgradeable, Proxied, ILayerZeroRe } function getFee(uint16 _dstChainId, uint16 _outboundProofType, address _userApplication, uint _payloadSize, bytes calldata _adapterParams) external view override returns (uint) { + require(_payloadSize <= 10000, "Relayer: _payloadSize tooooo big"); (uint basePrice, uint pricePerByte) = _getPrices(_dstChainId, _outboundProofType, _userApplication, _adapterParams); return basePrice.add(_payloadSize.mul(pricePerByte)); } @@ -147,6 +148,7 @@ contract RelayerV2 is ReentrancyGuard, OwnableUpgradeable, Proxied, ILayerZeroRe function assignJob(uint16 _dstChainId, uint16 _outboundProofType, address _userApplication, uint _payloadSize, bytes calldata _adapterParams) external override returns (uint) { require(msg.sender == address(uln), "Relayer: invalid uln"); + require(_payloadSize <= 10000, "Relayer: _payloadSize tooooo big"); (uint basePrice, uint pricePerByte) = _getPrices(_dstChainId, _outboundProofType, _userApplication, _adapterParams); uint totalFee = basePrice.add(_payloadSize.mul(pricePerByte)); emit AssignJob(totalFee);